本文整理汇总了PHP中Profile_User::getEntitiesForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile_User::getEntitiesForUser方法的具体用法?PHP Profile_User::getEntitiesForUser怎么用?PHP Profile_User::getEntitiesForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile_User
的用法示例。
在下文中一共展示了Profile_User::getEntitiesForUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForItem
/**
* Show Links for an item
*
* @param $item CommonDBTM object
* @param $withtemplate integer withtemplate param (default '')
**/
static function showForItem(CommonDBTM $item, $withtemplate = '')
{
global $DB, $CFG_GLPI;
if (!self::canView()) {
return false;
}
if ($item->isNewID($item->getID())) {
return false;
}
$restrict = $item->getEntityID();
if ($item->getType() == 'User') {
$restrict = Profile_User::getEntitiesForUser($item->getID());
}
$query = "SELECT `glpi_links`.`id`,\n `glpi_links`.`link` AS link,\n `glpi_links`.`name` AS name ,\n `glpi_links`.`data` AS data,\n `glpi_links`.`open_window` AS open_window\n FROM `glpi_links`\n INNER JOIN `glpi_links_itemtypes`\n ON `glpi_links`.`id` = `glpi_links_itemtypes`.`links_id`\n WHERE `glpi_links_itemtypes`.`itemtype`='" . $item->getType() . "' " . getEntitiesRestrictRequest(" AND", "glpi_links", "entities_id", $restrict, true) . "\n ORDER BY name";
$result = $DB->query($query);
echo "<div class='spaced'><table class='tab_cadre_fixe'>";
if ($DB->numrows($result) > 0) {
echo "<tr><th>" . self::getTypeName(Session::getPluralNumber()) . "</th></tr>";
while ($data = $DB->fetch_assoc($result)) {
$links = self::getAllLinksFor($item, $data);
foreach ($links as $link) {
echo "<tr class='tab_bg_2'>";
echo "<td class='center'>{$link}</td></tr>";
}
}
echo "</table></div>";
} else {
echo "<tr class='tab_bg_2'><th>" . self::getTypeName(Session::getPluralNumber()) . "</th></tr>";
echo "<tr class='tab_bg_2'><td class='center b'>" . __('No link defined') . "</td></tr>";
echo "</table></div>";
}
}