Example #1
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (static::canView()) {
         switch ($item->getType()) {
             case __CLASS__:
                 $ong = array(1 => __('Analysis'), 3 => __('Plans'), 2 => __('Solution'));
                 if ($item->canUpdate()) {
                     $ong[4] = __('Statistics');
                 }
                 return $ong;
         }
     }
     return '';
 }
Example #2
0
 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (Session::haveRight("reminder_public", "r")) {
         switch ($item->getType()) {
             case 'Reminder':
                 if ($item->canUpdate()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         return array(1 => self::createTabEntry(__('Targets'), $item->countVisibilities()));
                     }
                     return array(1 => __('Targets'));
                 }
         }
     }
     return '';
 }
Example #3
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->isNewItem()) {
         return;
     }
     if (static::canView()) {
         $nb = 0;
         $title = self::getTypeName(Session::getPluralNumber());
         if ($_SESSION['glpishow_count_on_tabs']) {
             switch ($item->getType()) {
                 case 'User':
                     $nb = countElementsInTable(array('glpi_tickets', 'glpi_tickets_users'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_tickets_users`.`tickets_id` = `glpi_tickets`.`id`\n                                                AND `glpi_tickets_users`.`users_id` = '" . $item->getID() . "'\n                                                AND `glpi_tickets_users`.`type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 case 'Supplier':
                     $nb = countElementsInTable(array('glpi_tickets', 'glpi_suppliers_tickets'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_suppliers_tickets`.`tickets_id` = `glpi_tickets`.`id`\n                                                AND `glpi_suppliers_tickets`.`suppliers_id` = '" . $item->getID() . "'");
                     break;
                 case 'SLT':
                     $nb = countElementsInTable('glpi_tickets', ['slts_tto_id' => $item->getID(), 'slts_ttr_id' => $item->getID()]);
                     break;
                 case 'Group':
                     $nb = countElementsInTable(array('glpi_tickets', 'glpi_groups_tickets'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_groups_tickets`.`tickets_id` = `glpi_tickets`.`id`\n                                                AND `glpi_groups_tickets`.`groups_id` = '" . $item->getID() . "'\n                                                AND `glpi_groups_tickets`.`type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 default:
                     // Direct one
                     $nb = countElementsInTable('glpi_items_tickets', ['itemtype' => $item->getType(), 'items_id' => $item->getID()]);
                     // Linked items
                     $linkeditems = $item->getLinkedItems();
                     if (count($linkeditems)) {
                         foreach ($linkeditems as $type => $tab) {
                             foreach ($tab as $ID) {
                                 $nb += countElementsInTable('glpi_items_tickets', ['itemtype' => $type, 'items_id' => $ID]);
                             }
                         }
                     }
                     break;
             }
         }
         // glpishow_count_on_tabs
         // Not for Ticket class
         if ($item->getType() != __CLASS__) {
             return self::createTabEntry($title, $nb);
         }
     }
     // self::READALL right check
     // Not check self::READALL for Ticket itself
     switch ($item->getType()) {
         case __CLASS__:
             $ong = array();
             if ($_SESSION['glpiticket_timeline']) {
                 $timeline = $item->getTimelineItems();
                 $nb_elements = count($timeline);
                 $ong[1] = __("Processing ticket") . " <sup class='tab_nb'>{$nb_elements}</sup>";
             }
             if (!$_SESSION['glpiticket_timeline'] || $_SESSION['glpiticket_timeline_keep_replaced_tabs']) {
                 $ong[2] = _n('Solution', 'Solutions', 1);
             }
             // enquete si statut clos
             if ($item->fields['status'] == self::CLOSED && Session::haveRight('ticket', Ticket::SURVEY)) {
                 $satisfaction = new TicketSatisfaction();
                 if ($satisfaction->getFromDB($item->getID())) {
                     $ong[3] = __('Satisfaction');
                 }
             }
             if ($item->canUpdate()) {
                 $ong[4] = __('Statistics');
             }
             return $ong;
             //   default :
             //      return _n('Ticket','Tickets', Session::getPluralNumber());
     }
     return '';
 }
Example #4
0
   /**
    * Display tab
    *
    * @param CommonGLPI $item
    * @param integer $withtemplate
    *
    * @return varchar name of the tab(s) to display
    */
   function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {

      $ong = array();

      if ($item->getType() == 'PluginMonitoringSlider') {
         if ($item->getID() > 0) {
            $ong[1] = 'items';

            if ($item->canUpdate()) {
               $ong[2] = __('Targets');
            }
         }
      } else if ($item->getType() == 'Central') {
         $a_sliders = $this->getSliders(1);
         foreach ($a_sliders as $sliders_id=>$name) {
            $this->getFromDB($sliders_id);
            if (Session::haveRight("plugin_monitoring_slider", PluginMonitoringSlider::HOMEPAGE)
                    && $this->haveVisibilityAccess()) {
               $ong[] = "[".__('Carrousel / slider', 'monitoring')."] ".$this->fields['name'];
            }
         }
      }
      return $ong;
   }
Example #5
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         switch ($item->getType()) {
             case __CLASS__:
                 $ong[1] = $this->getTypeName(1);
                 if ($item->canUpdate()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         $ong[2] = self::createTabEntry(__('Targets'), $item->countVisibilities());
                     } else {
                         $ong[2] = __('Targets');
                     }
                 }
                 return $ong;
         }
     }
     return '';
 }
Example #6
0
 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (self::canView()) {
         switch ($item->getType()) {
             case 'Reminder':
                 if ($item->canUpdate()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         $nb = $item->countVisibilities();
                         return array(1 => self::createTabEntry(_n('Target', 'Targets', $nb), $nb));
                     }
                     return array(1 => _n('Target', 'Targets', Session::getPluralNumber()));
                 }
         }
     }
     return '';
 }
Example #7
0
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if (array_key_exists($item->getType(), self::$clone_types) && $item->canUpdate()) {
         self::showCloneForm($item);
     }
     return true;
 }
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (static::canView()) {
         $nb = 0;
         $title = self::getTypeName(Session::getPluralNumber());
         if ($_SESSION['glpishow_count_on_tabs']) {
             switch ($item->getType()) {
                 case 'User':
                     $nb = countElementsInTable('glpi_tickets_users', "`users_id` = '" . $item->getID() . "'\n                                                AND `type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 case 'Supplier':
                     $nb = countElementsInTable('glpi_suppliers_tickets', "`suppliers_id` = '" . $item->getID() . "'");
                     break;
                 case 'SLA':
                     $nb = countElementsInTable('glpi_tickets', "`slas_id` = '" . $item->getID() . "'");
                     break;
                 case 'Group':
                     $nb = countElementsInTable('glpi_groups_tickets', "`groups_id` = '" . $item->getID() . "'\n                                               AND `type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 default:
                     // Direct one
                     $nb = countElementsInTable('glpi_items_tickets', " `itemtype` = '" . $item->getType() . "'\n                                                AND `items_id` = '" . $item->getID() . "'");
                     // Linked items
                     $linkeditems = $item->getLinkedItems();
                     if (count($linkeditems)) {
                         foreach ($linkeditems as $type => $tab) {
                             foreach ($tab as $ID) {
                                 $nb += countElementsInTable('glpi_items_tickets', " `itemtype` = '{$type}'\n                                                         AND `items_id` = '{$ID}'");
                             }
                         }
                     }
                     break;
             }
         }
         // glpishow_count_on_tabs
         // Not for Ticket class
         if ($item->getType() != __CLASS__) {
             return self::createTabEntry($title, $nb);
         }
     }
     // self::READALL right check
     // Not check self::READALL for Ticket itself
     switch ($item->getType()) {
         case __CLASS__:
             $ong = array();
             $ong[2] = _n('Solution', 'Solutions', 1);
             // enquete si statut clos
             if ($item->fields['status'] == self::CLOSED) {
                 $satisfaction = new TicketSatisfaction();
                 if ($satisfaction->getFromDB($item->getID())) {
                     $ong[3] = __('Satisfaction');
                 }
             }
             if ($item->canUpdate()) {
                 $ong[4] = __('Statistics');
             }
             return $ong;
             //   default :
             //      return _n('Ticket','Tickets', Session::getPluralNumber());
     }
     return '';
 }
 /**
  * Display tab
  *
  * @param CommonGLPI $item
  * @param integer $withtemplate
  *
  * @return varchar name of the tab(s) to display
  */
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $ong = array();
     if ($item->getType() == 'PluginMonitoringDisplayview') {
         if ($item->getID() > 0) {
             $ong[1] = 'items';
             if ($item->canUpdate()) {
                 $ong[2] = __('Targets');
             }
             $pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
             $ong = $pmDisplayview_rule->addRulesTabs($item->getID(), $ong);
         }
     } else {
         if ($item->getType() == 'Central') {
             $a_views = $this->getViews(1);
             foreach ($a_views as $views_id => $name) {
                 $this->getFromDB($views_id);
                 if (Session::haveRight("plugin_monitoring_displayview", PluginMonitoringDisplayview::HOMEPAGE) && $this->haveVisibilityAccess()) {
                     $ong[] = "[" . _n('View', 'Views', 1, 'monitoring') . "] " . $this->fields['name'];
                 }
             }
         }
     }
     return $ong;
 }
Example #10
0
 /**
  * Display tab
  *
  * @param CommonGLPI $item
  * @param integer $withtemplate
  *
  * @return varchar name of the tab(s) to display
  */
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $ong = array();
     if ($item->getType() == 'PluginMonitoringDisplayview') {
         if ($item->getID() > 0) {
             $ong[1] = 'items';
             if ($item->canUpdate() && isset($item->fields['is_frontview']) && $item->fields['is_frontview'] == 1) {
                 $ong[2] = __('Targets');
             }
             $pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
             $ong = $pmDisplayview_rule->addRulesTabs($item->getID(), $ong);
         }
     }
     return $ong;
 }