예제 #1
0
 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     // can exists for template
     if ($item->getType() == static::$itemtype && static::canView()) {
         if ($_SESSION['glpishow_count_on_tabs']) {
             return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), countElementsInTable($this->getTable(), "`" . $item->getForeignKeyField() . "`\n                                                                = '" . $item->getID() . "'"));
         }
         return self::getTypeName(Session::getPluralNumber());
     }
     return '';
 }
예제 #2
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == $this->getItilObjectItemType() && $this->canView()) {
         $nb = 0;
         if ($_SESSION['glpishow_count_on_tabs']) {
             $restrict = "`" . $item->getForeignKeyField() . "` = '" . $item->getID() . "'";
             if ($this->maybePrivate() && !$this->canViewPrivates()) {
                 $restrict .= " AND (`is_private` = '0'\n                                   OR `users_id` = '" . Session::getLoginUserID() . "') ";
             }
             $nb = countElementsInTable($this->getTable(), $restrict);
         }
         return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $nb);
     }
     return '';
 }