本文整理匯總了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;
}