static function getHistory($tickets_id, $full_history = false) { global $CFG_GLPI; $filter_groups_id = array(); if ($_SESSION['plugins']['escalade']['config']['use_filter_assign_group']) { $groups_groups = new PluginEscaladeGroup_Group(); $filter_groups_id = $groups_groups->getGroups($tickets_id); $use_filter_assign_group = true; } else { $use_filter_assign_group = false; } $plugin_dir = $full_history ? ".." : "../plugins/escalade"; //get all line for this ticket $group = new Group(); $history = new self(); $found = $history->find("tickets_id = {$tickets_id}", "date_mod DESC"); $nb_histories = count($found); //remove first line (current assign) $first_group = array_shift($found); if ($full_history) { //show 1st group echo "<div class='escalade_active'>"; echo " <img src='" . $CFG_GLPI['root_doc'] . "/pics/group.png' /> "; if ($group->getFromDB($first_group['groups_id'])) { echo $group->getLink(true); } echo "</div>"; } echo "<div class='escalade'>"; //parse all lines $i = 0; foreach ($found as $key => $hline) { echo "<div class='escalade_history'>"; if (!$use_filter_assign_group || isset($filter_groups_id[$hline['groups_id']])) { //up link and image echo "<a href='{$plugin_dir}/front/climb_group.php?tickets_id=" . $tickets_id . "&groups_id=" . $hline['groups_id']; if ($full_history) { echo "&full_history=true"; } echo "' title='" . __("Reassign the ticket to group", "escalade") . "' class='up_a'></a>"; } else { echo " "; } //group link echo " <img src='" . $CFG_GLPI['root_doc'] . "/pics/group.png' /> "; if ($group->getFromDB($hline['groups_id'])) { echo self::showGroupLink($group, $full_history); } echo "</div>"; $i++; if ($i == self::HISTORY_LIMIT && !$full_history) { break; } } //In case there are more than 10 group changes, a popup can display historical if ($nb_histories - 1 > self::HISTORY_LIMIT && !$full_history) { echo "<a href='#' onclick='var w=window.open(\"" . $plugin_dir . "/front/popup_histories.php?tickets_id=" . $tickets_id . "\" ,\"\", \"height=500, width=250, top=100, left=100, scrollbars=yes\" ); " . "w.focus();' title='" . __("View full history", "escalade") . "'>...</a>"; } echo "</div>"; }
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { if ($item->getType() == 'Group') { $PluginEscaladeGroup_Group = new PluginEscaladeGroup_Group(); $PluginEscaladeGroup_Group->manageGroup($item->getID()); } return true; }
<?php $AJAX_INCLUDE = 1; include "../../../inc/includes.php"; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); Session::checkLoginUser(); $ticket_id = isset($_REQUEST['ticket_id']) ? $_REQUEST['ticket_id'] : 0; $PluginEscaladeGroup_Group = new PluginEscaladeGroup_Group(); $groups_id_filtred = $PluginEscaladeGroup_Group->getGroups($ticket_id); if (count($groups_id_filtred) > 0) { $myarray = array(); foreach ($groups_id_filtred as $groups_id => $groups_name) { $myarray[] = $groups_id; } $newarray = implode(", ", $myarray); $condition = " id IN ({$newarray})"; } else { $condition = "1=0"; } $rand = mt_rand(); $_SESSION['glpicondition'][$rand] = $condition; $_GET["condition"] = $rand; if (!isset($_GET["entity_restrict"]) && $ticket_id) { $ticket = new Ticket(); $ticket->getFromDB($ticket_id); $_GET["entity_restrict"] = $ticket->fields['entities_id']; } require "../../../ajax/getDropdownValue.php";
<?php include "../../../inc/includes.php"; Html::header("escalade", $_SERVER["PHP_SELF"], "plugins", "escalade", "group_group"); if (Session::haveRight('group', 'w')) { if (isset($_POST['addgroup'])) { $PluginEscaladeGroup_Group = new PluginEscaladeGroup_Group(); $PluginEscaladeGroup_Group->add($_POST); } if (isset($_POST['deleteitem'])) { $PluginEscaladeGroup_Group = new PluginEscaladeGroup_Group(); foreach ($_POST['delgroup'] as $id) { $PluginEscaladeGroup_Group->delete(array('id' => $id)); } } } Html::back(); Html::footer();
<?php $AJAX_INCLUDE = 1; include "../../../inc/includes.php"; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); Session::checkLoginUser(); $ticket_id = isset($_REQUEST['ticket_id']) ? $_REQUEST['ticket_id'] : 0; echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>"; $PluginEscaladeGroup_Group = new PluginEscaladeGroup_Group(); foreach ($PluginEscaladeGroup_Group->getGroups($ticket_id) as $groups_id => $groups_name) { echo "<option value='{$groups_id}'>{$groups_name}</option>"; }