示例#1
0
文件: groups.php 项目: vazahat/dudex
 public function edit($params)
 {
     $groupId = (int) $params['groupId'];
     if (empty($groupId)) {
         throw new Redirect404Exception();
     }
     $groupDto = $this->service->findGroupById($groupId);
     if (!$this->service->isCurrentUserCanEdit($groupDto)) {
         throw new Redirect404Exception();
     }
     if ($groupId === null) {
         throw new Redirect404Exception();
     }
     $form = new GROUPS_EditGroupForm($groupDto);
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         if ($form->process()) {
             OW::getFeedback()->info(OW::getLanguage()->text('groups', 'edit_success_msg'));
         }
         $this->redirect();
     }
     $this->addForm($form);
     $this->assign('imageUrl', empty($groupDto->imageHash) ? false : $this->service->getGroupImageUrl($groupDto));
     $deleteUrl = OW::getRouter()->urlFor('GROUPS_CTRL_Groups', 'delete', array('groupId' => $groupDto->id));
     $viewUrl = $this->service->getGroupUrl($groupDto);
     $lang = OW::getLanguage()->text('groups', 'delete_confirm_msg');
     $js = UTIL_JsGenerator::newInstance();
     $js->newFunction('window.location.href=url', array('url'), 'redirect');
     $js->jQueryEvent('#groups-delete_btn', 'click', UTIL_JsGenerator::composeJsString('if( confirm({$lang}) ) redirect({$url});', array('url' => $deleteUrl, 'lang' => $lang)));
     $js->jQueryEvent('#groups-back_btn', 'click', UTIL_JsGenerator::composeJsString('redirect({$url});', array('url' => $viewUrl)));
     OW::getDocument()->addOnloadScript($js);
 }
示例#2
0
文件: header.php 项目: vazahat/dudex
 private function getGroupInfo()
 {
     static $groupInfo = array();
     if (!empty($groupInfo)) {
         return $groupInfo;
     }
     $groupInfo['id'] = $this->group->id;
     $groupInfo['hasImage'] = !empty($this->group->imageHash);
     $groupInfo['image'] = $this->groupService->getGroupImageUrl($this->group);
     $groupInfo['title'] = htmlspecialchars($this->group->title);
     $groupInfo['description'] = $this->group->description;
     $groupInfo['url'] = $this->groupService->getGroupUrl($this->group);
     $groupInfo['time'] = UTIL_DateTime::formatDate($this->group->timeStamp);
     $groupInfo['admin'] = array();
     $groupInfo['admin']['name'] = BOL_UserService::getInstance()->getDisplayName($this->group->userId);
     $groupInfo['admin']['url'] = BOL_UserService::getInstance()->getUserUrl($this->group->userId);
     return $groupInfo;
 }
示例#3
0
 public function onGetInfo(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     $groups = $this->service->findGroupListByIds($params["entityIds"]);
     $out = array();
     foreach ($groups as $group) {
         $info = array();
         $info["id"] = $group->id;
         $info["userId"] = $group->userId;
         $info["title"] = $group->title;
         $info["description"] = $group->description;
         $info["url"] = $this->service->getGroupUrl($group);
         $info["timeStamp"] = $group->timeStamp;
         $info["image"] = array("thumbnail" => $this->service->getGroupImageUrl($group));
         $out[$group->id] = $info;
     }
     $event->setData($out);
     return $out;
 }
示例#4
0
 private function assignList($listName, $list)
 {
     $groupIdList = array();
     foreach ($list as $item) {
         $groupIdList[] = $item->id;
     }
     $userCountList = $this->service->findUserCountForList($groupIdList);
     $tplList = array();
     foreach ($list as $item) {
         /* @var $item GROUPS_BOL_Group */
         $tplList[] = array('image' => $this->service->getGroupImageUrl($item), 'title' => htmlspecialchars($item->title), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $item->id)), 'users' => $userCountList[$item->id]);
     }
     $this->assign($listName, $tplList);
     return !empty($tplList);
 }