function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     return;
     if ($item->getType() == 'PluginCustomTab' && $item->canView()) {
         return Toolbox::ucfirst(_n("Profile", "Profiles", 1));
     }
     return '';
 }
예제 #2
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->canView()) {
         $nb = 0;
         if (in_array($item->getType(), self::getConcernedItems())) {
             if ($_SESSION['glpishow_count_on_tabs']) {
                 foreach (self::getItemAffinities($item->getType()) as $link_type) {
                     $nb += countElementsInTable($link_type::getTable(), "`items_id` = '" . $item->getID() . "'\n                                                   AND `itemtype` = '" . $item->getType() . "'\n                                                   AND `is_deleted` = '0'");
                 }
             }
             return self::createTabEntry(_n('Component', 'Components', Session::getPluralNumber()), $nb);
         }
         if ($item instanceof CommonDevice) {
             if ($_SESSION['glpishow_count_on_tabs']) {
                 $deviceClass = $item->getType();
                 $linkClass = $deviceClass::getItem_DeviceType();
                 $table = $linkClass::getTable();
                 $foreignkeyField = $deviceClass::getForeignKeyField();
                 $nb = countElementsInTable($table, "`{$foreignkeyField}` = '" . $item->getID() . "'\n                                            AND `is_deleted` = '0'");
             }
             return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb);
         }
     }
     return '';
 }
예제 #3
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->canView()) {
         switch ($item->getType()) {
             case 'Computer':
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = 0;
                     foreach (self::getDeviceTypes() as $link_type) {
                         $nb += countElementsInTable($link_type::getTable(), "`items_id` = '" . $item->getID() . "'\n                                                      AND `itemtype` = '" . $item->getType() . "'\n                                                      AND `is_deleted`='0'");
                     }
                 }
                 if (isset($nb)) {
                     return self::createTabEntry(_n('Component', 'Components', 2), $nb);
                 }
                 return _n('Component', 'Components', 2);
         }
     }
     return '';
 }
예제 #4
0
 /**
  * Display tab's content for each typology
  *
  * @static
  * @param CommonGLPI $item
  * @param int $tabnum
  * @param int $withtemplate
  * @return bool|true
  */
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'PluginTypologyTypology') {
         if ($item->canView()) {
             self::showForTypology($item);
         }
     }
     return true;
 }