Пример #1
0
 /**
  * Display tab
  *
  * @param CommonGLPI $item
  * @param integer $withtemplate
  *
  * @return varchar name of the tab(s) to display
  */
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Ticket' && $item->getID() > 0 && PluginEscalationProfile::haveRight("copyticket", 1)) {
         return "Copie de ticket";
     }
     return '';
 }
Пример #2
0
 static function checkRight($module, $right)
 {
     global $CFG_GLPI;
     if (!PluginEscalationProfile::haveRight($module, $right)) {
         // Gestion timeout session
         if (!Session::getLoginUserID()) {
             Html::redirect($CFG_GLPI["root_doc"] . "/index.php");
             exit;
         }
         Html::displayRightError();
     }
 }
Пример #3
0
 function showGroups($tickets_id)
 {
     global $DB, $CFG_GLPI;
     $group_Ticket = new Group_Ticket();
     $group = new Group();
     $ticket = new Ticket();
     $ticket->getFromDB($tickets_id);
     $createticketRight = 0;
     if (PluginEscalationProfile::haveRight("copyticketonworkflow", 1)) {
         $createticketRight = 1;
     }
     $groups_id = 0;
     $query = "SELECT * FROM `" . $group_Ticket->getTable() . "`\n              WHERE `tickets_id`='" . $tickets_id . "'\n               AND `type`='2'";
     $result = $DB->query($query);
     while ($data = $DB->fetch_array($result)) {
         $groups_id = $data['groups_id'];
     }
     echo "<form method='post' name='' id=''  action=\"" . $CFG_GLPI['root_doc'] . "/plugins/escalation/front/group_group.form.php\">";
     echo "<table width='950' class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th colspan='4'>";
     echo "Escalade";
     echo "</th>";
     echo "</tr>";
     $a_groups = array();
     $a_groups['0'] = Dropdown::EMPTY_VALUE;
     if ($groups_id != '0' or PluginEscalationProfile::haveRight("bypassworkflow", 1)) {
         $query = "SELECT * FROM `" . $this->getTable() . "`\n            WHERE `groups_id_source` = '" . $groups_id . "' ";
         $result = $DB->query($query);
         while ($data = $DB->fetch_array($result)) {
             $group->getFromDB($data['groups_id_destination']);
             $a_groups[$data['groups_id_destination']] = $group->getName();
         }
         echo "<tr class='tab_bg_1' id='groupadd'>";
         echo "<td width='200'>";
         echo "Escalade vers le groupe ";
         echo "</td>";
         echo "<td>";
         if (PluginEscalationProfile::haveRight("bypassworkflow", 1)) {
             Dropdown::show('Group', array('name' => 'group_assign', 'entity' => $ticket->fields['entities_id']));
             while ($data = $DB->fetch_array($result)) {
                 $group->getFromDB($data['groups_id_destination']);
                 $a_groups[$data['groups_id_destination']] = $group->getName();
             }
         } else {
             $rand = Dropdown::showFromArray('group_assign', $a_groups, array('on_change' => 'Ext.get("useradd").hide();Ext.get("or").hide();'));
         }
         echo "</td>";
         if ($createticketRight) {
             echo "<th colspan='2'>";
             echo "Créer sous-ticket";
             echo "</th>";
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1' id='or'>";
         echo "<td>";
         echo "</td>";
         echo "<td>";
         echo "ou";
         echo "</td>";
         if ($createticketRight) {
             echo "<td>";
             echo "Créer sous-ticket";
             echo "</td>";
             echo "<td>";
             Dropdown::showYesNo("createsubticket");
             echo "</td>";
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1' id='useradd'>";
         echo "<td>";
         echo "Escalade vers le technicien";
         echo "</td>";
         echo "<td>";
         $user = new User();
         $elements = array('0' => Dropdown::EMPTY_VALUE);
         $query = "SELECT * FROM `glpi_groups_users`\n            WHERE `groups_id`='" . $groups_id . "'";
         $result = $DB->query($query);
         while ($data = $DB->fetch_assoc($result)) {
             $user->getFromDB($data['users_id']);
             $elements[$data['users_id']] = $user->getName();
         }
         $rand = Dropdown::showFromArray("_users_id_assign", $elements, array('on_change' => 'Ext.get("groupadd").hide();Ext.get("or").hide();'));
         echo "</td>";
         if ($createticketRight) {
             echo "<td>";
             echo "SLA à appliquer";
             echo "</td>";
             echo "<td>";
             Dropdown::show('Sla', array('entity' => $ticket->fields["entities_id"]));
             echo "</td>";
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='2'>";
         echo "<span id='show_assignuser{$rand}'></span>";
         echo "</td>";
         if ($createticketRight) {
             echo "<td>";
             echo "Groupe de technicien assigné";
             echo "</td>";
             echo "<td>";
             if (PluginEscalationProfile::haveRight("bypassworkflow", 1)) {
                 Dropdown::show('Group', array('name' => 'groupsubticket', 'entity' => $ticket->fields['entities_id']));
             } else {
                 $rand = Dropdown::showFromArray('groupsubticket', $a_groups);
             }
             echo "</td>";
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='4' align='center'>";
         echo "<input type='hidden' name='tickets_id' value='" . $tickets_id . "'/>";
         echo "<input type='submit' class='submit' name='update' value='" . __('Update') . "'/>";
         echo "</td>";
         echo "</tr>";
     } else {
         echo "<tr class='tab_bg_1'>";
         echo "<td>";
         echo "Escalade vers le groupe ";
         echo "</td>";
         echo "<td>";
         $a_groups = array();
         foreach ($_SESSION['glpigroups'] as $groups_id) {
             $group->getFromDB($groups_id);
             $a_groups[$groups_id] = $group->getName();
         }
         $rand = Dropdown::showFromArray("group_assign", $a_groups);
         $params = array('groups_id' => '__VALUE__', 'entity' => $ticket->fields['entities_id'], 'rand' => $rand);
         Ajax::updateItemOnSelectEvent("dropdown_group_assign" . $rand, "show_assignuser{$rand}", $CFG_GLPI["root_doc"] . "/plugins/escalation/ajax/dropdownUserassign.php", $params);
         if ($createticketRight) {
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='2'>";
         echo "<span id='show_assignuser{$rand}'></span>";
         echo "</td>";
         if ($createticketRight) {
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='4' align='center'>";
         echo "<input type='hidden' name='tickets_id' value='" . $tickets_id . "'/>";
         echo "<input type='submit' class='submit' name='update' value='" . __('Update') . "'/>";
         echo "</td>";
         echo "</tr>";
     }
     echo "</table>";
     Html::closeForm();
 }
Пример #4
0
  ------------------------------------------------------------------------

  @package   Plugin Escalation for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2012 Plugin Escalation for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/escalation/
  @since     2012

  ------------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
    define('GLPI_ROOT', '../../..');
}
include_once GLPI_ROOT . "/inc/includes.php";
Session::checkRight("profile", "r");
$peProfile = new PluginEscalationProfile();
Session::checkRight("profile", "w");
if ($peProfile->getFromDB($_POST['profiles_id'])) {
    $peProfile->update($_POST);
    $peProfile->changeprofile();
    Html::back();
} else {
    $peProfile->add($_POST);
    $peProfile->changeprofile();
    Html::back();
}