本文整理汇总了PHP中Widgets::retrieveWidgetList方法的典型用法代码示例。如果您正苦于以下问题:PHP Widgets::retrieveWidgetList方法的具体用法?PHP Widgets::retrieveWidgetList怎么用?PHP Widgets::retrieveWidgetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widgets
的用法示例。
在下文中一共展示了Widgets::retrieveWidgetList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* This action is the default action of the Admin module. It should be triggered
* when the user agent request requests to enter the administration panel.
*/
public function index()
{
// Session message handling.
if (isset($_SESSION['message'])) {
$message = $_SESSION['message'];
$isError = $_SESSION['isError'];
// We consider message and isError session variables as flash variables.
unset($_SESSION['message']);
unset($_SESSION['isError']);
}
if (!(Auth::isAuth() && (Auth::isAdmin() || Auth::isGod()))) {
// forward to the login script
DefaultFC::redirection('users/index?ref=admin');
} else {
// Determine if the view must allow the user to manage widgets.
$widgetManagement = false;
if (Auth::isAdmin() || Auth::isGod()) {
$widgetManagement = true;
}
// View preparation.
$categories = $this->buildCategoryList();
$installedWidgets = Widgets::retrieveWidgetList(Auth::getUserId(), Auth::getUserLevel(), 'raw', true);
$partial = 'widgets';
require DefaultFC::getView('admin.tpl');
}
}
示例2: getWidgetList
/**
* The getWidgetList action acts as a service and should be triggered through an XML HTTP GET Request in order
* to get the lists of widgets that are available for the user-agent's owner (the currently logged in user).
*
* @param string $format The output format that will be written in the HTTP Response. It must 'json' or 'xml'.
* @param string $tag If set, will search the widgets to put in the resulting output by tag name.
* @param integer $cat If set, will search the widgets to put in the resulting output by category id.
*/
public function getWidgetList($format, $tag = null, $cat = null)
{
if (!Auth::isAuth()) {
throw new ServiceException(MwwException::CONTROLLER, 'getWidgetList', ServiceException::SERV_AUTH);
}
if (isset($tag)) {
// We have to search widgets by tag name.
$widgets = Widgets::retrieveWidgetListByTag(Auth::getUserId(), $tag, Auth::getUserLevel(), $format);
} else {
if (isset($cat)) {
// We have to search widgets by category id.
$widgets = Widgets::retrieveWidgetListByCategory(Auth::getUserId(), $cat, Auth::getUserLevel(), $format);
} else {
// We have to get all widgets relevant to the authenticated user.
$widgets = Widgets::retrieveWidgetList(Auth::getUserId(), Auth::getUserLevel(), $format);
}
}
echo $widgets;
}