示例#1
0
 public function getMenu()
 {
     $language = OW::getLanguage();
     $menu = new BASE_CMP_ContentMenu();
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('all');
     $menuItem->setPrefix('questions');
     $menuItem->setLabel($language->text('equestions', 'list_all_tab'));
     $menuItem->setOrder(1);
     $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-all'));
     $menuItem->setIconClass('ow_ic_lens');
     $menu->addElement($menuItem);
     if (OW::getUser()->isAuthenticated()) {
         if (OW::getPluginManager()->isPluginActive('friends')) {
             $menuItem = new BASE_MenuItem();
             $menuItem->setKey('friends');
             $menuItem->setPrefix('questions');
             $menuItem->setLabel($language->text('equestions', 'list_friends_tab'));
             $menuItem->setOrder(2);
             $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-friends'));
             $menuItem->setIconClass('ow_ic_user');
             $menu->addElement($menuItem);
         }
         $menuItem = new BASE_MenuItem();
         $menuItem->setKey('my');
         $menuItem->setPrefix('questions');
         $menuItem->setLabel($language->text('equestions', 'list_my_tab'));
         $menuItem->setOrder(3);
         $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-my'));
         $menuItem->setIconClass('ow_ic_user');
         $menu->addElement($menuItem);
     }
     return $menu;
 }
示例#2
0
 function getMenu()
 {
     $language = OW::getLanguage();
     $menu = new BASE_CMP_ContentMenu();
     $menuItems = array();
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('spvideolite', 'adm_menu_tweaks'));
     $item->setUrl(OW::getRouter()->urlForRoute('spvideolite.admin'));
     $item->setKey('tweaks');
     $item->setIconClass('ow_ic_star');
     $item->setOrder(0);
     $menuItems[] = $item;
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('spvideolite', 'adm_menu_upload'));
     $item->setUrl(OW::getRouter()->urlForRoute('spvideolite.admin_upload'));
     $item->setKey('help');
     $item->setIconClass('ow_ic_attach');
     $item->setOrder(1);
     $menuItems[] = $item;
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('spvideolite', 'adm_menu_help'));
     $item->setUrl(OW::getRouter()->urlForRoute('spvideolite.admin_help'));
     $item->setKey('help');
     $item->setIconClass('ow_ic_help');
     $item->setOrder(2);
     $menuItems[] = $item;
     $menu->setMenuItems($menuItems);
     $menu->deactivateElements();
     return $menu;
 }
示例#3
0
文件: admin.php 项目: vazahat/dudex
 public function __construct()
 {
     parent::__construct();
     if (OW::getRequest()->isAjax()) {
         return;
     }
     $language = OW::getLanguage();
     $menu = new BASE_CMP_ContentMenu();
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('steps');
     $menuItem->setLabel($language->text('sitetour', 'admin_steps'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('sitetour_admin'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(1);
     $menu->addElement($menuItem);
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('settings');
     $menuItem->setLabel($language->text('sitetour', 'admin_settings'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('sitetour_settings'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(2);
     $menu->addElement($menuItem);
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('console');
     $menuItem->setLabel($language->text('sitetour', 'admin_console'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('sitetour_console'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(3);
     $menu->addElement($menuItem);
     $this->addComponent('menu', $menu);
     $this->menu = $menu;
 }
示例#4
0
文件: admin.php 项目: vazahat/dudex
 public function __construct()
 {
     parent::__construct();
     if (OW::getRequest()->isAjax()) {
         return;
     }
     $language = OW::getLanguage();
     $menu = new BASE_CMP_ContentMenu();
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('admin-index');
     $menuItem->setLabel($language->text('sponsors', 'admin_tab_general_title'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('sponsors_admin'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(1);
     $menu->addElement($menuItem);
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('admin-list');
     $menuItem->setLabel($language->text('sponsors', 'admin_sponsors_list'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('sponsors_admin_list'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(2);
     $menu->addElement($menuItem);
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('admin-add');
     $menuItem->setLabel($language->text('sponsors', 'admin_add_sponsor'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('sponsors_admin_add'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(3);
     $menu->addElement($menuItem);
     $this->addComponent('menu', $menu);
     $this->menu = $menu;
 }
示例#5
0
文件: admin.php 项目: vazahat/dudex
 public function __construct()
 {
     parent::__construct();
     if (OW::getRequest()->isAjax()) {
         return;
     }
     $language = OW::getLanguage();
     $menu = new BASE_CMP_ContentMenu();
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('admin-index');
     $menuItem->setLabel($language->text('advancedphoto', 'admin_tab_general_title'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('advancedphoto_admin_config'));
     $menuItem->setIconClass('ow_ic_files');
     $menuItem->setOrder(1);
     $menu->addElement($menuItem);
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('categories');
     $menuItem->setLabel($language->text('advancedphoto', 'admin_category_tab_title'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('advancedphoto_categories'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(2);
     $menu->addElement($menuItem);
     $this->addComponent('menu', $menu);
     $this->menu = $menu;
     $this->setPageHeading(OW::getLanguage()->text('advancedphoto', 'admin_settings_title'));
     $this->setPageTitle(OW::getLanguage()->text('advancedphoto', 'admin_settings_title'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
 }
示例#6
0
文件: theme.php 项目: ZyXelP/oxwall
 public function settings()
 {
     $dto = $this->themeService->findThemeByKey(OW::getConfig()->getValue('base', 'selectedTheme'));
     if ($dto === null) {
         throw new LogicException("Can't find theme `" . OW::getConfig()->getValue('base', 'selectedTheme') . "`");
     }
     $assignArray = (array) json_decode($dto->getDescription());
     $assignArray['iconUrl'] = $this->themeService->getStaticUrl($dto->getKey()) . BOL_ThemeService::ICON_FILE;
     $assignArray['name'] = $dto->getKey();
     $assignArray['title'] = $dto->getTitle();
     $this->assign('themeInfo', $assignArray);
     $this->assign('resetUrl', OW::getRouter()->urlFor(__CLASS__, 'reset'));
     $controls = $this->themeService->findThemeControls($dto->getId());
     if (empty($controls)) {
         $this->assign('noControls', true);
     } else {
         $form = new ThemeEditForm($controls);
         $this->assign('inputArray', $form->getFormElements());
         $this->addForm($form);
         if (OW::getRequest()->isPost()) {
             if ($form->isValid($_POST)) {
                 $this->themeService->saveThemeControls($dto->getId(), $form->getValues());
                 $this->themeService->updateCustomCssFile($dto->getId());
                 $this->redirect();
             }
         }
     }
     $this->menu->getElement('settings')->setActive(true);
 }
示例#7
0
 public function __construct()
 {
     $event = new BASE_CLASS_EventCollector('base.dashboard_menu_items');
     OW::getEventManager()->trigger($event);
     $menuItems = $event->getData();
     parent::__construct($menuItems);
 }
示例#8
0
 public static function getMenu($activeListType)
 {
     $language = OW::getLanguage();
     $menuArray = array(array('label' => $language->text('base', 'user_list_menu_item_latest'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'latest')), 'iconClass' => 'ow_ic_clock', 'key' => 'latest', 'order' => 1), array('label' => $language->text('base', 'user_list_menu_item_online'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'online')), 'iconClass' => 'ow_ic_push_pin', 'key' => 'online', 'order' => 3), array('label' => $language->text('base', 'user_search_menu_item_label'), 'url' => OW::getRouter()->urlForRoute('users-search'), 'iconClass' => 'ow_ic_lens', 'key' => 'search', 'order' => 4));
     if (BOL_UserService::getInstance()->countFeatured() > 0) {
         $menuArray[] = array('label' => $language->text('base', 'user_list_menu_item_featured'), 'url' => OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'featured')), 'iconClass' => 'ow_ic_push_pin', 'key' => 'featured', 'order' => 2);
     }
     $event = new BASE_CLASS_EventCollector('base.add_user_list');
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     if (!empty($data)) {
         $menuArray = array_merge($menuArray, $data);
     }
     $menu = new BASE_CMP_ContentMenu();
     foreach ($menuArray as $item) {
         $menuItem = new BASE_MenuItem();
         $menuItem->setLabel($item['label']);
         $menuItem->setIconClass($item['iconClass']);
         $menuItem->setUrl($item['url']);
         $menuItem->setKey($item['key']);
         $menuItem->setOrder(empty($item['order']) ? 999 : $item['order']);
         $menu->addElement($menuItem);
         if ($activeListType == $item['key']) {
             $menuItem->setActive(true);
         }
     }
     return $menu;
 }
示例#9
0
 /**
  * Tagged video list view action
  *
  * @param array $params
  * @throws AuthorizationException
  */
 public function viewTaggedList(array $params = null)
 {
     // is moderator
     $modPermissions = OW::getUser()->isAuthorized('video');
     if (!OW::getUser()->isAuthorized('video', 'view') && !$modPermissions) {
         $error = BOL_AuthorizationService::getInstance()->getActionStatus('video', 'view');
         throw new AuthorizationException($error['msg']);
     }
     $tag = !empty($params['tag']) ? trim(htmlspecialchars(urldecode($params['tag']))) : '';
     $this->addComponent('videoMenu', $this->menu);
     $this->menu->getElement('tagged')->setActive(true);
     $this->setTemplate(OW::getPluginManager()->getPlugin('video')->getCtrlViewDir() . 'video_view_list-tagged.html');
     $listUrl = OW::getRouter()->urlForRoute('view_tagged_list_st');
     OW::getDocument()->addScript($this->pluginJsUrl . 'video_tag_search.js');
     $objParams = array('listUrl' => $listUrl);
     $script = "\$(document).ready(function(){\n                var videoSearch = new videoTagSearch(" . json_encode($objParams) . ");\n            }); ";
     OW::getDocument()->addOnloadScript($script);
     if (strlen($tag)) {
         $this->assign('tag', $tag);
         OW::getDocument()->setTitle(OW::getLanguage()->text('video', 'meta_title_video_tagged_as', array('tag' => $tag)));
         OW::getDocument()->setDescription(OW::getLanguage()->text('video', 'meta_description_video_tagged_as', array('tag' => $tag)));
     } else {
         $tags = new BASE_CMP_EntityTagCloud('video');
         $tags->setRouteName('view_tagged_list');
         $this->addComponent('tags', $tags);
         OW::getDocument()->setTitle(OW::getLanguage()->text('video', 'meta_title_video_tagged'));
         $tagsArr = BOL_TagService::getInstance()->findMostPopularTags('video', 20);
         $labels = array();
         foreach ($tagsArr as $t) {
             $labels[] = $t['label'];
         }
         $tagStr = $tagsArr ? implode(', ', $labels) : '';
         OW::getDocument()->setDescription(OW::getLanguage()->text('video', 'meta_description_video_tagged', array('topTags' => $tagStr)));
     }
     $this->assign('listType', 'tagged');
     // check auth
     $showAddButton = true;
     $status = BOL_AuthorizationService::getInstance()->getActionStatus('video', 'add');
     if ($status['status'] == BOL_AuthorizationService::STATUS_AVAILABLE) {
         $script = '$("#btn-add-new-video").click(function(){
             document.location.href = ' . json_encode(OW::getRouter()->urlFor('VIDEO_CTRL_Add', 'index')) . ';
         });';
         OW::getDocument()->addOnloadScript($script);
     } else {
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $script = '$("#btn-add-new-video").click(function(){
             OW.authorizationLimitedFloatbox(' . json_encode($status['msg']) . ');
         });';
             OW::getDocument()->addOnloadScript($script);
         } else {
             $showAddButton = false;
         }
     }
     $this->assign('showAddButton', $showAddButton);
     OW::getDocument()->setHeading(OW::getLanguage()->text('video', 'page_title_browse_video'));
     OW::getDocument()->setHeadingIconClass('ow_ic_video');
 }
示例#10
0
 /**
  * 
  * @return BASE_CMP_ContentMenu
  */
 protected function getMenu()
 {
     $event = new BASE_CLASS_EventCollector("base.moderation_tools.collect_menu");
     OW::getEventManager()->trigger($event);
     $menuData = $event->getData();
     if (empty($menuData)) {
         return null;
     }
     $menu = new BASE_CMP_ContentMenu();
     foreach (array_reverse($menuData) as $item) {
         $element = new BASE_MenuItem();
         $element->setUrl($item["url"]);
         $element->setLabel($item["label"]);
         $element->setIconClass($item["iconClass"]);
         $element->setKey($item["key"]);
         $menu->addElement($element);
     }
     return $menu;
 }
示例#11
0
文件: admin.php 项目: vazahat/dudex
 public function __construct()
 {
     parent::__construct();
     if (OW::getRequest()->isAjax()) {
         return;
     }
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $menu = new BASE_CMP_ContentMenu();
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('admin-index');
     $menuItem->setLabel($language->text('eventx', 'admin_tab_general_title'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('eventx_admin_index'));
     $menuItem->setIconClass('ow_ic_files');
     $menuItem->setOrder(1);
     $menu->addElement($menuItem);
     if ($config->getValue('eventx', 'enableCategoryList') == '1') {
         $menuItem = new BASE_MenuItem();
         $menuItem->setKey('categories');
         $menuItem->setLabel($language->text('eventx', 'admin_category_tab_title'));
         $menuItem->setUrl(OW::getRouter()->urlForRoute('eventx_admin_categories'));
         $menuItem->setIconClass('ow_ic_gear_wheel');
         $menuItem->setOrder(2);
         $menu->addElement($menuItem);
     }
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('approval');
     $menuItem->setLabel($language->text('eventx', 'admin_pending_approval'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('eventx_admin_approval'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(3);
     $menu->addElement($menuItem);
     if ($config->getValue('eventx', 'enableCalendar') == '1') {
         $menuItem = new BASE_MenuItem();
         $menuItem->setKey('calendar');
         $menuItem->setLabel($language->text('eventx', 'admin_calendar_tab'));
         $menuItem->setUrl(OW::getRouter()->urlForRoute('eventx_admin_calendar'));
         $menuItem->setIconClass('ow_ic_calendar');
         $menuItem->setOrder(4);
         $menu->addElement($menuItem);
     }
     if (is_dir(OW_DIR_PLUGIN . 'event')) {
         $menuItem = new BASE_MenuItem();
         $menuItem->setKey('import');
         $menuItem->setLabel($language->text('eventx', 'admin_import_tab'));
         $menuItem->setUrl(OW::getRouter()->urlForRoute('eventx_admin_import'));
         $menuItem->setIconClass('ow_ic_gear_wheel');
         $menuItem->setOrder(5);
         $menu->addElement($menuItem);
     }
     $this->addComponent('menu', $menu);
     $this->menu = $menu;
     $this->setPageHeading(OW::getLanguage()->text('eventx', 'admin_settings_title'));
     $this->setPageTitle(OW::getLanguage()->text('eventx', 'admin_settings_title'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
 }
示例#12
0
文件: admin.php 项目: vazahat/dudex
 public function __construct()
 {
     parent::__construct();
     if (OW::getRequest()->isAjax()) {
         return;
     }
     $language = OW::getLanguage();
     $menu = new BASE_CMP_ContentMenu();
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('admin-index');
     $menuItem->setLabel($language->text('ivideo', 'admin_tab_general_title'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('ivideo_admin'));
     $menuItem->setIconClass('ow_ic_files');
     $menuItem->setOrder(1);
     $menu->addElement($menuItem);
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('categories');
     $menuItem->setLabel($language->text('ivideo', 'admin_category_tab_title'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('ivideo_categories'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(2);
     $menu->addElement($menuItem);
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('approval');
     $menuItem->setLabel($language->text('ivideo', 'admin_pending_approval'));
     $menuItem->setUrl(OW::getRouter()->urlForRoute('ivideo_admin_approval'));
     $menuItem->setIconClass('ow_ic_gear_wheel');
     $menuItem->setOrder(3);
     $menu->addElement($menuItem);
     $this->addComponent('menu', $menu);
     $this->menu = $menu;
     $this->assign('videosPerRow', OW::getConfig()->getValue('ivideo', 'videosPerRow'));
     $this->assign('addItemAuthorized', OW::getUser()->isAuthenticated() && OW::getUser()->isAuthorized('ivideo', 'add'));
     $this->setPageHeading(OW::getLanguage()->text('ivideo', 'admin_settings_title'));
     $this->setPageTitle(OW::getLanguage()->text('ivideo', 'admin_settings_title'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
 }
示例#13
0
 public function manage()
 {
     $this->menu->getElement('manage')->setActive(true);
     $language = OW::getLanguage();
     $event = new BASE_CLASS_EventCollector('ads.enabled_plugins');
     OW::getEventManager()->trigger($event);
     $pluginList = $event->getData();
     $pluginsArray = array();
     $first = false;
     /* @var $pluginObj BOL_Plugin */
     foreach ($pluginList as $plugin) {
         $pluginObj = OW::getPluginManager()->getPlugin($plugin);
         if ($pluginObj === null) {
             continue;
         }
         $pluginsArray[$pluginObj->getDto()->getKey()] = strtolower($pluginObj->getDto()->getKey()) === 'base' ? $language->text('ads', 'ads_manage_global_label') : $pluginObj->getDto()->getTitle();
         if (!$first) {
             $first = $pluginObj->getDto()->getKey();
         }
     }
     $selected = isset($_GET['plugin']) && in_array(trim($_GET['plugin']), array_keys($pluginsArray)) ? trim($_GET['plugin']) : $first;
     $topForm = $this->getManageForm('top_form');
     $this->addForm($topForm);
     $topForm->getElement('plugin_key')->setValue($selected);
     $topForm->getElement('banners')->setValue($this->adsService->findBannerIdList(ADS_BOL_Service::BANNER_POSITION_TOP, $selected));
     $sidebarForm = $this->getManageForm('sidebar_form');
     $sidebarForm->getElement('plugin_key')->setValue($selected);
     $sidebarForm->getElement('banners')->setValue($this->adsService->findBannerIdList(ADS_BOL_Service::BANNER_POSITION_SIDEBAR, $selected));
     $this->addForm($sidebarForm);
     $bottomForm = $this->getManageForm('bottom_form');
     $bottomForm->getElement('plugin_key')->setValue($selected);
     $bottomForm->getElement('banners')->setValue($this->adsService->findBannerIdList(ADS_BOL_Service::BANNER_POSITION_BOTTOM, $selected));
     $this->addForm($bottomForm);
     $this->assign('plugins', $pluginsArray);
     $this->assign('selected', $selected);
     $this->assign('top_link_label', $language->text('ads', 'ads_banners_count_label', array('count' => $this->adsService->findBannersCount('top', $selected))));
     $this->assign('sidebar_link_label', $language->text('ads', 'ads_banners_count_label', array('count' => $this->adsService->findBannersCount('sidebar', $selected))));
     $this->assign('bottom_link_label', $language->text('ads', 'ads_banners_count_label', array('count' => $this->adsService->findBannersCount('bottom', $selected))));
     $this->assign('sidebarPosition', OW::getThemeManager()->getSelectedTheme()->getDto()->getSidebarPosition());
     $floatboxCapLabel = $language->text('ads', 'ads_banners_add_floatbox_label');
     $script = "\$('#top_link').click(function(){window.adsForm = new OW_FloatBox({\$title:'" . $floatboxCapLabel . "', \$contents: \$('#top_form'), width: '550px'})});";
     $script .= "\$('#bottom_link').click(function(){window.adsForm = new OW_FloatBox({\$title:'" . $floatboxCapLabel . "', \$contents: \$('#bottom_form'), width: '550px'})});";
     $script .= "\$('#sidebar_link').click(function(){window.adsForm = new OW_FloatBox({\$title:'" . $floatboxCapLabel . "', \$contents: \$('#sidebar_form'), width: '550px'})});";
     OW::getDocument()->addOnloadScript($script);
 }
示例#14
0
文件: photo.php 项目: vazahat/dudex
 /**
  * Tagged photo list action
  *
  * @param array $params
  */
 public function viewTaggedList(array $params = null)
 {
     if (isset($params['tag'])) {
         $tag = htmlspecialchars(urldecode($params['tag']));
     }
     // is moderator
     $modPermissions = OW::getUser()->isAuthorized('photo');
     if (!$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
         $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
         return;
     }
     $this->addComponent('photoMenu', $this->menu);
     $this->menu->getElement('tagged')->setActive(true);
     $this->setTemplate(OW::getPluginManager()->getPlugin('photo')->getCtrlViewDir() . 'photo_view_list-tagged.html');
     $listUrl = OW::getRouter()->urlForRoute('view_tagged_photo_list_st');
     OW::getDocument()->addScript($this->pluginJsUrl . 'photo_tag_search.js');
     $objParams = array('listUrl' => $listUrl);
     $script = "\$(document).ready(function(){\n                var photoSearch = new photoTagSearch(" . json_encode($objParams) . ");\n            }); ";
     OW::getDocument()->addOnloadScript($script);
     if (isset($tag)) {
         $this->assign('tag', $tag);
         OW::getDocument()->setTitle(OW::getLanguage()->text('photo', 'meta_title_photo_tagged_as', array('tag' => $tag)));
         OW::getDocument()->setDescription(OW::getLanguage()->text('photo', 'meta_description_photo_tagged_as', array('tag' => $tag)));
     } else {
         $tags = new BASE_CMP_EntityTagCloud('photo');
         $tags->setRouteName('view_tagged_photo_list');
         $this->addComponent('tags', $tags);
         OW::getDocument()->setTitle(OW::getLanguage()->text('photo', 'meta_title_photo_tagged'));
         $tagsArr = BOL_TagService::getInstance()->findMostPopularTags('photo', 20);
         $labels = array();
         foreach ($tagsArr as $t) {
             $labels[] = $t['label'];
         }
         $tagStr = $tagsArr ? implode(', ', $labels) : '';
         OW::getDocument()->setDescription(OW::getLanguage()->text('photo', 'meta_description_photo_tagged', array('topTags' => $tagStr)));
     }
     $this->assign('listType', 'tagged');
     $this->assign('canAdd', OW::getUser()->isAuthorized('photo', 'upload'));
     OW::getDocument()->setHeading(OW::getLanguage()->text('photo', 'page_title_browse_photos'));
     OW::getDocument()->setHeadingIconClass('ow_ic_picture');
     $js = UTIL_JsGenerator::newInstance()->newVariable('addNewUrl', OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'index'))->jQueryEvent('#btn-add-new-photo', 'click', 'document.location.href = addNewUrl');
     OW::getDocument()->addOnloadScript($js);
 }
示例#15
0
 public function __construct()
 {
     parent::__construct();
     $template = OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'content_menu.html';
     $this->setTemplate($template);
     $event = new BASE_CLASS_EventCollector(CONTACTIMPORTER_CLASS_EventHandler::EVENT_COLLECT_PROVIDERS);
     OW::getEventManager()->trigger($event);
     $providers = $event->getData();
     for ($i = 0; $i < count($providers); $i++) {
         $p = $providers[$i];
         if (empty($p['settigsUrl'])) {
             continue;
         }
         $item = new BASE_MenuItem();
         $item->setLabel($p['title']);
         $item->setUrl($p['settigsUrl']);
         $item->setKey($p['key']);
         $item->setIconClass($p['iconClass']);
         $item->setOrder($i);
         $this->addElement($item);
     }
 }
示例#16
0
文件: list.php 项目: vazahat/dudex
 public function index()
 {
     if (!OW::getUser()->isAuthorized('links', 'view')) {
         $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
         return;
     }
     $this->assign('addNew_isAuthorized', OW::getUser()->isAuthenticated() && OW::getUser()->isAuthorized('links', 'add'));
     switch (OW::getConfig()->getValue('links', 'result_mode')) {
         case LinkService::RESULT_MODE_SUM:
             $this->assign('mode', 'sum');
             break;
         case LinkService::RESULT_MODE_DETAILED:
             $this->assign('mode', 'detailed');
             break;
     }
     $this->setPageHeading(OW::getLanguage()->text('links', 'list_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_link');
     $plugin = OW::getPluginManager()->getPlugin('links');
     OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, $plugin->getKey(), 'main_menu_item');
     if (false === strstr($_SERVER['REQUEST_URI'], 'browse-by-tag')) {
         $isBrowseByTagCase = false;
     } else {
         $this->assign('tag', empty($_GET['tag']) ? '' : strip_tags($_GET['tag']));
         $isBrowseByTagCase = true;
     }
     $this->assign('isBrowseByTagCase', $isBrowseByTagCase);
     $tagCloud = new BASE_CMP_EntityTagCloud('link', OW::getRouter()->urlForRoute('links-by-tag'));
     if ($isBrowseByTagCase) {
         $tagCloud->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'big_tag_cloud.html');
     }
     $this->addComponent('tagCloud', $tagCloud);
     $tagSearch = new BASE_CMP_TagSearch(OW::getRouter()->urlForRoute('links-by-tag'));
     $this->addComponent('tagSearch', $tagSearch);
     //~~
     $menu = new BASE_CMP_ContentMenu($this->getMenuItems());
     $this->assign('menu', $menu->render());
     $service = LinkService::getInstance();
     $rpp = (int) OW::getConfig()->getValue('links', 'results_per_page');
     $page = !empty($_GET['page']) && (int) $_GET['page'] ? (int) $_GET['page'] : 1;
     $first = ($page - 1) * $rpp;
     $count = $rpp;
     $list = array();
     $itemsCount = 0;
     list($list, $itemsCount) = $this->getData($first, $count);
     $descLength = 120;
     //$this->assign('descLength', $descLength);
     $titleLength = 50;
     $this->assign('titleLength', $titleLength);
     $voteService = BOL_VoteService::getInstance();
     $idList = array();
     $links = array();
     $voteTotall = array();
     $authorIdList = array();
     $commentTotall = array();
     foreach ($list as $item) {
         $link = $item['dto'];
         $link->setUrl(strip_tags($link->getUrl()));
         $link->setTitle(strip_tags($link->getTitle()));
         $description = BASE_CMP_TextFormatter::fromBBtoHtml($link->getDescription());
         $description = strip_tags($description);
         if (strlen($description) > $descLength) {
             $description = UTIL_String::truncate($description, $descLength, '...');
             $description .= ' <a href="' . OW::getRouter()->urlForRoute('link', array('id' => $link->getId())) . '" class="ow_lbutton">' . OW::getLanguage()->text('base', 'more') . '</a>';
         }
         $link->setDescription($description);
         $links[$link->getId()] = array('dto' => $link);
         $idList[] = $link->getId();
         $authorIdList[] = $link->getUserId();
     }
     $ulist = BOL_UserService::getInstance()->getUserNamesForList($authorIdList);
     $nlist = BOL_UserService::getInstance()->getDisplayNamesForList($authorIdList);
     $this->assign('usernameList', $ulist);
     $this->assign('nameList', $nlist);
     if (!empty($idList)) {
         $commentTotall = BOL_CommentService::getInstance()->findCommentCountForEntityList('link', $idList);
         $voteTotall = $voteService->findTotalVotesResultForList($idList, 'link');
         $tagsInfo = BOL_TagService::getInstance()->findTagListByEntityIdList('link', $idList);
         $this->assign('tagsInfo', $tagsInfo);
         $toolbars = array();
         foreach ($list as $item) {
             $dto = $item['dto'];
             $toolbars[$dto->id] = array();
             $userId = $dto->userId;
             $toolbars[$dto->id][] = array('class' => ' ow_icon_control ow_ic_user', 'label' => !empty($nlist[$userId]) ? $nlist[$userId] : OW::getLanguage()->text('base', 'deleted_user'), 'href' => !empty($ulist[$userId]) ? BOL_UserService::getInstance()->getUserUrlForUsername($ulist[$userId]) : '#');
             $toolbars[$dto->id][] = array('href' => OW::getRouter()->urlForRoute('link', array('id' => $dto->id)), 'label' => UTIL_DateTime::formatDate($dto->timestamp));
             if ($commentTotall[$dto->id]) {
                 $toolbars[$dto->id][] = array('href' => OW::getRouter()->urlForRoute('link', array('id' => $dto->id)) . "#comments", 'label' => '<span class="ow_txt_value">' . $commentTotall[$dto->id] . '</span> ' . OW::getLanguage()->text('links', 'toolbar_comments'));
             }
             if (empty($tagsInfo[$dto->id])) {
                 continue;
             }
             $value = OW::getLanguage()->text('links', 'tags') . ' ';
             $c = 0;
             foreach ($tagsInfo[$dto->id] as $tag) {
                 if ($c == 3) {
                     break;
                 }
                 $value .= '<a href="' . OW::getRouter()->urlForRoute('links-by-tag') . "?tag={$tag}" . "\">{$tag}</a>, ";
                 $c++;
             }
             $value = mb_substr($value, 0, mb_strlen($value) - 2);
             $toolbars[$dto->id][] = array('label' => $value);
         }
         if (OW::getUser()->isAuthenticated()) {
             $userVotes = $voteService->findUserVoteForList($idList, 'link', OW::getUser()->getId());
             $this->assign('userVotes', $userVotes);
         }
         $this->assign('tb', $toolbars);
     }
     foreach ($voteTotall as $val) {
         $links[$val['id']]['isVoted'] = true;
         $links[$val['id']]['voteTotal'] = $val['sum'];
         $links[$val['id']]['up'] = $val['up'];
         $links[$val['id']]['down'] = $val['down'];
     }
     $this->assign('commentTotall', $commentTotall);
     $this->assign('list', $links);
     $this->assign('url_new_link', OW::getRouter()->urlForRoute('link-save-new'));
     $paging = new BASE_CMP_Paging($page, ceil($itemsCount / $rpp), 5);
     $this->assign('paging', $paging->render());
     $this->assign('isAuthenticated', OW::getUser()->isAuthenticated());
 }
示例#17
0
 public function edit($params)
 {
     if (!isset($params['questionId'])) {
         throw new Redirect404Exception();
     }
     $questionId = (int) @$params['questionId'];
     if (empty($questionId)) {
         throw new Redirect404Exception();
     }
     $this->addContentMenu();
     $this->contentMenu->getElement('qst_index')->setActive(true);
     $editQuestion = $this->questionService->findQuestionById($questionId);
     $parent = $editQuestion->parent;
     $parentIsset = false;
     if (!empty($parent)) {
         $parentDto = $this->questionService->findQuestionByName($parent);
         $parentIsset = !empty($parentDto) ? true : false;
         if ($parentIsset) {
             $this->assign('parentUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'edit', array("questionId" => $parentDto->id)));
             $this->assign('parentLabel', $this->questionService->getQuestionLang($parentDto->name));
         }
     }
     $this->assign('parentIsset', $parentIsset);
     if ($editQuestion === null) {
         throw new Redirect404Exception();
     }
     $this->assign('question', $editQuestion);
     //$editQuestionToAccountType = $this->questionService->findAccountTypeByQuestionName( $editQuestion->name );
     // get available account types from DB
     /* @var BOL_QuestionService $this->questionService */
     $accountTypes = $this->questionService->findAllAccountTypes();
     $serviceLang = BOL_LanguageService::getInstance();
     $language = OW::getLanguage();
     $currentLanguageId = OW::getLanguage()->getCurrentId();
     $accounts = array(BOL_QuestionService::ALL_ACCOUNT_TYPES => $language->text('base', 'questions_account_type_all'));
     /* @var $value BOL_QuestionAccount */
     foreach ($accountTypes as $value) {
         $accounts[$value->name] = $language->text('base', 'questions_account_type_' . $value->name);
     }
     $sections = $this->questionService->findAllSections();
     // need to hide sections select box
     if (empty($section)) {
         $this->assign('no_sections', true);
     }
     $sectionsArray = array();
     /* @var $section BOL_QuestionSection */
     foreach ($sections as $section) {
         $sectionsArray[$section->name] = $language->text('base', 'questions_section_' . $section->name . '_label');
     }
     $presentations = array();
     $presentationsLabel = array();
     $presentationList = $this->questionService->getPresentations();
     if ($editQuestion->name != 'password') {
         unset($presentationList[BOL_QuestionService::QUESTION_PRESENTATION_PASSWORD]);
     }
     foreach ($presentationList as $presentationKey => $presentation) {
         if ($presentationList[$editQuestion->presentation] == $presentation) {
             $presentations[$presentationKey] = $presentationKey;
             //TODO add langs with presentation labels
             $presentationsLabel[$presentationKey] = $language->text('base', 'questions_question_presentation_' . $presentationKey . '_label');
         }
     }
     $presentation = $editQuestion->presentation;
     if (OW::getSession()->isKeySet(self::EDIT_QUESTION_SESSION_VAR)) {
         $session = OW::getSession()->get(self::EDIT_QUESTION_SESSION_VAR);
         if (isset($session['qst_answer_type']) && isset($presentations[$session['qst_answer_type']])) {
             $presentation = $presentations[$session['qst_answer_type']];
         }
     }
     if (isset($_POST['qst_answer_type']) && isset($presentations[$_POST['qst_answer_type']])) {
         $presentation = $presentations[$_POST['qst_answer_type']];
     }
     //$this->addForm(new LanguageValueEditForm( 'base', 'questions_question_' . ($editQuestion->id) . '_label', $this ) );
     //--  -------------------------------------
     //--  add question values form creating
     //--  -------------------------------------
     $questionValues = $this->questionService->findQuestionValues($editQuestion->name);
     $this->assign('questionValues', $questionValues);
     //add field values form
     $addQuestionValuesForm = new AddValuesForm($questionId);
     $addQuestionValuesForm->setAction($this->ajaxResponderUrl);
     $this->addForm($addQuestionValuesForm);
     //--  -------------------------------------
     //--  edit field form creating
     //--  -------------------------------------
     $editForm = new Form('qst_edit_form');
     $editForm->setId('qst_edit_form');
     $disableActionList = array('disable_account_type' => false, 'disable_answer_type' => false, 'disable_presentation' => false, 'disable_column_count' => false, 'disable_display_config' => false, 'disable_required' => false, 'disable_on_join' => false, 'disable_on_view' => false, 'disable_on_search' => false, 'disable_on_edit' => false);
     $event = new OW_Event('admin.disable_fields_on_edit_profile_question', array('questionDto' => $editQuestion), $disableActionList);
     OW::getEventManager()->trigger($event);
     $disableActionList = $event->getData();
     if (count($accountTypes) > 1) {
         $qstAccountType = new Selectbox('qst_account_type');
         $qstAccountType->setLabel($language->text('admin', 'questions_for_account_type_label'));
         $qstAccountType->setDescription($language->text('admin', 'questions_for_account_type_description'));
         $qstAccountType->setOptions($accounts);
         $qstAccountType->setValue(BOL_QuestionService::ALL_ACCOUNT_TYPES);
         $qstAccountType->setHasInvitation(false);
         if ($editQuestion->accountTypeName !== null) {
             $qstAccountType->setValue($editQuestion->accountTypeName);
         }
         if ($editQuestion->base == 1) {
             $qstAccountType->addAttribute('disabled', 'disabled');
         } else {
             if ($disableActionList['disable_account_type']) {
                 $qstAnswerType->setRequired(false);
                 $qstAccountType->addAttribute('disabled', 'disabled');
             }
         }
         $editForm->addElement($qstAccountType);
     }
     if (!empty($sectionsArray)) {
         $qstSection = new Selectbox('qst_section');
         $qstSection->setLabel($language->text('admin', 'questions_question_section_label'));
         $qstSection->setOptions($sectionsArray);
         $qstSection->setValue($editQuestion->sectionName);
         $qstSection->setHasInvitation(false);
         $editForm->addElement($qstSection);
     }
     $qstAnswerType = new Selectbox('qst_answer_type');
     $qstAnswerType->setLabel($language->text('admin', 'questions_answer_type_label'));
     $qstAnswerType->addAttribute('class', $qstAnswerType->getName());
     $qstAnswerType->setOptions($presentationsLabel);
     $qstAnswerType->setValue($presentation);
     $qstAnswerType->setRequired();
     $qstAnswerType->setHasInvitation(false);
     if ($parentIsset) {
         $qstAnswerType->setValue($parentDto->columnCount);
         $qstAnswerType->addAttribute('disabled', 'disabled');
     }
     if ((int) $editQuestion->base === 1 || count($presentations) <= 1 || $parentIsset || $disableActionList['disable_answer_type']) {
         $qstAnswerType->setRequired(false);
         $qstAnswerType->addAttribute('disabled', 'disabled');
     }
     $editForm->addElement($qstAnswerType);
     $columnCountPresentation = array(BOL_QuestionService::QUESTION_PRESENTATION_MULTICHECKBOX, BOL_QuestionService::QUESTION_PRESENTATION_RADIO);
     if (in_array($presentation, $columnCountPresentation)) {
         $qstColumnCount = new Selectbox('qst_column_count');
         $qstColumnCount->addAttribute('class', $qstColumnCount->getName());
         $qstColumnCount->setLabel($language->text('admin', 'questions_columns_count_label'));
         $qstColumnCount->setRequired();
         $qstColumnCount->setOptions($this->qstColumnCountValues);
         $qstColumnCount->setValue($editQuestion->columnCount);
         $parentIsset = !empty($parentDto) ? true : false;
         if ($parentIsset) {
             $qstColumnCount->setValue($parentDto->columnCount);
             $qstColumnCount->addAttribute('disabled', 'disabled');
             $qstColumnCount->setRequired(false);
         } else {
             if ($disableActionList['disable_column_count']) {
                 $qstAnswerType->setRequired(false);
                 $qstAnswerType->addAttribute('disabled', 'disabled');
             }
         }
         $editForm->addElement($qstColumnCount);
     }
     $presentationConfigList = BOL_QuestionService::getInstance()->getConfigList($presentation);
     $presentationConfigValues = json_decode($editQuestion->custom, true);
     if ($editQuestion->name !== 'joinStamp' && !$disableActionList['disable_display_config']) {
         foreach ($presentationConfigList as $config) {
             $className = $config->presentationClass;
             /* @var $qstConfig OW_FormElement */
             $qstConfig = new $className($config->name);
             $qstConfig->setLabel($language->text('admin', 'questions_config_' . $config->name . '_label'));
             if (!empty($config->description)) {
                 $qstConfig->setDescription($config->description);
             }
             if (isset($presentationConfigValues[$config->name])) {
                 $qstConfig->setValue($presentationConfigValues[$config->name]);
             }
             $editForm->addElement($qstConfig);
         }
     }
     $qstRequired = new CheckboxField('qst_required');
     $qstRequired->setLabel($language->text('admin', 'questions_required_label'));
     $qstRequired->setDescription($language->text('admin', 'questions_required_description'));
     $qstRequired->setValue((bool) $editQuestion->required);
     if ((int) $editQuestion->base === 1 || $disableActionList['disable_required']) {
         $qstRequired->addAttribute('disabled', 'disabled');
     }
     $editForm->addElement($qstRequired);
     $qstOnSignUp = new CheckboxField('qst_on_sign_up');
     $qstOnSignUp->setLabel($language->text('admin', 'questions_on_sing_up_label'));
     $qstOnSignUp->setDescription($language->text('admin', 'questions_on_sing_up_description'));
     $qstOnSignUp->setValue((bool) $editQuestion->onJoin);
     if ((int) $editQuestion->base === 1 || $disableActionList['disable_on_join']) {
         $qstOnSignUp->addAttribute('disabled', 'disabled');
     }
     $editForm->addElement($qstOnSignUp);
     $qstOnEdit = new CheckboxField('qst_on_edit');
     $qstOnEdit->setLabel($language->text('admin', 'questions_on_edit_label'));
     $qstOnEdit->setDescription($language->text('admin', 'questions_on_edit_description'));
     $qstOnEdit->setValue((bool) $editQuestion->onEdit);
     $description = $language->text('admin', 'questions_on_edit_description');
     if ($editQuestion->name === 'username') {
         $qstOnEdit->setDescription($language->text('admin', 'questions_on_edit_description') . "<br/><br/>" . $language->text('admin', 'questions_edit_username_warning'));
     } else {
         if ((int) $editQuestion->base === 1 || $disableActionList['disable_on_edit']) {
             $qstOnEdit->addAttribute('disabled', 'disabled');
         }
     }
     $editForm->addElement($qstOnEdit);
     $qstOnView = new CheckboxField('qst_on_view');
     $qstOnView->setLabel($language->text('admin', 'questions_on_view_label'));
     $qstOnView->setDescription($language->text('admin', 'questions_on_view_description'));
     $qstOnView->setValue((bool) $editQuestion->onView);
     if ((int) $editQuestion->base === 1 && $editQuestion->name !== 'joinStamp' || $disableActionList['disable_on_view']) {
         $qstOnView->addAttribute('disabled', 'disabled');
     }
     $editForm->addElement($qstOnView);
     $qstOnSearch = new CheckboxField('qst_on_search');
     $qstOnSearch->setLabel($language->text('admin', 'questions_on_search_label'));
     $qstOnSearch->setDescription($language->text('admin', 'questions_on_search_description'));
     $qstOnSearch->setValue((bool) $editQuestion->onSearch);
     if ((int) $editQuestion->base === 1 && $editQuestion->name != 'username' || $parentIsset || $disableActionList['disable_on_search']) {
         $qstOnSearch->addAttribute('disabled', 'disabled');
     }
     $editForm->addElement($qstOnSearch);
     $qstSubmit = new Submit('qst_submit');
     $qstSubmit->addAttribute('class', 'ow_button ow_ic_save');
     $qstSubmit->setValue($language->text('admin', 'btn_label_edit'));
     $editForm->addElement($qstSubmit);
     if (OW::getSession()->isKeySet(self::EDIT_QUESTION_SESSION_VAR)) {
         $editForm->setValues(OW::getSession()->get(self::EDIT_QUESTION_SESSION_VAR));
         OW::getSession()->delete(self::EDIT_QUESTION_SESSION_VAR);
     }
     $this->addForm($editForm);
     if (OW_Request::getInstance()->isPost()) {
         if ((isset($_POST['qst_submit_and_add']) || isset($_POST['qst_submit'])) && $editForm->isValid($_POST)) {
             OW::getSession()->delete(self::EDIT_QUESTION_SESSION_VAR);
             $updated = false;
             $data = $editForm->getValues();
             $elements = $editForm->getElements();
             foreach ($elements as $element) {
                 if (!$element->getAttribute('disabled')) {
                     switch ($element->getName()) {
                         case 'qst_required':
                             $editQuestion->required = isset($_POST['qst_required']) ? 1 : 0;
                             break;
                         case 'qst_on_sign_up':
                             $editQuestion->onJoin = isset($_POST['qst_on_sign_up']) ? 1 : 0;
                             break;
                         case 'qst_on_edit':
                             $editQuestion->onEdit = isset($_POST['qst_on_edit']) ? 1 : 0;
                             break;
                         case 'qst_on_search':
                             $editQuestion->onSearch = isset($_POST['qst_on_search']) ? 1 : 0;
                             break;
                         case 'qst_on_view':
                             $editQuestion->onView = isset($_POST['qst_on_view']) ? 1 : 0;
                             break;
                         case 'qst_answer_type':
                             $editQuestion->presentation = htmlspecialchars($data['qst_answer_type']);
                             break;
                         case 'qst_column_count':
                             $editQuestion->columnCount = htmlspecialchars($data['qst_column_count']);
                             break;
                         case 'qst_section':
                             if (!empty($data['qst_section'])) {
                                 $section = $this->questionService->findSectionBySectionName(htmlspecialchars(trim($data['qst_section'])));
                                 $sectionName = null;
                                 if (isset($section)) {
                                     $sectionName = $section->name;
                                 }
                                 if ($editQuestion->sectionName !== $sectionName) {
                                     $editQuestion->sectionName = $sectionName;
                                     $editQuestion->sortOrder = (int) BOL_QuestionService::getInstance()->findLastQuestionOrder($editQuestion->sectionName) + 1;
                                 }
                             }
                             break;
                         case 'qst_account_type':
                             if ($data['qst_account_type'] !== null) {
                                 $editQuestion->accountTypeName = htmlspecialchars(trim($data['qst_account_type']));
                                 if ($editQuestion->accountTypeName === BOL_QuestionService::ALL_ACCOUNT_TYPES) {
                                     $editQuestion->accountTypeName = null;
                                 }
                             }
                             break;
                     }
                 }
             }
             if (!$disableActionList['disable_display_config']) {
                 // save question configs
                 $configs = array();
                 foreach ($presentationConfigList as $config) {
                     if (isset($data[$config->name])) {
                         $configs[$config->name] = $data[$config->name];
                     }
                 }
                 $editQuestion->custom = json_encode($configs);
             }
             $this->questionService->saveOrUpdateQuestion($editQuestion);
             if (OW::getDbo()->getAffectedRows() > 0) {
                 $updated = true;
                 $list = $this->questionService->findQuestionChildren($editQuestion->name);
                 /* @var BOL_Question $child */
                 foreach ($list as $child) {
                     $child->columnCount = $editQuestion->columnCount;
                     $this->questionService->saveOrUpdateQuestion($child);
                 }
             }
             //update question values sort
             if (isset($_POST['question_values_order'])) {
                 $valuesOrder = json_decode($_POST['question_values_order'], true);
                 if (isset($valuesOrder) && count($valuesOrder) > 0 && is_array($valuesOrder)) {
                     foreach ($questionValues as $questionValue) {
                         if (isset($valuesOrder[$questionValue->value])) {
                             $questionValue->sortOrder = (int) $valuesOrder[$questionValue->value];
                         }
                         $this->questionService->saveOrUpdateQuestionValue($questionValue);
                         if (OW::getDbo()->getAffectedRows() > 0) {
                             $updated = true;
                         }
                     }
                 }
             }
             if ($updated) {
                 OW::getFeedback()->info($language->text('admin', 'questions_update_question_message'));
             } else {
                 OW::getFeedback()->info($language->text('admin', 'questions_question_was_not_updated_message'));
             }
             //exit;
             $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'index'));
         }
         $editForm->setValues($_POST);
         OW::getSession()->set(self::EDIT_QUESTION_SESSION_VAR, $_POST);
         //OW::getFeedback()->error($language->text('admin', 'questions_question_was_not_updated_message'));
         $this->redirect();
     }
     $types = array();
     foreach ($this->questionService->getPresentations() as $presentation => $type) {
         if ($type === 'select') {
             $types[] = $presentation;
         }
     }
     $questionLabel = $this->questionService->getQuestionLang($editQuestion->name);
     $questionDescription = $this->questionService->getQuestionDescriptionLang($editQuestion->name);
     $noValue = $language->text('admin', 'questions_empty_lang_value');
     $questionLabel = mb_strlen(trim($questionLabel)) == 0 || $questionLabel == '&nbsp;' ? $noValue : $questionLabel;
     $questionDescription = mb_strlen(trim($questionDescription)) == 0 || $questionDescription == '&nbsp;' ? $noValue : $questionDescription;
     $this->assign('questionLabel', $questionLabel);
     $this->assign('questionDescription', $questionDescription);
     $language->addKeyForJs('admin', 'questions_empty_lang_value');
     $language->addKeyForJs('admin', 'questions_edit_question_name_title');
     $language->addKeyForJs('admin', 'questions_edit_question_description_title');
     $language->addKeyForJs('admin', 'questions_edit_question_value_title');
     $language->addKeyForJs('admin', 'questions_edit_delete_value_confirm_message');
     $fields = array();
     foreach ($editForm->getElements() as $element) {
         if (!$element instanceof HiddenField) {
             $fields[$element->getName()] = $element->getName();
         }
     }
     $this->assign('formData', $fields);
     $script = '
                 window.editQuestion = new editQuestion(' . json_encode(array('types' => $types, 'ajaxResponderUrl' => $this->ajaxResponderUrl)) . ');
                 ';
     OW::getDocument()->addOnloadScript($script);
     $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl();
     $baseJsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
     OW::getDocument()->addScript($jsDir . "questions.js");
     OW::getDocument()->addScript($baseJsDir . "jquery-ui.min.js");
 }
示例#18
0
文件: photo.php 项目: vazahat/dudex
    /**
     * Tagged photo list action
     *
     * @param array $params
     */
    public function viewTaggedList(array $params = null)
    {
        if (isset($params['tag'])) {
            $tag = htmlspecialchars(urldecode($params['tag']));
        }
        // is moderator
        $modPermissions = OW::getUser()->isAuthorized('photo');
        if (!$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
            $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
            return;
        }
        $this->addComponent('photoMenu', $this->menu);
        $this->menu->getElement('tagged')->setActive(true);
        $this->setTemplate(OW::getPluginManager()->getPlugin('advancedphoto')->getCtrlViewDir() . 'photo_view_list-tagged.html');
        $listUrl = OW::getRouter()->urlForRoute('view_tagged_photo_list_st');
        OW::getDocument()->addScript($this->photoPluginJsUrl . 'photo_tag_search.js');
        $objParams = array('listUrl' => $listUrl);
        $script = "\$(document).ready(function(){\n                var photoSearch = new photoTagSearch(" . json_encode($objParams) . ");\n            }); ";
        OW::getDocument()->addOnloadScript($script);
        if (isset($tag)) {
            $this->assign('tag', $tag);
            OW::getDocument()->setTitle(OW::getLanguage()->text('photo', 'meta_title_photo_tagged_as', array('tag' => $tag)));
            OW::getDocument()->setDescription(OW::getLanguage()->text('photo', 'meta_description_photo_tagged_as', array('tag' => $tag)));
            OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('advancedphoto')->getStaticJsUrl() . 'hap.min.js');
            $script = '
				hap.initialize({request_url: "' . OW::getRouter()->urlForRoute('photo_list_index') . '", max_width: 220, listType: "tagged", tag: "' . $tag . '"});			  
			';
            OW::getDocument()->addOnloadScript($script);
            OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.bbq.min.js');
            OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('photo')->getStaticJsUrl() . 'photo.js');
            OW::getLanguage()->addKeyForJs('photo', 'tb_edit_photo');
            OW::getLanguage()->addKeyForJs('photo', 'confirm_delete');
            OW::getLanguage()->addKeyForJs('photo', 'mark_featured');
            OW::getLanguage()->addKeyForJs('photo', 'remove_from_featured');
            $objParams = array('ajaxResponder' => OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'), 'fbResponder' => OW::getRouter()->urlForRoute('photo.floatbox'));
            $script = '$("div.photo a").on("click", function(e){
				e.preventDefault();
				var photo_id = $(this).attr("rel");

				if ( !window.photoViewObj ) {
					window.photoViewObj = new photoView(' . json_encode($objParams) . ');
				}
				
				window.photoViewObj.setId(photo_id);
			}); 
			
			$(window).bind( "hashchange", function(e) {
				var photo_id = $.bbq.getState("view-photo");
				if ( photo_id != undefined )
				{
					if ( window.photoFBLoading ) { return; }
					window.photoViewObj.showPhotoCmp(photo_id);
				}
			});';
            OW::getDocument()->addOnloadScript($script);
        } else {
            $tags = new BASE_CMP_EntityTagCloud('photo');
            $tags->setRouteName('view_tagged_photo_list');
            $this->addComponent('tags', $tags);
            OW::getDocument()->setTitle(OW::getLanguage()->text('photo', 'meta_title_photo_tagged'));
            $tagsArr = BOL_TagService::getInstance()->findMostPopularTags('photo', 20);
            foreach ($tagsArr as $t) {
                $labels[] = $t['label'];
            }
            $tagStr = $tagsArr ? implode(', ', $labels) : '';
            OW::getDocument()->setDescription(OW::getLanguage()->text('photo', 'meta_description_photo_tagged', array('topTags' => $tagStr)));
        }
        $this->assign('listType', 'tagged');
        //OW::getDocument()->setHeading(OW::getLanguage()->text('photo', 'page_title_browse_photos'));
        //OW::getDocument()->setHeadingIconClass('ow_ic_picture');
        $js = UTIL_JsGenerator::newInstance()->newVariable('addNewUrl', OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'index'))->jQueryEvent('#btn-add-new-photo', 'click', 'document.location.href = addNewUrl');
        OW::getDocument()->addOnloadScript($js);
    }