From 97f36825df1c626c642d7edc05730e521d7a4f6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Mar 2015 21:47:50 +0100 Subject: [PATCH] Work on new timesheet page --- htdocs/core/lib/project.lib.php | 16 ++++--- htdocs/projet/activity/perday.php | 69 ++++++++++++++++-------------- htdocs/projet/class/task.class.php | 13 +++++- 3 files changed, 58 insertions(+), 40 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e028c3cbbd8..f744508d9bf 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -555,10 +555,12 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$ for ($k = 0 ; $k < $level ; $k++) print "   "; $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->label; + $taskstatic->date_start=$lines[$i]->date_start; + $taskstatic->date_end=$lines[$i]->date_end; print $taskstatic->getNomUrl(0); - print "
"; - for ($k = 0 ; $k < $level ; $k++) print "   "; - print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); + //print "
"; + //for ($k = 0 ; $k < $level ; $k++) print "   "; + //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); print "\n"; // Planned Workload @@ -714,10 +716,12 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t for ($k = 0 ; $k < $level ; $k++) print "   "; $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->label; + $taskstatic->date_start=$lines[$i]->date_start; + $taskstatic->date_end=$lines[$i]->date_end; print $taskstatic->getNomUrl(0); - print "
"; - for ($k = 0 ; $k < $level ; $k++) print "   "; - print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); + //print "
"; + //for ($k = 0 ; $k < $level ; $k++) print "   "; + //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); print "\n"; // Planned Workload diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 9ca8f95ac45..abec2e8cf7c 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -108,10 +108,45 @@ llxHeader("",$title,"",'','','',array('/core/js/timesheet.js')); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); -print '
'; +$startdayarray=dol_get_first_day_week($day, $month, $year); + +$prev = $startdayarray; +$prev_year = $prev['prev_year']; +$prev_month = $prev['prev_month']; +$prev_day = $prev['prev_day']; +$first_day = $prev['first_day']; +$first_month= $prev['first_month']; +$first_year = $prev['first_year']; +$week = $prev['week']; + +$day = (int) $day; +$next = dol_get_next_week($first_day, $week, $first_month, $first_year); +$next_year = $next['year']; +$next_month = $next['month']; +$next_day = $next['day']; + +// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) +$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); +$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); + +$tmpday = $first_day; + +// Show navigation bar +$nav ="".img_previous($langs->trans("Previous"))."\n"; +$nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; +$nav.=" \n"; +$nav.="".img_next($langs->trans("Next"))."\n"; +$nav.="   (".$langs->trans("Today").")"; +$picto='calendarweek'; + + +print ''; print ''; print ''; print ''; +print ''; +print ''; +print ''; $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperday', '', 0, 'task'); @@ -146,36 +181,6 @@ print "\n"; */ -$startdayarray=dol_get_first_day_week($day, $month, $year); - -$prev = $startdayarray; -$prev_year = $prev['prev_year']; -$prev_month = $prev['prev_month']; -$prev_day = $prev['prev_day']; -$first_day = $prev['first_day']; -$first_month= $prev['first_month']; -$first_year = $prev['first_year']; -$week = $prev['week']; - -$day = (int) $day; -$next = dol_get_next_week($first_day, $week, $first_month, $first_year); -$next_year = $next['year']; -$next_month = $next['month']; -$next_day = $next['day']; - -// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) -$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); -$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); - -$tmpday = $first_day; - -// Show navigation bar -$nav ="".img_previous($langs->trans("Previous"))."\n"; -$nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; -$nav.=" \n"; -$nav.="".img_next($langs->trans("Next"))."\n"; -$nav.="   (".$langs->trans("Today").")"; -$picto='calendarweek'; print '
'.$nav.'
'; @@ -230,7 +235,7 @@ print ''; -print ''; +print ''; print ''; print '
'."\n\n"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index f9e07ab6e9d..c322e0be3cc 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -506,9 +506,18 @@ class Task extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowTask").': '.$this->ref.($this->label?' - '.$this->label:''); + $label = '' . $langs->trans("ShowTask") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->title)) + $label .= '
' . $langs->trans('LabelTask') . ': ' . $this->label; + if ($this->date_start || $this->date_end) + { + $label .= "
".get_date_range($this->date_start,$this->date_end,'',$langs,0); + } + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - $lien = ''; + $lien = '