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="'.dolBuildUrl($_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
img_picto(
'',
'calendar',
'class="pictofixedwidth"');
184print $form->selectarray(
'year', $arrayyears, $year, 0, 0, 0,
'', 0, 0, 0,
'',
'width75');
186print
'<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans(
"Refresh").
'"></td></tr>';
194print
'<div class="div-table-responsive-no-min">';
195print
'<table class="noborder centpercent">';
196print
'<tr class="liste_titre">';
197print
'<td>'.$langs->trans(
"Year").
'</td>';
198print
'<td class="right">'.$langs->trans(
"NbOfTasks").
'</td>';
202foreach ($data_all_year as $val) {
203 $year = $val[
'year'];
204 while ($year && $oldyear > (
int) $year + 1) {
207 print
'<tr class="oddeven">';
208 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$oldyear.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$oldyear.
'</a></td>';
209 print
'<td class="right">0</td>';
213 print
'<tr class="oddeven">';
214 print
'<td><a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.($socid > 0 ?
'&socid='.$socid :
'').($userid > 0 ?
'&userid='.$userid :
'').
'">'.$year.
'</a></td>';
215 print
'<td class="right">'.$val[
'nb'].
'</td>';
223print
'</div><div class="fichetwothirdright">';
225$stringtoshow =
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
229 $stringtoshow .= $px1->show();
230 $stringtoshow .=
"<br>\n";
232$stringtoshow .=
'</td></tr></table>';
239print
'<div class="clearboth"></div>';
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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, $morecssdiv='')
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=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.