/** * Show the current ticketfollowup summary * * @param $ticket Ticket object **/ function showSummary($ticket) { global $DB, $CFG_GLPI; if (!Session::haveRightsOr(self::$rightname, array(self::SEEPUBLIC, self::SEEPRIVATE))) { return false; } $tID = $ticket->fields['id']; // Display existing Followups $showprivate = Session::haveRight(self::$rightname, self::SEEPRIVATE); $caneditall = Session::haveRight(self::$rightname, self::UPDATEALL); $tmp = array('tickets_id' => $tID); $canadd = $this->can(-1, CREATE, $tmp); $showuserlink = 0; if (User::canView()) { $showuserlink = 1; } $techs = $ticket->getAllUsers(CommonITILActor::ASSIGN); $reopen_case = false; if (in_array($ticket->fields["status"], $ticket->getClosedStatusArray()) && $ticket->isAllowedStatus($ticket->fields['status'], Ticket::INCOMING)) { $reopen_case = true; } $tech = Session::haveRight(self::$rightname, self::ADDALLTICKET) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']); $RESTRICT = ""; if (!$showprivate) { $RESTRICT = " AND (`is_private` = '0'\n OR `users_id` ='" . Session::getLoginUserID() . "') "; } $query = "SELECT `glpi_ticketfollowups`.*, `glpi_users`.`picture`\n FROM `glpi_ticketfollowups`\n LEFT JOIN `glpi_users` ON (`glpi_ticketfollowups`.`users_id` = `glpi_users`.`id`)\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__, 'parenttype' => 'Ticket', 'tickets_id' => $ticket->fields['id'], 'id' => -1); Ajax::updateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params); echo Html::jsHide('addbutton' . $ticket->fields['id'] . "{$rand}"); echo "};"; echo "</script>\n"; // Not closed ticket or closed if (!in_array($ticket->fields["status"], array_merge($ticket->getSolvedStatusArray(), $ticket->getClosedStatusArray())) || $reopen_case) { if (isset($_GET['_openfollowup']) && $_GET['_openfollowup']) { echo Html::scriptBlock("viewAddFollowup" . $ticket->fields['id'] . "{$rand}()"); } else { echo "<div id='addbutton" . $ticket->fields['id'] . "{$rand}' class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddFollowup" . $ticket->fields['id'] . "{$rand}();'>"; if ($reopen_case) { _e('Reopen the ticket'); } else { _e('Add a new followup'); } echo "</a></div>\n"; } } } if ($DB->numrows($result) == 0) { echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'>"; echo "<th class='b'>" . __('No followup for this ticket.') . "</th></tr></table>"; } else { $today = strtotime('today'); $lastmonday = strtotime('last monday'); $lastlastmonday = strtotime('last monday', strtotime('last monday')); // Case of monday if ($today - $lastmonday == 7 * DAY_TIMESTAMP) { $lastlastmonday = $lastmonday; $lastmonday = $today; } $steps = array(0 => array('end' => $today, 'name' => __('Today')), 1 => array('end' => $lastmonday, 'name' => __('This week')), 2 => array('end' => $lastlastmonday, 'name' => __('Last week')), 3 => array('end' => strtotime('midnight first day of'), 'name' => __('This month')), 4 => array('end' => strtotime('midnight first day of last month'), 'name' => __('Last month')), 5 => array('end' => 0, 'name' => __('Before the last month'))); $currentpos = -1; while ($data = $DB->fetch_assoc($result)) { $this->getFromDB($data['id']); $candelete = $this->canPurge() && $this->canPurgeItem(); $canedit = $this->canUpdate() && $this->canUpdateItem(); $time = strtotime($data['date']); if (!isset($steps[$currentpos]) || $steps[$currentpos]['end'] > $time) { $currentpos++; while ($steps[$currentpos]['end'] > $time && isset($steps[$currentpos + 1])) { $currentpos++; } if (isset($steps[$currentpos])) { echo "<h3>" . $steps[$currentpos]['name'] . "</h3>"; } } $id = 'followup' . $data['id'] . $rand; $color = 'byuser'; if (isset($techs[$data['users_id']])) { $color = 'bytech'; } $classtoadd = ''; if ($canedit) { $classtoadd = " pointer"; } echo "<div class='boxnote {$color}' id='view{$id}'"; echo ">"; echo "<div class='boxnoteleft'>"; echo "<img class='user_picture_verysmall' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($data['picture']) . "'>"; echo "</div>"; // boxnoteleft echo "<div class='boxnotecontent'"; echo ">"; echo "<div class='boxnotefloatleft'>"; $username = NOT_AVAILABLE; if ($data['users_id']) { $username = getUserName($data['users_id'], $showuserlink); } $name = sprintf(__('Create by %1$s on %2$s'), $username, Html::convDateTime($data['date'])); if ($data['requesttypes_id']) { $name = sprintf(__('%1$s - %2$s'), $name, Dropdown::getDropdownName('glpi_requesttypes', $data['requesttypes_id'])); } if ($showprivate && $data["is_private"]) { $name = sprintf(__('%1$s - %2$s'), $name, __('Private')); } echo $name; echo "</div>"; // floatright echo "<div class='boxnotetext {$classtoadd}'"; if ($canedit) { echo " onClick=\"viewEditFollowup" . $ticket->fields['id'] . $data['id'] . "{$rand}(); " . Html::jsHide("view{$id}") . " " . Html::jsShow("viewfollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}") . "\" "; } echo ">"; $content = nl2br($data['content']); if (empty($content)) { $content = NOT_AVAILABLE; } echo $content . '</div>'; // boxnotetext echo "</div>"; // boxnotecontent echo "<div class='boxnoteright'>"; if ($candelete) { Html::showSimpleForm(Toolbox::getItemTypeFormURL('TicketFollowup'), array('purge' => 'purge'), _x('button', 'Delete permanently'), array('id' => $data['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png", '', __('Confirm the final deletion?')); } echo "</div>"; // boxnoteright echo "</div>"; // boxnote if ($canedit) { echo "<div id='viewfollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}' class='starthidden'></div>\n"; echo "\n<script type='text/javascript' >\n"; echo "function viewEditFollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}() {\n"; $params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $data["tickets_id"], 'id' => $data["id"]); Ajax::updateItemJsCode("viewfollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params); echo "};"; echo "</script>\n"; } } } }
/** * @param $size (default 25) **/ static function showDocumentAddButton($size = 25) { global $CFG_GLPI; echo "<script type='text/javascript'>var nbfiles=1; var maxfiles = 5;</script>"; echo "<span id='addfilebutton'><img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\" onClick=\"if (nbfiles<maxfiles){\n var row = " . Html::jsGetElementbyID('uploadfiles') . ";\n row.append('<br><input type=\\'file\\' name=\\'filename[]\\' size=\\'{$size}\\'>');\n nbfiles++;\n if (nbfiles==maxfiles) {\n " . Html::jsHide('addfilebutton') . "\n }\n }\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'></span>"; }
/** * Show the current task sumnary * * @param $item CommonITILObject **/ function showSummary(CommonITILObject $item) { global $DB, $CFG_GLPI; if (!static::canView()) { return false; } $tID = $item->fields['id']; // Display existing Followups $showprivate = $this->canViewPrivates(); $caneditall = $this->canEditAll(); $tmp = array($item->getForeignKeyField() => $tID); $canadd = $this->can(-1, CREATE, $tmp); $canpurge = $this->canPurgeItem(); $canview = $this->canViewItem(); $RESTRICT = ""; if ($this->maybePrivate() && !$showprivate) { $RESTRICT = " AND (`is_private` = '0'\n OR `users_id` ='" . Session::getLoginUserID() . "'\n OR `users_id_tech` ='" . Session::getLoginUserID() . "'\n OR `groups_id_tech` IN ('" . implode("','", $_SESSION["glpigroups"]) . "')) "; } $query = "SELECT `id`, `date`\n FROM `" . $this->getTable() . "`\n WHERE `" . $item->getForeignKeyField() . "` = '{$tID}'\n {$RESTRICT}\n ORDER BY `date` DESC"; $result = $DB->query($query); $rand = mt_rand(); if ($caneditall || $canadd || $canpurge) { echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n"; } if ($canadd) { echo "<script type='text/javascript' >\n"; echo "function viewAddTask" . $item->fields['id'] . "{$rand}() {\n"; $params = array('type' => $this->getType(), 'parenttype' => $item->getType(), $item->getForeignKeyField() => $item->fields['id'], 'id' => -1); Ajax::updateItemJsCode("viewfollowup" . $item->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params); echo Html::jsHide('addbutton' . $item->fields['id'] . "{$rand}"); echo "};"; echo "</script>\n"; if (!in_array($item->fields["status"], array_merge($item->getSolvedStatusArray(), $item->getClosedStatusArray()))) { echo "<div id='addbutton" . $item->fields['id'] . "{$rand}' class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddTask" . $item->fields['id'] . "{$rand}();'>"; echo __('Add a new task') . "</a></div>\n"; } } if ($DB->numrows($result) == 0) { echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'><th>" . __('No task found.'); echo "</th></tr></table>"; } else { echo "<table class='tab_cadre_fixehov'>"; $header = "<tr><th> </th><th>" . __('Type') . "</th><th>" . __('Date') . "</th>"; $header .= "<th>" . __('Description') . "</th><th>" . __('Duration') . "</th>"; $header .= "<th>" . __('Writer') . "</th>"; if ($this->maybePrivate() && $showprivate) { $header .= "<th>" . __('Private') . "</th>"; } $header .= "<th>" . __('Planning') . "</th></tr>\n"; echo $header; while ($data = $DB->fetch_assoc($result)) { if ($this->getFromDB($data['id'])) { $options = array('parent' => $item, 'rand' => $rand, 'showprivate' => $showprivate); Plugin::doHook('pre_show_item', array('item' => $this, 'options' => &$options)); $this->showInObjectSumnary($item, $rand, $showprivate); Plugin::doHook('post_show_item', array('item' => $this, 'options' => $options)); } } echo $header; echo "</table>"; } }
/** * Show notepads for an item * * @param $item CommonDBTM object * @param $withtemplate integer template or basic item (default '') **/ static function showForItem(CommonDBTM $item, $withtemplate = '') { global $CFG_GLPI; if (!Session::haveRight($item::$rightname, READNOTE)) { return false; } $notes = static::getAllForItem($item); $rand = mt_rand(); $canedit = Session::haveRight($item::$rightname, UPDATENOTE); $showuserlink = 0; if (User::canView()) { $showuserlink = 1; } if ($canedit) { echo "<div class='boxnote center'>"; echo "<div class='boxnoteleft'></div>"; echo "<form name='addnote_form{$rand}' id='addnote_form{$rand}' "; echo " method='post' action='" . Toolbox::getItemTypeFormURL('Notepad') . "'>"; echo Html::hidden('itemtype', array('value' => $item->getType())); echo Html::hidden('items_id', array('value' => $item->getID())); echo "<div class='boxnotecontent'>"; echo "<div class='floatleft'>"; echo "<textarea name='content' rows=5 cols=100></textarea>"; echo "</div>"; echo "</div>"; // box notecontent echo "<div class='boxnoteright'><br>"; echo Html::submit(_x('button', 'Add'), array('name' => 'add')); echo "</div>"; Html::closeForm(); echo "</div>"; // boxnote } if (count($notes)) { foreach ($notes as $note) { $id = 'note' . $note['id'] . $rand; $classtoadd = ''; if ($canedit) { $classtoadd = " pointer"; } echo "<div class='boxnote' id='view{$id}'>"; echo "<div class='boxnoteleft'>"; echo "<img class='user_picture_verysmall' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($note['picture']) . "'>"; echo "</div>"; // boxnoteleft echo "<div class='boxnotecontent'>"; echo "<div class='boxnotefloatright'>"; $username = NOT_AVAILABLE; if ($note['users_id_lastupdater']) { $username = getUserName($note['users_id_lastupdater'], $showuserlink); } $update = sprintf(__('Last update by %1$s on %2$s'), $username, Html::convDateTime($note['date_mod'])); $username = NOT_AVAILABLE; if ($note['users_id']) { $username = getUserName($note['users_id'], $showuserlink); } $create = sprintf(__('Create by %1$s on %2$s'), $username, Html::convDateTime($note['date'])); printf(__('%1$s / %2$s'), $update, $create); echo "</div>"; // floatright echo "<div class='boxnotetext {$classtoadd}' "; if ($canedit) { echo "onclick=\"" . Html::jsHide("view{$id}") . " " . Html::jsShow("edit{$id}") . "\""; } echo ">"; $content = nl2br($note['content']); if (empty($content)) { $content = NOT_AVAILABLE; } echo $content . '</div>'; // boxnotetext echo "</div>"; // boxnotecontent echo "<div class='boxnoteright'>"; if ($canedit) { Html::showSimpleForm(Toolbox::getItemTypeFormURL('Notepad'), array('purge' => 'purge'), _x('button', 'Delete permanently'), array('id' => $note['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png", '', __('Confirm the final deletion?')); } echo "</div>"; // boxnoteright echo "</div>"; // boxnote if ($canedit) { echo "<div class='boxnote starthidden' id='edit{$id}'>"; echo "<form name='update_form{$id}{$rand}' id='update_form{$id}{$rand}' "; echo " method='post' action='" . Toolbox::getItemTypeFormURL('Notepad') . "'>"; echo "<div class='boxnoteleft'></div>"; echo "<div class='boxnotecontent'>"; echo Html::hidden('id', array('value' => $note['id'])); echo "<textarea name='content' rows=5 cols=100>" . $note['content'] . "</textarea>"; echo "</div>"; // boxnotecontent echo "<div class='boxnoteright'><br>"; echo Html::submit(_x('button', 'Update'), array('name' => 'update')); echo "</div>"; // boxnoteright Html::closeForm(); echo "</div>"; // boxnote } } } return true; }
/** * Print the reminder form * * @param $ID integer Id of the item to print * @param $options array of possible options: * - target filename : where to go when done. **/ function showForm($ID, $options = array()) { global $CFG_GLPI; $this->initForm($ID, $options); // Show Reminder or blank form $onfocus = ""; if (!$ID > 0) { // Create item : do getempty before check right to set default values $onfocus = "onfocus=\"if (this.value=='" . $this->fields['name'] . "') this.value='';\""; } $canedit = $this->can($ID, UPDATE); if ($canedit) { Html::initEditorSystem('text'); } $this->showFormHeader($options); echo "<tr class='tab_bg_2'><td>" . __('Title') . "</td>"; echo "<td>"; if ($canedit) { Html::autocompletionTextField($this, "name", array('size' => 80, 'entity' => -1, 'user' => $this->fields["users_id"], 'option' => $onfocus)); } else { echo $this->fields['name']; } echo "</td>\n"; echo "<td>" . __('By') . "</td>"; echo "<td>"; echo getUserName($this->fields["users_id"]); if (!$ID) { echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>\n"; } echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Visibility') . "</td>"; echo "<td>"; echo '<table><tr><td>'; echo __('Begin') . '</td><td>'; Html::showDateTimeField("begin_view_date", array('value' => $this->fields["begin_view_date"], 'timestep' => 1, 'maybeempty' => true, 'canedit' => $canedit)); echo '</td><td>' . __('End') . '</td><td>'; Html::showDateTimeField("end_view_date", array('value' => $this->fields["end_view_date"], 'timestep' => 1, 'maybeempty' => true, 'canedit' => $canedit)); echo '</td></tr></table>'; echo "</td>"; echo "<td>" . __('Status') . "</td>"; echo "<td>"; if ($canedit) { Planning::dropdownState("state", $this->fields["state"]); } else { echo Planning::getState($this->fields["state"]); } echo "</td>\n"; echo "</tr>\n"; echo "<tr class='tab_bg_2'><td >" . __('Calendar') . "</td>"; echo "<td class='center'>"; if ($canedit) { echo "<script type='text/javascript' >\n"; echo "function showPlan() {\n"; echo Html::jsHide('plan'); $params = array('form' => 'remind', 'users_id' => $this->fields["users_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID()); if ($ID && $this->fields["is_planned"]) { $params['begin'] = $this->fields["begin"]; $params['end'] = $this->fields["end"]; } Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params); echo "}"; echo "</script>\n"; } if (!$ID || !$this->fields["is_planned"]) { if (Session::haveRightsOr("planning", array(Planning::READMY, Planning::READGROUP, Planning::READALL))) { echo "<div id='plan' onClick='showPlan()'>\n"; echo "<a href='#' class='vsubmit'>" . __('Add to schedule') . "</a>"; } } else { if ($canedit) { echo "<div id='plan' onClick='showPlan()'>\n"; echo "<span class='showplan'>"; } //TRANS: %1$s is the begin date, %2$s is the end date printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"])); if ($canedit) { echo "</span>"; } } if ($canedit) { echo "</div>\n"; echo "<div id='viewplan'>\n</div>\n"; } echo "</td>"; if ($ID && $this->fields["is_planned"] && PlanningRecall::isAvailable()) { echo "<td>" . _x('Planning', 'Reminder') . "</td>"; echo "<td>"; if ($canedit) { PlanningRecall::dropdown(array('itemtype' => 'Reminder', 'items_id' => $ID)); } else { // No edit right : use specific Planning Recall Form PlanningRecall::specificForm(array('itemtype' => 'Reminder', 'items_id' => $ID)); } echo "</td>"; } else { echo "<td colspan='2'></td>"; } echo "</tr>\n"; echo "<tr class='tab_bg_2'><td>" . __('Description') . "</td>" . "<td colspan='3'>"; if ($canedit) { echo "<textarea cols='115' rows='15' name='text'>" . $this->fields["text"] . "</textarea>"; } else { echo "<div id='kbanswer'>"; echo Toolbox::unclean_html_cross_side_scripting_deep($this->fields["text"]); echo "</div>"; } echo "</td></tr>\n"; $this->showFormButtons($options); return true; }
/** form for Task * * @param $ID Integer : Id of the task * @param $options array * - parent Object : the object **/ function showForm($ID, $options = array()) { global $DB, $CFG_GLPI; if (isset($options['parent']) && !empty($options['parent'])) { $item = $options['parent']; } $fkfield = $item->getForeignKeyField(); if ($ID > 0) { $this->check($ID, READ); } else { // Create item $options[$fkfield] = $item->getField('id'); $this->check(-1, CREATE, $options); } $rand = mt_rand(); $this->showFormHeader($options); $canplan = !$item->isStatusExists(CommonITILObject::PLANNED) || $item->isAllowedStatus($item->fields['status'], CommonITILObject::PLANNED); $rowspan = 3; if ($this->maybePrivate()) { $rowspan++; } if (isset($this->fields["state"])) { $rowspan++; } echo "<tr class='tab_bg_1'>"; echo "<td rowspan='{$rowspan}' class='middle'>" . __('Description') . "</td>"; echo "<td class='center middle' rowspan='{$rowspan}'>" . "<textarea name='content' cols='50' rows='{$rowspan}' class='form-control'>" . $this->fields["content"] . "</textarea></td>"; if ($ID > 0) { echo "<td>" . __('Date') . "</td>"; echo "<td>"; Html::showDateTimeField("date", array('value' => $this->fields["date"], 'timestep' => 1, 'maybeempty' => false)); } else { echo "<td colspan='2'> "; } echo "<input type='hidden' name='{$fkfield}' value='" . $this->fields[$fkfield] . "'>"; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Category') . "</td><td>"; TaskCategory::dropdown(array('value' => $this->fields["taskcategories_id"], 'entity' => $item->fields["entities_id"])); echo "</td></tr>\n"; if (isset($this->fields["state"])) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Status') . "</td><td>"; Planning::dropdownState("state", $this->fields["state"]); echo "</td></tr>\n"; } if ($this->maybePrivate()) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Private') . "</td>"; echo "<td>"; Dropdown::showYesNo('is_private', $this->fields["is_private"]); echo "</td>"; echo "</tr>"; } echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Duration') . "</td><td>"; $toadd = array(); for ($i = 9; $i <= 100; $i++) { $toadd[] = $i * HOUR_TIMESTAMP; } Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd)); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('By'); echo " <a href='#' onClick=\"" . Html::jsGetElementbyID('planningcheck' . $rand) . ".dialog('open');\">"; echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/reservation-3.png'\n title=\"" . __s('Availability') . "\" alt=\"" . __s('Availability') . "\"\n class='calendrier'>"; echo "</a>"; Ajax::createIframeModalWindow('planningcheck' . $rand, $CFG_GLPI["root_doc"] . "/front/planning.php?checkavailability=checkavailability" . "&itemtype=" . $item->getType() . "&{$fkfield}=" . $item->getID(), array('title' => __('Availability'))); echo "</td>"; echo "<td class='center'>"; $rand_user = mt_rand(); $params = array('name' => "users_id_tech", 'value' => $this->fields["users_id_tech"], 'right' => "own_ticket", 'rand' => $rand_user, 'entity' => $item->fields["entities_id"]); $params['toupdate'] = array('value_fieldname' => 'users_id', 'to_update' => "user_available{$rand_user}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/planningcheck.php"); User::dropdown($params); echo "</td>\n"; if ($canplan) { echo "<td>" . __('Planning') . "</td>"; } echo "<td>"; if (!empty($this->fields["begin"])) { if (Session::haveRight('planning', Planning::READMY)) { echo "<script type='text/javascript' >\n"; echo "function showPlan" . $ID . "() {\n"; echo Html::jsHide('plan'); $params = array('form' => 'followups', 'users_id' => $this->fields["users_id_tech"], 'id' => $this->fields["id"], 'begin' => $this->fields["begin"], 'end' => $this->fields["end"], 'rand_user' => $rand_user, 'entity' => $item->fields["entities_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID()); Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params); echo "}"; echo "</script>\n"; echo "<div id='plan' onClick='showPlan" . $ID . "()'>\n"; echo "<span class='showplan'>"; } if (isset($this->fields["state"])) { echo Planning::getState($this->fields["state"]) . "<br>"; } printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"])); echo "<br>" . getUserName($this->fields["users_id_tech"]); if (Session::haveRight('planning', Planning::READMY)) { echo "</span>"; echo "</div>\n"; echo "<div id='viewplan'></div>\n"; } } else { if ($canplan) { echo "<script type='text/javascript' >\n"; echo "function showPlanUpdate() {\n"; echo Html::jsHide('plan'); $params = array('form' => 'followups', 'entity' => $_SESSION["glpiactive_entity"], 'rand_user' => $rand_user, 'itemtype' => $this->getType(), 'items_id' => $this->getID()); Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params); echo "};"; echo "</script>"; if ($canplan) { echo "<div id='plan' onClick='showPlanUpdate()'>\n"; echo "<span class='vsubmit'>" . __('Plan this task') . "</span>"; echo "</div>\n"; echo "<div id='viewplan'></div>\n"; } } else { _e('None'); } } echo "</td></tr>"; if (!empty($this->fields["begin"]) && PlanningRecall::isAvailable()) { echo "<tr class='tab_bg_1'><td>" . _x('Planning', 'Reminder') . "</td><td class='center'>"; PlanningRecall::dropdown(array('itemtype' => $this->getType(), 'items_id' => $this->getID())); echo "</td></tr>"; } $this->showFormButtons($options); return true; }