* Finish task#8117.

This commit is contained in:
leiyong
2020-10-14 10:37:41 +08:00
parent 7eecf4b27f
commit 984e782595
7 changed files with 119 additions and 35 deletions
+12
View File
@@ -25,6 +25,18 @@ class deptModel extends model
return $this->dao->findById($deptID)->from(TABLE_DEPT)->fetch();
}
/**
* Get all department names.
*
* @param int $deptID
* @access public
* @return object
*/
public function getDeptPairs($deptID = 0)
{
return $this->dao->select('id,name')->from(TABLE_DEPT)->fetchPairs('id', 'name');
}
/**
* Build the query.
*
+11 -12
View File
@@ -1,16 +1,15 @@
<?php
global $lang;
$config->personnel->accessible = new stdClass();
$config->personnel->accessible->search['module'] = 'accessible';
$config->personnel->accessible->search['fields']['department'] = $lang->personnel->department;
$config->personnel->accessible->search['fields']['realName'] = $lang->personnel->realName;
$config->personnel->accessible->search['fields']['userName'] = $lang->personnel->userName;
$config->personnel->accessible->search['fields']['job'] = $lang->personnel->job;
$config->personnel->accessible->search['fields']['genders'] = $lang->personnel->genders;
$config->personnel->accessible->search['module'] = 'accessible';
$config->personnel->accessible->search['fields']['realname'] = $lang->personnel->realName;
$config->personnel->accessible->search['fields']['dept'] = $lang->personnel->department;
$config->personnel->accessible->search['fields']['role'] = $lang->personnel->job;
$config->personnel->accessible->search['fields']['account'] = $lang->personnel->userName;
$config->personnel->accessible->search['fields']['gender'] = $lang->personnel->genders;
$config->personnel->accessible->search['params']['department'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->personnel->accessible->search['params']['realName'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->personnel->accessible->search['params']['userName'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->personnel->accessible->search['params']['job'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->personnel->accessible->search['params']['genders'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->personnel->accessible->search['params']['dept'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->personnel->accessible->search['params']['realname'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->personnel->accessible->search['params']['account'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->personnel->accessible->search['params']['role'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->personnel->accessible->search['params']['gender'] = array('operator' => '=', 'control' => 'select', 'values' => '');
+27 -16
View File
@@ -16,16 +16,19 @@ class personnel extends control
*
* @param int $programID
* @param int $deptID
* @param string $orderBy
* @param string $browseType
* @param int $param
* @param int $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $deptID
* @param int $pageID
* @access public
* @return void
*/
public function accessible($programID = 0, $deptID = 0, $browseType='browse', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
public function accessible($programID = 0, $deptID = 0, $browseType='browse', $param = 0, $orderBy = 't2.id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
{
$this->loadModel('program');
$this->app->loadLang('user');
$this->lang->navGroup->program = 'program';
$this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID);
$this->program->setPGMViewMenu($programID);
@@ -35,24 +38,32 @@ class personnel extends control
$pager = pager::init($recTotal, $recPerPage, $pageID);
/* Build the search form. */
$queryID = $browseType == 'browse' ? 0 : (int)$param;
$actionURL = $this->createLink('personnel', 'accessible', "pargramID=$programID&deptID=$deptID&param=myQueryID&type=bysearch");
$queryID = $browseType == 'bysearch' ? (int)$param : 0;
$actionURL = $this->createLink('personnel', 'accessible', "pargramID=$programID&deptID=$deptID&browseType=bysearch&quertID=myQueryID");
$deptList = $this->loadModel('dept')->getDeptPairs($deptID);
$this->config->personnel->accessible->search['params']['dept']['values'] = $deptList;
$this->config->personnel->accessible->search['params']['role']['values'] = $this->lang->user->roleList;
$this->config->personnel->accessible->search['params']['gender']['values'] = $this->lang->user->genderList;
$this->personnel->buildSearchForm($queryID, $actionURL);
$personnelList = $this->personnel->getAccessiblePersonnel($programID, $deptID, $browseType, $orderBy, $queryID, $pager);
$this->view->title = $this->lang->personnel->accessible;
$this->view->position[] = $this->lang->personnel->accessible;
$this->view->deptID = $deptID;
$this->view->programID = $programID;
$this->view->orderBy = $orderBy;
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->pager = $pager;
$this->view->param = $param;
$this->view->browseType = $browseType;
$this->view->dept = $this->loadModel('dept')->getByID($deptID);
$this->view->deptTree = $this->personnel->getTreeMenu($deptID = 0, array('personnelModel', 'createMemberLink'), $programID);
$this->view->deptID = $deptID;
$this->view->programID = $programID;
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->pager = $pager;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->personnelList = $personnelList;
$this->view->dept = $this->dept->getByID($deptID);
$this->view->deptList = $deptList;
$this->view->deptTree = $this->personnel->getTreeMenu($deptID = 0, array('personnelModel', 'createMemberLink'), $programID);
$this->display();
}
+2
View File
@@ -0,0 +1,2 @@
$('#dept' + deptID).addClass('active');
$(".tree .active").parent('li').addClass('active');
+38
View File
@@ -11,6 +11,44 @@
*/
class personnelModel extends model
{
/**
* Access to program set input staff.
*
* @param int $programID
* @param int $deptID
* @param string $browseType
* @param string $orderBy
* @param int $queryID
* @param object $pager
* @access public
* @return array
*/
public function getAccessiblePersonnel($programID = 0, $deptID = 0, $browseType = 'all', $orderBy = 't2.id_desc', $queryID = 0, $pager)
{
$accessibleQuery = '';
if($browseType == 'bysearch')
{
$query = $queryID ? $this->loadModel('search')->getQuery($queryID) : '';
if($query)
{
$this->session->set('accessibleQuery', $query->sql);
$this->session->set('accessibleForm', $query->form);
}
if($this->session->accessibleQuery == false) $this->session->set('accessibleQuery', ' 1=1');
$accessibleQuery = $this->session->accessibleQuery;
}
$personnelList = $this->dao->select('t2.id,t2.dept,t2.account,t2.role,t2.realname,t2.gender')->from(TABLE_USERVIEW)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
->where('t1.programs')->like(',%' . $programID . ',%')
->beginIF($deptID > 0)->andWhere('t2.dept')->eq($deptID)->fi()
->beginIF($browseType == 'bysearch')->andWhere($accessibleQuery)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll();
return $personnelList;
}
/**
* Access to program set input staff.
*
+26 -7
View File
@@ -31,26 +31,45 @@ js::set('deptID', $deptID);
</div>
</div>
<div class="main-col">
<?php if(!empty($personnelList)):?>
<div id="queryBox" class="cell" data-module="accessible"></div>
<form class="main-table table-personnel" action="" data-ride="table">
<?php $vars = "programID=$programID&deptID=$deptID&param=$param&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
<?php $vars = "programID=$programID&deptID=$deptID&browseType=$browseType&param=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
<table id="accessibleList" class="table has-sort-head">
<thead>
<tr>
<th class="c-id"><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class="w-120px"><?php echo common::printOrderLink('department', $orderBy, $vars, $lang->personnel->department);?></th>
<th class="c-id"><?php common::printOrderLink('t2.id', $orderBy, $vars, $lang->idAB);?></th>
<th class="w-120px"><?php echo common::printOrderLink('t2.dept', $orderBy, $vars, $lang->personnel->department);?></th>
<th class="w-100px"><?php echo $lang->personnel->realName;?></th>
<th class="w-100px"><?php echo $lang->personnel->userName;?></th>
<th class="w-80px"><?php echo $lang->personnel->job;?></th>
<th class="w-60px"><?php echo $lang->personnel->genders;?></th>
</tr>
</thead>
<tbody>
<?php foreach($personnelList as $personnel):?>
<tr>
<td class="c-id"><?php echo $personnel->id;?></td>
<td class="c-name"><?php echo zget($deptList, $personnel->dept);?></td>
<td class="c-name"><?php echo $personnel->realname;?></td>
<td class="c-name"><?php echo $personnel->account;?></td>
<td><?php echo zget($lang->user->roleList, $personnel->role);?></td>
<td><?php echo zget($lang->user->genderList, $personnel->gender);?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class="table-footer">
<?php $pager->show('right', 'pagerjs');?>
</div>
</form>
</div>
<?php else:?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->personnel->emptyTip;?></span>
</p>
</div>
<?php endif;?>
</div>
<script>
$('#dept' + deptID).addClass('active');
$(".tree .active").parent('li').addClass('active');
</script>
<?php include '../../common/view/footer.html.php';?>
+3
View File
@@ -339,6 +339,7 @@ class programModel extends model
->stripTags($this->config->program->editor->pgmedit['id'], $this->config->allowedTags)
->remove('uid')
->get();
if(!isset($project->whitelist) or $project->acl != 'custom') $project->whitelist = '';
$program = $this->loadModel('file')->processImgURL($program, $this->config->program->editor->pgmedit['id'], $this->post->uid);
$children = $this->getChildren($programID);
@@ -1132,6 +1133,8 @@ class programModel extends model
->remove('longTime')
->get();
if(!isset($project->whitelist) or $project->acl != 'custom') $project->whitelist = '';
if($project->parent)
{
$parentProgram = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($project->parent)->fetch();