本文整理汇总了PHP中BASE_CLASS_Widget类的典型用法代码示例。如果您正苦于以下问题:PHP BASE_CLASS_Widget类的具体用法?PHP BASE_CLASS_Widget怎么用?PHP BASE_CLASS_Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BASE_CLASS_Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(BASE_CLASS_WidgetParameter $paramsObj)
{
parent::__construct();
$params = $paramsObj->customParamList;
$addParams = $paramsObj->additionalParamList;
if (empty($addParams['entityId']) || !OW::getUser()->isAuthenticated() || !OW::getUser()->isAuthorized('eventx', 'view_event')) {
$this->setVisible(false);
return;
} else {
$userId = $addParams['entityId'];
}
$eventParams = array('action' => 'event_view_attend_events', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $e) {
$this->setVisible(false);
return;
}
$language = OW::getLanguage();
$eventService = EVENTX_BOL_EventService::getInstance();
$userEvents = $eventService->findUserParticipatedPublicEvents($userId, null, $params['events_count']);
if (empty($userEvents)) {
$this->setVisible(false);
return;
}
$this->assign('my_events', $eventService->getListingDataWithToolbar($userEvents));
$toolbarArray = array();
if ($eventService->findUserParticipatedPublicEventsCount($userId) > $params['events_count']) {
$url = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('eventx.view_event_list', array('list' => 'user-participated-events')), array('userId' => $userId));
$toolbarArray = array(array('href' => $url, 'label' => $language->text('eventx', 'view_all_label')));
}
$this->assign('toolbars', $toolbarArray);
}
示例2: __construct
public function __construct(BASE_CLASS_WidgetParameter $objParams)
{
parent::__construct();
$uniqName = $objParams->widgetDetails->uniqName;
$this->assign('uniqName', $uniqName);
$service = SLIDESHOW_BOL_Service::getInstance();
$slides = $service->getSlideList($uniqName);
$this->assign('slides', $slides);
if ($slides) {
$url = OW::getPluginManager()->getPlugin('slideshow')->getStaticJsUrl() . 'slides.min.jquery.js';
OW::getDocument()->addScript($url);
$settings = $objParams->customParamList;
$params = array('sizes' => $service->getSizes($slides), 'pagination' => $settings['navigation'] ? "true" : "false", 'interval' => $settings['interval'], 'uniqname' => $uniqName, 'effect' => $settings['effect'], 'preloadImage' => OW::getThemeManager()->getThemeImagesUrl() . '/ajax_preloader_content.gif');
$url = OW::getPluginManager()->getPlugin('slideshow')->getStaticJsUrl() . 'slideshow.js';
OW::getDocument()->addScript($url);
$id = uniqid();
$script = 'var slideshow' . $id . ' = new slideshow(' . json_encode($params) . '); slideshow' . $id . '.init();';
if ($objParams->customizeMode) {
$script .= 'OW.WidgetPanel.bind("move", function(e) {
if ( e.widgetName == "' . $uniqName . '" ) {
OW.WidgetPanel.reloadWidget("' . $uniqName . '", function(markup, data){});
}
});';
}
OW::getDocument()->addOnloadScript($script);
}
}
示例3: __construct
public function __construct(BASE_CLASS_WidgetParameter $paramObject)
{
parent::__construct();
$this->assign('url', OW::getRouter()->urlForRoute('base_join'));
$this->assign('label', !empty($paramObject->customParamList['buttonLabel']) ? $paramObject->customParamList['buttonLabel'] : OW::getLanguage()->text('base', 'join_index_join_button'));
$this->setTemplate(OW::getPluginManager()->getPlugin('base')->getMobileCmpViewDir() . 'join_now_widget.html');
}
示例4: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
// $service = PostService::getInstance();
// $count = $params->customParamList['count'];
// $previewLength = $params->customParamList['previewLength'];
// $list = $service->findList(0, $count);
/*
if ( empty($list) && !OW::getUser()->isAuthorized('shoppro', 'add') && !$params->customizeMode )
{
$this->setVisible(false);
return;
}
*/
$this->userId = OW::getUser()->getId();
//citent login user (uwner)
$this->feed_working_Id = $params->additionalParamList['entityId'];
//set wotching user id
$posts = array();
$userService = BOL_UserService::getInstance();
$postIdList = array();
$commentInfo = array();
$this->assign('commentInfo', $commentInfo);
$this->assign('list', $posts);
}
示例5: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$groupId = $params->additionalParamList['entityId'];
$userId = OW::getUser()->getId();
$service = GROUPS_BOL_Service::getInstance();
$feedService = GROUPRSS_BOL_FeedService::getInstance();
$whoCanAdd = OW::getConfig()->getValue('grouprss', 'actionMember');
if ($whoCanAdd == 'admin' && !OW::getUser()->isAdmin()) {
$this->setVisible(false);
return;
}
$mypaths = explode("/", UTIL_Url::selfUrl());
$groupId = strtolower(end($mypaths));
if ($groupId == 'customize') {
$groupId = strtolower(prev($mypaths));
}
if ($whoCanAdd == 'creator' && $feedService->getGroupCreater($groupId) !== $userId) {
$this->setVisible(false);
return;
}
if ($whoCanAdd == 'both') {
if (!OW::getUser()->isAdmin() && $feedService->getGroupCreater($groupId) !== $userId) {
$this->setVisible(false);
return;
}
}
$this->assign('groupId', (int) $groupId);
}
示例6: __construct
/**
* @return Constructor.
*/
public function __construct(BASE_CLASS_WidgetParameter $paramObj)
{
parent::__construct();
$service = GROUPS_BOL_Service::getInstance();
$groupId = (int) $paramObj->additionalParamList['entityId'];
$this->addComponent('briefInfo', new GROUPS_CMP_BriefInfoContent($groupId));
}
示例7: __construct
/**
* @return Constructor.
*/
public function __construct(BASE_CLASS_WidgetParameter $paramObj)
{
parent::__construct();
$avatarService = BOL_AvatarService::getInstance();
$viewerId = OW::getUser()->getId();
$userId = $paramObj->additionalParamList['entityId'];
if ($viewerId == $userId) {
$this->assign('owner', true);
$this->assign('changeAvatarUrl', OW::getRouter()->urlForRoute('base_avatar_crop'));
} else {
$this->assign('owner', false);
}
$avatar = $avatarService->getAvatarUrl($userId, 2);
$this->assign('avatar', $avatar ? $avatar : $avatarService->getDefaultAvatarUrl(2));
$roles = BOL_AuthorizationService::getInstance()->getRoleListOfUsers(array($userId));
$this->assign('role', !empty($roles[$userId]) ? $roles[$userId] : null);
$userService = BOL_UserService::getInstance();
$showPresence = true;
// Check privacy permissions
$eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $e) {
$showPresence = false;
}
$this->assign('isUserOnline', $userService->findOnlineUserById($userId) && $showPresence);
$this->assign('userId', $userId);
$this->assign('avatarSize', OW::getConfig()->getValue('base', 'avatar_big_size'));
}
示例8: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'users_widget.html');
$randId = UTIL_HtmlTag::generateAutoId('base_users_widget');
$this->assign('widgetId', $randId);
$data = $this->getData($params);
$menuItems = array();
$dataToAssign = array();
if (!empty($data)) {
foreach ($data as $key => $item) {
$contId = "{$randId}_users_widget_{$key}";
$toolbarId = !empty($item['toolbar']) ? "{$randId}_toolbar_{$key}" : false;
$menuItems[$key] = array('label' => $item['menu-label'], 'id' => "{$randId}_users_widget_menu_{$key}", 'contId' => $contId, 'active' => !empty($item['menu_active']), 'toolbarId' => $toolbarId);
$usersCmp = $this->getUsersCmp($item['userIds']);
$dataToAssign[$key] = array('users' => $usersCmp->render(), 'active' => !empty($item['menu_active']), 'toolbar' => !empty($item['toolbar']) ? $item['toolbar'] : array(), 'toolbarId' => $toolbarId, 'contId' => $contId);
}
}
$this->assign('data', $dataToAssign);
$displayMenu = true;
if (count($data) == 1 && !$this->forceDisplayMenu) {
$displayMenu = false;
}
if (!$params->customizeMode && (count($data) != 1 || $this->forceDisplayMenu)) {
$menu = $this->getMenuCmp($menuItems);
if (!empty($menu)) {
$this->addComponent('menu', $menu);
}
}
}
示例9: __construct
public function __construct(BASE_CLASS_WidgetParameter $paramObject)
{
parent::__construct();
$text = OW::getLanguage()->text('base', 'welcome_widget_content');
$text = str_replace('</li>', "</li>\n", $text);
//if the tags are written in a line it is necessary to make a compulsory hyphenation?
$photoKey = str_replace('{$key}', self::KEY_PHOTO_UPLOAD, self::PATTERN);
$avatarKey = str_replace('{$key}', self::KEY_CHANGE_AVATAR, self::PATTERN);
if (OW::getPluginManager()->isPluginActive('photo') && mb_stripos($text, self::KEY_PHOTO_UPLOAD) !== false) {
$label = OW::getLanguage()->text('photo', 'upload_photos');
$js = OW::getEventManager()->call('photo.getAddPhotoURL');
$langLabel = $this->getLangLabel($photoKey, $text, self::KEY_PHOTO_UPLOAD);
if ($langLabel != NULL) {
$label = $langLabel;
}
$text = preg_replace($photoKey, '<li><a href="javascript://" onclick="' . $js . '();">' . $label . '</a></li>', $text);
} else {
$text = preg_replace($photoKey, '', $text);
}
if (mb_stripos($text, self::KEY_CHANGE_AVATAR) !== false) {
$label = OW::getLanguage()->text('base', 'avatar_change');
$js = ' $("#welcomeWinget_loadAvatarChangeCmp").click(function(){' . 'document.avatarFloatBox = OW.ajaxFloatBox("BASE_CMP_AvatarChange", [], {width: 749, title: ' . json_encode($label) . '});' . '});';
OW::getDocument()->addOnloadScript($js);
$langLabel = $this->getLangLabel($avatarKey, $text, self::KEY_CHANGE_AVATAR);
if ($langLabel != NULL) {
$label = $langLabel;
}
$text = preg_replace($avatarKey, '<li><a id="welcomeWinget_loadAvatarChangeCmp" href="javascript://">' . $label . '</a></li>', $text);
} else {
$text = preg_replace($avatarKey, '', $text);
}
$this->assign('text', $text);
}
示例10: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$service = FRIENDS_BOL_Service::getInstance();
$userId = $params->additionalParamList['entityId'];
$count = (int) $params->customParamList['count'];
$idList = $service->findUserFriendsInList($userId, 0, $count);
$total = $service->countFriends($userId);
$userService = BOL_UserService::getInstance();
$eventParams = array('action' => 'friends_view', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $e) {
$this->setVisible(false);
return;
}
if (empty($idList) && !$params->customizeMode) {
$this->setVisible(false);
return;
}
if (!empty($idList)) {
$this->addComponent('userList', new BASE_CMP_AvatarUserList($idList));
}
$username = BOL_UserService::getInstance()->getUserName($userId);
$toolbar = array();
if ($total > $count) {
$toolbar = array(array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('friends_user_friends', array('user' => $username))));
}
$this->assign('toolbar', $toolbar);
}
示例11: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$count = (int) $params->customParamList['count'];
$service = SKAPI_BOL_Service::getInstance();
$userId = OW::getUser()->getId();
$guests = $service->findGuestsForUser($userId, 1, $count);
if (!$guests) {
$this->setVisible(false);
return;
}
$userIdList = array();
foreach ($guests as $guest) {
array_push($userIdList, $guest->guestId);
}
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($userIdList);
foreach ($avatars as &$item) {
$item['class'] = 'ow_guest_avatar';
}
$event = new OW_Event('bookmarks.is_mark', array(), $avatars);
OW::getEventManager()->trigger($event);
if ($event->getData()) {
$avatars = $event->getData();
}
$this->assign('avatars', $avatars);
$this->assign('guests', $guests);
$total = $service->countGuestsForUser($userId);
if ($total > $count) {
$toolbar = array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('skapi.list'));
$this->setSettingValue(self::SETTING_TOOLBAR, array($toolbar));
}
}
示例12: __construct
/**
* @return Constructor.
*/
public function __construct(BASE_CLASS_WidgetParameter $paramObj)
{
parent::__construct();
//echo "call";
$avatarService = BOL_AvatarService::getInstance();
$userId = OW::getUser()->getId();
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId), true, true, true, true, 2);
// $avatars = BOL_AvatarService::getInstance()->getAvatarsUrlList(array($userId), 2);
// echo '<pre>';
// print_r($avatars);
// echo '</pre>';
$this->assign('avatar', $avatars[$userId]);
$event = new BASE_CLASS_EventCollector('base.on_avatar_toolbar_collect', array('userId' => $userId));
OW::getEventManager()->trigger($event);
$toolbarItems = $event->getData();
// echo '<pre>';
// print_r($toolbarItems);
// echo '</pre>';
$tplToolbarItems = array();
foreach ($toolbarItems as $item) {
if (empty($item['title']) || empty($item['url']) || empty($item['iconClass'])) {
continue;
}
$order = empty($item['order']) ? count($tplToolbarItems) + 1 : (int) $item['order'];
if (!empty($tplToolbarItems[$order])) {
$order = count($tplToolbarItems) + 1;
}
$tplToolbarItems[$order] = $item;
}
ksort($tplToolbarItems);
$this->assign('toolbarItems', array_values($tplToolbarItems));
}
示例13: __construct
/**
* @param BASE_CLASS_WidgetParameter $params
* @return \BASE_CMP_UserViewWidget
*/
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$userId = $params->additionalParamList['entityId'];
$viewerId = OW::getUser()->getId();
$ownerMode = $userId == $viewerId;
$adminMode = OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('base');
$isSuperAdmin = BOL_AuthorizationService::getInstance()->isSuperModerator($userId);
$user = BOL_UserService::getInstance()->findUserById($userId);
$accountType = $user->accountType;
$questionService = BOL_QuestionService::getInstance();
$questions = self::getUserViewQuestions($userId, $adminMode);
$questionArray = $questions['questions'];
$questionData = $questions['data'];
$questionLabelList = $questions['labels'];
$sections = array_keys($questionArray);
$template = OW::getPluginManager()->getPlugin('base')->getViewDir() . 'components' . DS . 'user_view_widget_table.html';
$userViewPresntation = OW::getConfig()->getValue('base', 'user_view_presentation');
if ($userViewPresntation === self::USER_VIEW_PRESENTATION_TABS) {
$template = OW::getPluginManager()->getPlugin('base')->getViewDir() . 'components' . DS . 'user_view_widget_tabs.html';
OW::getDocument()->addOnloadScript(" view = new UserViewWidget(); ");
$jsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
OW::getDocument()->addScript($jsDir . "user_view_widget.js");
$this->addMenu($sections);
}
$script = ' $(".profile_hidden_field").bind( "mouseover.hiddenfield",
function() {
OW.showTip($(this), {side: "top", hideEvent: "mouseout", timeout:0, show: "' . OW::getLanguage()->text('base', 'base_invisible_profile_field_tooltip') . '"});
} );';
OW::getDocument()->addOnloadScript($script);
$this->setTemplate($template);
$accountTypes = $questionService->findAllAccountTypes();
if (!isset($sections[0])) {
$sections[0] = 0;
}
if (count($accountTypes) > 1) {
if (!isset($questionArray[$sections[0]])) {
$questionArray[$sections[0]] = array();
}
array_unshift($questionArray[$sections[0]], array('name' => 'accountType', 'presentation' => 'select'));
$questionData[$userId]['accountType'] = $questionService->getAccountTypeLang($accountType);
}
if (!isset($questionData[$userId])) {
$questionData[$userId] = array();
}
$this->assign('firstSection', $sections[0]);
$this->assign('questionArray', $questionArray);
$this->assign('questionData', $questionData[$userId]);
$this->assign('ownerMode', $ownerMode);
$this->assign('adminMode', $adminMode);
$this->assign('superAdminProfile', $isSuperAdmin);
$this->assign('profileEditUrl', OW::getRouter()->urlForRoute('base_edit'));
if ($adminMode && !$ownerMode) {
$this->assign('profileEditUrl', OW::getRouter()->urlForRoute('base_edit_user_datails', array('userId' => $userId)));
}
$this->assign('avatarUrl', BOL_AvatarService::getInstance()->getAvatarUrl($userId));
$this->assign('displayName', BOL_UserService::getInstance()->getDisplayName($userId));
$this->assign('questionLabelList', $questionLabelList);
$this->assign('userId', $userId);
}
示例14: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
if (!BOL_AuthorizationService::getInstance()->isModerator() && !OW::getUser()->isAdmin()) {
$this->setVisible(false);
return;
}
$uniqId = uniqid("mp-");
$this->assign("uniqId", $uniqId);
$event = new BASE_CLASS_EventCollector(self::EVENT_COLLECT_CONTENTS);
OW::getEventManager()->trigger($event);
$tplContents = array();
$activeTab = null;
foreach ($event->getData() as $content) {
$tplContent = array_merge(array("name" => null, "content" => null, "active" => false), $content);
$activeTab = $tplContent["active"] ? $tplContent["name"] : $activeTab;
$tplContents[$tplContent["name"]] = $tplContent;
}
if (empty($tplContents)) {
$this->setVisible(false);
return;
}
if ($activeTab === null) {
$firstTab = reset($tplContents);
$activeTab = $firstTab["name"];
$tplContents[$activeTab]["active"] = true;
}
$this->assign("items", $tplContents);
}
示例15: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$lang = OW::getLanguage();
$service = OCSTOPUSERS_BOL_Service::getInstance();
$limit = $params->customParamList['userCount'];
$list = $service->findList(1, $limit);
if ($list) {
$this->assign('list', $list);
$total = $service->countUsers();
$this->assign('total', $total);
$idList = array();
$scores = array();
$rates = array();
foreach ($list as $user) {
array_push($idList, $user['dto']->id);
$scores[$user['dto']->id] = $user['score'];
$rates[$user['dto']->id] = $user['rates'];
}
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList);
foreach ($avatars as $userId => &$av) {
$av['title'] .= ' - ' . $lang->text('ocstopusers', 'rate_info', array('rates' => $rates[$userId], 'score' => floatval($scores[$userId])));
}
$this->assign('avatars', $avatars);
$this->assign('scores', $scores);
if ($total > $limit) {
$toolbar = array(array('href' => OW::getRouter()->urlForRoute('ocstopusers.list'), 'label' => OW::getLanguage()->text('base', 'view_all')));
$this->setSettingValue(self::SETTING_TOOLBAR, $toolbar);
}
} else {
$this->assign('list', null);
}
}