示例#1
0
 private function displayGroupList($list, $paging, $menu = null)
 {
     $templatePath = OW::getPluginManager()->getPlugin('groups')->getCtrlViewDir() . 'groups_list.html';
     $this->setTemplate($templatePath);
     $out = array();
     foreach ($list as $item) {
         /* @var $item GROUPS_BOL_Group */
         $userCount = GROUPS_BOL_Service::getInstance()->findUserListCount($item->id);
         $title = strip_tags($item->title);
         $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'listing_users_label', array('count' => $userCount))));
         $out[] = array('id' => $item->id, 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $item->id)), 'title' => $title, 'imageTitle' => $title, 'content' => UTIL_String::truncate(strip_tags($item->description), 300, '...'), 'time' => UTIL_DateTime::formatDate($item->timeStamp), 'imageSrc' => GROUPS_BOL_Service::getInstance()->getGroupImageUrl($item), 'users' => $userCount, 'toolbar' => $toolbar);
     }
     $this->addComponent('paging', $paging);
     if (!empty($menu)) {
         $this->addComponent('menu', $menu);
     } else {
         $this->assign('menu', '');
     }
     $this->assign("showCreate", true);
     if (!$this->service->isCurrentUserCanCreate()) {
         $authStatus = BOL_AuthorizationService::getInstance()->getActionStatus('groups', 'create');
         if ($authStatus['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $this->assign("authMsg", json_encode($authStatus["msg"]));
         } else {
             $this->assign("showCreate", false);
         }
     }
     $this->assign('list', $out);
 }
示例#2
0
 /**
  * @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'));
 }
示例#3
0
 /**
  * @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'));
 }
示例#4
0
文件: groups.php 项目: vazahat/dudex
 private function displayGroupList($list, $paging, $menu = null)
 {
     $templatePath = OW::getPluginManager()->getPlugin('groups')->getCtrlViewDir() . 'groups_list.html';
     $this->setTemplate($templatePath);
     $out = array();
     foreach ($list as $item) {
         /* @var $item GROUPS_BOL_Group */
         $userCount = GROUPS_BOL_Service::getInstance()->findUserListCount($item->id);
         $title = strip_tags($item->title);
         $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'listing_users_label', array('count' => $userCount))));
         $out[] = array('id' => $item->id, 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $item->id)), 'title' => $title, 'imageTitle' => $title, 'content' => strip_tags($item->description), 'time' => UTIL_DateTime::formatDate($item->timeStamp), 'imageSrc' => GROUPS_BOL_Service::getInstance()->getGroupImageUrl($item), 'users' => $userCount, 'toolbar' => $toolbar);
     }
     $this->addComponent('paging', $paging);
     if (!empty($menu)) {
         $this->addComponent('menu', $menu);
     } else {
         $this->assign('menu', '');
     }
     $this->assign('canCreate', $this->service->isCurrentUserCanCreate());
     $this->assign('list', $out);
 }