Example #1
0
 /**
  * Controller's default action
  *
  * @param array $params
  * @throws Redirect404Exception
  */
 public function index(array $params)
 {
     if (!isset($params['sectionId']) || !($sectionId = (int) $params['sectionId'])) {
         throw new Redirect404Exception();
     }
     $forumSection = $this->forumService->findSectionById($sectionId);
     if (!$forumSection || $forumSection->isHidden) {
         throw new Redirect404Exception();
     }
     $userId = OW::getUser()->getId();
     $bcItems = array(array('href' => OW::getRouter()->urlForRoute('forum-default'), 'label' => OW::getLanguage()->text('forum', 'forum_index')), array('label' => $forumSection->name));
     $breadCrumbCmp = new BASE_CMP_Breadcrumb($bcItems);
     $this->addComponent('breadcrumb', $breadCrumbCmp);
     $sectionGroupList = $this->forumService->getSectionGroupList($userId, $sectionId);
     $authors = array();
     foreach ($sectionGroupList as $section) {
         foreach ($section['groups'] as $group) {
             if (!$group['lastReply']) {
                 continue;
             }
             $id = $group['lastReply']['userId'];
             if (!in_array($id, $authors)) {
                 array_push($authors, $id);
             }
         }
     }
     $this->assign('sectionGroupList', $sectionGroupList);
     $userNames = BOL_UserService::getInstance()->getUserNamesForList($authors);
     $this->assign('userNames', $userNames);
     $displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($authors);
     $this->assign('displayNames', $displayNames);
     $this->addComponent('search', new FORUM_CMP_ForumSearch(array('scope' => 'section', 'sectionId' => $sectionId)));
     OW::getDocument()->setHeading(OW::getLanguage()->text('forum', 'forum'));
     OW::getDocument()->setHeadingIconClass('ow_ic_forum');
 }
 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()));
 }
Example #3
0
 /**
  * Returns real request uri.
  *
  * @return string
  */
 public function getRequestUri()
 {
     if ($this->uri === null) {
         $this->uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
     }
     return $this->uri;
 }
Example #4
0
 public function index()
 {
     $language = OW::getLanguage();
     OW::getDocument()->setHeading($language->text('mcompose', 'heading_configuration'));
     OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
     $this->assign('pluginUrl', 'http://www.oxwall.org/store/item/10');
     if (!$this->plugin->isAvaliable()) {
         $this->assign('avaliable', false);
         return;
     }
     $this->assign('avaliable', true);
     $settingUrl = OW::getRouter()->urlForRoute('mailbox_admin_config');
     $this->assign('settingsUrl', $settingUrl);
     $configs = OW::getConfig()->getValues('mcompose');
     $features = array();
     $features["friends"] = MCOMPOSE_CLASS_FriendsBridge::getInstance()->isActive();
     $features["groups"] = MCOMPOSE_CLASS_GroupsBridge::getInstance()->isActive();
     $features["events"] = MCOMPOSE_CLASS_EventsBridge::getInstance()->isActive();
     $form = new MCOMPOSE_ConfigForm($configs, $features);
     $this->addForm($form);
     $this->assign("configs", $configs);
     $this->assign("features", $features);
     $this->assign("activeFeatures", array_filter($features));
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         if ($form->process($_POST)) {
             OW::getFeedback()->info($language->text('mcompose', 'admin_settings_updated'));
             $this->redirect(OW::getRouter()->urlForRoute('mcompose-admin'));
         }
     }
 }
Example #5
0
 private static function detectContext()
 {
     if (self::$context !== null) {
         return;
     }
     if (defined('OW_USE_CONTEXT')) {
         switch (true) {
             case OW_USE_CONTEXT == 1:
                 self::$context = self::CONTEXT_DESKTOP;
                 return;
             case OW_USE_CONTEXT == 1 << 1:
                 self::$context = self::CONTEXT_MOBILE;
                 return;
             case OW_USE_CONTEXT == 1 << 2:
                 self::$context = self::CONTEXT_API;
                 return;
         }
     }
     $context = self::CONTEXT_DESKTOP;
     try {
         $isSmart = UTIL_Browser::isSmartphone();
     } catch (Exception $e) {
         return;
     }
     if (defined('OW_CRON')) {
         $context = self::CONTEXT_DESKTOP;
     } else {
         if (self::getSession()->isKeySet(OW_Application::CONTEXT_NAME)) {
             $context = self::getSession()->get(OW_Application::CONTEXT_NAME);
         } else {
             if ($isSmart) {
                 $context = self::CONTEXT_MOBILE;
             }
         }
     }
     if (defined('OW_USE_CONTEXT')) {
         if ((OW_USE_CONTEXT & 1 << 1) == 0 && $context == self::CONTEXT_MOBILE) {
             $context = self::CONTEXT_DESKTOP;
         }
         if ((OW_USE_CONTEXT & 1 << 2) == 0 && $context == self::CONTEXT_API) {
             $context = self::CONTEXT_DESKTOP;
         }
     }
     if ((bool) OW::getConfig()->getValue('base', 'disable_mobile_context') && $context == self::CONTEXT_MOBILE) {
         $context = self::CONTEXT_DESKTOP;
     }
     //temp API context detection
     //TODO remake
     $uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
     if (mb_strstr($uri, '/')) {
         if (trim(mb_substr($uri, 0, mb_strpos($uri, '/'))) == 'api') {
             $context = self::CONTEXT_API;
         }
     } else {
         if (trim($uri) == 'api') {
             $context = self::CONTEXT_API;
         }
     }
     self::$context = $context;
 }
Example #6
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
     $this->setAjax();
     $lang = OW::getLanguage();
     $affName = new TextField('name');
     $affName->setRequired(true);
     $affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
     $this->addElement($affName);
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $password = new PasswordField('password');
     $password->setRequired(true);
     $password->setLabel($lang->text('ocsaffiliates', 'password'));
     $this->addElement($password);
     $payment = new Textarea('payment');
     $payment->setRequired(true);
     $payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
     $this->addElement($payment);
     if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
         $terms = new CheckboxField('terms');
         $validator = new RequiredValidator();
         $validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
         $terms->addValidator($validator);
         $this->addElement($terms);
     }
     $submit = new Submit('signup');
     $submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Example #7
0
 public function __construct(BASE_CommentsParams $params, $id, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $textArea->setHasInvitation(true);
     $textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text'));
     $form->addElement($textArea);
     $hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1);
     foreach ($hiddenEls as $name => $value) {
         $el = new HiddenField($name);
         $el->setValue($value);
         $form->addElement($el);
     }
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
     //        $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}");
     //        $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}");
     $this->addForm($form);
     OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');");
     $this->assign('form', true);
     $this->assign('id', $id);
 }
 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);
     }
 }
Example #9
0
    /**
     * 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);
    }
Example #10
0
function ganalytics_admin_notification(BASE_CLASS_EventCollector $event)
{
    $wpid = OW::getConfig()->getValue('ganalytics', 'web_property_id');
    if (empty($wpid)) {
        $event->add(OW::getLanguage()->text('ganalytics', 'admin_notification_text', array('link' => OW::getRouter()->urlForRoute('ganalytics_admin'))));
    }
}
Example #11
0
    public function __construct()
    {
        parent::__construct('set-credits-form');
        $this->setAjax(true);
        $this->setAction(OW::getRouter()->urlFor('USERCREDITS_CTRL_Ajax', 'setCredits'));
        $lang = OW::getLanguage();
        $userIdField = new HiddenField('userId');
        $userIdField->setRequired(true);
        $this->addElement($userIdField);
        $balance = new TextField('balance');
        $this->addElement($balance);
        $submit = new Submit('save');
        $submit->setValue($lang->text('base', 'edit_button'));
        $this->addElement($submit);
        $js = 'owForms["' . $this->getName() . '"].bind("success", function(data){
            if ( data.error ){
                OW.error(data.error);
            }
            
            if ( data.message ) {
                OW.info(data.message);
            }

            _scope.floatBox && _scope.floatBox.close();
            _scope.callBack && _scope.callBack(data);
        });';
        OW::getDocument()->addOnloadScript($js);
    }
Example #12
0
 public function profile($paramList)
 {
     $userService = BOL_UserService::getInstance();
     /* @var $userDao BOL_User */
     $userDto = $userService->findByUsername($paramList['username']);
     if ($userDto === null) {
         throw new Redirect404Exception();
     }
     if (!OW::getUser()->isAuthorized('base', 'view_profile')) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'view_profile');
         $this->assign('permissionMessage', $status['msg']);
         return;
     }
     $eventParams = array('action' => 'base_view_profile', 'ownerId' => $userDto->id, 'viewerId' => OW::getUser()->getId());
     $displayName = BOL_UserService::getInstance()->getDisplayName($userDto->id);
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $ex) {
         throw new RedirectException(OW::getRouter()->urlForRoute('base_user_privacy_no_permission', array('username' => $displayName)));
     }
     $this->setPageTitle(OW::getLanguage()->text('base', 'profile_view_title', array('username' => $displayName)));
     $this->setPageHeading(OW::getLanguage()->text('base', 'profile_view_heading', array('username' => $displayName)));
     $this->setPageHeadingIconClass('ow_ic_user');
     $profileHeader = OW::getClassInstance("BASE_MCMP_ProfileHeader", $userDto->id);
     $this->addComponent("header", $profileHeader);
     //Profile Info
     $displayNameQuestion = OW::getConfig()->getValue('base', 'display_name_question');
     $profileInfo = OW::getClassInstance("BASE_MCMP_ProfileInfo", $userDto->id, false, array($displayNameQuestion, "birthdate"));
     $this->addComponent("info", $profileInfo);
     $this->addComponent('contentMenu', OW::getClassInstance("BASE_MCMP_ProfileContentMenu", $userDto->id));
     $this->addComponent('about', OW::getClassInstance("BASE_MCMP_ProfileAbout", $userDto->id, 80));
     $place = BOL_MobileWidgetService::PLACE_MOBILE_PROFILE;
     $this->initDragAndDrop($place, $userDto->id);
 }
Example #13
0
 public function getData(BASE_CLASS_WidgetParameter $params)
 {
     $count = (int) $params->customParamList['count'];
     $userId = OW::getUser()->getId();
     $service = OCSFAVORITES_BOL_Service::getInstance();
     $lang = OW::getLanguage();
     $router = OW::getRouter();
     $multiple = OW::getConfig()->getValue('ocsfavorites', 'can_view') && OW::getUser()->isAuthorized('ocsfavorites', 'view_users');
     $toolbar = array();
     $lists = array();
     $resultList = array();
     $toolbar['my'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.list'));
     $lists['my'] = $service->findFavoritesForUser($userId, 1, $count);
     if ($multiple) {
         $toolbar['me'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.added_list'));
         $lists['me'] = $service->findUsersWhoAddedUserAsFavorite($userId, 1, $count);
         $toolbar['mutual'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.mutual_list'));
         $lists['mutual'] = $service->findMutualFavorites($userId, 1, $count);
     }
     $this->setSettingValue(self::SETTING_TOOLBAR, array($toolbar['my']));
     $resultList['my'] = array('menu-label' => $lang->text('ocsfavorites', 'my'), 'menu_active' => true, 'userIds' => $this->getIds($lists['my'], 'favoriteId'), 'toolbar' => array($toolbar['my']));
     if ($multiple) {
         if ($lists['me']) {
             $resultList['me'] = array('menu-label' => $lang->text('ocsfavorites', 'who_added_me'), 'userIds' => $this->getIds($lists['me'], 'userId'), 'toolbar' => array($toolbar['me']));
         }
         if ($lists['mutual']) {
             $resultList['mutual'] = array('menu-label' => $lang->text('ocsfavorites', 'mutual'), 'userIds' => $this->getIds($lists['mutual'], 'userId'), 'toolbar' => array($toolbar['mutual']));
         }
     }
     return $resultList;
 }
Example #14
0
 /**
  * Default action
  */
 public function index()
 {
     $language = OW::getLanguage();
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('gphotoviewer', 'admin_menu_general'));
     $item->setUrl(OW::getRouter()->urlForRoute('gphotoviewer.admin_config'));
     $item->setKey('general');
     $item->setIconClass('ow_ic_gear_wheel');
     $item->setOrder(0);
     $menu = new BASE_CMP_ContentMenu(array($item));
     $this->addComponent('menu', $menu);
     $configs = OW::getConfig()->getValues('gphotoviewer');
     $configSaveForm = new ConfigSaveForm();
     $this->addForm($configSaveForm);
     if (OW::getRequest()->isPost() && $configSaveForm->isValid($_POST)) {
         $res = $configSaveForm->process();
         OW::getFeedback()->info($language->text('gphotoviewer', 'settings_updated'));
         $this->redirect(OW::getRouter()->urlForRoute('gphotoviewer.admin_config'));
     }
     if (!OW::getRequest()->isAjax()) {
         $this->setPageHeading(OW::getLanguage()->text('gphotoviewer', 'admin_config'));
         $this->setPageHeadingIconClass('ow_ic_picture');
         $elem = $menu->getElement('general');
         if ($elem) {
             $elem->setActive(true);
         }
     }
     $configSaveForm->getElement('enablePhotoviewer')->setValue($configs['enable_photo_viewer']);
     $configSaveForm->getElement('downloadable')->setValue($configs['can_users_to_download_photos']);
     $configSaveForm->getElement('slideshowTime')->setValue($configs['slideshow_time_per_a_photo']);
 }
Example #15
0
function payeer_add_admin_notification(BASE_CLASS_EventCollector $coll)
{
    $billingService = BOL_BillingService::getInstance();
    if (!mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_key')) && !mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_shop'))) {
        $coll->add(OW::getLanguage()->text('billingpayeer', 'plugin_configuration_notice', array('url' => OW::getRouter()->urlForRoute('billing_payeer_admin'))));
    }
}
Example #16
0
 public function index()
 {
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('ynsocialpublisher', 'admin_config'));
     $this->setPageHeadingIconClass('ow_ic_picture');
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('ynsocialpublisher', 'admin_menu_general'));
     $item->setUrl(OW::getRouter()->urlForRoute('ynsocialpublisher.admin'));
     $item->setKey('general');
     $item->setIconClass('ow_ic_gear_wheel');
     $item->setOrder(0);
     $item->setActive(true);
     $menu = new BASE_CMP_ContentMenu(array($item));
     $this->addComponent('menu', $menu);
     $service = YNSOCIALPUBLISHER_BOL_Service::getInstance();
     $plugins = $service->getEnabledPlugins();
     $this->assign('plugins', $plugins);
     $form_url = OW::getRouter()->urlForRoute('ynsocialpublisher.admin');
     $this->assign('form_url', $form_url);
     if (OW::getRequest()->isPost()) {
         // get plugins data from post
         $params = $_POST['params'];
         foreach ($params as $key => $settings) {
             if (!isset($settings['providers'])) {
                 $settings['providers'] = array();
             }
             OW::getConfig()->saveConfig('ynsocialpublisher', $key, json_encode($settings));
         }
         OW::getFeedback()->info($language->text('ynsocialpublisher', 'settings_updated'));
         $this->redirect($form_url);
     }
 }
Example #17
0
 public function __construct()
 {
     parent::__construct('add-album');
     $this->setAjax();
     $this->setAjaxResetOnSuccess(FALSE);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'));
     $ajaxFunc = new HiddenField('ajaxFunc');
     $ajaxFunc->setValue('ajaxMoveToAlbum');
     $ajaxFunc->setRequired();
     $this->addElement($ajaxFunc);
     $fromAlbum = new HiddenField('from-album');
     $fromAlbum->setRequired();
     $fromAlbum->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($fromAlbum);
     $toAlbum = new HiddenField('to-album');
     $this->addElement($toAlbum);
     $photos = new HiddenField('photos');
     $photos->setRequired();
     $this->albumPhotosValidator = new AlbumPhotosValidator();
     $photos->addValidator($this->albumPhotosValidator);
     $this->addElement($photos);
     $albumName = new TextField('album-name');
     $albumName->setRequired();
     $albumName->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE));
     $albumName->setHasInvitation(TRUE);
     $albumName->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
     $albumName->addAttribute('class', 'ow_smallmargin');
     $this->addElement($albumName);
     $desc = new Textarea('desc');
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($desc);
     $this->addElement(new Submit('add'));
 }
Example #18
0
 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));
     }
 }
Example #19
0
 /**
  * @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 __construct($conversationId, $opponentId)
 {
     parent::__construct('newMailMessageForm');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $field = new TextField('newMessageText');
     $field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
     $field->setId('newMessageText');
     $this->addElement($field);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $field = new HiddenField('conversationId');
     $field->setValue($conversationId);
     $this->addElement($field);
     $field = new HiddenField('opponentId');
     $field->setValue($opponentId);
     $this->addElement($field);
     $field = new HiddenField('uid');
     $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId));
     $this->addElement($field);
     $submit = new Submit('newMessageSendBtn');
     $submit->setId('newMessageSendBtn');
     $submit->setName('newMessageSendBtn');
     $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $js = UTIL_JsGenerator::composeJsString('
         owForms["newMailMessageForm"].bind( "submit", function( r )
         {
             $("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
         });');
         OW::getDocument()->addOnloadScript($js);
     }
     $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage'));
 }
Example #21
0
 public function __construct()
 {
     parent::__construct();
     $menuItems = array();
     $item = new BASE_MenuItem();
     $item->setLabel(OW::getLanguage()->text('profileprogressbar', 'themes_menu_item'));
     $item->setUrl(OW::getRouter()->urlForRoute('profileprogressbar.admin'));
     $item->setIconClass('ow_ic_picture');
     $item->setOrder(0);
     array_push($menuItems, $item);
     $item = new BASE_MenuItem();
     $item->setLabel(OW::getLanguage()->text('profileprogressbar', 'features_menu_item'));
     $item->setUrl(OW::getRouter()->urlForRoute('profileprogressbar.admin_features'));
     $item->setIconClass('ow_ic_flag');
     $item->setOrder(1);
     array_push($menuItems, $item);
     $item = new BASE_MenuItem();
     $item->setLabel(OW::getLanguage()->text('profileprogressbar', 'hint_menu_item'));
     $item->setUrl(OW::getRouter()->urlForRoute('profileprogressbar.admin_hint'));
     $item->setIconClass('ow_ic_comment');
     $item->setOrder(2);
     array_push($menuItems, $item);
     $this->addComponent('menu', new BASE_CMP_ContentMenu($menuItems));
     $this->document = OW::getDocument();
     $this->plugin = OW::getPluginManager()->getPlugin('profileprogressbar');
     $this->theme = OW::getConfig()->getValue('profileprogressbar', 'theme');
 }
Example #22
0
 /**
  * Default action
  */
 public function index()
 {
     $language = OW::getLanguage();
     $clipService = VIDEO_BOL_ClipService::getInstance();
     $userId = OW::getUser()->getId();
     if (!OW::getUser()->isAuthorized('video', 'add')) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('video', 'add');
         throw new AuthorizationException($status['msg']);
     }
     if (!($clipService->findUserClipsCount($userId) <= $clipService->getUserQuotaConfig())) {
         $this->assign('auth_msg', $language->text('video', 'quota_exceeded', array('limit' => $clipService->getUserQuotaConfig())));
     } else {
         $this->assign('auth_msg', null);
         $videoAddForm = new videoAddForm();
         $this->addForm($videoAddForm);
         if (OW::getRequest()->isPost() && $videoAddForm->isValid($_POST)) {
             $values = $videoAddForm->getValues();
             $code = $clipService->validateClipCode($values['code']);
             if (!mb_strlen($code)) {
                 OW::getFeedback()->warning($language->text('video', 'resource_not_allowed'));
                 $this->redirect();
             }
             $res = $videoAddForm->process();
             OW::getFeedback()->info($language->text('video', 'clip_added'));
             $this->redirect(OW::getRouter()->urlForRoute('view_clip', array('id' => $res['id'])));
         }
     }
     if (!OW::getRequest()->isAjax()) {
         OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'video', 'video');
     }
     OW::getDocument()->setHeading($language->text('video', 'page_title_add_video'));
     OW::getDocument()->setHeadingIconClass('ow_ic_video');
     OW::getDocument()->setTitle($language->text('video', 'meta_title_video_add'));
     OW::getDocument()->setDescription($language->text('video', 'meta_description_video_add'));
 }
Example #23
0
function contactus_handler_after_install(BASE_CLASS_EventCollector $event)
{
    if (count(CONTACTUS_BOL_Service::getInstance()->getDepartmentList()) < 1) {
        $url = OW::getRouter()->urlForRoute('contactus.admin');
        $event->add(OW::getLanguage()->text('contactus', 'after_install_notification', array('url' => $url)));
    }
}
Example #24
0
 /**
  * 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'));
 }
Example #25
0
 public function index($params)
 {
     if (OW::getUser()->isAuthenticated()) {
         $this->redirect(OW::getRouter()->urlForRoute('base_index'));
     }
     parent::index($params);
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getMobileCtrlViewDir() . 'join_index.html');
     $urlParams = $_GET;
     if (is_array($params) && !empty($params)) {
         $urlParams = array_merge($_GET, $params);
     }
     /* @var $form JoinForm */
     $form = $this->joinForm;
     if (!empty($form)) {
         $this->joinForm->setAction(OW::getRouter()->urlFor('BASE_MCTRL_Join', 'joinFormSubmit', $urlParams));
         BASE_MCLASS_JoinFormUtlis::setLabels($form, $form->getSortedQuestionsList());
         BASE_MCLASS_JoinFormUtlis::setInvitations($form, $form->getSortedQuestionsList());
         BASE_MCLASS_JoinFormUtlis::setColumnCount($form);
         $displayPhotoUpload = OW::getConfig()->getValue('base', 'join_display_photo_upload');
         $this->assign('requiredPhotoUpload', $displayPhotoUpload == BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD);
         $this->assign('presentationToClass', $this->presentationToCssClass());
         $element = $this->joinForm->getElement('userPhoto');
         $this->assign('photoUploadId', 'userPhoto');
         if ($element) {
             $this->assign('photoUploadId', $element->getId());
         }
         BASE_MCLASS_JoinFormUtlis::addOnloadJs($form->getName());
     }
 }
Example #26
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     if (!OW::getUser()->isAdmin()) {
         throw new AuthenticateException();
     }
     if (!OW::getRequest()->isAjax()) {
         $document = OW::getDocument();
         $document->setMasterPage(new ADMIN_CLASS_MasterPage());
         $this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title'));
     }
     BOL_PluginService::getInstance()->checkManualUpdates();
     $plugin = BOL_PluginService::getInstance()->findNextManualUpdatePlugin();
     $handlerParams = OW::getRequestHandler()->getHandlerAttributes();
     // TODO refactor shortcut below
     if (!defined('OW_PLUGIN_XP') && $plugin !== null) {
         if ($handlerParams['controller'] === 'ADMIN_CTRL_Plugins' && $handlerParams['action'] === 'manualUpdateRequest') {
             //action
         } else {
             throw new RedirectException(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'manualUpdateRequest', array('key' => $plugin->getKey())));
         }
     }
     // TODO temp admin pge inform event
     function admin_check_if_admin_page()
     {
         return true;
     }
     OW::getEventManager()->bind('admin.check_if_admin_page', 'admin_check_if_admin_page');
 }
Example #27
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct('update-question-form');
     $this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion'));
     $lang = OW::getLanguage();
     $questionId = new HiddenField('questionId');
     $questionId->setRequired(true);
     $this->addElement($questionId);
     $question = new TextField('question');
     $question->setRequired(true);
     $question->setLabel($lang->text('ocsfaq', 'question'));
     $this->addElement($question);
     $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
     $answer = new WysiwygTextarea('answer', $btnSet);
     $answer->setRequired(true);
     $answer->setLabel($lang->text('ocsfaq', 'answer'));
     $this->addElement($answer);
     $isFeatured = new CheckboxField('isFeatured');
     $isFeatured->setLabel($lang->text('ocsfaq', 'is_featured'));
     $this->addElement($isFeatured);
     $categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories();
     if ($categories) {
         $category = new Selectbox('category');
         foreach ($categories as $cat) {
             $category->addOption($cat->id, $cat->name);
         }
         $category->setLabel($lang->text('ocsfaq', 'category'));
         $this->addElement($category);
     }
     // submit
     $submit = new Submit('update');
     $submit->setValue($lang->text('ocsfaq', 'btn_save'));
     $this->addElement($submit);
 }
 public function onGetInfo(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     $entityList = $this->service->findClipByIds($params["entityIds"]);
     $out = array();
     foreach ($entityList as $entity) {
         /* @var $entity VIDEO_BOL_Clip */
         $info = array();
         $info["id"] = $entity->id;
         $info["userId"] = $entity->userId;
         $info["title"] = $entity->title;
         $info["description"] = $entity->description;
         $info["url"] = $url = OW::getRouter()->urlForRoute('view_clip', array('id' => $entity->id));
         $info["html"] = $entity->code;
         $info["timeStamp"] = $entity->addDatetime;
         $info["provider"] = $entity->provider;
         $info["image"] = array("thumbnail" => $this->service->getClipThumbUrl($entity->id));
         if ($info["image"]["thumbnail"] == "undefined") {
             $info["image"]["thumbnail"] = $this->service->getClipDefaultThumbUrl();
         }
         $info["status"] = $entity->status == "approved" ? BOL_ContentService::STATUS_ACTIVE : BOL_ContentService::STATUS_APPROVAL;
         $out[$entity->id] = $info;
     }
     $event->setData($out);
     return $out;
 }
 public function __construct()
 {
     parent::__construct('delete-membership-form');
     $this->setAjaxResetOnSuccess(false);
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlForRoute('membership_delete_type'));
     $lang = OW::getLanguage();
     $typeId = new HiddenField('typeId');
     $typeId->setRequired(true);
     $this->addElement($typeId);
     $newTypeId = new Selectbox('newTypeId');
     $newTypeId->setHasInvitation(false);
     $this->addElement($newTypeId);
     $types = new RadioGroupItemField('type');
     $types->setRequired(true);
     $types->setLabel($lang->text('membership', 'set_membership'));
     $this->addElement($types);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function( data ) {\n                if ( data.result ) {\n                    document.location.reload();\n                }\n            }");
     $script = '$("#btn-confirm-type-delete").click(function(){
         if ( confirm(' . json_encode($lang->text('membership', 'type_delete_confirm')) . ') ) {
              $(this).parents("form:eq(0)").submit();
         }
     });
     ';
     OW::getDocument()->addOnloadScript($script);
 }
Example #30
0
 public function onConsolePagesCollect(BASE_CLASS_EventCollector $event)
 {
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'underscore-min.js', 'text/javascript', 3000);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'backbone-min.js', 'text/javascript', 3000);
     //        OW::getDocument()->addScript( OW::getPluginManager()->getPlugin('base')->getStaticJsUrl().'backbone.js', 'text/javascript', 3000 );
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'mobile_mailbox.js', 'text/javascript', 3000);
     $userListUrl = OW::getRouter()->urlForRoute('mailbox_user_list');
     $convListUrl = OW::getRouter()->urlForRoute('mailbox_conv_list');
     $authorizationResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'authorization');
     $pingResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'ping');
     $getHistoryResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'getHistory');
     $userId = OW::getUser()->getId();
     $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
     $avatarUrl = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     if (empty($avatarUrl)) {
         $avatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $profileUrl = BOL_UserService::getInstance()->getUserUrl($userId);
     $lastSentMessage = MAILBOX_BOL_ConversationService::getInstance()->getLastSentMessage($userId);
     $lastMessageTimestamp = (int) ($lastSentMessage ? $lastSentMessage->timeStamp : 0);
     $params = array('getHistoryResponderUrl' => $getHistoryResponderUrl, 'pingResponderUrl' => $pingResponderUrl, 'authorizationResponderUrl' => $authorizationResponderUrl, 'userListUrl' => $userListUrl, 'convListUrl' => $convListUrl, 'pingInterval' => 5000, 'lastMessageTimestamp' => $lastMessageTimestamp, 'user' => array('userId' => $userId, 'displayName' => $displayName, 'profileUrl' => $profileUrl, 'avatarUrl' => $avatarUrl));
     $js = UTIL_JsGenerator::composeJsString('OWM.Mailbox = new MAILBOX_Mobile({$params});', array('params' => $params));
     OW::getDocument()->addOnloadScript($js, 'text/javascript', 3000);
     $event->add(array('key' => 'convers', 'cmpClass' => 'MAILBOX_MCMP_ConsoleConversationsPage', 'order' => 2));
 }