Beispiel #1
0
 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);
 }
Beispiel #2
0
 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;
 }
Beispiel #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;
 }