* finish task#1323.

This commit is contained in:
chencongzhi520@gmail.com
2013-04-11 07:15:43 +00:00
parent 1a0473ef84
commit f5867097f4
3 changed files with 28 additions and 2 deletions

View File

@@ -347,12 +347,16 @@ class user extends control
die(js::locate($this->createLink('company', 'browse'), 'parent'));
}
$user = $this->user->getById($userID);
$user->group = $this->dao->select('`group`')->from(TABLE_USERGROUP)->where('account')->eq($user->account)->fetchPairs();
$title = $this->lang->company->common . $this->lang->colon . $this->lang->user->edit;
$position[] = $this->lang->user->edit;
$this->view->title = $title;
$this->view->position = $position;
$this->view->user = $this->user->getById($userID);
$this->view->user = $user;
$this->view->depts = $this->dept->getOptionMenu();
$this->view->groups = $this->loadModel('group')->getPairs();
$this->display();
}

View File

@@ -317,7 +317,7 @@ class userModel extends model
$user = fixer::input('post')
->setDefault('join', '0000-00-00')
->setIF($this->post->password1 != false, 'password', md5($this->post->password1))
->remove('password1, password2')
->remove('password1, password2, groups')
->specialChars('msn,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode')
->get();
@@ -341,6 +341,17 @@ class userModel extends model
if(!dao::isError()) $this->app->user->account = $this->post->account;
}
}
$this->dao->delete()->from(TABLE_USERGROUP)->where('account')->eq($this->post->account)->exec();
if($this->post->groups)
{
foreach($this->post->groups as $groupID)
{
$data->account = $this->post->account;
$data->group = $groupID;
$this->dao->insert(TABLE_USERGROUP)->data($data)->exec();
}
}
}
/**

View File

@@ -27,6 +27,17 @@
<th class='rowhead'><?php echo $lang->user->realname;?></th>
<td><?php echo html::input('realname', $user->realname, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->user->group;?></th>
<td>
<?php
foreach($groups as $groupID => $groupName)
{
echo html::checkbox('groups', array($groupID => $groupName), in_array($groupID, $user->group) ? $groupID : '');
}
?>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->user->role;?></th>
<td><?php echo html::select('role', $lang->user->roleList, $user->role, "class='select-3'");?></td>