/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $paramObj) { parent::__construct(); $this->service = GROUPS_BOL_Service::getInstance(); if (!$this->service->isCurrentUserCanCreate()) { $authStatus = BOL_AuthorizationService::getInstance()->getActionStatus('groups', 'create'); $this->showCreate = $authStatus['status'] == BOL_AuthorizationService::STATUS_PROMOTED; if ($this->showCreate) { $script = UTIL_JsGenerator::composeJsString('$("#groups-create-btn-c a").click(function(){ OW.authorizationLimitedFloatbox({$msg}); return false; });', array("msg" => $authStatus["msg"])); OW::getDocument()->addOnloadScript($script); } } $num = isset($paramObj->customParamList['count']) ? (int) $paramObj->customParamList['count'] : 8; $this->assign('showTitles', !empty($paramObj->customParamList['showTitles'])); $latest = $this->service->findGroupList(GROUPS_BOL_Service::LIST_LATEST, 0, $num); $popular = $this->service->findGroupList(GROUPS_BOL_Service::LIST_MOST_POPULAR, 0, $num); $toolbars = self::getToolbar(); $lang = OW::getLanguage(); $menuItems = array(); if ($this->assignList('latest', $latest)) { $this->setSettingValue(self::SETTING_TOOLBAR, $toolbars['latest']); $menuItems[] = array('label' => $lang->text('groups', 'group_list_menu_item_latest'), 'id' => 'groups-widget-menu-latest', 'contId' => 'groups-widget-latest', 'active' => true); } if ($this->assignList('popular', $popular)) { $menuItems[] = array('label' => $lang->text('groups', 'group_list_menu_item_popular'), 'id' => 'groups-widget-menu-popular', 'contId' => 'groups-widget-popular', 'active' => empty($menuItems)); } if (empty($menuItems) && !$this->showCreate) { $this->setVisible(false); return; } $this->assign('menuItems', $menuItems); if ($paramObj->customizeMode) { $this->assign('menu', ''); } else { $this->addComponent('menu', new BASE_CMP_WidgetMenu($menuItems)); } $this->assign('toolbars', $toolbars); $this->assign('createUrl', OW::getRouter()->urlForRoute('groups-create')); }
/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $paramObj) { parent::__construct(); $this->service = GROUPS_BOL_Service::getInstance(); /*if ( !$this->service->isCurrentUserCanViewList() ) { $this->setVisible(false); return; }*/ $num = isset($paramObj->customParamList['count']) ? (int) $paramObj->customParamList['count'] : 8; $this->assign('showTitles', !empty($paramObj->customParamList['showTitles'])); $latest = $this->service->findGroupList(GROUPS_BOL_Service::LIST_LATEST, 0, $num); $popular = $this->service->findGroupList(GROUPS_BOL_Service::LIST_MOST_POPULAR, 0, $num); $toolbars = self::getToolbar(); $lang = OW::getLanguage(); $menuItems = array(); if ($this->assignList('latest', $latest)) { $this->setSettingValue(self::SETTING_TOOLBAR, $toolbars['latest']); $menuItems[] = array('label' => $lang->text('groups', 'group_list_menu_item_latest'), 'id' => 'groups-widget-menu-latest', 'contId' => 'groups-widget-latest', 'active' => true); } if ($this->assignList('popular', $popular)) { $menuItems[] = array('label' => $lang->text('groups', 'group_list_menu_item_popular'), 'id' => 'groups-widget-menu-popular', 'contId' => 'groups-widget-popular', 'active' => empty($menuItems)); } if (empty($menuItems) && !$this->service->isCurrentUserCanCreate()) { $this->setVisible(false); return; } $this->assign('menuItems', $menuItems); if ($paramObj->customizeMode) { $this->assign('menu', ''); } else { $this->addComponent('menu', new BASE_CMP_WidgetMenu($menuItems)); } $this->assign('toolbars', $toolbars); $this->assign('createUrl', OW::getRouter()->urlForRoute('groups-create')); }
public function latestList() { $language = OW::getLanguage(); OW::getDocument()->setHeading($language->text('groups', 'group_list_heading')); OW::getDocument()->setHeadingIconClass('ow_ic_files'); OW::getDocument()->setTitle($language->text('groups', 'latest_list_page_title')); OW::getDocument()->setDescription($language->text('groups', 'latest_list_page_description')); if (!$this->service->isCurrentUserCanViewList()) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('groups', 'view'); throw new AuthorizationException($status['msg']); } $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1; $perPage = 20; $first = ($page - 1) * $perPage; $count = $perPage; $dtoList = $this->service->findGroupList(GROUPS_BOL_Service::LIST_LATEST, $first, $count); $listCount = $this->service->findGroupListCount(GROUPS_BOL_Service::LIST_LATEST); $paging = new BASE_CMP_Paging($page, ceil($listCount / $perPage), 5); $menu = $this->getGroupListMenu(); $menu->getElement('latest')->setActive(true); $this->assign('listType', 'latest'); $this->displayGroupList($dtoList, $paging, $menu); }
public function latestList() { $language = OW::getLanguage(); OW::getDocument()->setHeading($language->text('groups', 'group_list_heading')); OW::getDocument()->setHeadingIconClass('ow_ic_files'); OW::getDocument()->setTitle($language->text('groups', 'latest_list_page_title')); OW::getDocument()->setDescription($language->text('groups', 'latest_list_page_description')); if (!$this->service->isCurrentUserCanViewList()) { $this->assign('permissionMessage', $language->text('groups', 'view_no_permission')); $templatePath = OW::getPluginManager()->getPlugin('groups')->getCtrlViewDir() . 'no_permission.html'; $this->setTemplate($templatePath); return; } $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1; $perPage = 20; $first = ($page - 1) * $perPage; $count = $perPage; $dtoList = $this->service->findGroupList(GROUPS_BOL_Service::LIST_LATEST, $first, $count); $listCount = $this->service->findGroupListCount(GROUPS_BOL_Service::LIST_LATEST); $paging = new BASE_CMP_Paging($page, ceil($listCount / $perPage), 5); $menu = $this->getGroupListMenu(); $menu->getElement('latest')->setActive(true); $this->displayGroupList($dtoList, $paging, $menu); }