Computer_Item::getTabNameForItem PHP Method

getTabNameForItem() public method

See also: CommonGLPI::getTabNameForItem()
public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI
    function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
    {
        // can exists for Template
        if ($item->can($item->getField('id'), READ)) {
            $nb = 0;
            switch ($item->getType()) {
                case 'Phone':
                case 'Printer':
                case 'Peripheral':
                case 'Monitor':
                    if (Computer::canView()) {
                        if ($_SESSION['glpishow_count_on_tabs']) {
                            $nb = self::countForItem($item);
                        }
                        return self::createTabEntry(_n('Connection', 'Connections', Session::getPluralNumber()), $nb);
                    }
                    break;
                case 'Computer':
                    if (Phone::canView() || Printer::canView() || Peripheral::canView() || Monitor::canView()) {
                        if ($_SESSION['glpishow_count_on_tabs']) {
                            $nb = self::countForComputer($item);
                        }
                        return self::createTabEntry(_n('Connection', 'Connections', Session::getPluralNumber()), $nb);
                    }
                    break;
            }
        }
        return '';
    }