本文整理汇总了PHP中BASE_CLASS_Widget::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP BASE_CLASS_Widget::__construct方法的具体用法?PHP BASE_CLASS_Widget::__construct怎么用?PHP BASE_CLASS_Widget::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BASE_CLASS_Widget
的用法示例。
在下文中一共展示了BASE_CLASS_Widget::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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));
}
}
示例2: __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));
}
示例3: __construct
public function __construct(BASE_CLASS_WidgetParameter $param)
{
parent::__construct();
$userId = $param->additionalParamList['entityId'];
if (isset($param->customParamList['content'])) {
$content = $param->customParamList['content'];
} else {
$settings = BOL_ComponentEntityService::getInstance()->findSettingList($param->widgetDetails->uniqName, $userId, array('content'));
$content = empty($settings['content']) ? null : $settings['content'];
}
if ($param->additionalParamList['entityId'] == OW::getUser()->getId()) {
$this->assign('ownerMode', true);
$this->assign('noContent', $content === null);
$this->addForm(new AboutMeForm($param->widgetDetails->uniqName, $content));
} else {
if (empty($content)) {
$this->setVisible(false);
return;
}
$this->assign('ownerMode', false);
$content = htmlspecialchars($content);
$content = UTIL_HtmlTag::autoLink($content);
$this->assign('contentText', $content);
}
}
示例4: __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);
}
示例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
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);
}
示例7: __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);
}
示例8: __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');
}
示例9: __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));
}
示例10: __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);
}
}
}
示例11: __construct
public function __construct(BASE_CLASS_WidgetParameter $paramObj)
{
parent::__construct();
$active = array(self::IOS => OW::getPluginManager()->isPluginActive(self::IOS), self::ANDROID => OW::getPluginManager()->isPluginActive(self::ANDROID));
if (!$active[self::IOS] && !$active[self::ANDROID]) {
$this->setVisible(false);
return;
} elseif (empty($paramObj->customParamList['banners'])) {
$this->setVisible(false);
return;
}
$banners = $paramObj->customParamList['banners'];
$banners = array_merge(array($paramObj->customParamList['show_first'] => true), $banners);
$event = new BASE_CLASS_EventCollector('app.promo_info');
OW::getEventManager()->trigger($event);
$data = call_user_func_array('array_merge', $event->getData());
$promos = array();
foreach (array_keys($banners) as $bunner) {
if (!isset($data[$bunner])) {
continue;
}
$promos[$bunner] = array('app_url' => $data[$bunner]['app_url']);
}
if (count($promos) === 0) {
$this->setVisible(false);
return;
}
OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('skadate')->getStaticCssUrl() . 'mobile_experience.css');
$this->assign('promos', $promos);
}
示例12: __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);
}
示例13: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
/*if ( !GROUPS_BOL_Service::getInstance()->isCurrentUserCanViewList() )
{
$this->setVisible(false);
return;
}*/
$userId = $params->additionalParamList['entityId'];
$count = empty($params->customParamList['count']) ? 3 : (int) $params->customParamList['count'];
// privacy check
$viewerId = OW::getUser()->getId();
$ownerMode = $userId == $viewerId;
$modPermissions = OW::getUser()->isAuthorized('groups');
if (!$ownerMode && !$modPermissions) {
$privacyParams = array('action' => GROUPS_BOL_Service::PRIVACY_ACTION_VIEW_MY_GROUPS, 'ownerId' => $userId, 'viewerId' => $viewerId);
$event = new OW_Event('privacy_check_permission', $privacyParams);
try {
OW::getEventManager()->trigger($event);
} catch (RedirectException $e) {
$this->setVisible(false);
return;
}
}
$userName = BOL_UserService::getInstance()->findUserById($userId)->getUsername();
if (!$this->assignList($userId, $count)) {
$this->setVisible($params->customizeMode);
return;
}
$this->setSettingValue(self::SETTING_TOOLBAR, array(array('label' => OW::getLanguage()->text('groups', 'widget_user_groups_view_all'), 'href' => OW::getRouter()->urlForRoute('groups-user-groups', array('user' => $userName)))));
}
示例14: __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);
}
示例15: __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);
}
}