当前位置: 首页>>代码示例>>PHP>>正文


PHP Group::get方法代码示例

本文整理汇总了PHP中Hubzero\User\Group::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::get方法的具体用法?PHP Group::get怎么用?PHP Group::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hubzero\User\Group的用法示例。


在下文中一共展示了Group::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: displayTask

 /**
  * Displays a list of groups
  *
  * @return	void
  */
 public function displayTask()
 {
     // Incoming
     $this->view->filters = array('gid' => Request::getState($this->_option . '.' . $this->_controller . '.gid', 'gid', ''));
     // Ensure we have a group ID
     if (!$this->view->filters['gid']) {
         App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_GROUPS_MISSING_ID'), 'error');
         return;
     }
     // Load the group page
     $group = new Group();
     $group->read($this->view->filters['gid']);
     $this->view->filters['gidNumber'] = $group->get('gidNumber');
     $this->view->filters['search'] = urldecode(trim(Request::getState($this->_option . '.' . $this->_controller . '.search', 'search', '')));
     $this->view->filters['status'] = trim(Request::getState($this->_option . '.' . $this->_controller . '.status', 'status', ''));
     // Sorting options
     $this->view->filters['sort'] = trim(Request::getState($this->_option . '.' . $this->_controller . '.sort', 'filter_order', 'name'));
     $this->view->filters['sort_Dir'] = trim(Request::getState($this->_option . '.' . $this->_controller . '.sortdir', 'filter_order_Dir', 'ASC'));
     // Filters for returning results
     $this->view->filters['limit'] = Request::getState($this->_option . '.' . $this->_controller . '.limit', 'limit', Config::get('list_limit'), 'int');
     $this->view->filters['start'] = Request::getState($this->_option . '.' . $this->_controller . '.limitstart', 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $this->view->filters['start'] = $this->view->filters['limit'] != 0 ? floor($this->view->filters['start'] / $this->view->filters['limit']) * $this->view->filters['limit'] : 0;
     $tbl = new Tables\Group($this->database);
     $this->view->total = $tbl->countMembers($this->view->filters);
     $this->view->rows = $tbl->findMembers($this->view->filters);
     //add invite emails to list
     if ($this->view->filters['status'] == '' || $this->view->filters['status'] == 'invitee') {
         //get group invite emails
         $hubzeroGroupInviteEmail = new \Hubzero\User\Group\InviteEmail($this->database);
         $inviteemails = $hubzeroGroupInviteEmail->getInviteEmails($group->get('gidNumber'));
         //add invite emails to list
         foreach ($inviteemails as $inviteemail) {
             $this->view->rows[$inviteemail['email']] = new \stdClass();
             $this->view->rows[$inviteemail['email']]->name = $inviteemail['email'];
             $this->view->rows[$inviteemail['email']]->username = null;
             $this->view->rows[$inviteemail['email']]->email = $inviteemail['email'];
             $this->view->rows[$inviteemail['email']]->uidNumber = null;
             $this->view->rows[$inviteemail['email']]->role = 'inviteemail';
         }
     }
     $this->view->group = $group;
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:54,代码来源:membership.php

示例2: approveTask

 /**
  * Approve a group
  *
  * @return void
  */
 public function approveTask()
 {
     // Incoming
     $ids = Request::getVar('id', array());
     // Get the single ID we're working with
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     // Do we have any IDs?
     if (!empty($ids)) {
         // foreach group id passed in
         foreach ($ids as $id) {
             // Load the group page
             $group = new Group();
             $group->read($id);
             // Ensure we found the group info
             if (!$group) {
                 continue;
             }
             //set the group to be published and update
             $group->set('approved', 1);
             $group->update();
             // log publishing
             Log::log(array('gidNumber' => $group->get('gidNumber'), 'action' => 'group_approved', 'comments' => 'approved by administrator'));
         }
         // Output messsage and redirect
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_GROUPS_APPROVED'));
     }
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:34,代码来源:manage.php

示例3: assignTask

 /**
  * Assign members to a role
  *
  * @return  void
  */
 public function assignTask()
 {
     Request::setVar('hidemainmenu', 1);
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     $gid = Request::getVar('gid', '');
     if (!$gid) {
         App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_GROUPS_MISSING_ID'), 'error');
     }
     $group = new Group();
     $group->read($gid);
     $rows = Role::all()->whereEquals('gidNumber', $group->get('gidNumber'))->rows();
     // Output the HTML
     $this->view->set('rows', $rows)->set('group', $group)->set('ids', $ids)->setLayout('assign')->display();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:20,代码来源:roles.php

示例4: saveTask

 /**
  *  Save group settings
  *
  * @return 		void
  */
 public function saveTask()
 {
     // Check if they're logged in
     if (User::isGuest()) {
         $this->loginTask(Lang::txt('COM_GROUPS_CREATE_MUST_BE_LOGGED_IN'));
         return;
     }
     Request::checkToken();
     // Incoming
     $g_gidNumber = Request::getInt('gidNumber', 0, 'post');
     $c_gidNumber = Request::getVar('gidNumber', 0, 'post');
     if ((string) $g_gidNumber !== (string) $c_gidNumber) {
         App::abort(404, Lang::txt('COM_GROUPS_ERROR_NO_ID'));
     }
     if (!$g_gidNumber && !User::authorise('core.create', $this->_option) || $g_gidNumber && !User::authorise('core.edit', $this->_option)) {
         return App::redirect(Route::url('index.php?option=' . $this->_option), Lang::txt('COM_GROUPS_ERROR_NOT_AUTH'), 'warning');
     }
     $g_cn = trim(Request::getVar('cn', '', 'post'));
     $g_description = preg_replace('/\\s+/', ' ', trim(Request::getVar('description', Lang::txt('NONE'), 'post')));
     $g_discoverability = Request::getInt('discoverability', 0, 'post');
     $g_public_desc = Sanitize::stripScripts(trim(Request::getVar('public_desc', '', 'post', 'none', 2)));
     $g_private_desc = Sanitize::stripScripts(trim(Request::getVar('private_desc', '', 'post', 'none', 2)));
     $g_restrict_msg = Sanitize::stripScripts(trim(Request::getVar('restrict_msg', '', 'post', 'none', 2)));
     $g_join_policy = Request::getInt('join_policy', 0, 'post');
     $tags = trim(Request::getVar('tags', ''));
     $lid = Request::getInt('lid', 0, 'post');
     $customization = Request::getVar('group', '', 'POST', 'none', 2);
     $plugins = Request::getVar('group_plugin', '', 'POST');
     $params = Request::getVar('params', array(), 'POST');
     $g_discussion_email_autosubscribe = Request::getInt('discussion_email_autosubscribe', 0, 'post');
     //Check authorization
     if ($this->_authorize() != 'manager' && $g_gidNumber != 0 && !$this->_authorizedForTask('group.edit')) {
         $this->_errorHandler(403, Lang::txt('COM_GROUPS_ERROR_NOT_AUTH'));
     }
     //are we editing or creating
     if ($g_gidNumber) {
         $group = Group::getInstance($g_gidNumber);
         $this->_task = 'edit';
         $before = Group::getInstance($g_gidNumber);
     } else {
         $this->_task = 'new';
         $group = new Group();
         $before = new Group();
     }
     // Check for any missing info
     if (!$g_cn) {
         $this->setNotification(Lang::txt('COM_GROUPS_SAVE_ERROR_MISSING_INFORMATION') . ': ' . Lang::txt('COM_GROUPS_DETAILS_FIELD_CN'), 'error');
     }
     if (!$g_description) {
         $this->setNotification(Lang::txt('COM_GROUPS_SAVE_ERROR_MISSING_INFORMATION') . ': ' . Lang::txt('COM_GROUPS_DETAILS_FIELD_DESCRIPTION'), 'error');
     }
     // Ensure the data passed is valid
     if ($g_cn == 'new' || $g_cn == 'browse') {
         $this->setNotification(Lang::txt('COM_GROUPS_SAVE_ERROR_INVALID_ID'), 'error');
     }
     if (!$this->_validCn($g_cn)) {
         $this->setNotification(Lang::txt('COM_GROUPS_SAVE_ERROR_INVALID_ID'), 'error');
     }
     if ($this->_task == 'new' && Group::exists($g_cn, true)) {
         $this->setNotification(Lang::txt('COM_GROUPS_SAVE_ERROR_ID_TAKEN'), 'error');
     }
     // Get the logo
     $logo = '';
     if (isset($customization['logo'])) {
         $logo_parts = explode("/", $customization['logo']);
         $logo = array_pop($logo_parts);
     }
     // Plugin settings
     $plugin_access = '';
     foreach ($plugins as $plugin) {
         $plugin_access .= $plugin['name'] . '=' . $plugin['access'] . ',' . "\n";
     }
     // Run content through validation and spam filters
     if (trim($g_public_desc)) {
         $results = Event::trigger('content.onContentBeforeSave', array('com_groups.group.public_desc', &$g_public_desc, $this->_task == 'new'));
         foreach ($results as $result) {
             if ($result === false) {
                 $this->setNotification(Lang::txt('COM_GROUPS_SAVE_ERROR_FAILED_VALIDATION'), 'error');
                 break;
             }
         }
     }
     // Push back into edit mode if any errors
     if ($this->getNotifications()) {
         $group->set('cn', $g_cn);
         $group->set('description', $g_description);
         $group->set('public_desc', $g_public_desc);
         $group->set('private_desc', $g_private_desc);
         $group->set('join_policy', $g_join_policy);
         $group->set('restrict_msg', $g_restrict_msg);
         $group->set('discoverability', $g_discoverability);
         $group->set('discussion_email_autosubscribe', $g_discussion_email_autosubscribe);
         $group->set('logo', $logo);
         $group->set('plugins', $plugin_access);
         $this->lid = $lid;
//.........这里部分代码省略.........
开发者ID:zooley,项目名称:hubzero-cms,代码行数:101,代码来源:groups.php

示例5: removeTask

 /**
  * Remove member(s) from a group
  * Disallows removal of last manager (group must have at least one)
  *
  * @return void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken(['get', 'post']);
     $gid = Request::getVar('gid', '');
     // Load the group page
     $group = new Group();
     $group->read($gid);
     // Get all the group's managers
     $managers = $group->get('managers');
     // Get all the group's members
     $members = $group->get('members');
     $users_mem = array();
     $users_man = array();
     // Incoming array of users to remove
     $id = Request::getInt('id', 0);
     // Ensure we found an account
     if (!$id) {
         \App::abort(404, Lang::txt('COM_MEMBERS_NOT_FOUND'));
     }
     if (in_array($id, $members)) {
         $users_mem[] = $id;
     }
     if (in_array($id, $managers)) {
         $users_man[] = $id;
     }
     // Remove users from members list
     $group->remove('members', $users_mem);
     // Remove users from managers list
     $group->remove('managers', $users_man);
     // Save changes
     $group->update();
     // Push through to the groups view
     $this->displayTask($id);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:41,代码来源:groups.php

示例6: unapproveTask

 /**
  * Unapprove a group
  *
  * @return  void
  */
 public function unapproveTask()
 {
     // Check for request forgeries
     //Request::checkToken();
     if (!User::authorise('core.manage', $this->_option) && !User::authorise('core.admin', $this->_option) && !User::authorise('core.edit', $this->_option) && !User::authorise('core.edit.state', $this->_option)) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
     }
     // Incoming
     $ids = Request::getVar('id', array());
     // Get the single ID we're working with
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $i = 0;
     // foreach group id passed in
     foreach ($ids as $id) {
         // Load the group page
         $group = new Group();
         $group->read($id);
         // Ensure we found the group info
         if (!$group) {
             continue;
         }
         // Set the group to be published and update
         $group->set('approved', 0);
         $group->update();
         $i++;
         // log publishing
         Log::log(array('gidNumber' => $group->get('gidNumber'), 'action' => 'group_unapproved', 'comments' => 'unapproved by administrator'));
     }
     if ($i) {
         Notify::success(Lang::txt('COM_GROUPS_UNAPPROVED'));
     }
     // Output messsage and redirect
     $this->cancelTask();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:41,代码来源:manage.php


注:本文中的Hubzero\User\Group::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。