27require
'../../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/projet/class/taskstats.class.php';
33if (!$user->hasRight(
'projet',
'lire')) {
44if ($user->socid > 0) {
46 $socid = $user->socid;
54$langs->loadlangs(array(
'companies',
'projects'));
63$includeuserlist = array();
66llxHeader(
'', $langs->trans(
'Tasks'),
'',
'', 0, 0,
'',
'',
'',
'mod-project project-tasks page-stats');
68$title = $langs->trans(
"TasksStatistics");
69$dir = $conf->project->dir_output.
'/temp';
77if (!empty($userid) && $userid != -1) {
78 $stats_tasks->userid = $userid;
80if (!empty($socid) && $socid != -1) {
81 $stats_tasks->socid = $socid;
84 $stats_tasks->year = $year;
91$data = $stats_tasks->getNbByMonthWithPrevYear($endyear, $startyear);
94$filenamenb = $conf->project->dir_output.
"/stats/tasknbprevyear-".$year.
".png";
95$fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=taskstats&file=tasknbprevyear-'.$year.
'.png';
98$mesg = $px1->isGraphKo();
100 $px1->SetData($data);
103 while ($i <= $endyear) {
107 $px1->SetLegend($legend);
108 $px1->SetMaxValue($px1->GetCeilMaxValue());
109 $px1->SetWidth($WIDTH);
110 $px1->SetHeight($HEIGHT);
111 $px1->SetYLabel($langs->trans(
"ProjectNbTask"));
113 $px1->SetHorizTickIncrement(1);
114 $px1->mode =
'depth';
115 $px1->SetTitle($langs->trans(
"ProjectNbTaskByMonth"));
117 $px1->draw($filenamenb, $fileurlnb);
122$stats_tasks->year = 0;
123$data_all_year = $stats_tasks->getAllByYear();
126 $stats_tasks->year = $year;
128$arrayyears = array();
129foreach ($data_all_year as $val) {
130 $arrayyears[$val[
'year']] = $val[
'year'];
132if (!count($arrayyears)) {
133 $arrayyears[$nowyear] = $nowyear;
139$head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/stats/index.php';
140$head[$h][1] = $langs->trans(
"ByMonthYear");
141$head[$h][2] =
'byyear';
149print
'<div class="fichecenter"><div class="fichethirdleft">';
151print
'<form name="stats" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
152print
'<input type="hidden" name="token" value="'.newToken().
'">';
154print
'<table class="noborder centpercent">';
155print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
166print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
167if (!in_array($year, $arrayyears)) {
168 $arrayyears[$year] = $year;
170if (!in_array($nowyear, $arrayyears)) {
171 $arrayyears[$nowyear] = $nowyear;
174print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
176print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
184print
'<div class="div-table-responsive-no-min">';
185print
'<table class="noborder centpercent">';
186print
'<tr class="liste_titre">';
187print
'<td>'.$langs->trans(
"Year").
'</td>';
188print
'<td class="right">'.$langs->trans(
"NbOfTasks").
'</td>';
192foreach ($data_all_year as $val) {
193 $year = $val[
'year'];
194 while ($year && $oldyear > (
int) $year + 1) {
197 print
'<tr class="oddeven">';
198 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$oldyear.
'</a></td>';
199 print
'<td class="right">0</td>';
203 print
'<tr class="oddeven">';
204 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$year.
'</a></td>';
205 print
'<td class="right">'.$val[
'nb'].
'</td>';
213print
'</div><div class="fichetwothirdright">';
215$stringtoshow =
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
219 $stringtoshow .= $px1->show();
220 $stringtoshow .=
"<br>\n";
222$stringtoshow .=
'</td></tr></table>';
229print
'<div class="clearboth"></div>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Class to manage statistics on project tasks.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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 a 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.