static function getHeadForObject($tab_object, $fk_object) { global $db, $conf, $langs, $user; $head = array(); if (empty($tab_object)) { return $head; } if ($tab_object === 'product') { dol_include_once('/product/class/product.class.php'); dol_include_once('/core/lib/product.lib.php'); $object = new Product($db); $object->fetch($fk_object); $head = product_prepare_head($object); } else { if ($tab_object === 'thirdparty') { dol_include_once('/societe/class/societe.class.php'); dol_include_once('/core/lib/company.lib.php'); $object = new Societe($db); $object->fetch($fk_object); $head = societe_prepare_head($object); } else { if ($tab_object === 'contact') { dol_include_once('/contact/class/contact.class.php'); dol_include_once('/core/lib/contact.lib.php'); $object = new Contact($db); $object->fetch($fk_object); $head = contact_prepare_head($object); } else { if ($tab_object === 'user') { dol_include_once('/user/class/user.class.php'); dol_include_once('/core/lib/usergroups.lib.php'); $object = new User($db); $object->fetch($fk_object); $head = user_prepare_head($object); } else { if ($tab_object === 'group') { dol_include_once('/user/class/usergroup.class.php'); dol_include_once('/lib/usergroups.lib.php'); $object = new UserGroup($db); $object->fetch($fk_object); $head = group_prepare_head($object); } else { if ($tab_object === 'project') { dol_include_once('/projet/class/project.class.php'); dol_include_once('/core/lib/project.lib.php'); $object = new Project($db); $object->fetch($fk_object); $head = project_prepare_head($object); } } } } } } return $head; }
$form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref) > 0) { $res = $object->fetch_optionals($object->id, $extralabels); $result = $projectstatic->fetch($object->fk_project); if (!empty($projectstatic->socid)) { $projectstatic->fetch_thirdparty(); } $object->project = dol_clone($projectstatic); $userWrite = $projectstatic->restrictedProjectArea($user, 'write'); if (!empty($withproject)) { // Tabs for project $tab = 'tasks'; $head = project_prepare_head($projectstatic); dol_fiche_head($head, $tab, $langs->trans("Project"), 0, $projectstatic->public ? 'projectpub' : 'project'); $param = $mode == 'mine' ? '&mode=mine' : ''; print '<table class="border" width="100%">'; // Ref print '<tr><td width="30%">'; print $langs->trans("Ref"); print '</td><td>'; // Define a complementary filter for search of next/prev ref. if (!$user->rights->projet->all->lire) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $mine, 0); $projectstatic->next_prev_filter = " rowid in (" . (count($projectsListId) ? join(',', array_keys($projectsListId)) : '0') . ")"; } print $form->showrefnav($projectstatic, 'project_ref', '', 1, 'ref', 'ref', '', $param . '&withproject=1'); print '</td></tr>'; print '<tr><td>' . $langs->trans("Label") . '</td><td>' . $projectstatic->title . '</td></tr>';
if ($nboftask) { $text .= '<br>' . img_warning() . ' ' . $langs->trans("ThisWillAlsoRemoveTasks", $nboftask); } print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans("DeleteAProject"), $text, "confirm_delete", '', '', 1); } // Clone confirmation if ($action == 'clone') { $formquestion = array('text' => $langs->trans("ConfirmClone"), array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true), array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_project_files', 'label' => $langs->trans("CloneProjectFiles"), 'value' => false), array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false)); print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $object->id, $langs->trans("CloneProject"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 240); } print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="id" value="' . $object->id . '">'; print '<input type="hidden" name="comefromclone" value="' . $comefromclone . '">'; $head = project_prepare_head($object); dol_fiche_head($head, 'project', $langs->trans("Project"), 0, $object->public ? 'projectpub' : 'project'); if ($action == 'edit' && $userWrite > 0) { print '<table class="border" width="100%">'; // Ref print '<tr><td class="fieldrequired" width="30%">' . $langs->trans("Ref") . '</td>'; print '<td><input size="12" name="ref" value="' . $object->ref . '"></td></tr>'; // Label print '<tr><td class="fieldrequired">' . $langs->trans("Label") . '</td>'; print '<td><input size="40" name="title" value="' . $object->title . '"></td></tr>'; // Customer print '<tr><td>' . $langs->trans("ThirdParty") . '</td><td>'; $filteronlist = ''; if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) { $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; }
function _fiche(&$c) { global $db, $conf, $langs, $user; llxHeader('', 'Checklist'); $PDOdb = new TPDOdb(); if ($c->type_object == 'project') { dol_include_once('/projet/class/project.class.php'); dol_include_once('/core/lib/project.lib.php'); $object = new Project($db); $object->fetch($c->fk_object); $head = project_prepare_head($object); dol_fiche_head($head, 'checklist', $langs->trans("Project"), 0, $object->public ? 'projectpub' : 'project'); } ?> <table class="border" > <tr class="liste_titre"> <td class="liste_titre"><?php echo $langs->trans('Label'); ?> </td> <?php for ($ii = 0; $ii < $c->levelAnswer; $ii++) { echo '<td class="liste_titre"> </td>'; // '.($ii+1).' } if ($user->rights->checklist->write) { ?> <td class="liste_titre"><?php echo $langs->trans('YesIDo'); ?> </td> <?php } ?> </tr> <?php foreach ($c->TCheck as $k => &$check) { echo '<tr>'; echo '<td>' . $check['label'] . '</td>'; $Tab = $check['answers']; for ($ii = 0; $ii < $c->levelAnswer; $ii++) { $a = each($Tab); echo '<td>'; if (!empty($a)) { $date = $a['key']; $value = $a['value']; if ($value['value'] === true) { $u = new User($db); $u->fetch($value['fk_user']); echo dol_print_date($date) . img_info($u->login); } } echo '</td>'; } if ($user->rights->checklist->write) { echo '<td><a href="?action=yesido&k=' . $k . '&type_object=' . $c->type_object . '&fk_object=' . $c->fk_object . '">' . img_picto($langs->trans('YesIDo'), 'history.png') . '</a></td>'; } echo '</tr>'; } ?> </table> <?php dol_fiche_end(); llxFooter(); }