static function showVeryShort($ID) { global $CFG_GLPI, $LANG; // Prints a job in short form // Should be called in a <table>-segment // Print links or not in case of user view // Make new job object and fill it from database, if success, print it $viewusers = haveRight("user", "r"); $showprivate = haveRight("show_full_ticket", 1); $job = new self(); $rand = mt_rand(); if ($job->getFromDBwithData($ID, 0)) { $bgcolor = $_SESSION["glpipriority_" . $job->fields["priority"]]; // $rand = mt_rand(); echo "<tr class='tab_bg_2'>"; echo "<td class='center' bgcolor='{$bgcolor}' >ID : " . $job->fields["id"] . "</td>"; echo "<td class='center'>"; if (isset($job->users[self::REQUESTER]) && count($job->users[self::REQUESTER])) { foreach ($job->users[self::REQUESTER] as $d) { if ($d["users_id"] > 0) { $userdata = getUserName($d["users_id"], 2); echo "<strong>" . $userdata['name'] . "</strong> "; if ($viewusers) { showToolTip($userdata["comment"], array('link' => $userdata["link"])); } } else { echo $d['alternative_email'] . " "; } echo "<br>"; } } if (isset($job->groups[self::REQUESTER]) && count($job->groups[self::REQUESTER])) { foreach ($job->groups[self::REQUESTER] as $d) { echo Dropdown::getDropdownName("glpi_groups", $d["groups_id"]); echo "<br>"; } } echo "</td>"; if ($job->hardwaredatas && $job->hardwaredatas->canView()) { echo "<td class='center"; if ($job->hardwaredatas->isDeleted()) { echo " tab_bg_1_2"; } echo "'>"; echo $job->hardwaredatas->getTypeName() . "<br>"; echo "<strong>" . $job->hardwaredatas->getLink() . "</strong>"; echo "</td>"; } else { if ($job->hardwaredatas) { echo "<td class='center' >" . $job->hardwaredatas->getTypeName() . "<br><strong>" . $job->hardwaredatas->getNameID() . "</strong></td>"; } else { echo "<td class='center' >" . $LANG['help'][30] . "</td>"; } } echo "<td>"; echo "<a id='ticket" . $job->fields["id"] . $rand . "' href='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $job->fields["id"] . "'>"; echo "<strong>" . $job->fields["name"] . "</strong></a> "; echo "(" . $job->numberOfFollowups($showprivate) . "-" . $job->numberOfTasks($showprivate) . ") "; showToolTip($job->fields['content'], array('applyto' => 'ticket' . $job->fields["id"] . $rand)); echo "</td>"; // Finish Line echo "</tr>"; } else { echo "<tr class='tab_bg_2'><td colspan='6' ><i>" . $LANG['joblist'][16] . "</i></td></tr>"; } }
/** * @param $ID * @param $forcetab string name of the tab to force at the display (default '') **/ static function showVeryShort($ID, $forcetab = '') { global $CFG_GLPI; // Prints a job in short form // Should be called in a <table>-segment // Print links or not in case of user view // Make new job object and fill it from database, if success, print it $showprivate = false; if (Session::haveRight('followup', TicketFollowup::SEEPRIVATE)) { $showprivate = true; } $job = new self(); $rand = mt_rand(); if ($job->getFromDBwithData($ID, 0)) { $bgcolor = $_SESSION["glpipriority_" . $job->fields["priority"]]; // $rand = mt_rand(); echo "<tr class='tab_bg_2'>"; echo "<td class='center' bgcolor='{$bgcolor}'>" . sprintf(__('%1$s: %2$s'), __('ID'), $job->fields["id"]) . "</td>"; echo "<td class='center'>"; if (isset($job->users[CommonITILActor::REQUESTER]) && count($job->users[CommonITILActor::REQUESTER])) { foreach ($job->users[CommonITILActor::REQUESTER] as $d) { if ($d["users_id"] > 0) { $userdata = getUserName($d["users_id"], 2); $name = "<span class='b'>" . $userdata['name'] . "</span>"; $name = sprintf(__('%1$s %2$s'), $name, Html::showToolTip($userdata["comment"], array('link' => $userdata["link"], 'display' => false))); echo $name; } else { echo $d['alternative_email'] . " "; } echo "<br>"; } } if (isset($job->groups[CommonITILActor::REQUESTER]) && count($job->groups[CommonITILActor::REQUESTER])) { foreach ($job->groups[CommonITILActor::REQUESTER] as $d) { echo Dropdown::getDropdownName("glpi_groups", $d["groups_id"]); echo "<br>"; } } echo "</td>"; echo "<td class='center'>"; if (!empty($job->hardwaredatas)) { foreach ($job->hardwaredatas as $hardwaredatas) { if ($hardwaredatas->canView()) { echo $hardwaredatas->getTypeName() . " - "; echo "<span class='b'>" . $hardwaredatas->getLink() . "</span><br/>"; } else { if ($hardwaredatas) { echo $hardwaredatas->getTypeName() . " - "; echo "<span class='b'>" . $hardwaredatas->getNameID() . "</span><br/>"; } } } } else { echo __('General'); } echo "<td>"; $link = "<a id='ticket" . $job->fields["id"] . $rand . "' href='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $job->fields["id"]; if ($forcetab != '') { $link .= "&forcetab=" . $forcetab; } $link .= "'>"; $link .= "<span class='b'>" . $job->getNameID() . "</span></a>"; $link = sprintf(__('%1$s (%2$s)'), $link, sprintf(__('%1$s - %2$s'), $job->numberOfFollowups($showprivate), $job->numberOfTasks($showprivate))); $content = Toolbox::unclean_cross_side_scripting_deep(html_entity_decode($job->fields['content'], ENT_QUOTES, "UTF-8")); $link = printf(__('%1$s %2$s'), $link, Html::showToolTip(nl2br(Html::Clean($content)), array('applyto' => 'ticket' . $job->fields["id"] . $rand, 'display' => false))); echo "</td>"; // Finish Line echo "</tr>"; } else { echo "<tr class='tab_bg_2'>"; echo "<td colspan='6' ><i>" . __('No ticket in progress.') . "</i></td></tr>"; } }
/** * @since version 0.84 * * @param $ID * @param $forcetab string name of the tab to force at the display (default '') **/ static function showVeryShort($ID, $forcetab = '') { global $CFG_GLPI; // Prints a job in short form // Should be called in a <table>-segment // Print links or not in case of user view // Make new job object and fill it from database, if success, print it $viewusers = Session::haveRight("user", "r"); $problem = new self(); $rand = mt_rand(); if ($problem->getFromDBwithData($ID, 0)) { $bgcolor = $_SESSION["glpipriority_" . $problem->fields["priority"]]; // $rand = mt_rand(); echo "<tr class='tab_bg_2'>"; echo "<td class='center' bgcolor='{$bgcolor}'>" . sprintf(__('%1$s: %2$s'), __('ID'), $problem->fields["id"]) . "</td>"; echo "<td class='center'>"; if (isset($problem->users[CommonITILActor::REQUESTER]) && count($problem->users[CommonITILActor::REQUESTER])) { foreach ($problem->users[CommonITILActor::REQUESTER] as $d) { if ($d["users_id"] > 0) { $userdata = getUserName($d["users_id"], 2); $name = "<span class='b'>" . $userdata['name'] . "</span>"; if ($viewusers) { $name = sprintf(__('%1$s %2$s'), $name, Html::showToolTip($userdata["comment"], array('link' => $userdata["link"], 'display' => false))); } echo $name; } else { echo $d['alternative_email'] . " "; } echo "<br>"; } } if (isset($problem->groups[CommonITILActor::REQUESTER]) && count($problem->groups[CommonITILActor::REQUESTER])) { foreach ($problem->groups[CommonITILActor::REQUESTER] as $d) { echo Dropdown::getDropdownName("glpi_groups", $d["groups_id"]); echo "<br>"; } } echo "</td>"; echo "<td>"; $link = "<a id='problem" . $problem->fields["id"] . $rand . "' href='" . $CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $problem->fields["id"]; if ($forcetab != '') { $link .= "&forcetab=" . $forcetab; } $link .= "'>"; $link .= "<span class='b'>" . $problem->fields["name"] . "</span></a>"; $link = printf(__('%1$s %2$s'), $link, Html::showToolTip($problem->fields['content'], array('applyto' => 'problem' . $problem->fields["id"] . $rand, 'display' => false))); echo "</td>"; // Finish Line echo "</tr>"; } else { echo "<tr class='tab_bg_2'>"; echo "<td colspan='6' ><i>" . __('No problem in progress.') . "</i></td></tr>"; } }