本文整理汇总了PHP中Printer::canView方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::canView方法的具体用法?PHP Printer::canView怎么用?PHP Printer::canView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::canView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate && Printer::canView()) {
switch ($item->getType()) {
case 'CartridgeItem':
if ($_SESSION['glpishow_count_on_tabs']) {
return self::createTabEntry(PrinterModel::getTypeName(Session::getPluralNumber()), self::countForCartridgeItem($item));
}
return PrinterModel::getTypeName(Session::getPluralNumber());
break;
}
}
return '';
}
示例2: title
/**
* Show report title
**/
static function title()
{
global $PLUGIN_HOOKS, $CFG_GLPI;
// Report generation
// Default Report included
$report_list["default"]["name"] = __('Default report');
$report_list["default"]["file"] = "report.default.php";
if (Contract::canView()) {
// Rapport ajoute par GLPI V0.2
$report_list["Contrats"]["name"] = __('By contract');
$report_list["Contrats"]["file"] = "report.contract.php";
}
if (Infocom::canView()) {
$report_list["Par_annee"]["name"] = __('By year');
$report_list["Par_annee"]["file"] = "report.year.php";
$report_list["Infocoms"]["name"] = __('Hardware financial and administrative information');
$report_list["Infocoms"]["file"] = "report.infocom.php";
$report_list["Infocoms2"]["name"] = __('Other financial and administrative information (licenses, cartridges, consumables)');
$report_list["Infocoms2"]["file"] = "report.infocom.conso.php";
}
if (Session::haveRight("networking", READ)) {
$report_list["Rapport prises reseau"]["name"] = __('Network report');
$report_list["Rapport prises reseau"]["file"] = "report.networking.php";
}
if (Session::haveRight("reservation", READ)) {
$report_list["reservation"]["name"] = __('Loan');
$report_list["reservation"]["file"] = "report.reservation.php";
}
if (Computer::canView() || Monitor::canView() || Session::haveRight("networking", READ) || Peripheral::canView() || Printer::canView() || Phone::canView()) {
$report_list["state"]["name"] = _n('Status', 'Statuses', Session::getPluralNumber());
$report_list["state"]["file"] = "report.state.php";
}
//Affichage du tableau de presentation des stats
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('Select the report you want to generate') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
$count = count($report_list);
$selected = -1;
$values = array($CFG_GLPI["root_doc"] . '/front/report.php' => Dropdown::EMPTY_VALUE);
while ($data = each($report_list)) {
$val = $data[0];
$name = $report_list["{$val}"]["name"];
$file = $report_list["{$val}"]["file"];
$key = $CFG_GLPI["root_doc"] . "/front/" . $file;
$values[$key] = $name;
if (stripos($_SERVER['REQUEST_URI'], $key) !== false) {
$selected = $key;
}
}
$names = array();
$optgroup = array();
if (isset($PLUGIN_HOOKS["reports"]) && is_array($PLUGIN_HOOKS["reports"])) {
foreach ($PLUGIN_HOOKS["reports"] as $plug => $pages) {
if (is_array($pages) && count($pages)) {
foreach ($pages as $page => $name) {
$names[$plug . '/' . $page] = array("name" => $name, "plug" => $plug);
$optgroup[$plug] = Plugin::getInfo($plug, 'name');
}
}
}
asort($names);
}
foreach ($optgroup as $opt => $title) {
$group = $title;
foreach ($names as $key => $val) {
if ($opt == $val["plug"]) {
$file = $CFG_GLPI["root_doc"] . "/plugins/" . $key;
$values[$group][$file] = $val["name"];
if (stripos($_SERVER['REQUEST_URI'], $file) !== false) {
$selected = $file;
}
}
}
}
Dropdown::showFromArray('statmenu', $values, array('on_change' => "window.location.href=this.options[this.selectedIndex].value", 'value' => $selected));
echo "</td>";
echo "</tr>";
echo "</table>";
}
示例3: getTabNameForItem
/**
* @see CommonGLPI::getTabNameForItem()
**/
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 '';
}