コード例 #1
0
ファイル: Controller.php プロジェクト: hoalangoc/ftf
 public function indexAction()
 {
     // Get paginator
     // Don't render this if not authorized
     if (!Engine_Api::_()->core()->hasSubject()) {
         return $this->setNoRender();
     }
     $this->view->group = $group = Engine_Api::_()->core()->getSubject();
     $viewer = Engine_Api::_()->user()->getViewer();
     $this->view->user_id = $user_id = $viewer->getIdentity();
     if ($group->is_subgroup && !$group->isParentGroupOwner($viewer)) {
         $parent_group = $group->getParentGroup();
         if (!$parent_group->authorization()->isAllowed($viewer, "view")) {
             return $this->setNoRender();
         } else {
             if (!$group->authorization()->isAllowed($viewer, "view")) {
                 return $this->setNoRender();
             }
         }
     } else {
         if (!$group->authorization()->isAllowed($viewer, 'view')) {
             return $this->setNoRender();
         }
     }
     //get marked announcements of current user
     $tableMark = Engine_Api::_()->getDbtable('marks', 'advgroup');
     $ids = array();
     $select = $tableMark->select()->where('user_id  = ?', $user_id);
     foreach ($tableMark->fetchAll($select) as $row) {
         $ids[] = $row->announcement_id;
     }
     $table = Engine_Api::_()->getDbtable('announcements', 'advgroup');
     $select = $table->select()->where('group_id = ?', $group->group_id)->order('modified_date DESC');
     if (!empty($ids)) {
         $select->where('announcement_id NOT IN (?)', $ids);
     }
     $announcements = $table->fetchAll($select);
     // Hide if nothing to show
     if (!$announcements) {
     }
     $this->view->announcements = $announcements;
     if (count($announcements) <= 0) {
     }
     $menu = new Advgroup_Plugin_Menus();
     $viewer = Engine_Api::_()->user()->getViewer();
     $subject = Engine_Api::_()->core()->getSubject();
     $canManage = $subject->authorization()->isAllowed(null, 'announcement');
     $allow_manage = "";
     $levelManage = Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('group', $viewer, 'announcement');
     if ($canManage && $levelManage) {
         $allow_manage = true;
     } else {
         $allow_manage = false;
     }
     $this->view->allow_manage = $allow_manage;
     $aManageAnnouncementButton = $menu->onMenuInitialize_AdvgroupManageAnnouncement();
     $this->view->aManageAnnouncementButton = $aManageAnnouncementButton;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: hoalangoc/ftf
 public function indexAction()
 {
     // Don't render this if not authorized
     $viewer = Engine_Api::_()->user()->getViewer();
     if (!Engine_Api::_()->core()->hasSubject()) {
         return $this->setNoRender();
     }
     // Get subject and check auth
     $group = Engine_Api::_()->core()->getSubject('group');
     $viewer = Engine_Api::_()->user()->getViewer();
     if ($group->is_subgroup && !$group->isParentGroupOwner($viewer)) {
         $parent_group = $group->getParentGroup();
         if (!$parent_group->authorization()->isAllowed($viewer, "view")) {
             return $this->setNoRender();
         } else {
             if (!$group->authorization()->isAllowed($viewer, "view")) {
                 return $this->setNoRender();
             }
         }
     } else {
         if (!$group->authorization()->isAllowed($viewer, "view")) {
             return $this->setNoRender();
         }
     }
     $menu = new Advgroup_Plugin_Menus();
     $aJoinButton = $menu->onMenuInitialize_AdvgroupProfileMember();
     $this->view->aJoinButton = $aJoinButton;
     $this->view->group = $group;
     $followTable = Engine_Api::_()->getDbTable('follow', 'advgroup');
     $row = $followTable->getFollowGroup($group->getIdentity(), $viewer->getIdentity());
     if ($row) {
         $this->view->follow = $row->follow;
     } else {
         $this->view->follow = false;
     }
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: hoalangoc/ftf
 public function indexAction()
 {
     // Don't render this if not authorized
     $viewer = Engine_Api::_()->user()->getViewer();
     if (!Engine_Api::_()->core()->hasSubject()) {
         return $this->setNoRender();
     }
     // Get subject and check auth
     $subject = Engine_Api::_()->core()->getSubject('group');
     $view = $this->view;
     $view->addHelperPath(APPLICATION_PATH . '/application/modules/Fields/View/Helper', 'Fields_View_Helper');
     $this->view->group = $group = $subject;
     $category = null;
     if ($group->category_id) {
         $category = Engine_Api::_()->getItem('advgroup_category', $group->category_id);
     }
     $followTable = Engine_Api::_()->getDbTable('follow', 'advgroup');
     $row = $followTable->getFollowGroup($group->getIdentity(), $viewer->getIdentity());
     if ($row) {
         $this->view->follow = $row->follow;
     } else {
         $this->view->follow = false;
     }
     $this->view->category = $category;
     $this->view->user = $user = $group->getOwner();
     $this->view->canComment = $canComment = $group->authorization()->isAllowed($viewer, 'comment');
     $this->view->fieldStructure = $fieldStructure = Engine_Api::_()->fields()->getFieldsStructurePartial($group);
     // Get subject and check auth
     $subject = Engine_Api::_()->core()->getSubject('group');
     $menu = new Advgroup_Plugin_Menus();
     $aJoinButton = $menu->onMenuInitialize_AdvgroupProfileMember();
     $this->view->aJoinButton = $aJoinButton;
     $aReportButton = $menu->onMenuInitialize_AdvgroupProfileReport();
     $this->view->aReportButton = $aReportButton;
     $aEditButton = $menu->onMenuInitialize_AdvgroupProfileEdit();
     $this->view->aEditButton = $aEditButton;
     $aStyleButton = $menu->onMenuInitialize_AdvgroupProfileStyle();
     $this->view->aStyleButton = $aStyleButton;
     $aDeleteButton = $menu->onMenuInitialize_AdvgroupProfileDelete();
     $this->view->aDeleteButton = $aDeleteButton;
     $aCreateSubGroupButton = $menu->onMenuInitialize_AdvgroupProfileCreateSubGroup();
     $this->view->aCreateSubGroupButton = $aCreateSubGroupButton;
     $aTrasferButton = $menu->onMenuInitialize_AdvgroupProfileTransfer();
     $this->view->aTrasferButton = $aTrasferButton;
     $aMessageButton = $menu->onMenuInitialize_AdvgroupProfileMessage();
     $this->view->aMessageButton = $aMessageButton;
     $aInviteButton = $menu->onMenuInitialize_AdvgroupProfileInvite();
     $this->view->aInviteButton = $aInviteButton;
     $aProfileInvitenewButton = $menu->onMenuInitialize_AdvgroupProfileInvitenew();
     $this->view->aProfileInvitenewButton = $aProfileInvitenewButton;
     $aInviteManageButton = $menu->onMenuInitialize_AdvgroupProfileInviteManage();
     $this->view->aInviteManageButton = $aInviteManageButton;
     $aProfileAlbumButton = $menu->onMenuInitialize_AdvgroupProfileAlbum();
     $this->view->aProfileAlbumButton = $aProfileAlbumButton;
     $aProfileDiscussionButton = $menu->onMenuInitialize_AdvgroupProfileDiscussion();
     $this->view->aProfileDiscussionButton = $aProfileDiscussionButton;
     $aProfileEventButton = $menu->onMenuInitialize_AdvgroupProfileEvent();
     $this->view->aProfileEventButton = $aProfileEventButton;
     $aProfilePollButton = $menu->onMenuInitialize_AdvgroupProfilePoll();
     $this->view->aProfilePollButton = $aProfilePollButton;
     $aProfileVideoButton = $menu->onMenuInitialize_AdvgroupProfileVideo();
     $this->view->aProfileVideoButton = $aProfileVideoButton;
     $aProfileUsefulLinkButton = $menu->onMenuInitialize_AdvgroupProfileUsefulLink();
     $this->view->aProfileUsefulLinkButton = $aProfileUsefulLinkButton;
     $aProfileActivityButton = $menu->onMenuInitialize_AdvgroupProfileActivity();
     $this->view->aProfileActivityButton = $aProfileActivityButton;
     $aProfileMusicButton = $menu->onMenuInitialize_AdvgroupProfileMusic();
     $this->view->aProfileMusicButton = $aProfileMusicButton;
     $aProfileMp3MusicButton = $menu->onMenuInitialize_AdvgroupProfileMp3Music();
     $this->view->aProfileMp3MusicButton = $aProfileMp3MusicButton;
     $aFileSharingButton = $menu->onMenuInitialize_AdvgroupFileSharing();
     $this->view->aFileSharingButton = $aFileSharingButton;
     $aWikiButton = $menu->onMenuInitialize_AdvgroupProfileWiki();
     $this->view->aWikiButton = $aWikiButton;
     $aProfileListingButton = $menu->onMenuInitialize_AdvgroupProfileListing();
     $this->view->aProfileListingButton = $aProfileListingButton;
     $aContactButton = $menu->canSendMessageToOwner();
     $this->view->aContactButton = $aContactButton;
     // Get staff
     $ids = array();
     $ids[] = $subject->getOwner()->getIdentity();
     $list = $subject->getOfficerList();
     foreach ($list->getAll() as $listiteminfo) {
         $ids[] = $listiteminfo->child_id;
     }
     $staff = array();
     foreach ($ids as $id) {
         $user = Engine_Api::_()->getItem('user', $id);
         $staff[] = array('membership' => $subject->membership()->getMemberInfo($user), 'user' => $user);
     }
     $this->view->staff = $staff;
 }