Skip to content

Commit

Permalink
group memberships cleaned up and opperational
Browse files Browse the repository at this point in the history
  • Loading branch information
illiphilli committed Apr 27, 2011
1 parent d1ba111 commit 51ec705
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions framework/modules/users/controllers/usersController.php
Expand Up @@ -587,13 +587,14 @@ public function manage_group_memberships() {
}
}

$limit = empty($this->config['limit']) ? 10 : $this->config['limit'];
//$limit = empty($this->config['limit']) ? 10 : $this->config['limit'];
$order = empty($this->config['order']) ? 'username' : $this->config['order'];
$page = new expPaginator(array(
// 'model'=>'user',
'records'=>$users,
'where'=>1,
'limit'=>$limit,
'limit'=>9999, // unless we're showing all users on a page at once, there's no way to
// add all users to a group, since it's rebuilding the group on save...
'order'=>$order,
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
Expand Down Expand Up @@ -655,21 +656,20 @@ public function update_memberships() {
global $user, $db;

//$memb = $db->selectObject('groupmembership','member_id='.$user->id.' AND group_id='.$this->params['id'].' AND is_admin=1');

$group = $db->selectObject('group','id='.intval($this->params['id']));

$db->delete('groupmembership','group_id='.$group->id);
$memb = null;
$memb->group_id = $group->id;
if ($this->params['membdata'] != "") {
foreach ($this->params['membdata'] as $u=>$str) {
if ($this->params['memdata'] != "") {
foreach ($this->params['memdata'] as $u=>$str) {
$memb->member_id = $u;
$memb->is_admin = $str['is_admin'];
$db->insertObject($memb,'groupmembership');
}
}
exponent_permissions_triggerRefresh();
expoHistory::back();
expHistory::back();

}

Expand Down
Expand Up @@ -37,10 +37,10 @@
<td>{$user->firstname}</td>
<td>{$user->lastname}</td>
<td>
{control type=checkbox name=memdata[{$user->id}][is_member] value=1 checked=$user->is_member}
{control type=checkbox name="memdata[`$user->id`][is_member]" value=1 checked=$user->is_member}
</td>
<td>
{control type=checkbox name=memdata[{$user->id}][is_admin] value=1 checked=$user->is_admin}
{control type=checkbox name="memdata[`$user->id`][is_admin]" value=1 checked=$user->is_admin}
</td>
</tr>
{foreachelse}
Expand Down
4 changes: 2 additions & 2 deletions framework/modules/users/views/users/manage_groups.tpl
Expand Up @@ -48,8 +48,8 @@
{permissions level=$smarty.const.UILEVEL_PERMISSIONS}
<div class="item-actions">
{icon img=groupperms.png controller=users action="manage_group_memberships" record=$group title="Add/Remove Members to Group `$group->name`"}
{icon class=edit controller=users action=edit_group record=$group title="Edit"}
{icon class=delete controller=users action=delete_group record=$group title="Delete" onclick="return confirm('Are you sure you want to delete this group?');"}
{icon img=edit.png controller=users action=edit_group record=$group title="Edit"}
{icon img=delete.png controller=users action=delete_group record=$group title="Delete" onclick="return confirm('Are you sure you want to delete this group?');"}
</div>
{/permissions}
</td>
Expand Down

0 comments on commit 51ec705

Please sign in to comment.