Skip to content
Snippets Groups Projects
Commit c36f9239 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Add navigation into the new timesheet week page.

Fix bad merge
parent 39a7271f
No related branches found
No related tags found
No related merge requests found
...@@ -234,10 +234,10 @@ function project_admin_prepare_head() ...@@ -234,10 +234,10 @@ function project_admin_prepare_head()
/** /**
* Show task lines with a particular parent * Show task lines with a particular parent
* *
* @param string $inc Counter that count number of lines legitimate to show (for return) * @param string $inc Line number (start to 0, then increased by recursive call)
* @param int $parent Id of parent task to start * @param string $parent Id of parent project to show (0 to show all)
* @param array $lines Array of all tasks * @param Task[] $lines Array of lines
* @param int $level Level of task * @param int $level Level (start to 0, then increased/decrease by recursive call)
* @param string $var Color * @param string $var Color
* @param int $showproject Show project columns * @param int $showproject Show project columns
* @param int $taskrole Array of roles of user for each tasks * @param int $taskrole Array of roles of user for each tasks
...@@ -482,12 +482,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t ...@@ -482,12 +482,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
/** /**
* Output a task line into a pertime intput mode * Output a task line into a pertime intput mode
* *
* @param string $inc ? * @param string $inc Line number (start to 0, then increased by recursive call)
* @param string $parent ? * @param string $parent Id of parent project to show (0 to show all)
* @param Task[] $lines ? * @param Task[] $lines Array of lines
* @param int $level ? * @param int $level Level (start to 0, then increased/decrease by recursive call)
* @param string $projectsrole ? * @param string $projectsrole Array of roles user has on project
* @param string $tasksrole ? * @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc * @return $inc
...@@ -628,12 +628,12 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$ ...@@ -628,12 +628,12 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
/** /**
* Output a task line into a perday intput mode * Output a task line into a perday intput mode
* *
* @param string $inc ? * @param string $inc Line number (start to 0, then increased by recursive call)
* @param string $parent ? * @param string $parent Id of parent project to show (0 to show all)
* @param Task[] $lines ? * @param Task[] $lines Array of lines
* @param int $level ? * @param int $level Level (start to 0, then increased/decrease by recursive call)
* @param string $projectsrole ? * @param string $projectsrole Array of roles user has on project
* @param string $tasksrole ? * @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc * @return $inc
...@@ -750,7 +750,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t ...@@ -750,7 +750,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
{ {
$dayWorkLoad = 0; $dayWorkLoad = 0;
$tableCell ='<td align="center">'; $tableCell ='<td align="center">';
$tableCell.='<input type="text" class="center" size="2" disabled="disabled" value="'.convertSecondToTime($dayWorkLoad,'allhourmin').'">+'; $tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center" size="2" disabled="disabled" value="'.convertSecondToTime($dayWorkLoad,'allhourmin').'"></span>+';
$tableCell.='<input type="text" class="center" size="2" id="task['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; $tableCell.='<input type="text" class="center" size="2" id="task['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"'; $tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
$tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\');updateTotal('.$idw.',\''.$modeinput.'\')" />'; $tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\');updateTotal('.$idw.',\''.$modeinput.'\')" />';
...@@ -927,7 +927,8 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta ...@@ -927,7 +927,8 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta
print "</table>"; print "</table>";
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE))
{
//Add the year filter input //Add the year filter input
print '<table width="100%">'; print '<table width="100%">';
print '<tr>'; print '<tr>';
......
...@@ -136,4 +136,5 @@ ProjectMustBeValidatedFirst=Project must be validated first ...@@ -136,4 +136,5 @@ ProjectMustBeValidatedFirst=Project must be validated first
ProjectDraft=Draft projects ProjectDraft=Draft projects
FirstAddRessourceToAllocateTime=Associate a ressource to allocate time FirstAddRessourceToAllocateTime=Associate a ressource to allocate time
InputPerTime=Input per time InputPerTime=Input per time
InputPerDay=Input per day InputPerDay=Input per day
\ No newline at end of file TimeAlreadyRecorded=Time spent already recorded for this task/day and user %s
\ No newline at end of file
...@@ -1376,9 +1376,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a ...@@ -1376,9 +1376,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
// Wrapper to show tooltips // Wrapper to show tooltips
print "\n".'<script type="text/javascript"> print "\n".'<script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery(function() { jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
});
}); });
</script>'; </script>';
} }
......
...@@ -50,6 +50,11 @@ $result = restrictedArea($user, 'projet', $projectid); ...@@ -50,6 +50,11 @@ $result = restrictedArea($user, 'projet', $projectid);
$now=dol_now(); $now=dol_now();
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
/* /*
* Actions * Actions
...@@ -138,6 +143,40 @@ print "\n"; ...@@ -138,6 +143,40 @@ print "\n";
dol_fiche_end(); dol_fiche_end();
*/ */
$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 ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week;
$nav.=" </span>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
$nav.=" &nbsp; (<a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
$picto='calendarweek';
print '<div align="right">'.$nav.'</div>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Project").'</td>'; print '<td>'.$langs->trans("Project").'</td>';
...@@ -147,8 +186,6 @@ print '<td align="right">'.$langs->trans("PlannedWorkload").'</td>'; ...@@ -147,8 +186,6 @@ print '<td align="right">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>'; print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
//print '<td align="right">'.$langs->trans("TimeSpent").'</td>'; //print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
$tmp=dol_getdate($now);
$startdayarray=dol_get_first_day_week($tmp['mday'], $tmp['mon'], $tmp['year']);
$startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']); $startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
for($i=0;$i<7;$i++) for($i=0;$i<7;$i++)
...@@ -192,7 +229,14 @@ print '<div class="center">'; ...@@ -192,7 +229,14 @@ print '<div class="center">';
print '<input type="button" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; print '<input type="button" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>'."\n\n";
print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n";
print ' jQuery(".timesheetalreadyrecorded").tipTip({ maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50, content: \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $user->getFullName($langs))).'\'});';
print "});";
print '</script>';
llxFooter(); llxFooter();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment