Ejemplo n.º 1
0
function plugin_init_escalation()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['change_profile']['escalation'] = array('PluginEscalationProfile', 'changeprofile');
    $PLUGIN_HOOKS['csrf_compliant']['escalation'] = true;
    // After escalation, if user can't see the ticket (dan't see all ticket right), it redirect to ticket list
    if (isset($_SERVER['HTTP_REFERER']) and strstr($_SERVER['HTTP_REFERER'], "escalation/front/group_group.form.php")) {
        if (isset($_GET['id'])) {
            $ticket = new Ticket();
            $ticket->getFromDB($_GET['id']);
            if (!$ticket->canViewItem()) {
                // Can't see ticket, go in ticket list
                $ticket->redirectToList();
            }
        }
    }
    if (isset($_SESSION["glpiID"])) {
        $plugin = new Plugin();
        if ($plugin->isActivated('escalation')) {
            Plugin::registerClass('PluginEscalationProfile', array('addtabon' => array('Profile')));
            Plugin::registerClass('PluginEscalationTicketCopy', array('addtabon' => array('Ticket')));
            Plugin::registerClass('PluginEscalationConfig', array('addtabon' => array('Entity')));
            Plugin::registerClass('PluginEscalationGroup_Group', array('addtabon' => array('Ticket', 'Group')));
            $PLUGIN_HOOKS['menu_entry']['escalation'] = false;
            PluginEscalationGroup_Group::convertNewTicket();
            // limit group
            $peConfig = new PluginEscalationConfig();
            if ($peConfig->getValue('limitgroup', $_SESSION['glpidefault_entity']) == '1') {
                if (strpos($_SERVER['PHP_SELF'], "ticket.form.php") && !isset($_GET['id'])) {
                    $group = new Group();
                    $a_groups = array();
                    $a_groups[0] = Dropdown::EMPTY_VALUE;
                    foreach ($_SESSION['glpigroups'] as $groups_id) {
                        $group->getFromDB($groups_id);
                        $a_groups[$groups_id] = $group->getName();
                    }
                    $_SESSION['plugin_escalation_requestergroups'] = $a_groups;
                    register_shutdown_function('plugin_escalation_on_exit');
                    ob_start();
                }
            }
            // end limit group
        }
        $PLUGIN_HOOKS['pre_item_add']['escalation'] = array('Ticket' => array('PluginEscalationGroup_Group', 'selectGroupOnAdd'));
        $PLUGIN_HOOKS['item_add']['escalation'] = array('Ticket' => array('PluginEscalationTicketCopy', 'finishAdd'));
        //         $PLUGIN_HOOKS['pre_item_update']['escalation'] = array('Ticket' => array('PluginEscalationGroup_Group', 'notMultiple'));
    }
}
Ejemplo n.º 2
0
        $input['id'] = $_POST['tickets_id'];
        $input['_itil_assign'] = array('_type' => 'user', 'users_id' => $_POST['_users_id_assign']);
        $ticket->update($input);
        $ticket_user = new Ticket_User();
        $a_users = $ticket_user->find("`tickets_id`='" . $_POST['tickets_id'] . "'\n         AND `type`='2'");
        foreach ($a_users as $data) {
            if ($data['users_id'] != $_POST['_users_id_assign']) {
                $ticket_user->delete($data);
                Event::log($_POST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . __('Deletion of an actor to the ticket'));
            }
        }
        $_SESSION['glpiactiveprofile']['assign_ticket'] = $assign_ticket_right;
        Html::back();
    } else {
        if (isset($_POST['addgroup'])) {
            $peGroup_Group = new PluginEscalationGroup_Group();
            $peGroup_Group->add($_POST);
            Html::back();
        } else {
            if (isset($_POST['deleteitem'])) {
                $peGroup_Group = new PluginEscalationGroup_Group();
                foreach ($_POST['delgroup'] as $id) {
                    $peGroup_Group->delete(array('id' => $id));
                }
                Html::back();
            }
        }
    }
}
Html::back();
Html::footer();
Ejemplo n.º 3
0
 /**
  * Display content of tab
  *
  * @param CommonGLPI $item
  * @param integer $tabnum
  * @param interger $withtemplate
  *
  * @return boolean TRUE
  */
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'Ticket') {
         $peGroup_Group = new PluginEscalationGroup_Group();
         $peGroup_Group->showGroups($item->getID());
     } else {
         if ($item->getType() == 'Group') {
             $peGroup_Group = new PluginEscalationGroup_Group();
             $peGroup_Group->manageGroup($item->getID());
         }
     }
     return TRUE;
 }