本文整理汇总了PHP中Widgets::retrieveWidgetListByTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Widgets::retrieveWidgetListByTag方法的具体用法?PHP Widgets::retrieveWidgetListByTag怎么用?PHP Widgets::retrieveWidgetListByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widgets
的用法示例。
在下文中一共展示了Widgets::retrieveWidgetListByTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}