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


PHP User\Group类代码示例

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


在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: up

 /**
  * Up
  **/
 public function up()
 {
     // select all groups with duplicate cname's
     $query = "SELECT gidNumber, cn, description\n\t\t\t\t  FROM `#__xgroups` WHERE cn IN (\n\t\t\t\t\t  SELECT cn FROM `#__xgroups` GROUP BY cn HAVING COUNT(*) > 1\n\t\t\t\t  ) ORDER BY gidNumber;";
     $this->db->setQuery($query);
     $duplicateGroups = $this->db->loadObjectList();
     // var to hold original groups
     $original = array();
     // loop through each group
     foreach ($duplicateGroups as $duplicateGroup) {
         // make sure to keep the original group
         if (!in_array($duplicateGroup->cn, $original)) {
             $original[] = $duplicateGroup->cn;
             continue;
         }
         // delete group
         // also deletes membership related stuff
         $hzGroup = \Hubzero\User\Group::getInstance($duplicateGroup->gidNumber);
         $hzGroup->delete();
     }
     // // Add unique index to cn column
     if ($this->db->tableExists('#__xgroups')) {
         if (!$this->db->tableHasKey('#__xgroups', 'idx_cn')) {
             $query = "ALTER TABLE `#__xgroups` ADD UNIQUE INDEX `idx_cn` (`cn`);";
             $this->db->setQuery($query);
             $this->db->query();
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:32,代码来源:Migration20140423131112ComGroups.php

示例3: up

 /**
  * Up
  **/
 public function up()
 {
     // include com_wishlist files
     require_once PATH_CORE . DS . 'components' . DS . 'com_wishlist' . DS . 'models' . DS . 'wishlist.php';
     // Load some objects
     $wishlist = new \Components\Wishlist\Tables\Wishlist($this->db);
     $wish = new \Components\Wishlist\Tables\Wish($this->db);
     // Get records
     $lists = $wishlist->getRecords(array('category' => 'group'));
     // vars to hold counts
     $deletedLists = 0;
     $deletedWishes = 0;
     // check to make sure each group wishlist has a valid group
     foreach ($lists as $list) {
         // load group
         $group = \Hubzero\User\Group::getInstance($list->referenceid);
         // if group doesnt exist we need to remove the list and wishes
         if (!$group || !is_object($group)) {
             // Get wishes
             $wishes = $wish->get_wishes($list->id, array('filterby' => 'all', 'sortby' => ''), 1);
             // delete each wish
             foreach ($wishes as $item) {
                 $wish->load($item->id);
                 $wish->delete();
                 $deletedWishes++;
             }
             // delete wishlist
             $wishlist->load($list->id);
             $wishlist->delete();
             $deletedLists++;
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:36,代码来源:Migration20150115234546PlgGroupsWishlist.php

示例4: __construct

 /**
  * Constructor - sets output mechanism and arguments for use by command
  *
  * @param   \Hubzero\Console\Output    $output     The ouput renderer
  * @param   \Hubzero\Console\Arguments $arguments  The command arguments
  * @return  void
  **/
 public function __construct(Output $output, Arguments $arguments)
 {
     parent::__construct($output, $arguments);
     // Do we have a group arg?
     if ($cname = $this->arguments->getOpt('group')) {
         $group = \Hubzero\User\Group::getInstance($cname);
     } else {
         // Get the current directory
         $currentDirectory = getcwd();
         // Remove web root
         $currentDirectory = str_replace(PATH_APP, '', $currentDirectory);
         // Get group upload directory
         $groupsConfig = \Component::params('com_groups');
         $groupsDirectory = trim($groupsConfig->get('uploadpath', '/site/groups'), DS);
         // Are we within the groups upload path
         if (strpos($currentDirectory, $groupsDirectory)) {
             $gid = str_replace($groupsDirectory, '', $currentDirectory);
             $gid = trim($gid, DS);
             // Get group instance
             $group = \Hubzero\User\Group::getInstance($gid);
         }
     }
     // Make sure we have a group & its super!
     if (isset($group) && $group && $group->isSuperGroup()) {
         $this->group = $group;
     } else {
         $this->output->error('Error: Provided group is not valid');
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:36,代码来源:Group.php

示例5: execute

 /**
  * Override Execute Method
  *
  * @return 	void
  */
 public function execute()
 {
     //get the cname, active tab, and action for plugins
     $this->cn = Request::getVar('cn', '');
     $this->active = Request::getVar('active', '');
     $this->action = Request::getVar('action', '');
     // Check if they're logged in
     if (User::isGuest()) {
         $this->loginTask(Lang::txt('COM_GROUPS_ERROR_MUST_BE_LOGGED_IN'));
         return;
     }
     //check to make sure we have  cname
     if (!$this->cn) {
         $this->_errorHandler(400, Lang::txt('COM_GROUPS_ERROR_NO_ID'));
     }
     // Load the group page
     $this->group = Group::getInstance($this->cn);
     // Ensure we found the group info
     if (!$this->group || !$this->group->get('gidNumber')) {
         $this->_errorHandler(404, Lang::txt('COM_GROUPS_ERROR_NOT_FOUND'));
     }
     // Check authorization
     if ($this->_authorize() != 'manager' && !$this->_authorizedForTask('group.pages')) {
         $this->_errorHandler(403, Lang::txt('COM_GROUPS_ERROR_NOT_AUTH'));
     }
     //continue with parent execute method
     parent::execute();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:33,代码来源:pages.php

示例6: __construct

 /**
  * Constructor
  *
  * @param   integer  $referenceid  Scope ID (group, course, etc.)
  * @return  void
  */
 public function __construct($referenceid = 0)
 {
     $this->set('referenceid', $referenceid)->set('category', 'group')->set('option', $this->_segments['option']);
     $this->_item = \Hubzero\User\Group::getInstance($referenceid);
     if (!$this->_item) {
         $this->_item = new \Hubzero\User\Group();
     }
     $this->_segments['cn'] = $this->_item->get('cn');
     $this->_segments['active'] = 'wishlist';
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:16,代码来源:group.php

示例7: loadLanguage

 /**
  * Loads the plugin language file
  *
  * @param   string   $extension  The extension for which a language file should be loaded
  * @param   string   $basePath   The basepath to use
  * @return  boolean  True, if the file has successfully loaded.
  */
 public function loadLanguage($extension = '', $basePath = PATH_APP)
 {
     if (empty($extension)) {
         $extension = 'plg_' . $this->_type . '_' . $this->_name;
     }
     $group = \Hubzero\User\Group::getInstance(Request::getCmd('cn'));
     if ($group && $group->isSuperGroup()) {
         $basePath = PATH_APP . DS . 'site' . DS . 'groups' . DS . $group->get('gidNumber');
     }
     $lang = \App::get('language');
     return $lang->load(strtolower($extension), $basePath, null, false, true) || $lang->load(strtolower($extension), PATH_APP . DS . 'plugins' . DS . $this->_type . DS . $this->_name, null, false, true) || $lang->load(strtolower($extension), PATH_APP . DS . 'plugins' . DS . $this->_type . DS . $this->_name, null, false, true) || $lang->load(strtolower($extension), PATH_CORE . DS . 'plugins' . DS . $this->_type . DS . $this->_name, null, false, true);
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:19,代码来源:blog.php

示例8: __construct

 /**
  * Constructor
  *
  * @param   integer  $scope_id  Scope ID (group, course, etc.)
  * @return  void
  */
 public function __construct($scope_id)
 {
     $group = \Hubzero\User\Group::getInstance($scope_id);
     if (!$group) {
         $group = new \Hubzero\User\Group();
         $group->set('cn', '_unknown_');
     }
     $this->_segments['cn'] = $group->get('cn');
     $this->_segments['active'] = 'forum';
     $this->_segments['scope'] = '';
     $this->_name = $group->get('cn');
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:18,代码来源:group.php

示例9: execute

 /**
  * Override Execute Method
  *
  * @return 	void
  */
 public function execute()
 {
     // Incoming
     $this->gid = Request::getVar('gid', '');
     // Ensure we have a group ID
     if (!$this->gid) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=manage', false), Lang::txt('COM_GROUPS_MISSING_ID'), 'error');
         return;
     }
     $this->group = Group::getInstance($this->gid);
     parent::execute();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:17,代码来源:modules.php

示例10: listTask

 /**
  * Display members of a group
  *
  * @apiMethod GET
  * @apiUri    /groups/{id}/members/list
  * @apiParameter {
  * 		"name":          "id",
  * 		"description":   "Group identifier",
  * 		"type":          "integer",
  * 		"required":      true,
  * 		"default":       0
  * }
  * @apiParameter {
  * 		"name":          "list",
  * 		"description":   "Comma-separated list of member status",
  * 		"type":          "string",
  * 		"required":      false,
  * 		"default":       "",
  * 		"allowedValues": "members, managers, invitees, applicants"
  * }
  * @apiParameter {
  * 		"name":          "start",
  * 		"description":   "Number of where to start returning results.",
  * 		"type":          "integer",
  * 		"required":      false,
  * 		"default":       0
  * }
  * @return  void
  */
 public function listTask()
 {
     $id = Request::getInt('id', 0);
     $group = \Hubzero\User\Group::getInstance($id);
     if (!$group) {
         throw new Exception(Lang::txt('COM_GROUPS_ERROR_MISSING_RECORD'), 404);
     }
     // get all group members, managers, etc
     $members = $group->get('members');
     $managers = $group->get('managers');
     $invitees = $group->get('invitees');
     $applicants = $group->get('applicants');
     // get what the user wants back
     $list = Request::getVar('list', 'members, managers, invitees, applicants');
     // split by comma
     if (is_string($list)) {
         $list = explode(',', $list);
         $list = array_map('trim', $list);
         $list = array_map('strtolower', $list);
     }
     // var to hold return
     $response = array();
     // add members
     if (in_array('members', $list)) {
         foreach ($members as $k => $member) {
             $members[$k] = array('uidNumber' => $member);
         }
         $response['members'] = $members;
     }
     // add managers
     if (in_array('managers', $list)) {
         foreach ($managers as $k => $manager) {
             $managers[$k] = array('uidNumber' => $manager);
         }
         $response['managers'] = $managers;
     }
     // add invitees
     if (in_array('invitees', $list)) {
         foreach ($invitees as $k => $invitee) {
             $invitees[$k] = array('uidNumber' => $invitee);
         }
         $response['invitees'] = $invitees;
     }
     // add managers
     if (in_array('applicants', $list)) {
         foreach ($applicants as $k => $applicant) {
             $applicants[$k] = array('uidNumber' => $applicant);
         }
         $response['applicants'] = $applicants;
     }
     $this->send($response);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:81,代码来源:membersv1_0.php

示例11: execute

 /**
  * Override Execute Method
  *
  * @return  void
  */
 public function execute()
 {
     $id = Request::getInt('gidNumber');
     // Load the group page
     $this->group = Group::getInstance($id);
     // Ensure we found the group info
     if (!$this->group || !$this->group->get('gidNumber')) {
         App::abort(404, Lang::txt('COM_GROUPS_ERROR_NOT_FOUND'));
     }
     //build path to the group folder
     $this->path = PATH_APP . DS . trim($this->config->get('uploadpath', '/site/groups'), DS) . DS . $this->group->get('gidNumber');
     //continue with parent execute method
     parent::execute();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:19,代码来源:media.php

示例12: __construct

 /**
  * Constructor
  *
  * @param   integer  $scope_id  Scope ID (group, course, etc.)
  * @return  void
  */
 public function __construct($scope_id = 0)
 {
     $this->set('scope_id', $scope_id);
     $group = \Hubzero\User\Group::getInstance($scope_id);
     if (!$group || !$group->get('cn')) {
         $group = new \Hubzero\User\Group();
         $group->set('gidNumber', $scope_id);
         $group->set('cn', $scope_id);
         $group->set('description', Lang::txt('(unknown)'));
     }
     $this->_group = $group;
     $this->_segments['cn'] = $group->get('cn');
     $this->_segments['active'] = 'collections';
     $this->set('option', $this->_segments['option']);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:21,代码来源:group.php

示例13: onUserAfterDelete

 /**
  * Method is called after user data is deleted from the database
  *
  * @param array  $user   holds the user data
  * @param bool   $succes true if user was succesfully stored in the database
  * @param string $msg    message
  */
 public function onUserAfterDelete($user, $succes, $msg)
 {
     // Check params for group name
     $groupAlias = $this->params->get('group', false);
     if ($groupAlias) {
         // Get the group
         $group = \Hubzero\User\Group::getInstance($groupAlias);
         if (is_object($group)) {
             // Remove the user from the group
             $group->remove('members', array($user['id']));
             // Update the groups
             $group->update();
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:22,代码来源:geo.php

示例14: __construct

 /**
  * Constructor
  *
  * @param   integer  $scope_id  Scope ID (group, course, etc.)
  * @return  void
  */
 public function __construct($scope_id = 0)
 {
     $this->set('scope_id', $scope_id);
     $this->_item = UserGroup::getInstance($scope_id);
     if (!$this->_item instanceof UserGroup) {
         $this->_item = new UserGroup();
     }
     $this->_segments['cn'] = $this->_item->get('cn');
     $this->_segments['active'] = 'blog';
     $groupParams = Component::params('com_groups');
     $uploadpath = $groupParams->get('uploadpath', '/site/groups');
     $uploadpath = trim($uploadpath, DS) . DS . $this->get('scope_id') . DS . 'uploads' . DS . 'blog';
     $this->set('path', $uploadpath);
     $this->set('scope', $this->_segments['cn'] . '/blog');
     $this->set('option', $this->_segments['option']);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:22,代码来源:group.php

示例15: onSearch

 /**
  * Build search query and add it to the $results
  *
  * @param      object $request  \Components\Search\Models\Basic\Request
  * @param      object &$results \Components\Search\Models\Basic\Result\Set
  * @param      object $authz    \Components\Search\Models\Basic\Authorization
  * @return     void
  */
 public static function onSearch($request, &$results, $authz)
 {
     $terms = $request->get_term_ar();
     $weight = 'match(e.title, e.content) against(\'' . join(' ', $terms['stemmed']) . '\')';
     $addtl_where = array();
     foreach ($terms['mandatory'] as $mand) {
         $addtl_where[] = "(e.title LIKE '%{$mand}%' OR e.content LIKE '%{$mand}%')";
     }
     foreach ($terms['forbidden'] as $forb) {
         $addtl_where[] = "(e.title NOT LIKE '%{$forb}%' AND e.content NOT LIKE '%{$forb}%')";
     }
     // Commenting out Access check as it was never used and column was removed from table
     // during events refactoring
     //
     // @author Chris Smoak
     // @date   4/20/2014
     //
     // $addtl_where[] = '(e.access IN (' . implode(',', User::getAuthorisedViewLevels()) . '))';
     $rows = new \Components\Search\Models\Basic\Result\Sql("SELECT\n\t\t\t\te.title,\n\t\t\t\te.content AS description,\n\t\t\t\te.scope,\n\t\t\t\te.scope_id,\n\t\t\t\tconcat('index.php?option=com_events&task=details&id=', e.id) AS link,\n\t\t\t\t{$weight} AS weight,\n\t\t\t\tpublish_up AS date,\n\t\t\t\t'Events' AS section\n\t\t\tFROM `#__events` e\n\t\t\tWHERE\n\t\t\t\tstate = 1 AND\n\t\t\t\tapproved AND {$weight} > 0" . ($addtl_where ? ' AND ' . join(' AND ', $addtl_where) : '') . " ORDER BY {$weight} DESC");
     foreach ($rows->to_associative() as $row) {
         if (!$row) {
             continue;
         }
         // check group perms
         if ($row->scope == 'group') {
             // load group
             $group = \Hubzero\User\Group::getInstance($row->scope_id);
             // make sure we found one
             if (!$group) {
                 continue;
             }
             // get group calendar access
             $access = \Hubzero\User\Group\Helper::getPluginAccess($group, 'calendar');
             // is calendar off
             // is calendar for registered users & not logged in
             // is calendar for members only and we are not a member
             if ($access == 'nobody' || $access == 'registered' && User::isGuest() || $access == 'members' && !in_array(User::get('id'), $group->get('members'))) {
                 continue;
             }
         }
         $row->set_description(preg_replace('/(\\[+.*?\\]+|\\{+.*?\\}+|[=*])/', '', $row->get_description()));
         $results->add($row);
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:52,代码来源:events.php


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