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


PHP Group::find方法代码示例

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


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

示例1: displayTask

 /**
  * Displays a list of groups
  *
  * @return	void
  */
 public function displayTask()
 {
     $this->view->filters = array('limit' => 'all', 'fields' => array('COUNT(*)'), 'authorized' => 'admin', 'type' => array(Request::getState($this->_option . '.browse.type', 'type', 'all')), 'search' => urldecode(Request::getState($this->_option . '.browse.search', 'search', '')), 'discoverability' => Request::getState($this->_option . '.browse.discoverability', 'discoverability', ''), 'policy' => Request::getState($this->_option . '.browse.policy', 'policy', ''), 'sort' => Request::getState($this->_option . '.browse.sort', 'filter_order', 'cn'), 'sort_Dir' => Request::getState($this->_option . '.browse.sortdir', 'filter_order_Dir', 'ASC'), 'approved' => Request::getVar('approved'), 'created' => Request::getVar('created', ''));
     $this->view->filters['sortby'] = $this->view->filters['sort'] . ' ' . $this->view->filters['sort_Dir'];
     $canDo = \Components\Groups\Helpers\Permissions::getActions('group');
     if (!$canDo->get('core.admin')) {
         if ($this->view->filters['type'][0] == 'system' || $this->view->filters['type'][0] == "0" || $this->view->filters['type'][0] == NULL) {
             $this->view->filters['type'] = array('all');
         }
         if ($this->view->filters['type'][0] == 'all') {
             $this->view->filters['type'] = array(1, 2, 3);
         }
     }
     // Get a record count
     $this->view->total = Group::find($this->view->filters);
     // Filters for returning results
     $this->view->filters['limit'] = Request::getState($this->_option . '.browse.limit', 'limit', Config::get('list_limit'), 'int');
     $this->view->filters['start'] = Request::getState($this->_option . '.browse.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;
     $this->view->filters['fields'] = array('cn', 'description', 'published', 'gidNumber', 'type');
     // Get a list of all groups
     $this->view->rows = null;
     if ($this->view->total > 0) {
         $this->view->rows = Group::find($this->view->filters);
     }
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // pass config to view
     $this->view->config = $this->config;
     // Output the HTML
     $this->view->display();
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:40,代码来源:manage.php

示例2: editTask

 /**
  * Edit an Import
  *
  * @return  void
  */
 public function editTask()
 {
     Request::setVar('hidemainmenu', 1);
     // get request vars
     $ids = Request::getVar('id', array());
     $id = isset($ids[0]) ? $ids[0] : null;
     // get the import object
     $this->view->import = new Models\Import($id);
     // import params
     $this->view->params = new \Hubzero\Config\Registry($this->view->import->get('params'));
     // get all files in import filespace
     $this->view->files = \Filesystem::files($this->view->import->fileSpacePath(), '.');
     // get all imports from archive
     $hooksArchive = Models\Import\Hook\Archive::getInstance();
     $this->view->hooks = $hooksArchive->hooks('list', array('state' => array(1)));
     // Get groups
     $this->view->groups = Group::find(array('authorized' => 'admin', 'fields' => array('cn', 'description', 'published', 'gidNumber', 'type'), 'type' => array(1, 3), 'sortby' => 'description'));
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:29,代码来源:import.php

示例3: editTask

 /**
  * Edit form for a resource
  *
  * @param   integer  $isnew  Flag for editing (0) or creating new (1)
  * @return  void
  */
 public function editTask($isnew = 0)
 {
     Request::setVar('hidemainmenu', 1);
     $this->view->isnew = $isnew;
     // Get the resource component config
     $this->view->rconfig = $this->config;
     // Push some needed styles to the tmeplate
     $this->css('resources.css');
     // Incoming resource ID
     $id = Request::getVar('id', array(0));
     if (is_array($id)) {
         $id = !empty($id) ? $id[0] : 0;
     }
     // Incoming parent ID - this determines if the resource is standalone or not
     $this->view->pid = Request::getInt('pid', 0);
     // Grab some filters for returning to place after editing
     $this->view->return = array();
     $this->view->return['type'] = Request::getVar('type', '');
     $this->view->return['sort'] = Request::getVar('sort', '');
     $this->view->return['status'] = Request::getVar('status', '');
     // Instantiate our resource object
     $this->view->row = new Resource($this->database);
     $this->view->row->load($id);
     // Fail if checked out not by 'me'
     if ($this->view->row->checked_out && $this->view->row->checked_out != User::get('id')) {
         $task = '';
         if ($this->view->pid) {
             $task = '&task=children&pid=' . $this->view->pid;
         }
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . $task, false), Lang::txt('COM_RESOURCES_WARNING_CHECKED_OUT'), 'notice');
         return;
     }
     // Is this a new resource?
     if (!$id) {
         $this->view->row->created = Date::toSql();
         $this->view->row->created_by = User::get('id');
         $this->view->row->modified = $this->database->getNullDate();
         $this->view->row->modified_by = 0;
         $this->view->row->publish_up = Date::toSql();
         $this->view->row->publish_down = Lang::txt('COM_RESOURCES_NEVER');
         if ($this->view->pid) {
             $this->view->row->published = 1;
             $this->view->row->standalone = 0;
         } else {
             $this->view->row->published = 3;
             // default to "new" status
             $this->view->row->standalone = 1;
         }
         $this->view->row->access = 0;
     }
     // Editing existing
     $this->view->row->checkout(User::get('id'));
     if (trim($this->view->row->publish_down) == '0000-00-00 00:00:00') {
         $this->view->row->publish_down = Lang::txt('COM_RESOURCES_NEVER');
     }
     // Get name of resource creator
     $creator = User::getInstance($this->view->row->created_by);
     $this->view->row->created_by_name = $creator->get('name');
     $this->view->row->created_by_name = $this->view->row->created_by_name ? $this->view->row->created_by_name : Lang::txt('Unknown');
     // Get name of last person to modify resource
     if ($this->view->row->modified_by) {
         $modifier = User::getInstance($this->view->row->modified_by);
         $this->view->row->modified_by_name = $modifier->get('name');
         $this->view->row->modified_by_name = $this->view->row->modified_by_name ? $this->view->row->modified_by_name : Lang::txt('Unknown');
     } else {
         $this->view->row->modified_by_name = '';
     }
     // Get params definitions
     $this->view->params = new \Hubzero\Html\Parameter($this->view->row->params, dirname(dirname(__DIR__)) . DS . 'resources.xml');
     $this->view->attribs = new \Hubzero\Config\Registry($this->view->row->attribs);
     // Build selects of various types
     $rt = new Type($this->database);
     if ($this->view->row->standalone != 1) {
         $this->view->lists['type'] = Html::selectType($rt->getTypes(30), 'type', $this->view->row->type, '', '', '', '');
         $this->view->lists['logical_type'] = Html::selectType($rt->getTypes(28), 'logical_type', $this->view->row->logical_type, '[ none ]', '', '', '');
         $this->view->lists['sub_type'] = Html::selectType($rt->getTypes(30), 'logical_type', $this->view->row->logical_type, '[ none ]', '', '', '');
     } else {
         $this->view->lists['type'] = Html::selectType($rt->getTypes(27), 'type', $this->view->row->type, '', '', '', '');
         $this->view->lists['logical_type'] = Html::selectType($rt->getTypes(21), 'logical_type', $this->view->row->logical_type, '[ none ]', '', '', '');
     }
     // Build the <select> of admin users
     $this->view->lists['created_by'] = $this->userSelect('created_by', 0, 1);
     // Build the <select> for the group access
     $this->view->lists['access'] = Html::selectAccess($this->view->rconfig->get('accesses'), $this->view->row->access);
     // Is this a standalone resource?
     if ($this->view->row->standalone == 1) {
         $this->view->lists['tags'] = '';
         // Get groups
         $filters = array('authorized' => 'admin', 'fields' => array('cn', 'description', 'published', 'gidNumber', 'type'), 'type' => array(1, 3), 'sortby' => 'description');
         $groups = \Hubzero\User\Group::find($filters);
         // Build <select> of groups
         $this->view->lists['groups'] = Html::selectGroup($groups, $this->view->row->group_owner);
         include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'profile.php';
         include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'association.php';
//.........这里部分代码省略.........
开发者ID:zooley,项目名称:hubzero-cms,代码行数:101,代码来源:items.php

示例4: browseTask

 /**
  * Browse Groups
  *
  * @return  void
  */
 public function browseTask()
 {
     // set the neeced layout
     $this->view->setLayout('browse');
     // build the title
     $this->_buildTitle();
     // build pathway
     $this->_buildPathway();
     //build list of filters
     $this->view->filters = array();
     $this->view->filters['type'] = array(1, 3);
     $this->view->filters['published'] = 1;
     $this->view->filters['limit'] = 'all';
     $this->view->filters['fields'] = array('COUNT(*)');
     $this->view->filters['search'] = Request::getVar('search', '');
     $this->view->filters['sortby'] = strtolower(Request::getWord('sortby', 'title'));
     $this->view->filters['policy'] = strtolower(Request::getWord('policy', ''));
     $this->view->filters['index'] = htmlentities(Request::getVar('index', ''));
     //make sure we have a valid sort filter
     if (!in_array($this->view->filters['sortby'], array('alias', 'title'))) {
         $this->view->filters['sortby'] = 'title';
     }
     //make sure we have a valid policy filter
     if (!in_array($this->view->filters['policy'], array('open', 'restricted', 'invite', 'closed'))) {
         $this->view->filters['policy'] = '';
     }
     // Get a record count
     $this->view->total = Group::find($this->view->filters);
     // Filters for returning results
     $this->view->filters['limit'] = Request::getInt('limit', Config::get('list_limit'));
     $this->view->filters['limit'] = $this->view->filters['limit'] ? $this->view->filters['limit'] : 'all';
     $this->view->filters['start'] = Request::getInt('limitstart', 0);
     $this->view->filters['fields'] = array('cn', 'description', 'published', 'gidNumber', 'type', 'public_desc', 'join_policy');
     // Get a list of all groups
     $this->view->groups = Group::find($this->view->filters);
     $this->view->authorized = $this->_authorize();
     //set some vars for view
     $this->view->title = $this->_title;
     // get view notifications
     $this->view->notifications = $this->getNotifications() ? $this->getNotifications() : array();
     //display view
     $this->view->display();
 }
开发者ID:zooley,项目名称:hubzero-cms,代码行数:48,代码来源:groups.php

示例5: displayTask

 /**
  * Display all the groups a member is apart of
  *
  * @param   integer  $id  Member ID to lookup
  * @return  void
  */
 public function displayTask($id = 0)
 {
     // Incoming
     $id = $id ? $id : Request::getInt('id', 0);
     // Get a list of all groups
     $rows = \Hubzero\User\Group::find(array('type' => array('all'), 'limit' => 'all', 'search' => '', 'fields' => array('cn', 'description', 'published', 'gidNumber', 'type'), 'sortby' => 'title', 'authorized' => 'admin'));
     // Output the HTML
     $this->view->set('id', $id)->set('rows', $rows)->setErrors($this->getErrors())->setLayout('display')->display();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:15,代码来源:groups.php

示例6: listTask

 /**
  * Display a list of groups
  *
  * @apiMethod GET
  * @apiUri    /groups/list
  * @apiParameter {
  * 		"name":          "limit",
  * 		"description":   "Number of result to return.",
  * 		"type":          "integer",
  * 		"required":      false,
  * 		"default":       25
  * }
  * @apiParameter {
  * 		"name":          "start",
  * 		"description":   "Number of where to start returning results.",
  * 		"type":          "integer",
  * 		"required":      false,
  * 		"default":       0
  * }
  * @apiParameter {
  * 		"name":          "search",
  * 		"description":   "A word or phrase to search for.",
  * 		"type":          "string",
  * 		"required":      false,
  * 		"default":       ""
  * }
  * @apiParameter {
  * 		"name":          "sort",
  * 		"description":   "Field to sort results by.",
  * 		"type":          "string",
  * 		"required":      false,
  *      "default":       "created",
  * 		"allowedValues": "created, title, alias, id, publish_up, publish_down, state"
  * }
  * @apiParameter {
  * 		"name":          "sort_Dir",
  * 		"description":   "Direction to sort results by.",
  * 		"type":          "string",
  * 		"required":      false,
  * 		"default":       "desc",
  * 		"allowedValues": "asc, desc"
  * }
  * @apiParameter {
  * 		"name":          "fields",
  * 		"description":   "Comma-separated list of fields to return",
  * 		"type":          "string",
  * 		"required":      false,
  * 		"default":       "gidNumber,cn,description,created,created_by",
  * 		"allowedValues": "gidNumber, cn, description, published, approved, type, public_desc, join_policy, discoverability, logo, params, created, created_by"
  * }
  * @return  void
  */
 public function listTask()
 {
     $filters = array('limit' => Request::getInt('limit', 25), 'start' => Request::getInt('limitstart', 0), 'search' => Request::getVar('search', ''), 'sortby' => Request::getWord('sort', 'description'), 'sort_Dir' => strtoupper(Request::getWord('sort_Dir', 'DESC')), 'fields' => Request::getVar('fields', 'gidNumber,cn,description,created,created_by'), 'policy' => strtolower(Request::getWord('policy', '')), 'type' => array(1, 3), 'published' => 1);
     $filters['fields'] = explode(',', $filters['fields']);
     $filters['fields'] = array_map('trim', $filters['fields']);
     $response = \Hubzero\User\Group::find($filters);
     $this->send($response);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:60,代码来源:groupsv1_0.php

示例7: array

echo Lang::txt('COM_COURSES_FIELD_GROUP');
?>
:</label><br />
					<select name="fields[group_id]" id="field-group_id">
						<option value="0"<?php 
if (!$this->row->get('group_id')) {
    echo ' selected="selected"';
}
?>
><?php 
echo Lang::txt('COM_COURSES_NONE');
?>
</option>
						<?php 
$filters = array('authorized' => 'admin', 'fields' => array('cn', 'description', 'published', 'gidNumber', 'type'), 'type' => array(1, 3), 'sortby' => 'description');
$groups = \Hubzero\User\Group::find($filters);
if ($groups) {
    foreach ($groups as $group) {
        ?>
								<option value="<?php 
        echo $group->gidNumber;
        ?>
"<?php 
        if ($group->gidNumber == $this->row->get('group_id')) {
            echo ' selected="selected"';
        }
        ?>
><?php 
        echo $this->escape($group->description);
        ?>
 (<?php 
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:edit.php

示例8: addEmailTask

 /**
  * Add to Mailing List Task
  *
  * @return 	void
  */
 public function addEmailTask()
 {
     // get request vars
     $mailinglistId = Request::getVar('id', 0);
     $mailinglistId = isset($mailinglistId[0]) ? $mailinglistId[0] : null;
     if (!$mailinglistId) {
         $mailinglistId = $this->mid;
     }
     // load mailing list
     $this->view->list = new MailList($this->database);
     $this->view->list->load($mailinglistId);
     // get list of groups
     $filters = array('fields' => array('gidNumber', 'description'), 'type' => array('hub', 'project', 'super', 'course'));
     $this->view->groups = \Hubzero\User\Group::find($filters);
     // getting vars from do import
     $this->view->emailBox = $this->emailBox;
     // set errors if we have any
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // output
     $this->view->setLayout('addemail')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:28,代码来源:mailinglist.php

示例9: editTask

 /**
  * Edit form for a publication
  *
  * @param   integer  $isnew  Flag for editing (0) or creating new (1)
  * @return  void
  */
 public function editTask($isnew = 0)
 {
     Request::setVar('hidemainmenu', 1);
     $this->view->isnew = $isnew;
     // Get the publications component config
     $this->view->config = $this->config;
     // Incoming publication ID
     $id = Request::getVar('id', array(0));
     if (is_array($id)) {
         $id = $id[0];
     }
     // Is this a new publication? TBD
     if (!$id) {
         $this->view->isnew = 1;
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_PUBLICATIONS_ERROR_CREATE_FRONT_END'), 'notice');
         return;
     }
     // Incoming version
     $version = Request::getVar('version', 'default');
     // Grab some filters for returning to place after editing
     $this->view->return = array();
     $this->view->return['category'] = Request::getVar('category', '');
     $this->view->return['sortby'] = Request::getVar('sortby', '');
     $this->view->return['status'] = Request::getVar('status', '');
     // Instantiate a publication object
     $this->view->model = new Models\Publication($id, $version);
     // If publication not found, raise error
     if (!$this->view->model->exists()) {
         throw new Exception(Lang::txt('COM_PUBLICATIONS_NOT_FOUND'), 404);
         return;
     }
     // Fail if checked out not by 'me'
     if ($this->view->model->get('checked_out') && $this->view->model->get('checked_out') != User::get('id')) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_PUBLICATIONS_ERROR_CHECKED_OUT'), 'notice');
         return;
     }
     // Editing existing
     $this->view->model->publication->checkout(User::get('id'));
     $this->view->model->setCuration();
     // Get licenses
     $this->view->licenses = $this->view->model->table('License')->getLicenses();
     // Get groups
     $filters = array('authorized' => 'admin', 'fields' => array('cn', 'description', 'published', 'gidNumber', 'type'), 'type' => array(1, 3), 'sortby' => 'description');
     $this->view->groups = \Hubzero\User\Group::find($filters);
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Output the HTML
     $this->view->display();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:57,代码来源:items.php


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