本文整理汇总了PHP中CommonGLPI::canView方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonGLPI::canView方法的具体用法?PHP CommonGLPI::canView怎么用?PHP CommonGLPI::canView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonGLPI
的用法示例。
在下文中一共展示了CommonGLPI::canView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
return;
if ($item->getType() == 'PluginCustomTab' && $item->canView()) {
return Toolbox::ucfirst(_n("Profile", "Profiles", 1));
}
return '';
}
示例2: getTabNameForItem
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: getTabNameForItem
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: displayTabContentForItem
/**
* 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;
}