* Refactor company::browse.
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
$config->company->user = new stdclass();
|
||||
$config->company->user->actionList = array();
|
||||
|
||||
if(!empty($config->sso->turnon))
|
||||
{
|
||||
$config->company->user->actionList['unbind']['icon'] = 'unlink';
|
||||
$config->company->user->actionList['unbind']['text'] = '';
|
||||
$config->company->user->actionList['unbind']['hint'] = '';
|
||||
$config->company->user->actionList['unbind']['url'] = array('module' => 'user', 'method' => 'unbind', 'params' => 'userID={id}');
|
||||
}
|
||||
|
||||
$config->company->user->actionList['unlock']['icon'] = 'unlock';
|
||||
$config->company->user->actionList['unlock']['text'] = '';
|
||||
$config->company->user->actionList['unlock']['hint'] = '';
|
||||
$config->company->user->actionList['unlock']['url'] = array('module' => 'user', 'method' => 'unlock', 'params' => 'userID={id}');
|
||||
|
||||
$config->company->user->actionList['edit']['icon'] = 'edit';
|
||||
$config->company->user->actionList['edit']['text'] = '';
|
||||
$config->company->user->actionList['edit']['hint'] = '';
|
||||
$config->company->user->actionList['edit']['url'] = array('module' => 'user', 'method' => 'edit', 'params' => 'userID={id}&from=company');
|
||||
|
||||
$config->company->user->actionList['delete']['icon'] = 'trash';
|
||||
$config->company->user->actionList['delete']['text'] = '';
|
||||
$config->company->user->actionList['delete']['hint'] = '';
|
||||
$config->company->user->actionList['delete']['url'] = array('module' => 'user', 'method' => 'delete', 'params' => 'userID={id}');
|
||||
|
||||
$config->company->user->dtable = new stdclass();
|
||||
$config->company->user->dtable->fieldList['id']['name'] = 'id';
|
||||
$config->company->user->dtable->fieldList['id']['title'] = $lang->idAB;
|
||||
$config->company->user->dtable->fieldList['id']['type'] = 'id';
|
||||
$config->company->user->dtable->fieldList['id']['sortType'] = true;
|
||||
|
||||
$config->company->user->dtable->fieldList['realname']['name'] = 'realname';
|
||||
$config->company->user->dtable->fieldList['realname']['title'] = $lang->user->realname;
|
||||
$config->company->user->dtable->fieldList['realname']['type'] = 'text';
|
||||
$config->company->user->dtable->fieldList['realname']['group'] = '1';
|
||||
$config->company->user->dtable->fieldList['realname']['sortType'] = true;
|
||||
|
||||
$config->company->user->dtable->fieldList['account']['name'] = 'account';
|
||||
$config->company->user->dtable->fieldList['account']['title'] = $lang->user->account;
|
||||
$config->company->user->dtable->fieldList['account']['type'] = 'text';
|
||||
$config->company->user->dtable->fieldList['account']['group'] = '1';
|
||||
$config->company->user->dtable->fieldList['account']['sortType'] = true;
|
||||
|
||||
$config->company->user->dtable->fieldList['role']['name'] = 'role';
|
||||
$config->company->user->dtable->fieldList['role']['title'] = $lang->user->role;
|
||||
$config->company->user->dtable->fieldList['role']['type'] = 'category';
|
||||
$config->company->user->dtable->fieldList['role']['map'] = $lang->user->roleList;
|
||||
$config->company->user->dtable->fieldList['role']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['role']['group'] = '2';
|
||||
|
||||
$config->company->user->dtable->fieldList['email']['name'] = 'email';
|
||||
$config->company->user->dtable->fieldList['email']['title'] = $lang->user->email;
|
||||
$config->company->user->dtable->fieldList['email']['type'] = 'text';
|
||||
$config->company->user->dtable->fieldList['email']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['email']['group'] = '3';
|
||||
|
||||
$config->company->user->dtable->fieldList['gender']['name'] = 'gender';
|
||||
$config->company->user->dtable->fieldList['gender']['title'] = $lang->user->gender;
|
||||
$config->company->user->dtable->fieldList['gender']['type'] = 'category';
|
||||
$config->company->user->dtable->fieldList['gender']['map'] = $lang->user->genderList;
|
||||
$config->company->user->dtable->fieldList['gender']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['gender']['group'] = '3';
|
||||
|
||||
$config->company->user->dtable->fieldList['phone']['name'] = 'phone';
|
||||
$config->company->user->dtable->fieldList['phone']['title'] = $lang->user->phone;
|
||||
$config->company->user->dtable->fieldList['phone']['type'] = 'text';
|
||||
$config->company->user->dtable->fieldList['phone']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['phone']['group'] = '3';
|
||||
|
||||
if(!empty($this->config->isINT))
|
||||
{
|
||||
$config->company->user->dtable->fieldList['skype']['name'] = 'skype';
|
||||
$config->company->user->dtable->fieldList['skype']['title'] = $lang->user->skype;
|
||||
$config->company->user->dtable->fieldList['skype']['type'] = 'text';
|
||||
$config->company->user->dtable->fieldList['skype']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['skype']['group'] = '3';
|
||||
}
|
||||
else
|
||||
{
|
||||
$config->company->user->dtable->fieldList['qq']['name'] = 'qq';
|
||||
$config->company->user->dtable->fieldList['qq']['title'] = $lang->user->qq;
|
||||
$config->company->user->dtable->fieldList['qq']['type'] = 'text';
|
||||
$config->company->user->dtable->fieldList['qq']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['qq']['group'] = '3';
|
||||
}
|
||||
|
||||
$config->company->user->dtable->fieldList['last']['name'] = 'last';
|
||||
$config->company->user->dtable->fieldList['last']['title'] = $lang->user->last;
|
||||
$config->company->user->dtable->fieldList['last']['type'] = 'date';
|
||||
$config->company->user->dtable->fieldList['last']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['last']['group'] = '4';
|
||||
|
||||
$config->company->user->dtable->fieldList['visits']['name'] = 'visits';
|
||||
$config->company->user->dtable->fieldList['visits']['title'] = $lang->user->visits;
|
||||
$config->company->user->dtable->fieldList['visits']['type'] = 'text';
|
||||
$config->company->user->dtable->fieldList['visits']['sortType'] = true;
|
||||
$config->company->user->dtable->fieldList['visits']['group'] = '4';
|
||||
|
||||
$config->company->user->dtable->fieldList['actions']['title'] = $lang->actions;
|
||||
$config->company->user->dtable->fieldList['actions']['type'] = 'actions';
|
||||
$config->company->user->dtable->fieldList['actions']['list'] = $config->company->user->actionList;
|
||||
$config->company->user->dtable->fieldList['actions']['menu'] = array_keys($config->company->user->actionList);
|
||||
$config->company->user->dtable->fieldList['actions']['group'] = '7';
|
||||
@@ -82,8 +82,8 @@ class company extends control
|
||||
/* Assign. */
|
||||
$this->view->title = $this->lang->company->index . $this->lang->colon . $this->lang->dept->common;
|
||||
$this->view->users = $users;
|
||||
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->company->browse->search);
|
||||
$this->view->deptTree = $this->dept->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createMemberLink'));
|
||||
// $this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->company->browse->search);
|
||||
$this->view->deptTree = $this->dept->getTreeMenu(0, array('deptModel', 'createMemberLink'));
|
||||
$this->view->parentDepts = $this->dept->getParents($deptID);
|
||||
$this->view->dept = $this->dept->getById($deptID);
|
||||
$this->view->orderBy = $orderBy;
|
||||
|
||||
@@ -51,3 +51,6 @@ $lang->company->featureBar['dynamic']['thisWeek'] = 'This Week';
|
||||
$lang->company->featureBar['dynamic']['lastWeek'] = 'Last Week';
|
||||
$lang->company->featureBar['dynamic']['thisMonth'] = 'This Month';
|
||||
$lang->company->featureBar['dynamic']['lastMonth'] = 'Last Month';
|
||||
|
||||
$lang->company->featureBar['browse']['inside'] = 'Internal';
|
||||
$lang->company->featureBar['browse']['outside'] = 'Outsiders';
|
||||
|
||||
@@ -51,3 +51,6 @@ $lang->company->featureBar['dynamic']['thisWeek'] = 'This Week';
|
||||
$lang->company->featureBar['dynamic']['lastWeek'] = 'Last Week';
|
||||
$lang->company->featureBar['dynamic']['thisMonth'] = 'This Month';
|
||||
$lang->company->featureBar['dynamic']['lastMonth'] = 'Last Month';
|
||||
|
||||
$lang->company->featureBar['browse']['inside'] = 'Internal';
|
||||
$lang->company->featureBar['browse']['outside'] = 'Outsiders';
|
||||
|
||||
@@ -51,3 +51,6 @@ $lang->company->featureBar['dynamic']['thisWeek'] = 'This Week';
|
||||
$lang->company->featureBar['dynamic']['lastWeek'] = 'Last Week';
|
||||
$lang->company->featureBar['dynamic']['thisMonth'] = 'This Month';
|
||||
$lang->company->featureBar['dynamic']['lastMonth'] = 'Last Month';
|
||||
|
||||
$lang->company->featureBar['browse']['inside'] = 'Internal';
|
||||
$lang->company->featureBar['browse']['outside'] = 'Outsiders';
|
||||
|
||||
@@ -51,3 +51,6 @@ $lang->company->featureBar['dynamic']['thisWeek'] = '本周';
|
||||
$lang->company->featureBar['dynamic']['lastWeek'] = '上周';
|
||||
$lang->company->featureBar['dynamic']['thisMonth'] = '本月';
|
||||
$lang->company->featureBar['dynamic']['lastMonth'] = '上月';
|
||||
|
||||
$lang->company->featureBar['browse']['inside'] = '内部人员';
|
||||
$lang->company->featureBar['browse']['outside'] = '外部人员';
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The browse view file of company module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Mengyi Liu <liumengyi@easycorp.ltd>
|
||||
* @package company
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
featureBar
|
||||
(
|
||||
set::current($browseType),
|
||||
set::linkParams("browseType={key}"),
|
||||
li(searchToggle(set::open($browseType == 'bysearch'))),
|
||||
);
|
||||
|
||||
toolbar
|
||||
(
|
||||
btngroup
|
||||
(
|
||||
btn
|
||||
(
|
||||
setClass('btn primary'),
|
||||
set::icon('plus'),
|
||||
set::url(helper::createLink('user', 'create', "deptID={$deptID}")),
|
||||
$lang->user->create
|
||||
),
|
||||
dropdown
|
||||
(
|
||||
btn(setClass('btn primary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
|
||||
set::items
|
||||
(
|
||||
array
|
||||
(
|
||||
array('text' => $lang->user->create, 'url' => helper::createLink('user', 'create', "deptID={$deptID}")),
|
||||
array('text' => $lang->user->batchCreate, 'url' => helper::createLink('user', 'batchCreate', "deptID={$deptID}")),
|
||||
)
|
||||
),
|
||||
set::placement('bottom-end'),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$settingLink = createLink('dept', 'browse');
|
||||
$closeLink = createLink('company', 'browse', "browseType={$browseType}¶m=0&type={$type}");
|
||||
sidebar
|
||||
(
|
||||
moduleMenu(set(array
|
||||
(
|
||||
'modules' => $deptTree,
|
||||
'activeKey' => $type == 'bydept' ? $param : 0,
|
||||
'settingLink' => $settingLink,
|
||||
'closeLink' => $closeLink
|
||||
)))
|
||||
);
|
||||
|
||||
$tableData = initTableData($users, $this->config->company->user->dtable->fieldList, $this->loadModel('user'));
|
||||
dtable
|
||||
(
|
||||
set::cols($this->config->company->user->dtable->fieldList),
|
||||
set::data($tableData),
|
||||
set::footPager(usePager()),
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
@@ -129,11 +129,12 @@ class deptModel extends model
|
||||
* Get the treemenu of departments.
|
||||
*
|
||||
* @param int $rootDeptID
|
||||
* @param array $userFunc
|
||||
* @param int $param
|
||||
* @access public
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function getTreeMenu($rootDeptID = 0, $param = 0)
|
||||
public function getTreeMenu(int $rootDeptID = 0, array $userFunc = array(), int $param = 0): array
|
||||
{
|
||||
$deptMenu = array();
|
||||
$data = new stdclass();
|
||||
@@ -144,7 +145,7 @@ class deptModel extends model
|
||||
$data->id = $dept->id;
|
||||
$data->parent = $dept->parent;
|
||||
$data->name = $dept->name;
|
||||
$data->url = helper::createLink('personnel', 'accessible', "program={$param}&deptID={$dept->id}");
|
||||
$data->url = call_user_func($userFunc, $dept, $param);
|
||||
|
||||
$deptMenu[] = $data;
|
||||
}
|
||||
@@ -200,8 +201,7 @@ class deptModel extends model
|
||||
*/
|
||||
public function createMemberLink($dept)
|
||||
{
|
||||
$linkHtml = html::a(helper::createLink('company', 'browse', "browseType=inside&dept={$dept->id}"), $dept->name, '_self', "id='dept{$dept->id}'");
|
||||
return $linkHtml;
|
||||
return helper::createLink('company', 'browse', "browseType=inside&dept={$dept->id}");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ $app->loadLang('testtask');
|
||||
$app->loadLang('testcase');
|
||||
$app->loadModuleConfig('testtask');
|
||||
$app->loadModuleConfig('testcase');
|
||||
$app->loadModuleConfig('company');
|
||||
|
||||
$config->my->todo = new stdclass();
|
||||
$config->my->todo->actionList = array();
|
||||
@@ -854,76 +855,6 @@ $config->my->doc->dtable->fieldList['actions']['list'] = $config->my->doc->a
|
||||
$config->my->doc->dtable->fieldList['actions']['menu'] = array('edit', 'delete');
|
||||
|
||||
$config->my->team = new stdclass();
|
||||
$config->my->team->dtable = new stdclass();
|
||||
$config->my->team->dtable->fieldList['id']['name'] = 'id';
|
||||
$config->my->team->dtable->fieldList['id']['title'] = $lang->idAB;
|
||||
$config->my->team->dtable->fieldList['id']['type'] = 'id';
|
||||
$config->my->team->dtable->fieldList['id']['sortType'] = true;
|
||||
|
||||
$config->my->team->dtable->fieldList['realname']['name'] = 'realname';
|
||||
$config->my->team->dtable->fieldList['realname']['title'] = $lang->user->realname;
|
||||
$config->my->team->dtable->fieldList['realname']['type'] = 'text';
|
||||
$config->my->team->dtable->fieldList['realname']['link'] = array('module' => 'user', 'method' => 'view', 'params' => 'userid={id}&from = my');
|
||||
$config->my->team->dtable->fieldList['realname']['group'] = '1';
|
||||
$config->my->team->dtable->fieldList['realname']['sortType'] = true;
|
||||
|
||||
$config->my->team->dtable->fieldList['account']['name'] = 'account';
|
||||
$config->my->team->dtable->fieldList['account']['title'] = $lang->user->account;
|
||||
$config->my->team->dtable->fieldList['account']['type'] = 'text';
|
||||
$config->my->team->dtable->fieldList['account']['group'] = '1';
|
||||
$config->my->team->dtable->fieldList['account']['sortType'] = true;
|
||||
|
||||
$config->my->team->dtable->fieldList['role']['name'] = 'role';
|
||||
$config->my->team->dtable->fieldList['role']['title'] = $lang->user->role;
|
||||
$config->my->team->dtable->fieldList['role']['type'] = 'category';
|
||||
$config->my->team->dtable->fieldList['role']['map'] = $lang->user->roleList;
|
||||
$config->my->team->dtable->fieldList['role']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['role']['group'] = '2';
|
||||
|
||||
$config->my->team->dtable->fieldList['email']['name'] = 'email';
|
||||
$config->my->team->dtable->fieldList['email']['title'] = $lang->user->email;
|
||||
$config->my->team->dtable->fieldList['email']['type'] = 'text';
|
||||
$config->my->team->dtable->fieldList['email']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['email']['group'] = '3';
|
||||
|
||||
$config->my->team->dtable->fieldList['gender']['name'] = 'gender';
|
||||
$config->my->team->dtable->fieldList['gender']['title'] = $lang->user->gender;
|
||||
$config->my->team->dtable->fieldList['gender']['type'] = 'category';
|
||||
$config->my->team->dtable->fieldList['gender']['map'] = $lang->user->genderList;
|
||||
$config->my->team->dtable->fieldList['gender']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['gender']['group'] = '3';
|
||||
|
||||
$config->my->team->dtable->fieldList['phone']['name'] = 'phone';
|
||||
$config->my->team->dtable->fieldList['phone']['title'] = $lang->user->phone;
|
||||
$config->my->team->dtable->fieldList['phone']['type'] = 'text';
|
||||
$config->my->team->dtable->fieldList['phone']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['phone']['group'] = '3';
|
||||
|
||||
if(!empty($this->config->isINT))
|
||||
{
|
||||
$config->my->team->dtable->fieldList['skype']['name'] = 'skype';
|
||||
$config->my->team->dtable->fieldList['skype']['title'] = $lang->user->skype;
|
||||
$config->my->team->dtable->fieldList['skype']['type'] = 'text';
|
||||
$config->my->team->dtable->fieldList['skype']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['skype']['group'] = '3';
|
||||
}
|
||||
else
|
||||
{
|
||||
$config->my->team->dtable->fieldList['qq']['name'] = 'qq';
|
||||
$config->my->team->dtable->fieldList['qq']['title'] = $lang->user->qq;
|
||||
$config->my->team->dtable->fieldList['qq']['type'] = 'text';
|
||||
$config->my->team->dtable->fieldList['qq']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['qq']['group'] = '3';
|
||||
}
|
||||
|
||||
$config->my->team->dtable->fieldList['last']['name'] = 'last';
|
||||
$config->my->team->dtable->fieldList['last']['title'] = $lang->user->last;
|
||||
$config->my->team->dtable->fieldList['last']['type'] = 'date';
|
||||
$config->my->team->dtable->fieldList['last']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['last']['group'] = '4';
|
||||
|
||||
$config->my->team->dtable->fieldList['visits']['name'] = 'visits';
|
||||
$config->my->team->dtable->fieldList['visits']['title'] = $lang->user->visits;
|
||||
$config->my->team->dtable->fieldList['visits']['type'] = 'text';
|
||||
$config->my->team->dtable->fieldList['visits']['sortType'] = true;
|
||||
$config->my->team->dtable->fieldList['visits']['group'] = '4';
|
||||
$config->my->team->dtable = $config->company->user->dtable;
|
||||
$config->my->team->dtable->fieldList['realname']['link'] = array('module' => 'user', 'method' => 'view', 'params' => 'userid={id}&from=my');
|
||||
unset($config->my->team->dtable->fieldList['actions']);
|
||||
|
||||
@@ -60,7 +60,7 @@ class personnel extends control
|
||||
$this->view->personnelList = empty($personnelList) ? $personnelList : $personnelList[$pageID - 1];
|
||||
$this->view->deptList = $this->loadModel('dept')->getOptionMenu();
|
||||
$this->view->dept = $this->dept->getByID($deptID);
|
||||
$this->view->deptTree = $this->dept->getTreeMenu(0, $programID);
|
||||
$this->view->deptTree = $this->dept->getTreeMenu(0, array(new personnelModel, 'createMemberLink'), $programID);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ class personnelModel extends model
|
||||
*/
|
||||
public function createMemberLink($dept = 0, $programID = 0)
|
||||
{
|
||||
return html::a(helper::createLink('personnel', 'accessible', "program={$programID}&deptID={$dept->id}"), $dept->name, '_self', "id='dept{$dept->id}'");
|
||||
return helper::createLink('personnel', 'accessible', "program={$programID}&deptID={$dept->id}");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2817,11 +2817,12 @@ class userModel extends model
|
||||
*/
|
||||
public static function isClickable($user, $action)
|
||||
{
|
||||
global $config;
|
||||
global $config, $app;
|
||||
$action = strtolower($action);
|
||||
|
||||
if($action == 'unbind' and empty($user->ranzhi)) return false;
|
||||
if($action == 'unlock' and (strtotime(date('Y-m-d H:i:s')) - strtotime($user->locked)) >= $config->user->lockMinutes * 60) return false;
|
||||
if($action == 'unbind' && empty($user->ranzhi)) return false;
|
||||
if($action == 'unlock' && (strtotime(date('Y-m-d H:i:s')) - strtotime($user->locked)) >= $config->user->lockMinutes * 60) return false;
|
||||
if($action == 'delete' && strpos($app->company->admins, ",{$user->account},") !== false) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user