28require
'../../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/projet/class/taskstats.class.php';
42if (!$user->hasRight(
'projet',
'lire')) {
53if ($user->socid > 0) {
55 $socid = $user->socid;
63$langs->loadlangs(array(
'companies',
'projects'));
72$includeuserlist = array();
75llxHeader(
'', $langs->trans(
'Tasks'),
'',
'', 0, 0,
'',
'',
'',
'mod-project project-tasks page-stats');
77$title = $langs->trans(
"TasksStatistics");
78$dir =
$conf->project->dir_output.
'/temp';
86if (!empty($userid) && $userid != -1) {
87 $stats_tasks->userid = $userid;
89if (!empty($socid) && $socid != -1) {
90 $stats_tasks->socid = $socid;
93 $stats_tasks->year = $year;
100$data = $stats_tasks->getNbByMonthWithPrevYear($endyear, $startyear);
103$filenamenb =
$conf->project->dir_output.
"/stats/tasknbprevyear-".$year.
".png";
104$fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=taskstats&file=tasknbprevyear-'.$year.
'.png';
107$mesg = $px1->isGraphKo();
109 $px1->SetData($data);
112 while ($i <= $endyear) {
116 $px1->SetLegend($legend);
117 $px1->SetMaxValue($px1->GetCeilMaxValue());
118 $px1->SetWidth($WIDTH);
119 $px1->SetHeight($HEIGHT);
120 $px1->SetYLabel($langs->trans(
"ProjectNbTask"));
122 $px1->SetHorizTickIncrement(1);
123 $px1->mode =
'depth';
124 $px1->SetTitle($langs->trans(
"ProjectNbTaskByMonth"));
126 $px1->draw($filenamenb, $fileurlnb);
131$stats_tasks->year = 0;
132$data_all_year = $stats_tasks->getAllByYear();
135 $stats_tasks->year = $year;
137$arrayyears = array();
138foreach ($data_all_year as $val) {
139 $arrayyears[$val[
'year']] = $val[
'year'];
141if (!count($arrayyears)) {
142 $arrayyears[$nowyear] = $nowyear;
148$head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/stats/index.php';
149$head[$h][1] = $langs->trans(
"ByMonthYear");
150$head[$h][2] =
'byyear';
158print
'<div class="fichecenter"><div class="fichethirdleft">';
160print
'<form name="stats" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
161print
'<input type="hidden" name="token" value="'.newToken().
'">';
163print
'<table class="noborder centpercent">';
164print
'<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans(
"Filter").
'</td></tr>';
175print
'<tr><td>'.$langs->trans(
"Year").
'</td><td>';
176if (!in_array($year, $arrayyears)) {
177 $arrayyears[$year] = $year;
179if (!in_array($nowyear, $arrayyears)) {
180 $arrayyears[$nowyear] = $nowyear;
183print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
185print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
193print
'<div class="div-table-responsive-no-min">';
194print
'<table class="noborder centpercent">';
195print
'<tr class="liste_titre">';
196print
'<td>'.$langs->trans(
"Year").
'</td>';
197print
'<td class="right">'.$langs->trans(
"NbOfTasks").
'</td>';
201foreach ($data_all_year as $val) {
202 $year = $val[
'year'];
203 while ($year && $oldyear > (
int) $year + 1) {
206 print
'<tr class="oddeven">';
207 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$oldyear.
'</a></td>';
208 print
'<td class="right">0</td>';
212 print
'<tr class="oddeven">';
213 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$year.
'</a></td>';
214 print
'<td class="right">'.$val[
'nb'].
'</td>';
222print
'</div><div class="fichetwothirdright">';
224$stringtoshow =
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
228 $stringtoshow .= $px1->show();
229 $stringtoshow .=
"<br>\n";
231$stringtoshow .=
'</td></tr></table>';
238print
'<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)
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.