* finish task#1203.
* code for task#1323.
This commit is contained in:
@@ -130,6 +130,22 @@ class groupModel extends model
|
||||
return $this->dao->findById($groupID)->from(TABLE_GROUP)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group by account.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByAccount($account)
|
||||
{
|
||||
return $this->dao->select('t2.*')->from(TABLE_USERGROUP)->alias('t1')
|
||||
->leftJoin(TABLE_GROUP)->alias('t2')
|
||||
->on('t1.group = t2.id')
|
||||
->where('t1.account')->eq($account)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get privileges of a groups.
|
||||
*
|
||||
|
||||
@@ -411,13 +411,13 @@ class my extends control
|
||||
{
|
||||
if($this->app->user->account == 'guest') die(js::alert('guest') . js::locate('back'));
|
||||
|
||||
$user = $this->user->getById($this->app->user->account);
|
||||
$deptPath = $this->dept->getParents($user->dept);
|
||||
$user = $this->user->getById($this->app->user->account);
|
||||
|
||||
$this->view->deptPath = $deptPath;
|
||||
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->profile;
|
||||
$this->view->position[] = $this->lang->my->profile;
|
||||
$this->view->user = $this->user->getById($this->app->user->id);
|
||||
$this->view->groups = $this->loadModel('group')->getByAccount($this->app->user->account);
|
||||
$this->view->deptPath = $this->dept->getParents($user->dept);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,15 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/tablesorter.html.php';?>
|
||||
<table align='center' class='table-4'>
|
||||
<caption><?php echo $lang->my->profile;?></caption>
|
||||
<caption>
|
||||
<div class='f-left'> <?php echo $lang->my->profile;?></div>
|
||||
<div class='f-right'>
|
||||
<?php
|
||||
echo html::a($this->createLink('user', 'editGroup', "account={$this->app->user->account}"), $lang->user->editGroup);
|
||||
echo html::a($this->createLink('my', 'editprofile'), $lang->user->editProfile);
|
||||
?>
|
||||
</div>
|
||||
</caption>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->user->dept;?></th>
|
||||
<td>
|
||||
@@ -42,6 +50,17 @@
|
||||
<th class='rowhead'><?php echo $lang->user->realname;?></th>
|
||||
<td><?php echo $user->realname;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->user->group;?></th>
|
||||
<td>
|
||||
<?php
|
||||
foreach($groups as $group)
|
||||
{
|
||||
echo $group->name . ' ';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->user->role;?></th>
|
||||
<td><?php echo $lang->user->roleList[$user->role];?></td>
|
||||
@@ -112,13 +131,5 @@
|
||||
<th class='rowhead'><?php echo $lang->user->zipcode;?></th>
|
||||
<td><?php echo $user->zipcode;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'>
|
||||
<?php
|
||||
echo html::a($this->createLink('my', 'editprofile'), $lang->user->editProfile);
|
||||
echo html::a($this->createLink('user', 'logout'), $lang->logout);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -208,22 +208,18 @@ class user extends control
|
||||
*/
|
||||
public function profile($account)
|
||||
{
|
||||
$position[] = $this->lang->user->profile;
|
||||
|
||||
/* Set menu. */
|
||||
$this->user->setMenu($this->user->getPairs('noempty|noclosed'), $account);
|
||||
$this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed'), $account);
|
||||
|
||||
$user = $this->user->getById($account);
|
||||
$deptPath = $this->dept->getParents($user->dept);
|
||||
|
||||
$title = "USER #$user->id $user->account/" . $this->lang->user->profile;
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->account = $account;
|
||||
$this->view->user = $user;
|
||||
|
||||
$this->view->deptPath = $deptPath;
|
||||
$this->view->title = "USER #$user->id $user->account/" . $this->lang->user->profile;
|
||||
$this->view->position[] = $this->lang->user->profile;
|
||||
$this->view->account = $account;
|
||||
$this->view->user = $user;
|
||||
$this->view->groups = $this->loadModel('group')->getByAccount($account);
|
||||
$this->view->deptPath = $this->dept->getParents($user->dept);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -428,7 +424,8 @@ class user extends control
|
||||
|
||||
$this->view->title = $this->lang->company->common . $this->lang->colon . $this->lang->user->editGroup;
|
||||
$this->view->position[] = $this->lang->user->editGroup;
|
||||
$this->view->userGroups = $this->dao->select('`group`')->from(TABLE_USERGROUP)->where('account')->eq($account)->fetchPairs();
|
||||
$this->view->account = $account;
|
||||
$this->view->userGroups = $this->loadModel('group')->getByAccount($account);
|
||||
$this->view->groups = $this->loadModel('group')->getList($this->app->company->id);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table align='center' class='table-1 tablesorter'>
|
||||
<caption class='caption-tl pb-10px'>
|
||||
<div class='f-left'><?php echo $lang->user->editGroup;?></div>
|
||||
<div class='f-left'><?php echo $lang->user->editGroup . $lang->colon . $account;?></div>
|
||||
<div class='f-right'><?php common::printIcon('group', 'create');?></div>
|
||||
</caption>
|
||||
<thead>
|
||||
@@ -28,7 +28,7 @@
|
||||
<tbody>
|
||||
<?php foreach($groups as $group):?>
|
||||
<tr class='a-left'>
|
||||
<td class='strong'> <?php echo html::checkbox('groups', array($group->id => $group->id), in_array($group->id, $userGroups) ? $group->id : '', "class='ml-10px'");?></td>
|
||||
<td class='strong'> <?php echo html::checkbox('groups', array($group->id => $group->id), isset($userGroups[$group->id]) ? $group->id : '', "class='ml-10px'");?></td>
|
||||
<td class='a-center'><?php echo $group->name;?></td>
|
||||
<td class='a-left'> <?php echo $group->desc;?></td>
|
||||
</tr>
|
||||
|
||||
@@ -14,7 +14,15 @@
|
||||
<?php include '../../common/view/tablesorter.html.php';?>
|
||||
<?php include './featurebar.html.php';?>
|
||||
<table align='center' class='table-4'>
|
||||
<caption><?php echo $lang->user->profile;?></caption>
|
||||
<caption>
|
||||
<div class='f-left'> <?php echo $lang->user->profile;?></div>
|
||||
<div class='f-right'>
|
||||
<?php
|
||||
echo html::a($this->createLink('user', 'editGroup', "account={$this->app->user->account}"), $lang->user->editGroup);
|
||||
echo html::a($this->createLink('user', 'edit', "userID=$user->id&from=company"), $lang->user->editProfile);
|
||||
?>
|
||||
</div>
|
||||
</caption>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->user->dept;?></th>
|
||||
<td>
|
||||
@@ -42,6 +50,17 @@
|
||||
<th class='rowhead'><?php echo $lang->user->realname;?></th>
|
||||
<td><?php echo $user->realname;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->user->group;?></th>
|
||||
<td>
|
||||
<?php
|
||||
foreach($groups as $group)
|
||||
{
|
||||
echo $group->name . ' ';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->user->role;?></th>
|
||||
<td><?php echo $lang->user->roleList[$user->role];?></td>
|
||||
@@ -112,13 +131,5 @@
|
||||
<th class='rowhead'><?php echo $lang->user->zipcode;?></th>
|
||||
<td><?php echo $user->zipcode;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'>
|
||||
<?php
|
||||
echo html::a($this->createLink('user', 'edit', "userID=$user->id&from=company"), $lang->user->editProfile);
|
||||
echo html::a($this->createLink('user', 'logout'), $lang->logout);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user