Пример #1
0
 print '</td></tr>';
 // Date start
 print '<tr><td>' . $langs->trans("DateStart") . '</td><td>';
 print $form->select_date($object->date_start, 'dateo', 1, 1);
 print '</td></tr>';
 // Date end
 print '<tr><td>' . $langs->trans("DateEnd") . '</td><td>';
 print $form->select_date($object->date_end ? $object->date_end : -1, 'datee', 1, 1);
 print '</td></tr>';
 // Planned workload
 print '<tr><td>' . $langs->trans("PlannedWorkload") . '</td><td>';
 print $form->select_duration('planned_workload', $object->planned_workload, 0, 'text');
 print '</td></tr>';
 // Progress declared
 print '<tr><td>' . $langs->trans("ProgressDeclared") . '</td><td colspan="3">';
 print $formother->select_percent($object->progress, 'progress');
 print '</td></tr>';
 // Description
 print '<tr><td valign="top">' . $langs->trans("Description") . '</td>';
 print '<td>';
 print '<textarea name="description" wrap="soft" cols="80" rows="' . ROWS_3 . '">' . $object->description . '</textarea>';
 print '</td></tr>';
 // Other options
 $parameters = array();
 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
 // Note that $action and $object may have been modified by hook
 if (empty($reshook) && !empty($extrafields->attribute_label)) {
     print $object->showOptionals($extrafields, 'edit');
 }
 print '</table>';
 dol_fiche_end();
Пример #2
0
     print img_object('', 'user', 'class="hideonsmartphone"');
     $contactsoftask = $object->getListContactId('internal');
     if (count($contactsoftask) > 0) {
         $userid = $contactsoftask[0];
         print $form->select_dolusers(GETPOST('userid') ? GETPOST('userid') : $userid, 'userid', 0, '', 0, '', $contactsoftask);
     } else {
         print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
     }
     print '</td>';
     // Note
     print '<td class="nowrap">';
     print '<textarea name="timespent_note" cols="80" rows="' . ROWS_2 . '">' . ($_POST['timespent_note'] ? $_POST['timespent_note'] : '') . '</textarea>';
     print '</td>';
     // Progress declared
     print '<td class="nowrap">';
     print $formother->select_percent(GETPOST('progress') ? GETPOST('progress') : $object->progress, 'progress');
     print '</td>';
     // Duration - Time spent
     print '<td class="nowrap" align="right">';
     print $form->select_duration('timespent_duration', $_POST['timespent_duration'] ? $_POST['timespent_duration'] : '', 0, 'text');
     print '</td>';
     print '<td align="center">';
     print '<input type="submit" class="button" value="' . $langs->trans("Add") . '">';
     print '</td></tr>';
     print '</table></form>';
 }
 print '<br>';
 /*
  *  List of time spent
  */
 $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note";
Пример #3
0
function visu_project_task(&$db, $fk_project_task, $mode, $name)
{
    if (!$fk_project_task) {
        return ' - ';
    }
    require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
    $projectTask = new Task($db);
    $projectTask->fetch($fk_project_task);
    $link = '<a href="' . DOL_URL_ROOT . '/projet/tasks/task.php?id=' . $fk_project_task . '">' . img_picto('', 'object_projecttask.png') . $projectTask->ref . '</a>';
    if ($projectTask->progress == 0) {
        $imgStatus = img_picto('En attente', 'statut0.png');
    } elseif ($projectTask->progress < 100) {
        $imgStatus = img_picto('En cours', 'statut3.png');
    } else {
        $imgStatus = img_picto('Terminée', 'statut4.png');
    }
    if ($mode == 'edit') {
        $formother = new FormOther($db);
        return $link . ' - ' . $formother->select_percent($projectTask->progress, $name) . ' ' . $imgStatus;
    } else {
        return $link . ' - ' . $projectTask->progress . ' % ' . $imgStatus;
    }
}
Пример #4
0
			print $formother->selectProjectTasks($task->fk_task_parent,$projectstatic->id, 'task_parent', $user->admin?0:1, 0);
			print '</td></tr>';

			// Date start
			print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
			print $html->select_date($task->date_start,'dateo');
			print '</td></tr>';

			// Date end
			print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
			print $html->select_date($task->date_end?$task->date_end:-1,'datee');
			print '</td></tr>';

			// Progress
			print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">';
			print $formother->select_percent($task->progress,'progress');
			print '</td></tr>';

			// Description
			print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
			print '<td>';
			print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$task->description.'</textarea>';
			print '</td></tr>';

			print '<tr><td align="center" colspan="2">';
			print '<input type="submit" class="button" name="update" value="'.$langs->trans("Modify").'"> &nbsp; ';
			print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
			print '</table>';
			print '</form>';
		}
		else
Пример #5
0
/**
 * Output a task line
 *
 * @param	string	   	$inc					?
 * @param   string		$parent					?
 * @param   Task[]		$lines					?
 * @param   int			$level					?
 * @param   string		$projectsrole			?
 * @param   string		$tasksrole				?
 * @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
 * @return  $inc
 */
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask = 0)
{
    global $db, $user, $bc, $langs;
    global $form, $formother, $projectstatic, $taskstatic;
    if (!is_object($formother)) {
        require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
        $formother = new FormOther($db);
    }
    $lastprojectid = 0;
    $var = true;
    $numlines = count($lines);
    for ($i = 0; $i < $numlines; $i++) {
        if ($parent == 0) {
            $level = 0;
        }
        if ($lines[$i]->fk_parent == $parent) {
            // Break on a new project
            if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
                $var = !$var;
                $lastprojectid = $lines[$i]->fk_project;
            }
            // If we want all or we have a role on task, we show it
            if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
                print "<tr " . $bc[$var] . ">\n";
                // Project
                print "<td>";
                $projectstatic->id = $lines[$i]->fk_project;
                $projectstatic->ref = $lines[$i]->projectref;
                $projectstatic->public = $lines[$i]->public;
                $projectstatic->label = $langs->transnoentitiesnoconv("YourRole") . ': ' . $projectsrole[$lines[$i]->fk_project];
                print $projectstatic->getNomUrl(1);
                print "</td>";
                // Ref
                print '<td>';
                $taskstatic->id = $lines[$i]->id;
                $taskstatic->ref = $lines[$i]->id;
                print $taskstatic->getNomUrl(1);
                print '</td>';
                // Label task
                print "<td>";
                for ($k = 0; $k < $level; $k++) {
                    print "&nbsp;&nbsp;&nbsp;";
                }
                $taskstatic->id = $lines[$i]->id;
                $taskstatic->ref = $lines[$i]->label;
                print $taskstatic->getNomUrl(0);
                print "</td>\n";
                // Date start
                print '<td align="center">';
                print dol_print_date($lines[$i]->date_start, 'dayhour');
                print '</td>';
                // Date end
                print '<td align="center">';
                print dol_print_date($lines[$i]->date_end, 'dayhour');
                print '</td>';
                // Planned Workload
                print '<td align="right">';
                if ($lines[$i]->planned_workload) {
                    print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
                } else {
                    print '--:--';
                }
                print '</td>';
                // Progress declared %
                print '<td align="right">';
                print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
                print '</td>';
                // Time spent
                print '<td align="right">';
                if ($lines[$i]->duration) {
                    print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $lines[$i]->id . '">';
                    print convertSecondToTime($lines[$i]->duration, 'allhourmin');
                    print '</a>';
                } else {
                    print '--:--';
                }
                print "</td>\n";
                $disabledproject = 1;
                $disabledtask = 1;
                //print "x".$lines[$i]->fk_project;
                //var_dump($lines[$i]);
                //var_dump($projectsrole[$lines[$i]->fk_project]);
                // If at least one role for project
                if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
                    $disabledproject = 0;
                    $disabledtask = 0;
                }
                // If $restricteditformytask is on and I have no role on task, i disable edit
                if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
                    $disabledtask = 1;
                }
                // Form to add new time
                print '<td class="nowrap" align="right">';
                $s = '';
                $s .= $form->select_date('', $lines[$i]->id, 0, 0, 2, "addtime", 1, 0, 1, $disabledtask);
                $s .= '&nbsp;&nbsp;&nbsp;';
                $s .= $form->select_duration($lines[$i]->id, '', $disabledtask, 'text', 0, 1);
                $s .= '&nbsp;<input type="submit" class="button"' . ($disabledtask ? ' disabled="disabled"' : '') . ' value="' . $langs->trans("Add") . '">';
                print $s;
                print '</td>';
                print '<td align="right">';
                if (!$lines[$i]->public && $disabledproject) {
                    print $form->textwithpicto('', $langs->trans("YouAreNotContactOfProject"));
                } else {
                    if ($disabledtask) {
                        print $form->textwithpicto('', $langs->trans("TaskIsNotAffectedToYou"));
                    }
                }
                print '</td>';
                print "</tr>\n";
            }
            $inc++;
            $level++;
            if ($lines[$i]->id) {
                projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
            }
            $level--;
        } else {
            //$level--;
        }
    }
    return $inc;
}