/** * Print the validation list into ticket * * @param $ticket class **/ function showSummary($ticket) { global $DB, $LANG, $CFG_GLPI; if (!haveRight('validate_ticket', 1) && !haveRight('create_validation', 1)) { return false; } $tID = $ticket->fields['id']; //$canadd = haveRight("create_validation", "1"); $tmp = array('tickets_id' => $tID); $canadd = $this->can(-1, 'w', $tmp); $rand = mt_rand(); echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n"; if ($canadd) { echo "<script type='text/javascript' >\n"; echo "function viewAddValidation" . $tID . "{$rand}() {\n"; $params = array('type' => __CLASS__, 'tickets_id' => $tID, 'id' => -1); ajaxUpdateItemJsCode("viewfollowup" . $tID . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false); echo "};"; echo "</script>\n"; if ($ticket->fields["status"] != 'solved' && $ticket->fields["status"] != 'closed') { echo "<div class='center'><a href='javascript:viewAddValidation" . $tID . "{$rand}();'>"; echo $LANG['validation'][1] . "</a></div><br>\n"; } } $query = "SELECT *\n FROM `" . $this->getTable() . "`\n WHERE `tickets_id` = '" . $ticket->getField('id') . "'"; if (!$canadd) { $query .= " AND `users_id_validate` = '" . getLoginUserID() . "' "; } $query .= " ORDER BY submission_date DESC"; $result = $DB->query($query); $number = $DB->numrows($result); if ($number) { $colonnes = array($LANG['validation'][2], $LANG['validation'][3], $LANG['validation'][18], $LANG['validation'][5], $LANG['validation'][4], $LANG['validation'][21], $LANG['validation'][6]); $nb_colonnes = count($colonnes); echo "<table class='tab_cadre_fixehov'>"; echo "<tr><th colspan='" . $nb_colonnes . "'>" . $LANG['validation'][7] . "</th></tr>"; echo "<tr>"; foreach ($colonnes as $colonne) { echo "<th>" . $colonne . "</th>"; } echo "</tr>"; initNavigateListItems('TicketValidation', $LANG['validation'][26] . " = " . $ticket->fields['name']); while ($row = $DB->fetch_assoc($result)) { $canedit = $this->can($row["id"], 'w'); addToNavigateListItems('TicketValidation', $row["id"]); $bgcolor = $this->getStatusColor($row['status']); $status = $this->getStatus($row['status']); echo "<tr class='tab_bg_1' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}();\"" : '') . " id='viewfollowup" . $this->fields['tickets_id'] . $row["id"] . "{$rand}'>"; echo "<td>"; if ($canedit) { echo "\n<script type='text/javascript' >\n"; echo "function viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}() {\n"; $params = array('type' => __CLASS__, 'tickets_id' => $this->fields["tickets_id"], 'id' => $row["id"]); ajaxUpdateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false); echo "};"; echo "</script>\n"; } echo "<div style='background-color:" . $bgcolor . ";'>" . $status . "</div></td>"; if ($ticket->can($ticket->fields['id'], 'r') && !strstr($ticket->fields["status"], "solved") && !strstr($ticket->fields["status"], "closed")) { $link_validation = getItemTypeFormURL('TicketValidation'); echo "<td>" . convDateTime($row["submission_date"]) . "</td>"; } else { echo "<td>" . convDateTime($row["submission_date"]) . "</a></td>"; } echo "<td>" . getUserName($row["users_id"]) . "</td>"; echo "<td>" . $row["comment_submission"] . "</td>"; echo "<td>" . convDateTime($row["validation_date"]) . "</td>"; echo "<td>" . getUserName($row["users_id_validate"]) . "</td>"; echo "<td>" . $row["comment_validation"] . "</td>"; echo "</tr>"; } echo "</table>"; } else { echo "<div class='center b'>" . $LANG['search'][15] . "</div>"; } }
function showForm($ID, $options = array()) { global $DB, $CFG_GLPI, $LANG; $canupdate = haveRight('update_ticket', '1'); $canpriority = haveRight('update_priority', '1'); $showuserlink = 0; if (haveRight('user', 'r')) { $showuserlink = 1; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w', $options); } $this->showTabs($options); $canupdate_descr = $canupdate || $this->fields['status'] == 'new' && $this->isUser(self::REQUESTER, getLoginUserID()) && $this->numberOfFollowups() == 0 && $this->numberOfTasks() == 0; if (!$ID) { //Get all the user's entities $all_entities = Profile_User::getUserEntities($options["_users_id_requester"], true); $this->userentities = array(); //For each user's entity, check if the technician which creates the ticket have access to it foreach ($all_entities as $tmp => $ID_entity) { if (haveAccessToEntity($ID_entity)) { $this->userentities[] = $ID_entity; } } $this->countentitiesforuser = count($this->userentities); if ($this->countentitiesforuser > 0 && !in_array($this->fields["entities_id"], $this->userentities)) { // If entity is not in the list of user's entities, // then use as default value the first value of the user's entites list $this->fields["entities_id"] = $this->userentities[0]; } } echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>"; echo "<div class='spaced' id='tabsbody'>"; echo "<table class='tab_cadre_fixe'>"; // Optional line $ismultientities = isMultiEntitiesMode(); echo '<tr><th colspan="4">'; if ($ID) { echo $this->getTypeName() . " - " . $LANG['common'][2] . " {$ID} "; if ($ismultientities) { echo "(" . Dropdown::getDropdownName('glpi_entities', $this->fields['entities_id']) . ")"; } } else { if ($ismultientities) { echo $LANG['job'][46] . " : " . Dropdown::getDropdownName("glpi_entities", $this->fields['entities_id']); } else { echo $LANG['job'][13]; } } echo '</th></tr>'; echo "<tr>"; echo "<th class='left' colspan='2'>"; echo "<table>"; echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['joblist'][11] . " : </span></td>"; echo "<td>"; $date = $this->fields["date"]; if (!$ID) { $date = date("Y-m-d H:i:s"); } if ($canupdate) { showDateTimeFormItem("date", $date, 1, false); } else { echo convDateTime($date); } echo "</td></tr>"; if ($ID) { echo "<tr><td><span class='tracking_small'>" . $LANG['common'][95] . " :</span></td><td>"; if ($canupdate) { User::dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'entity' => $this->fields["entities_id"], 'right' => 'all')); } else { echo getUserName($this->fields["users_id_recipient"], $showuserlink); } echo "</td></tr>"; } echo "</table>"; echo "</th>"; echo "<th class='left' colspan='2'>"; echo "<table>"; if ($ID) { echo "<tr><td><span class='tracking_small'>" . $LANG['common'][26] . " :</span></td>"; echo "<td><span class='tracking_small'>" . convDateTime($this->fields["date_mod"]) . "\n"; if ($this->fields['users_id_lastupdater'] > 0) { echo $LANG['common'][95] . " "; echo getUserName($this->fields["users_id_lastupdater"], $showuserlink); } echo "</span>"; echo "</td></tr>"; } // SLA echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['sla'][5] . " : </span></td>"; echo "<td>"; if ($ID) { if ($this->fields["slas_id"] > 0) { echo "<span class='tracking_small'> "; echo convDateTime($this->fields["due_date"]) . "</span>"; echo "</td></tr><tr><td><span class='tracking_small'>" . $LANG['sla'][1] . " :</span></td>"; echo "<td><span class='tracking_small'>"; echo Dropdown::getDropdownName("glpi_slas", $this->fields["slas_id"]); $commentsla = ""; $slalevel = new SlaLevel(); if ($slalevel->getFromDB($this->fields['slalevels_id'])) { $commentsla .= '<strong>' . $LANG['sla'][6] . " : </strong>" . $slalevel->getName() . '<br><br>'; } $nextaction = new SlaLevel_Ticket(); if ($nextaction->getFromDBForTicket($this->fields["id"])) { $commentsla .= '<strong>' . $LANG['sla'][8] . " : </strong>" . convDateTime($nextaction->fields['date']) . '<br>'; if ($slalevel->getFromDB($nextaction->fields['slalevels_id'])) { $commentsla .= '<strong>' . $LANG['sla'][6] . " : </strong>" . $slalevel->getName() . '<br>'; } } $slaoptions = array(); if (haveRight('config', 'r')) { } $slaoptions['link'] = getItemTypeFormURL('SLA') . "?id=" . $this->fields["slas_id"]; showToolTip($commentsla, $slaoptions); if ($canupdate) { echo " <input type='submit' class='submit' name='sla_delete' value='" . $LANG['sla'][7] . "'>"; } echo "</span>"; } else { showDateTimeFormItem("due_date", $this->fields["due_date"], 1, false, $canupdate); } } else { // New Ticket if ($this->fields["due_date"] == 'NULL') { $this->fields["due_date"] = ''; } showDateTimeFormItem("due_date", $this->fields["due_date"], 1, false, $canupdate); /* echo $LANG['choice'][2]." ".$LANG['sla'][1]." : "; Dropdown::show('Sla',array('entity' => $this->fields["entities_id"], 'value' =>$this->fields["slas_id"]));*/ } echo "</td></tr>"; if ($ID) { switch ($this->fields["status"]) { case 'closed': echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['joblist'][12] . " : </span></td>"; echo "<td>"; showDateTimeFormItem("closedate", $this->fields["closedate"], 1, false, $canupdate); echo "</td></tr>"; break; case 'solved': echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['joblist'][14] . " : </span></td>"; echo "<td>"; showDateTimeFormItem("solvedate", $this->fields["solvedate"], 1, false, $canupdate); echo "</td></tr>"; break; } } echo "</table>"; echo "</th></tr>"; echo "</table>"; if (!$ID) { $this->showActorsPartForm($ID, $options); } echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'>"; echo "<th width='10%'>" . $LANG['joblist'][0] . " : </th>"; echo "<td width='40%'>"; if ($canupdate) { self::dropdownStatus("status", $this->fields["status"], 2); // Allowed status } else { echo self::getStatus($this->fields["status"]); } echo "</td>"; echo "<th>" . $LANG['common'][17] . " : </th>"; echo "<td >"; // Permit to set type when creating ticket without update right if ($canupdate || !$ID) { self::dropdownType('type', $this->fields["type"]); } else { echo self::getTicketTypeName($this->fields["type"]); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th>" . $LANG['joblist'][29] . " : </th>"; echo "<td>"; if ($canupdate && $canpriority || !$ID || $canupdate_descr) { // Only change during creation OR when allowed to change priority OR when user is the creator $idurgency = self::dropdownUrgency("urgency", $this->fields["urgency"]); } else { $idurgency = "value_urgency" . mt_rand(); echo "<input id='{$idurgency}' type='hidden' name='urgency' value='" . $this->fields["urgency"] . "'>"; echo self::getUrgencyName($this->fields["urgency"]); } echo "</td>"; echo "<th>" . $LANG['common'][36] . " : </th>"; echo "<td >"; // Permit to set category when creating ticket without update right if ($canupdate || !$ID || $canupdate_descr) { $opt = array('value' => $this->fields["ticketcategories_id"], 'entity' => $this->fields["entities_id"]); if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") { $opt['condition'] = '`is_helpdeskvisible`=1'; } if ($ID && $CFG_GLPI["is_ticket_category_mandatory"]) { $opt['display_emptychoice'] = false; } Dropdown::show('TicketCategory', $opt); } else { echo Dropdown::getDropdownName("glpi_ticketcategories", $this->fields["ticketcategories_id"]); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th>" . $LANG['joblist'][30] . " : </th>"; echo "<td>"; if ($canupdate) { $idimpact = self::dropdownImpact("impact", $this->fields["impact"]); } else { echo self::getImpactName($this->fields["impact"]); } echo "</td>"; echo "<th class='left' rowspan='2'>" . $LANG['document'][14] . " : </th>"; echo "<td rowspan='2'>"; // Select hardware on creation or if have update right if ($canupdate || !$ID || $canupdate_descr) { if ($ID) { if ($this->fields['itemtype'] && class_exists($this->fields['itemtype']) && $this->fields["items_id"]) { $item = new $this->fields['itemtype'](); if ($item->can($this->fields["items_id"], 'r')) { echo $item->getTypeName() . " - " . $item->getLink(true); } else { echo $item->getTypeName() . " " . $item->getNameID(); } } } $dev_user_id = 0; if (!$ID) { $dev_user_id = $options['_users_id_requester']; } else { if (isset($this->users[self::REQUESTER]) && count($this->users[self::REQUESTER]) == 1) { foreach ($this->users[self::REQUESTER] as $user_id_single) { $dev_user_id = $user_id_single['users_id']; } } } if ($dev_user_id > 0) { self::dropdownMyDevices($dev_user_id, $this->fields["entities_id"], $this->fields["itemtype"], $this->fields["items_id"]); } self::dropdownAllDevices("itemtype", $this->fields["itemtype"], $this->fields["items_id"], 1, $this->fields["entities_id"]); } else { if ($ID && $this->fields['itemtype'] && class_exists($this->fields['itemtype'])) { $item = new $this->fields['itemtype'](); $item->getFromDB($this->fields['items_id']); echo $item->getTypeName() . " - " . $item->getNameID(); } else { echo $LANG['help'][30]; } } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th class='left'>" . $LANG['joblist'][2] . " : </th>"; echo "<td>"; if ($canupdate && $canpriority) { $idpriority = self::dropdownPriority("priority", $this->fields["priority"], false, true); $idajax = 'change_priority_' . mt_rand(); echo " <span id='{$idajax}' style='display:none'></span>"; } else { $idajax = 'change_priority_' . mt_rand(); $idpriority = 0; echo "<span id='{$idajax}'>" . self::getPriorityName($this->fields["priority"]) . "</span>"; } if ($canupdate) { $params = array('urgency' => '__VALUE0__', 'impact' => '__VALUE1__', 'priority' => $idpriority); ajaxUpdateItemOnSelectEvent(array($idurgency, $idimpact), $idajax, $CFG_GLPI["root_doc"] . "/ajax/priority.php", $params); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th class='left'>" . $LANG['job'][44] . " : </th>"; echo "<td>"; if ($canupdate) { Dropdown::show('RequestType', array('value' => $this->fields["requesttypes_id"])); } else { echo Dropdown::getDropdownName('glpi_requesttypes', $this->fields["requesttypes_id"]); } echo "</td>"; // Display validation state echo "<th>"; if (!$ID) { echo $LANG['validation'][26] . " : "; } else { echo $LANG['validation'][0] . " : "; } echo "</th>"; echo "<td>"; if (!$ID) { User::dropdown(array('name' => "_add_validation", 'entity' => $this->fields['entities_id'], 'right' => 'validate_ticket')); } else { if ($canupdate) { TicketValidation::dropdownStatus('global_validation', array('global' => true, 'value' => $this->fields['global_validation'])); } else { echo TicketValidation::getStatus($this->fields['global_validation']); } } echo "</td></tr>"; // Need comment right to add a followup with the actiontime if (!$ID && haveRight("global_add_followups", "1")) { echo "<tr class='tab_bg_1'>"; echo "<th>" . $LANG['job'][20] . " : </th>"; echo "<td class='left' colspan='3'>"; Dropdown::showInteger('hour', $options['hour'], 0, 100); echo " " . $LANG['job'][21] . " "; Dropdown::showInteger('minute', $options['minute'], 0, 59); echo " " . $LANG['job'][22] . " "; echo "</td>"; echo "</tr>"; } echo '</table>'; if ($ID) { $this->showActorsPartForm($ID, $options); } echo "<table class='tab_cadre_fixe'>"; $view_linked_tickets = $ID || $canupdate; echo "<tr class='tab_bg_1'>"; echo "<th width='10%'>" . $LANG['common'][57] . " :</th>"; echo "<td width='50%'>"; if (!$ID || $canupdate_descr) { $rand = mt_rand(); echo "<script type='text/javascript' >\n"; echo "function showName{$rand}() {\n"; echo "Ext.get('name{$rand}').setDisplayed('none');"; $params = array('maxlength' => 250, 'size' => 60, 'name' => 'name', 'data' => rawurlencode($this->fields["name"])); ajaxUpdateItemJsCode("viewname{$rand}", $CFG_GLPI["root_doc"] . "/ajax/inputtext.php", $params, false); echo "}"; echo "</script>\n"; echo "<div id='name{$rand}' class='tracking left' onClick='showName{$rand}()'>\n"; if (empty($this->fields["name"])) { echo $LANG['reminder'][15]; } else { echo $this->fields["name"]; } echo "</div>\n"; echo "<div id='viewname{$rand}'>\n"; echo "</div>\n"; if (!$ID) { echo "<script type='text/javascript' >\n\n showName{$rand}();\n </script>"; } } else { if (empty($this->fields["name"])) { echo $LANG['reminder'][15]; } else { echo $this->fields["name"]; } } echo "</td>"; // Permit to add doc when creating a ticket if (!$ID) { echo "<th>" . $LANG['document'][2] . " (" . Document::getMaxUploadSize() . ") :"; echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' class='pointer' alt=\"" . $LANG['central'][7] . "\" onclick=\"window.open('" . $CFG_GLPI["root_doc"] . "/front/documenttype.list.php','Help','scrollbars=1,resizable=1,width=1000,height=800')\">"; echo "</th>"; echo "<td>"; echo "<input type='file' name='filename' value=\"\" size='25'></td>"; } else { echo "<th colspan='2'>"; echo $LANG['document'][20] . ' : ' . Document_Item::countForItem($this); echo "</th>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th width='10%'>" . $LANG['joblist'][6] . " : </th>"; echo "<td width='50%'>"; if (!$ID || $canupdate_descr) { // Admin =oui on autorise la modification de la description $rand = mt_rand(); echo "<script type='text/javascript' >\n"; echo "function showDesc{$rand}() {\n"; echo "Ext.get('desc{$rand}').setDisplayed('none');"; $params = array('rows' => 6, 'cols' => 60, 'name' => 'content', 'data' => rawurlencode($this->fields["content"])); ajaxUpdateItemJsCode("viewdesc{$rand}", $CFG_GLPI["root_doc"] . "/ajax/textarea.php", $params, false); echo "}"; echo "</script>\n"; echo "<div id='desc{$rand}' class='tracking' onClick='showDesc{$rand}()'>\n"; if (!empty($this->fields["content"])) { echo nl2br($this->fields["content"]); } else { echo $LANG['job'][33]; } echo "</div>\n"; echo "<div id='viewdesc{$rand}'></div>\n"; if (!$ID) { echo "<script type='text/javascript' >\n\n showDesc{$rand}();\n </script>"; } } else { echo nl2br($this->fields["content"]); } echo "</td>"; if ($view_linked_tickets) { echo "<th width='10%'>"; echo $LANG['job'][55]; if ($canupdate) { $rand_linked_ticket = mt_rand(); echo " <a class='tracking'\n onClick=\"Ext.get('linkedticket{$rand_linked_ticket}').setDisplayed('block')\">\n"; echo $LANG['buttons'][8]; echo "</a>\n"; } echo '</th>'; echo "<td>"; Ticket_Ticket::displayLinkedTicketsTo($ID); if ($canupdate) { echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>"; Ticket_Ticket::dropdownLinks('_link[link]'); echo " " . $LANG['job'][38] . " " . $LANG['common'][2] . " : "; echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n"; echo "<input type='text' name='_link[tickets_id_2]' value='' size='10'>\n"; echo " "; echo "</div>"; } echo "</td>"; } echo "</tr>"; if (!$ID || $canupdate || $canupdate_descr || haveRight("assign_ticket", "1") || haveRight("steal_ticket", "1")) { echo "<tr class='tab_bg_1'>"; if ($ID) { if (haveRight('delete_ticket', 1)) { echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' class='submit' name='update' value='" . $LANG['buttons'][7] . "'></td>"; echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' class='submit' name='delete' value='" . $LANG['buttons'][22] . "'" . addConfirmationOnAction($LANG['common'][50]) . ">"; } else { echo "<td class='tab_bg_2 center' colspan='4'>"; echo "<input type='submit' class='submit' name='update' value='" . $LANG['buttons'][7] . "'>"; } } else { echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>"; echo "</td><td class='tab_bg_2 center' colspan='2'>"; echo "<input type='button' value=\"" . $LANG['buttons'][16] . "\" class='submit'\n onclick=\"window.location='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'\">"; } echo "</td></tr>"; } echo "</table>"; echo "<input type='hidden' name='id' value='{$ID}'>"; echo "</div>"; echo "</form>"; $this->addDivForTabs(); return true; }
/** * Show the current ticketfollowup summary * * @param $ticket Ticket object **/ function showSummary($ticket) { global $DB, $LANG, $CFG_GLPI; if (!haveRight("observe_ticket", "1") && !haveRight("show_full_ticket", "1")) { return false; } $tID = $ticket->fields['id']; // Display existing Followups $showprivate = haveRight("show_full_ticket", "1"); $caneditall = haveRight("update_followups", "1"); $tmp = array('tickets_id' => $tID); $canadd = $this->can(-1, 'w', $tmp); $RESTRICT = ""; if (!$showprivate) { $RESTRICT = " AND (`is_private` = '0'\n OR `users_id` ='" . getLoginUserID() . "') "; } $query = "SELECT `id`, `date`\n FROM `glpi_ticketfollowups`\n WHERE `tickets_id` = '{$tID}'\n {$RESTRICT}\n ORDER BY `date` DESC"; $result = $DB->query($query); $rand = mt_rand(); if ($caneditall || $canadd) { echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n"; } if ($canadd) { echo "<script type='text/javascript' >\n"; echo "function viewAddFollowup" . $ticket->fields['id'] . "{$rand}() {\n"; $params = array('type' => __CLASS__, 'tickets_id' => $ticket->fields['id'], 'id' => -1); ajaxUpdateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false); echo "};"; echo "</script>\n"; if ($ticket->fields["status"] != 'solved' && $ticket->fields["status"] != 'closed') { echo "<div class='center'>" . "<a href='javascript:viewAddFollowup" . $ticket->fields['id'] . "{$rand}();'>"; echo $LANG['job'][29] . "</a></div><br>\n"; } } if ($DB->numrows($result) == 0) { echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'>"; echo "<th class='b'>" . $LANG['job'][12] . "</th></tr></table>"; } else { echo "<table class='tab_cadre_fixehov'>"; echo "<tr><th>" . $LANG['common'][17] . "</th><th>" . $LANG['common'][27] . "</th>"; echo "<th>" . $LANG['joblist'][6] . "</th>"; //"<th>" . $LANG['job'][31] . "</th>"; echo "<th>" . $LANG['common'][37] . "</th>"; if ($showprivate) { echo "<th>" . $LANG['common'][77] . "</th>"; } echo "</tr>\n"; while ($data = $DB->fetch_array($result)) { if ($this->getFromDB($data['id'])) { $this->showInTicketSumnary($ticket, $rand, $showprivate); } } echo "</table>"; } }
/** * Javascript code for update an item * * @param $toupdate id of the item to update * @param $url Url to get datas to update the item * @param $parameters Parameters to send to ajax URL * @param $spinner NOT USED : always spinner - is a spinner displayed when loading ? * @param $toobserve id of another item used to get value in case of __VALUE__ used * **/ function ajaxUpdateItem($toupdate, $url, $parameters = array(), $spinner = true, $toobserve = "") { echo "<script type='text/javascript'>"; ajaxUpdateItemJsCode($toupdate, $url, $parameters, $spinner, $toobserve); echo "</script>"; }
/** * Toggle view in LDAP user import/synchro between no restriction and date restriction **/ static function showAdvanceDateRestrictionSwitch($enabled = 0) { global $LANG, $CFG_GLPI; $rand = mt_rand(); $url = $CFG_GLPI["root_doc"] . "/ajax/ldapdaterestriction.php"; echo "<script type='text/javascript' >\n"; echo "function activateRestriction() {\n"; $params = array('enabled' => 1); ajaxUpdateItemJsCode('date_restriction', $url, $params, false); echo "};"; echo "function deactivateRestriction() {\n"; $params = array('enabled' => 0); ajaxUpdateItemJsCode('date_restriction', $url, $params, false); echo "};"; echo "</script>"; echo "</table>"; echo "<span id='date_restriction'>"; $_POST['enabled'] = $enabled; include GLPI_ROOT . "/ajax/ldapdaterestriction.php"; echo "</span>\n"; return $rand; }
/** * Print the reminder form * * @param $ID Integer : Id of the item to print * @param $options array * - target filename : where to go when done. **/ function showForm($ID, $options = array()) { global $CFG_GLPI, $LANG; // Show Reminder or blank form $onfocus = ""; if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item : do getempty before check right to set default values $this->check(-1, 'w'); $onfocus = "onfocus=\"if (this.value=='" . $this->fields['name'] . "') this.value='';\""; } $canedit = $this->can($ID, 'w'); if ($canedit) { echo "<form method='post' name='remind' action='" . $this->getFormURL() . "'>"; } echo "<div class='center'><table class='tab_cadre' width='450'>"; echo "<tr><th> </th><th>"; if (!$ID) { echo $LANG['reminder'][6]; } else { echo $LANG['common'][2] . " {$ID}"; } echo "</th></tr>\n"; echo "<tr class='tab_bg_2'><td>" . $LANG['common'][57] . " : </td>"; echo "<td>"; if ($canedit) { autocompletionTextField($this, "name", array('size' => 80, 'entity' => -1, 'user' => $this->fields["users_id"], 'option' => $onfocus)); } else { echo $this->fields['name']; } echo "</td></tr>\n"; if (!$canedit) { echo "<tr class='tab_bg_2'><td>" . $LANG['common'][95] . " : </td>"; echo "<td>"; echo getUserName($this->fields["users_id"]); echo "</td></tr>\n"; } echo "<tr class='tab_bg_2'><td>" . $LANG['common'][17] . " : </td>"; echo "<td>"; if ($canedit && haveRight("reminder_public", "w")) { if (!$ID) { if (isset($_GET["is_private"])) { $this->fields["is_private"] = $_GET["is_private"]; } if (isset($_GET["is_recursive"])) { $this->fields["is_recursive"] = $_GET["is_recursive"]; } } Dropdown::showPrivatePublicSwitch($this->fields["is_private"], $this->fields["entities_id"], $this->fields["is_recursive"]); } else { if ($this->fields["is_private"]) { echo $LANG['common'][77]; } else { echo $LANG['common'][76]; } } echo "</td></tr>\n"; if (haveRight("reminder_public", "w") && !$this->fields["is_private"]) { echo "<tr class='tab_bg_2'><td>" . $LANG['tracking'][39] . " : </td>"; echo "<td>"; if ($canedit) { Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']); } else { echo Dropdpown::getYesNo($this->fields['is_helpdesk_visible']); } echo "</td></tr>\n"; } echo "<tr class='tab_bg_2'><td >" . $LANG['buttons'][15] . " : </td>"; echo "<td class='center'>"; if ($canedit) { echo "<script type='text/javascript' >\n"; echo "function showPlan() {\n"; echo "Ext.get('plan').setDisplayed('none');"; $params = array('form' => 'remind'); if ($ID && $this->fields["is_planned"]) { $params['state'] = $this->fields["state"]; $params['begin'] = $this->fields["begin"]; $params['end'] = $this->fields["end"]; } ajaxUpdateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params, false); echo "}"; echo "</script>\n"; } if (!$ID || !$this->fields["is_planned"]) { if (haveRight("show_planning", "1") || haveRight("show_group_planning", "1") || haveRight("show_all_planning", "1")) { echo "<div id='plan' onClick='showPlan()'>\n"; echo "<span class='showplan'>" . $LANG['reminder'][12] . "</span>"; } } else { if ($canedit) { echo "<div id='plan' onClick='showPlan()'>\n"; echo "<span class='showplan'>"; } echo Planning::getState($this->fields["state"]) . ": " . convDateTime($this->fields["begin"]) . "->" . convDateTime($this->fields["end"]); if ($canedit) { echo "</span>"; } } if ($canedit) { echo "</div>\n"; echo "<div id='viewplan'>\n"; echo "</div>\n"; } echo "</td></tr>\n"; echo "<tr class='tab_bg_2'><td>" . $LANG['reminder'][9] . " : </td><td>"; if ($canedit) { echo "<textarea cols='80' rows='15' name='text'>" . $this->fields["text"] . "</textarea>"; } else { echo nl2br($this->fields["text"]); } echo "</td></tr>\n"; if (!$ID) { // add echo "<tr><td class='tab_bg_2 top' colspan='2'>"; echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>\n"; echo "<div class='center'>"; echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>"; echo "</div>"; echo "</td></tr>\n"; } else { if ($canedit) { echo "<tr><td class='tab_bg_2 top' colspan='2'>"; echo "<input type='hidden' name='id' value='{$ID}'>\n"; echo "<div class='center'>"; echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\" class='submit'>"; echo "<input type='hidden' name='id' value='{$ID}'><span class='medium_space'>"; echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][22] . "\"\n class='submit' " . addConfirmationOnAction($LANG['common'][50]) . ">\n </span>"; echo "</div>"; echo "</td></tr>\n"; } } echo "</table></div>\n"; if ($canedit) { echo "</form>"; } return true; }
function showFormForTask(Ticket $ticket, TicketTask $task) { global $CFG_GLPI, $LANG; $taskid = $task->getField('id'); if ($taskid > 0 && $this->getFromDBbyTask($taskid)) { if ($this->canCreate()) { echo "<script type='text/javascript' >\n"; echo "function showPlan" . $taskid . "() {\n"; echo "Ext.get('plan').setDisplayed('none');"; $params = array('form' => 'followups', 'users_id' => $this->fields["users_id"], 'id' => $this->fields["id"], 'state' => $this->fields["state"], 'begin' => $this->fields["begin"], 'end' => $this->fields["end"], 'entity' => $ticket->fields["entities_id"]); ajaxUpdateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params); echo "}"; echo "</script>\n"; echo "<div id='plan' onClick='showPlan" . $taskid . "()'>\n"; echo "<span class='showplan'>"; } echo Planning::getState($this->fields["state"]) . "<br>" . convDateTime($this->fields["begin"]) . "<br>->" . convDateTime($this->fields["end"]) . "<br>" . getUserName($this->fields["users_id"]); if ($this->canCreate()) { echo "</span>"; echo "</div>\n"; echo "<div id='viewplan'></div>\n"; } } else { if ($this->canCreate()) { echo "<script type='text/javascript' >\n"; echo "function showPlanUpdate() {\n"; echo "Ext.get('plan').setDisplayed('none');"; $params = array('form' => 'followups', 'state' => 1, 'users_id' => getLoginUserID(), 'entity' => $_SESSION["glpiactive_entity"]); ajaxUpdateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params); echo "};"; echo "</script>"; echo "<div id='plan' onClick='showPlanUpdate()'>\n"; echo "<span class='showplan'>" . $LANG['job'][34] . "</span>"; echo "</div>\n"; echo "<div id='viewplan'></div>\n"; } else { echo $LANG['job'][32]; } } }