本文整理汇总了PHP中Group::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::getAll方法的具体用法?PHP Group::getAll怎么用?PHP Group::getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::getAll方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDropDownArray
public function getDropDownArray()
{
$groups = Group::getAll();
$groupsData = array();
foreach ($groups as $group) {
$groupsData[$group->id] = strval($group);
}
return $groupsData;
}
示例2: listUser
function listUser()
{
global $lang;
$page_lang = scandir('inc/lang/' . $_SESSION['language']);
foreach ($page_lang as $file) {
if ($file != '.' && $file != '..') {
$parts = explode(".", $file);
$page = $parts[0];
if ($page == 'user') {
$page_file = $file;
}
}
}
include_once 'inc/lang/' . $_SESSION['language'] . '/' . $page_file;
if ($_SESSION['access']->users > 0) {
$results = array();
$gResults = array();
$data = User::getAll();
$gData = Group::getAll();
$results['users'] = $data['results'];
$results['totalRows'] = $data['totalRows'];
$results['pageTitle'] = "Admin User Management";
$gResults['groups'] = $gData['results'];
$gResults['totalRows'] = $gData['totalRows'];
if (isset($_GET['success'])) {
if ($_GET['success'] == "userCreated") {
$results['successMessage'] = "Your new admin user profile has been created successully.";
}
if ($_GET['success'] == "groupCreated") {
$results['successMessage'] = "Your new admin group has been created successully.";
}
if ($_GET['success'] == "changesSaved") {
$results['successMessage'] = "Your user profile changes have been saved successully.";
}
if ($_GET['success'] == "groupChangesSaved") {
$results['successMessage'] = "Your group changes have been saved successully.";
}
}
require "inc/layout/listUser.php";
} else {
require "inc/layout/noAccess.php";
}
}
示例3: testListGroups
/**
* @depends testGetGroup
*/
public function testListGroups()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$authenticationData = $this->login();
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$groups = Group::getAll('name');
$compareData = array();
foreach ($groups as $group) {
$compareData[] = $this->getModelToApiDataUtilData($group);
}
//Test List
$response = $this->createApiCallWithRelativeUrl('list/', 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals(count($groups), count($response['data']['items']));
$this->assertEquals(count($groups), $response['data']['totalCount']);
$this->assertEquals(1, $response['data']['currentPage']);
$this->assertEquals($compareData, $response['data']['items']);
}
示例4:
</div>
</div>
<div class="row-fluid">
<div class="span4">
<label>Confirm Password</label>
<input class="text-input span12" type="password" id="passconfirm" name="passconfirm" autocomplete="off" required />
</div>
</div>
<div class="row-fluid">
<div class="span4">
<label>User Group</label>
<div class="controls">
<select id="usergroup" name="usergroup">
<option>Select Group</option>
<?php
$groups = Group::getAll();
foreach ($groups['results'] as $group) {
echo '<option value="' . $group->id . '">' . $group->title . '</option>';
}
?>
</select>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<label>Gender</label>
<label class="radio">
<div class="radio" style="padding-left:10px;">
<span>
<input type="radio" name="gender" value="m">
示例5: rebuildViaSlowWay
protected static function rebuildViaSlowWay($modelClassName)
{
// The slow way will remain here as documentation
// for what the optimized way is doing.
$mungeTableName = self::getMungeTableName($modelClassName);
self::recreateTable($mungeTableName);
//Specifically call RedBeanModel to avoid the use of the security in OwnedSecurableItem since for
//rebuild it needs to look at all models regardless of permissions of the current user.
$modelCount = RedBeanModel::getCount(null, null, $modelClassName);
$subset = intval($modelCount / 20);
if ($subset < 100) {
$subset = 100;
} elseif ($subset > 1000) {
$subset = 1000;
}
$users = User::getAll();
$groups = Group::getAll();
$roles = Role::getAll();
for ($i = 0; $i < $modelCount; $i += $subset) {
//Specifically call RedBeanModel to avoid the use of the security in OwnedSecurableItem since for
//rebuild it needs to look at all models regardless of permissions of the current user.
$models = RedBeanModel::getSubset(null, $i, $subset, null, null, $modelClassName);
foreach ($models as $model) {
assert('$model instanceof SecurableItem');
$securableItemId = $model->getClassId('SecurableItem');
foreach ($users as $user) {
list($allowPermissions, $denyPermissions) = $model->getExplicitActualPermissions($user);
$effectiveExplicitPermissions = $allowPermissions & ~$denyPermissions;
if (($effectiveExplicitPermissions & Permission::READ) == Permission::READ) {
self::incrementCount($mungeTableName, $securableItemId, $user);
}
}
foreach ($groups as $group) {
list($allowPermissions, $denyPermissions) = $model->getExplicitActualPermissions($group);
$effectiveExplicitPermissions = $allowPermissions & ~$denyPermissions;
if (($effectiveExplicitPermissions & Permission::READ) == Permission::READ) {
self::incrementCount($mungeTableName, $securableItemId, $group);
foreach ($group->users as $user) {
if ($user->role->id > 0) {
self::incrementParentRolesCounts($mungeTableName, $securableItemId, $user->role);
}
}
foreach ($group->groups as $subGroup) {
self::processNestedGroupWhereParentHasReadPermissionOnSecurableItem($mungeTableName, $securableItemId, $subGroup);
}
}
}
foreach ($roles as $role) {
$count = self::getRoleMungeCount($model, $role);
assert('$count >= 0');
if ($count > 0) {
self::setCount($mungeTableName, $securableItemId, $role, $count);
}
}
}
}
}
示例6: getSelectableGroupsData
public static function getSelectableGroupsData()
{
$groups = Group::getAll();
$groupsData = array();
foreach ($groups as $group) {
if ($group->name != Group::EVERYONE_GROUP_NAME && $group->name != Group::SUPER_ADMINISTRATORS_GROUP_NAME) {
$groupsData[$group->id] = strval($group);
}
}
return $groupsData;
}
示例7: setRandomNonEveryoneNonAdministratorsGroup
protected static function setRandomNonEveryoneNonAdministratorsGroup()
{
$groups = Group::getAll();
foreach ($groups as $group) {
if ($group->isDeletable()) {
static::$randomNonEveryoneNonAdministratorsGroup = $group;
break;
}
}
}
示例8: actionChangediscip
public function actionChangediscip($id = null)
{
$specialty = new Specialty();
$groups = array();
$disciplins = array();
if ($id == null) {
$model = new DisciplineToTeacher();
$this->pageTitle = 'Назначить дисциплину преподавателю';
} else {
$this->pageTitle = 'Изменить дисциплину';
$model = DisciplineToTeacher::model()->findByPk($id);
$specialty->id_specialty = $model->discipline->metBlock->id_speciality;
$criteria = new CDbCriteria();
$criteria->condition = 'id_speciality=:id_specialty';
$criteria->params = array(':id_specialty' => $specialty->id_specialty);
$groups = Group::getAll($criteria);
$criteria = new CDbCriteria();
$criteria->with = array('metBlock');
$criteria->condition = 'metBlock.id_speciality=:id_specialty';
$criteria->params = array(':id_specialty' => $specialty->id_specialty);
$disciplins = Discipline::getAll($criteria);
}
if (isset($_POST['id_specialty'])) {
$criteria = new CDbCriteria();
$criteria->condition = 'id_speciality=:id_specialty';
$criteria->params = array(':id_specialty' => $_POST['id_specialty']);
$groups = Group::getAll($criteria);
$criteria = new CDbCriteria();
$criteria->with = array('metBlock');
$criteria->condition = 'metBlock.id_speciality=:id_specialty';
$criteria->params = array(':id_specialty' => $_POST['id_specialty']);
$disciplins = Discipline::getAll($criteria);
$this->renderPartial('_forSpecialty', array('model' => $model, 'groups' => $groups, 'disciplins' => $disciplins));
Yii::app()->end();
}
if (isset($_POST['DisciplineToTeacher'])) {
$model->attributes = $_POST['DisciplineToTeacher'];
if ($model->save()) {
$this->redirect('listdiscip');
}
}
$this->render('changeDisipline', array('model' => $model, 'specialty' => $specialty, 'groups' => $groups, 'disciplins' => $disciplins));
}
示例9: testEveryoneImplicitlyContainsAllGroups
/**
* @depends testCannotModifyGroupMembershipForTheTheEveryoneGroup
*/
public function testEveryoneImplicitlyContainsAllGroups()
{
$everyone = Group::getByName(Group::EVERYONE_GROUP_NAME);
$groups = Group::getAll();
foreach ($groups as $group) {
$this->assertTrue($everyone->contains($group));
}
}
示例10: array
<?php
$this->pageTitle = 'Список дисциплин';
?>
<h1><?php
echo $this->pageTitle;
?>
</h1>
<?php
echo CHtml::link('Назначить дисциплину для преподавателя', array("discipline/changediscip"));
$this->widget('zii.widgets.grid.CGridView', array('id' => 'user-grid', 'dataProvider' => $discipline->search(), 'filter' => $discipline, 'emptyText' => 'В базе нет дисциплин', 'columns' => array('id_discipline' => array('name' => 'id_discipline', 'value' => '$data->discipline->title'), 'id_group' => array('name' => 'id_group', 'value' => '$data->group->title', 'filter' => Group::getAll()), 'id_teacher' => array('name' => 'id_teacher', 'value' => '$data->teacher->surname." ".$data->teacher->firstname." ".$data->teacher->middlename', 'filter' => User::getAllTeacher()), 'sem' => array('name' => 'sem', 'value' => '$data->sem', 'filter' => DisciplineToTeacher::getAllSem()), array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'updateButtonUrl' => 'Yii::app()->createUrl("discipline/changediscip", array("id"=>$data->id_notice))', 'deleteButtonUrl' => 'Yii::app()->createUrl("discipline/deletediscip", array("id"=>$data->id_notice))'))));
示例11: getUserForm
/**
* generate form: change user info
*
* @return string html code for the form
* @author Elias Müller
**/
private function getUserForm($user = NULL)
{
if ($this->s->user->hasRights('user:update') || $this->s->action == 'create') {
$list_status = Group::getAll();
} else {
$list_status = $this->s->user->status;
}
$path = $this->s->element != '' ? $this->s->action . '/' . $this->s->element . '.html' : $this->s->action;
$tpl = new Template('user');
$tpl->assign('user', $user);
$tpl->assign('path', $path);
$tpl->assign('status', $list_status);
return $tpl->fetch('form_user.html');
}
示例12: move
function move($id, $type = 'up') {
global $database, $db;
if(empty($id) || !isset($id))
return false;
if(!preg_match("/^[0-9]+$/", $id))
return false;
if(in_array($type, array('up', 'down'))) {
$group = Group::getAll($id);
if($group) {
if($type=='up') {
$prevGroup = $db->queryRow('SELECT * FROM '.$database['prefix'].'Groups WHERE priority < '. $group['priority'] .' ORDER BY priority DESC LIMIT 1');
if($prevGroup['id'] != $group['id']) {
$db->execute('UPDATE '.$database['prefix'].'Groups SET priority = '.$group['priority'].' WHERE id='.$prevGroup['id']);
$db->execute('UPDATE '.$database['prefix'].'Groups SET priority = '.$prevGroup['priority'].' WHERE id='.$group['id']);
}
} else {
$nextGroup = $db->queryRow('SELECT * FROM '.$database['prefix'].'Groups WHERE priority > '. $group['priority'] .' ORDER BY priority ASC LIMIT 1');
if($nextGroup['id'] != $group['id']) {
$db->execute('UPDATE '.$database['prefix'].'Groups SET priority = '.$group['priority'].' WHERE id='.$nextGroup['id']);
$db->execute('UPDATE '.$database['prefix'].'Groups SET priority = '.$nextGroup['priority'].' WHERE id='.$group['id']);
}
}
return true;
} else return false;
} else {
return false;
}
}
示例13: listGroups
/**
* Create group/rights list
*
* @return string HTML-Code for group list
*/
private function listGroups()
{
$tpl = new Template('group');
// get all rights of the active modules
$modules = $this->s->modules;
foreach ($modules as $module => $name) {
$cur_module = $this->s->loadModule($module);
$r = $cur_module->registerRights();
if (is_array($r)) {
$set = false;
foreach ($r as $key => $value) {
$r_names[$module][$key] = $value;
// names of the rights
$set = true;
}
if ($set) {
$m_names[$module] = $name;
}
}
is_array($r_names[$module]) && ksort($r_names[$module]);
}
// get all rights of the user groups
$groups = Group::getAll();
foreach ($groups as $g) {
foreach ($g->rights as $right) {
$r = explode(':', $right);
$r_groups[$r[0]][$r[1]][$g->id] = true;
}
}
$tpl->assign('groups', $groups);
$tpl->assign('count', count($groups) + 1);
$tpl->assign('modules', $m_names);
$tpl->assign('names', $r_names);
$tpl->assign('rights', $r_groups);
$tpl->assign('call', $this->s->post['call']);
$tpl->assign('permissions', array('activate' => $this->s->user->hasRights("group:activate"), 'delete' => $this->s->user->hasRights("group:delete"), 'create' => $this->s->user->hasRights("group:create")));
$tpl->assign('permission', $this->s->user->hasRights('group:activate'));
return $tpl->fetch('rights_table.html');
}
示例14: count
include ROOT . '/lib/includeForAdmin.php';
requireAdmin();
requireComponent('Bloglounge.Data.Groups');
include ROOT. '/lib/piece/adminHeader.php';
$groups = Group::getList();
$groupCount = count($groups );
$selectGroup = null;
$selectGroupId = 0;
if(isset($_GET['group'])) {
$selectGroupId = $_GET['group'];
$selectGroup = Group::getAll($selectGroupId);
}
?>
<script type="text/javascript">
function groupAdd() {
var name = $("#groupAddName");
if(name.val() == "") {
alert('<?php echo _t("그룹명을 입력해주세요.");?>');
name.focus();
return false;
}
$.ajax({
type: "POST",