26require
'../../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/taskstats.class.php';
32if (!$user->hasRight(
'projet',
'lire')) {
40$userid =
GETPOST(
'userid',
'int');
41$socid =
GETPOST(
'socid',
'int');
43if ($user->socid > 0) {
45 $socid = $user->socid;
53$langs->loadlangs(array(
'companies',
'projects'));
62$includeuserlist = array();
67$title = $langs->trans(
"TasksStatistics");
68$dir = $conf->project->dir_output.
'/temp';
76if (!empty($userid) && $userid != -1) {
77 $stats_tasks->userid = $userid;
79if (!empty($socid) && $socid != -1) {
80 $stats_tasks->socid = $socid;
83 $stats_tasks->year = $year;
90$data = $stats_tasks->getNbByMonthWithPrevYear($endyear, $startyear);
93$filenamenb = $conf->project->dir_output.
"/stats/tasknbprevyear-".$year.
".png";
94$fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=taskstats&file=tasknbprevyear-'.$year.
'.png';
97$mesg = $px1->isGraphKo();
102 while ($i <= $endyear) {
106 $px1->SetLegend($legend);
107 $px1->SetMaxValue($px1->GetCeilMaxValue());
108 $px1->SetWidth($WIDTH);
109 $px1->SetHeight($HEIGHT);
110 $px1->SetYLabel($langs->trans(
"ProjectNbTask"));
112 $px1->SetHorizTickIncrement(1);
113 $px1->mode =
'depth';
114 $px1->SetTitle($langs->trans(
"ProjectNbTaskByMonth"));
116 $px1->draw($filenamenb, $fileurlnb);
121$stats_tasks->year = 0;
122$data_all_year = $stats_tasks->getAllByYear();
125 $stats_tasks->year = $year;
127$arrayyears = array();
128foreach ($data_all_year as $val) {
129 $arrayyears[$val[
'year']] = $val[
'year'];
131if (!count($arrayyears)) {
132 $arrayyears[$nowyear] = $nowyear;
138$head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/stats/index.php';
139$head[$h][1] = $langs->trans(
"ByMonthYear");
140$head[$h][2] =
'byyear';
148print
'<div class="fichecenter"><div class="fichethirdleft">';
150print
'<form name="stats" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
151print
'<input type="hidden" name="token" value="'.newToken().
'">';
153print
'<table class="noborder centpercent">';
154print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
165print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
166if (!in_array($year, $arrayyears)) {
167 $arrayyears[$year] = $year;
169if (!in_array($nowyear, $arrayyears)) {
170 $arrayyears[$nowyear] = $nowyear;
173print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
175print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
183print
'<div class="div-table-responsive-no-min">';
184print
'<table class="noborder centpercent">';
185print
'<tr class="liste_titre">';
186print
'<td>'.$langs->trans(
"Year").
'</td>';
187print
'<td class="right">'.$langs->trans(
"NbOfTasks").
'</td>';
191foreach ($data_all_year as $val) {
192 $year = $val[
'year'];
193 while ($year && $oldyear > $year + 1) {
196 print
'<tr class="oddeven">';
197 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$oldyear.
'</a></td>';
198 print
'<td class="right">0</td>';
202 print
'<tr class="oddeven">';
203 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$year.
'</a></td>';
204 print
'<td class="right">'.$val[
'nb'].
'</td>';
212print
'</div><div class="fichetwothirdright">';
214$stringtoshow =
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
218 $stringtoshow .= $px1->show();
219 $stringtoshow .=
"<br>\n";
221$stringtoshow .=
'</td></tr></table>';
228print
'<div class="clearboth"></div>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage statistics on project tasks.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.