protected function getComponentMarkup(OW_Component $cmp) { /* @var $document OW_AjaxDocument */ $document = OW::getDocument(); $responce = array(); $responce['content'] = trim($cmp->render()); $beforeIncludes = $document->getScriptBeforeIncludes(); if (!empty($beforeIncludes)) { $responce['beforeIncludes'] = $beforeIncludes; } foreach ($document->getScripts() as $script) { $responce['scriptFiles'][] = $script; } $onloadScript = $document->getOnloadScript(); if (!empty($onloadScript)) { $responce['onloadScript'] = $onloadScript; } $styleDeclarations = $document->getStyleDeclarations(); if (!empty($styleDeclarations)) { $responce['styleDeclarations'] = $styleDeclarations; } $styleSheets = $document->getStyleSheets(); if (!empty($styleSheets)) { $responce['styleSheets'] = $styleSheets; } return $responce; }
public function __construct($userId) { parent::__construct(); $cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId($userId); if (empty($cover)) { $this->assign('error', OW::getLanguage()->text('uheader', 'cover_not_found')); return; } $src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover); $settings = $cover->getSettings(); $height = $settings['dimensions']['height']; $width = $settings['dimensions']['width']; $top = 0; if ($height < self::MIN_HEIGHT) { $top = (self::MIN_HEIGHT - $height) / 2; } $avatarsData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId)); $this->assign('user', $avatarsData[$userId]); $this->assign('src', $src); $this->assign('top', $top); $this->assign('dimensions', $settings['dimensions']); $cmtParams = new BASE_CommentsParams('uheader', UHEADER_CLASS_CommentsBridge::ENTITY_TYPE); $cmtParams->setWrapInBox(false); $cmtParams->setEntityId($cover->id); $cmtParams->setOwnerId($userId); $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_TOP_FORM_WITH_PAGING); $photoCmts = new BASE_CMP_Comments($cmtParams); $this->addComponent('comments', $photoCmts); }
public function render() { $cssUrl = OW::getPluginManager()->getPlugin('FBCONNECT')->getStaticCssUrl() . 'fbconnect.css'; OW::getDocument()->addStyleSheet($cssUrl); FBCONNECT_BOL_Service::getInstance()->initializeJs(array('email', 'user_about_me', 'user_birthday'), $_GET); return parent::render(); }
public function onBeforeRender() { parent::onBeforeRender(); $userList = array(); $userDtoList = array(); $userService = BOL_UserService::getInstance(); $questionService = BOL_QuestionService::getInstance(); $userIdList = array_keys($this->userList); $userDataList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $this->fieldList); foreach ($userService->findUserListByIdList($userIdList) as $userDto) { $userDtoList[$userDto->id] = $userDto; } foreach ($this->userList as $userId => $fieldList) { $fields = array_diff(array_keys($fieldList), $this->fieldList); $fieldsData = $questionService->getQuestionData(array($userId), $fields); $userList[$userId]['fields'] = array_merge(!empty($userDataList[$userId]) ? $userDataList[$userId] : array(), !empty($fieldsData[$userId]) ? $fieldsData[$userId] : array(), $fieldList); $userList[$userId]['dto'] = $userDtoList[$userId]; } $this->assign('userList', $userList); $this->assign('avatars', BOL_AvatarService::getInstance()->getAvatarsUrlList($userIdList, 2)); $this->assign('onlineList', !empty($userIdList) ? $userService->findOnlineStatusForUserList($userIdList) : array()); $this->assign('usernameList', $userService->getUserNamesForList($userIdList)); $this->assign('displaynameList', $userService->getDisplayNamesForList($userIdList)); $this->assign('displayActivity', $this->displayActivity); }
public function __construct($params = array()) { parent::__construct(); $service = BOL_BillingService::getInstance(); $gateway = $service->findGatewayByKey($params['gateway']); if (!$gateway || $gateway->dynamic) { $this->setVisible(false); return; } $event = new BASE_CLASS_EventCollector('base.billing_add_gateway_product'); OW::getEventManager()->trigger($event); $data = $event->getData(); $eventProducts = array(); if ($data) { foreach ($data as $plugin) { foreach ($plugin as $product) { $id = $service->addGatewayProduct($gateway->id, $product['pluginKey'], $product['entityType'], $product['entityId']); $product['id'] = $id; $eventProducts[] = $product; } } } $products = $service->findGatewayProductList($gateway->id); foreach ($eventProducts as &$prod) { $prod['productId'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['dto']->productId : null; $prod['plugin'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['plugin'] : null; } $this->assign('products', $eventProducts); $this->assign('actionUrl', OW::getRouter()->urlFor('BASE_CTRL_Billing', 'saveGatewayProduct')); $this->assign('backUrl', urlencode(OW::getRouter()->getBaseUrl() . OW::getRouter()->getUri())); }
/** * Constructor. * * @param BASE_CommentsParams $params */ public function __construct(BASE_CommentsParams $params) { parent::__construct(); $this->params = $params; $this->batchData = $params->getBatchData(); $this->staticData = empty($this->batchData['_static']) ? array() : $this->batchData['_static']; $this->batchData = isset($this->batchData[$params->getEntityType()][$params->getEntityId()]) ? $this->batchData[$params->getEntityType()][$params->getEntityId()] : array(); srand(time()); $this->id = $params->getEntityType() . $params->getEntityId() . rand(1, 10000); $this->cmpContextId = "comments-{$this->id}"; $this->assign('cmpContext', $this->cmpContextId); $this->assign('wrapInBox', $params->getWrapInBox()); $this->assign('topList', in_array($params->getDisplayType(), array(BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST, BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI))); $this->assign('bottomList', $params->getDisplayType() == BASE_CommentsParams::DISPLAY_TYPE_WITH_PAGING); $this->assign('mini', $params->getDisplayType() == BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI); $this->isAuthorized = OW::getUser()->isAuthorized($params->getPluginKey(), 'add_comment') && $params->getAddComment(); if (!$this->isAuthorized) { $errorMessage = $params->getErrorMessage(); if (empty($errorMessage)) { $status = BOL_AuthorizationService::getInstance()->getActionStatus($params->getPluginKey(), 'add_comment'); $errorMessage = OW::getUser()->isAuthenticated() ? $status['msg'] : OW::getLanguage()->text('base', 'comments_add_login_message'); } $this->assign('authErrorMessage', $errorMessage); } $this->initForm(); }
/** * Constructor. */ public function __construct($ajax = false) { parent::__construct(); $form = new Form('sign-in'); $form->setAction(""); $username = new TextField('identity'); $username->setRequired(true); $username->setHasInvitation(true); $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation')); $form->addElement($username); $password = new PasswordField('password'); $password->setHasInvitation(true); $password->setInvitation('password'); $password->setRequired(true); $form->addElement($password); $remeberMe = new CheckboxField('remember'); $remeberMe->setValue(true); $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label')); $form->addElement($remeberMe); $submit = new Submit('submit'); $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label')); $form->addElement($submit); $this->addForm($form); if ($ajax) { $form->setAjaxResetOnSuccess(false); $form->setAjax(); $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn')); $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}'); $this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password')); } $this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join')); }
/** * Constructor. */ public function __construct($params = array()) { parent::__construct(); $userId = (int) $params['userId']; $showMessage = (bool) $params['showMessage']; $rspUrl = OW::getRouter()->urlFor('BASE_CTRL_User', 'deleteUser', array('user-id' => $userId)); $rspUrl = OW::getRequest()->buildUrlQueryString($rspUrl, array('showMessage' => (int) $showMessage)); $js = UTIL_JsGenerator::composeJsString('$("#baseDCButton").click(function() { var button = this; OW.inProgressNode(button); $.getJSON({$rsp}, function(r) { OW.activateNode(button); if ( _scope.floatBox ) { _scope.floatBox.close(); } if ( _scope.deleteCallback ) { _scope.deleteCallback(r); } }); });', array('rsp' => $rspUrl)); OW::getDocument()->addOnloadScript($js); }
public function __construct($affiliateId) { parent::__construct(); $service = OCSAFFILIATES_BOL_Service::getInstance(); $affiliate = $service->findAffiliateById($affiliateId); if (!$affiliate) { $this->setVisible(false); return; } $billingService = BOL_BillingService::getInstance(); $this->assign('currency', $billingService->getActiveCurrency()); $clicksCount = $service->countClicksForAffiliate($affiliateId); $this->assign('clicksCount', $clicksCount); $signupCount = $service->countRegistrationsForAffiliate($affiliateId); $this->assign('signupCount', $signupCount); $salesCount = $service->countSalesForAffiliate($affiliateId); $this->assign('salesCount', $salesCount); $clicksSum = $service->getClicksSumForAffiliate($affiliateId); $this->assign('clicksSum', $clicksSum); $signupSum = $service->getRegistrationsSumForAffiliate($affiliateId); $this->assign('signupSum', $signupSum); $salesSum = $service->getSalesSumForAffiliate($affiliateId); $this->assign('salesSum', $salesSum); $earnings = $clicksSum + $signupSum + $salesSum; $this->assign('earnings', $earnings); $payouts = $service->getPayoutSum($affiliateId); $this->assign('payouts', $payouts); $balance = $earnings - $payouts; $this->assign('balance', $balance); $this->assign('affiliate', $affiliate); }
public function __construct($list, $offset, $count) { parent::__construct(); $this->assign('list', $list); $this->assign('count', $count); $this->assign('loadMore', $count - $offset > BOL_AvatarService::AVATAR_CHANGE_GALLERY_LIMIT); }
public function onBeforeRender() { parent::onBeforeRender(); $this->assign("uniqId", $this->uniqId); $this->assign("snippets", $this->snippets); $this->initStatic(); }
public function onBeforeRender() { parent::onBeforeRender(); $this->assign('uniqId', $this->uniqId); $language = OW::getLanguage(); $this->assign('langs', array('uploadSave' => $language->text('attachments', 'attachments_upload_save_label'), 'takeSave' => $language->text('attachments', 'attachments_take_save_label'), 'cancel' => $language->text('attachments', 'attachments_cancel_label'), 'close' => $language->text('attachments', 'attachments_close_label'), 'chooseImage' => $language->text('attachments', 'attachments_choose_image_label'))); }
public function __construct($affiliateId) { parent::__construct(); $form = new OCSAFFILIATES_CLASS_AssignUserForm('assign_user'); $form->getElement('affiliateId')->setValue($affiliateId); $this->addForm($form); }
public function __construct($pluginKey, $entityType, $entityId, $ownerId) { parent::__construct(); $service = BOL_RateService::getInstance(); $maxRate = $service->getConfig(BOL_RateService::CONFIG_MAX_RATE); $cmpId = uniqid(); $entityId = (int) $entityId; $entityType = trim($entityType); $ownerId = (int) $ownerId; if (OW::getUser()->isAuthenticated()) { $userRateItem = $service->findRate($entityId, $entityType, OW::getUser()->getId()); if ($userRateItem !== null) { $userRate = $userRateItem->getScore(); } else { $userRate = null; } } else { $userRate = null; } $this->assign('maxRate', $maxRate); $this->addComponent('totalScore', new BASE_CMP_TotalScore($entityId, $entityType, $maxRate)); $this->assign('cmpId', $cmpId); $jsParamsArray = array('cmpId' => $cmpId, 'userRate' => $userRate, 'entityId' => $entityId, 'entityType' => $entityType, 'itemsCount' => $maxRate, 'respondUrl' => OW::getRouter()->urlFor('BASE_CTRL_Rate', 'updateRate'), 'ownerId' => $ownerId); OW::getDocument()->addOnloadScript("var rate{$cmpId} = new OwRate(" . json_encode($jsParamsArray) . "); rate{$cmpId}.init();"); }
public function __construct($affiliateId, $adminMode = false) { parent::__construct(); $service = OCSAFFILIATES_BOL_Service::getInstance(); $affiliate = $service->findAffiliateById($affiliateId); if (!$affiliate) { $this->setVisible(false); return; } $this->assign('affiliate', $affiliate); $this->assign('adminMode', $adminMode); $this->assign('creditsEnabled', OW::getPluginManager()->isPluginActive('usercredits')); if ($adminMode) { $this->assign('assoc', $service->getAffiliateAssocUser($affiliateId)); $script = '$("#assign-assoc").click(function(){ assignUserFloatBox = OW.ajaxFloatBox( "OCSAFFILIATES_CMP_AssignUser", { affiliateId: ' . $affiliateId . ' }, { width: 500, title: ' . json_encode(OW::getLanguage()->text('ocsaffiliates', 'assign')) . ' } ); }); '; OW::getDocument()->addOnloadScript($script); } }
public function __construct($providerName) { parent::__construct(); $providerConfigForm = new YNSOCIALCONNECT_CLASS_ConfigFieldsForm($providerName); $this->addForm($providerConfigForm); $service = YNSOCIALCONNECT_BOL_ServicesService::getInstance(); $provider = $service->getProvider($providerName); $this->assign('provider', $provider->getTitle()); $questionDtoList = $service->getOWQuestionDtoList($providerName); $questionList = array(); foreach ($questionDtoList as $dto) { $questionList[$dto->sectionName][(int) $dto->sortOrder] = array('name' => $dto->name, 'el_name' => 'alias[' . $dto->name . ']'); } $questionSectionDtoList = BOL_QuestionService::getInstance()->findAllSections(); $tplQuestionList = array(); foreach ($questionSectionDtoList as $sectionDto) { if (empty($questionList[$sectionDto->name])) { continue; } /* @var $sectionDto BOL_QuestionSection */ $tplQuestionList[(int) $sectionDto->sortOrder] = array('name' => $sectionDto->name, 'items' => $questionList[$sectionDto->name]); } ksort($tplQuestionList); $this->assign('questionList', $tplQuestionList); }
public function __construct($groupId) { parent::__construct(); $cover = GHEADER_BOL_Service::getInstance()->findCoverByGroupId($groupId); if (empty($cover)) { $this->assign('error', OW::getLanguage()->text('gheader', 'cover_not_found')); return; } $group = GROUPS_BOL_Service::getInstance()->findGroupById($cover->groupId); $src = GHEADER_BOL_Service::getInstance()->getCoverUrl($cover); $settings = $cover->getSettings(); $height = $settings['dimensions']['height']; $width = $settings['dimensions']['width']; $top = 0; if ($height < self::MIN_HEIGHT) { $top = (self::MIN_HEIGHT - $height) / 2; } $this->assign('src', $src); $this->assign('top', $top); $this->assign('dimensions', $settings['dimensions']); $userId = OW::getUser()->getId(); $cmtParams = new BASE_CommentsParams('gheader', GHEADER_CLASS_CommentsBridge::ENTITY_TYPE); $cmtParams->setEntityId($cover->id); $cmtParams->setAddComment(GHEADER_BOL_Service::getInstance()->isUserCanInteract($userId, $group->id)); $cmtParams->setOwnerId($group->userId); $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_TOP_FORM_WITH_PAGING); $photoCmts = new BASE_CMP_Comments($cmtParams); $this->addComponent('comments', $photoCmts); }
public function __construct($layout) { parent::__construct(); $status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view'); if ($status['status'] == BOL_AuthorizationService::STATUS_DISABLED) { $this->assign('authError', $status['msg']); return; } $class = ""; switch ($layout) { case 'page': $class = ' ow_photoview_info_onpage'; break; default: if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) { $class = ' ow_photoview_pint_mode'; } else { $class = ''; } break; } $this->assign('class ', $class); $this->assign('layout ', $layout); $document = OW::getDocument(); $js = "\$('#btn-save-as-avatar').off().on('click', function() {\n console.log('photo floatbox call js');\n var photoId = \$('#btn-photo-edit') . attr('rel');\n\n document.avatarFloatBox = OW.ajaxFloatBox(\n 'BASE_CMP_AvatarChange', {\n params: {\n step: 2, entityType: 'photo_album', entityId: '', id: photoId\n }}, {\n width: 749, title: OW.getLanguageText('base', 'avatar_change')}\n );\n })"; $document->addOnloadScript($js); }
public function __construct(EQUESTIONS_AttachmentWidgetDelegate $delegate, $label, $iconClass = null) { parent::__construct(); $this->uniqId = uniqid('attachmentWidget'); $this->label = $label; $this->iconClass = $iconClass; }
public function __construct($userId) { parent::__construct(); $data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId)); $albums = empty($data["albums"]) ? array() : $data["albums"]; $source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId); $this->assign("source", $source == "album" ? "album" : "all"); $selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId); $form = new Form("pcGallerySettings"); $form->setEmptyElementsErrorMessage(null); $form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings")); $element = new HiddenField("userId"); $element->setValue($userId); $form->addElement($element); $element = new Selectbox("album"); $element->setHasInvitation(true); $element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation")); $validator = new PCGALLERY_AlbumValidator(); $element->addValidator($validator); $albumsPhotoCount = array(); foreach ($albums as $album) { $element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})"); $albumsPhotoCount[$album["id"]] = $album["photoCount"]; if ($album["id"] == $selectedAlbum) { $element->setValue($album["id"]); } } OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount))); $element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label")); $form->addElement($element); $submit = new Submit("save"); $submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label")); $form->addElement($submit); $this->addForm($form); }
public function __construct(array $aParams) { parent::__construct(); //print_r($aParams); exit; foreach ($aParams['items'] as $k => $v) { $aParams['items'][$k]['media_parent'] = isset($aParams['items'][$k]['media_parent']) ? $aParams['items'][$k]['media_parent'] : ''; $aParams['items'][$k]['title_decode'] = urldecode($aParams['items'][$k]['title']); $aParams['items'][$k]['update_page_param'] = http_build_query(array('service' => $aParams['items'][$k]['provider'], 'media' => 'photo', 'media_parent' => $aParams['items'][$k]['media_parent'], 'extra' => 'aid', 'aid' => $aParams['items'][$k]['aid'])); //$aParams['items'][$k]['brief_title'] = substr($aParams['items'][$k]['title_decode'], 0, 20); $aParams['items'][$k]['status_text'] = OW::getLanguage()->text("ynmediaimporter", 'import_status_' . $aParams['items'][$k]['status']); $aParams['items'][$k]['json'] = json_encode($aParams['items'][$k]); } //print_r($aParams); exit; if (isset($aParams['items'])) { $this->assign('items', $aParams['items']); } if (isset($aParams['params'])) { $this->assign('params', $aParams['params']); $this->assign('params_json', json_encode($aParams['params'])); } if (isset($aParams['item_count'])) { $this->assign('item_count', $aParams['item_count']); } if (isset($aParams['userId'])) { $this->assign('userId', $aParams['userId']); } }
/** * User list * * @param array $params * integer count * string boxType */ function __construct(array $params = array()) { parent::__construct(); $this->countUsers = !empty($params['count']) ? (int) $params['count'] : self::DEFAULT_USERS_COUNT; $boxType = !empty($params['boxType']) ? $params['boxType'] : ""; // init users short list $randId = UTIL_HtmlTag::generateAutoId('base_users_cmp'); $data = $this->getData($this->countUsers); $menuItems = array(); $dataToAssign = array(); foreach ($data as $key => $item) { $contId = "{$randId}_users_cmp_{$key}"; $toolbarId = !empty($item['toolbar']) ? "{$randId}_toolbar_{$key}" : false; $menuItems[$key] = array('label' => $item['menu-label'], 'id' => "{$randId}_users_cmp_menu_{$key}", 'contId' => $contId, 'active' => !empty($item['menu_active']), 'toolbarId' => $toolbarId, 'display' => 1); $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); } $menu = $this->getMenuCmp($menuItems); if (!empty($menu)) { $this->addComponent('menu', $menu); } // assign view variables $this->assign('widgetId', $randId); $this->assign('data', $dataToAssign); $this->assign('boxType', $boxType); }
/** * @return Constructor. */ public function __construct($groupId) { parent::__construct(); $service = GROUPS_BOL_Service::getInstance(); $groupDto = $service->findGroupById($groupId); $group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id); $imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto); OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop'); OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property'); $createDate = UTIL_DateTime::formatDate($groupDto->timeStamp); $adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId); $adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId); $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId))); OW::getDocument()->addOnloadScript($js, 1001); $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl)))); if ($service->isCurrentUserCanEdit($groupDto)) { $toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId))); } if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) { $toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag'); } $event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId)); OW::getEventManager()->trigger($event); foreach ($event->getData() as $item) { $toolbar[] = $item; } $this->assign('toolbar', $toolbar); $this->assign('group', $group); }
public function onBeforeRender() { parent::onBeforeRender(); $uniqId = uniqid('questionAdd'); $this->assign('uniqId', $uniqId); $config = OW::getConfig()->getValues(EQUESTIONS_Plugin::PLUGIN_KEY); $this->assign('configs', $config); $form = $this->initForm(); $this->addForm($form); EQUESTIONS_Plugin::getInstance()->addStatic(); $attachmentsId = null; if ($config['attachments']) { $types = array(); if ($config['attachments_image']) { $types[] = 'image'; } if ($config['attachments_video']) { $types[] = 'video'; } if ($config['attachments_link']) { $types[] = 'link'; } $attachments = new EQUESTIONS_CMP_Attachments($types); $attachments->initJs(); $this->addComponent('attachments', $attachments); $attachmentsId = $attachments->getUniqId(); } $js = UTIL_JsGenerator::newInstance()->newObject('questionsAdd', 'QUESTIONS_QuestionAdd', array($uniqId, $form->getName(), array('maxQuestionLength' => 500, 'minQuestionLength' => 3, 'maxAnswerLength' => 150), $attachmentsId)); OW::getDocument()->addOnloadScript($js); }
public function render() { $defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl(); $this->assign('defaultAvatarUrl', $defaultAvatarUrl); $js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();"; OW::getDocument()->addOnloadScript($js, 3006); //TODO check this config $enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments'); $this->assign('enableAttachments', $enableAttachments); $replyToMessageActionPromotedText = ''; $isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message'); $isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message'); if (!$isAuthorizedReplyToMessage) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message'); if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) { $replyToMessageActionPromotedText = $status['msg']; } } $this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage); $isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message'); if (!$isAuthorizedReplyToChatMessage) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message'); if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) { $replyToMessageActionPromotedText = $status['msg']; } } $this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage); $this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText); if ($isAuthorizedReplyToMessage) { $text = new WysiwygTextarea('mailbox_message'); $text->setId('conversationTextarea'); $this->assign('mailbox_message', $text->renderInput()); } return parent::render(); }
/** * Class constructor */ public function __construct($typeId) { parent::__construct(); if (!OW::getUser()->isAdmin()) { $this->setVisible(false); return; } $service = MEMBERSHIP_BOL_MembershipService::getInstance(); $type = $service->findTypeById($typeId); if (!$type) { $this->setVisible(false); return; } $types = $service->getTypeList($type->accountTypeId); $availableTypes = array(); if ($types) { foreach ($types as $mType) { if ($mType->id == $typeId) { continue; } $availableTypes[$mType->id] = $service->getMembershipTitle($mType->roleId); } } $this->assign('availableTypes', $availableTypes); $form = new MEMBERSHIP_CLASS_DeleteMembershipForm(); $this->addForm($form); $form->getElement('typeId')->setValue($typeId); if ($availableTypes) { $form->getElement('newTypeId')->addOptions($availableTypes); } }
public function __construct($layout, $params) { parent::__construct(); if (empty($params['available'])) { if (!empty($params['msg'])) { $msg = $params['msg']; } else { $msg = OW::getLanguage()->text('base', 'authorization_failed_feedback'); } $this->assign('authError', $msg); return; } switch ($layout) { case 'page': $class = ' ow_photoview_info_onpage'; break; default: if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) { $class = ' ow_photoview_pint_mode'; } else { $class = ''; } break; } $this->assign('class', $class); $this->assign('layout', $layout); }
public function __construct($items, $title = '') { parent::__construct(); $this->items = $items; $this->assign('items', $items); $this->assign('title', $title); }
/** * Constructor. * * @param array<count,label> $tagList * */ public function __construct(array $tagList = null, $url = null) { parent::__construct(); $this->tagList = $tagList; $this->url = $url; $this->service = BOL_TagService::getInstance(); }
public function __construct($entityType, $entityId, $likes = null) { parent::__construct(); if ($likes === null) { $likes = NEWSFEED_BOL_Service::getInstance()->findEntityLikes($entityType, $entityId); } $this->count = count($likes); if ($this->count == 0) { $this->setVisible(false); return; } $userIds = array(); foreach ($likes as $like) { $userIds[] = (int) $like->userId; } if ($this->count <= 3) { $displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($userIds); $urls = BOL_UserService::getInstance()->getUserUrlsForList($userIds); $langVars = array(); foreach ($userIds as $i => $userId) { $langVars['user' . ($i + 1)] = '<a href="' . $urls[$userId] . '">' . $displayNames[$userId] . '</a>'; } $string = OW::getLanguage()->text('newsfeed', 'feed_likes_' . $this->count . '_label', $langVars); } else { $url = "javascript: OW.showUsers(" . json_encode($userIds) . ")"; $string = OW::getLanguage()->text('newsfeed', 'feed_likes_list_label', array('count' => $this->count, 'url' => $url)); } $this->assign('string', $string); }