* Add project creation method.

This commit is contained in:
leiyong
2020-09-18 14:26:27 +08:00
parent ebc593c1c6
commit a8103fd03e
14 changed files with 308 additions and 63 deletions
+2 -1
View File
@@ -141,7 +141,8 @@ $filter->product->export->cookie['checkedItem'] = 'reg::checked';
$filter->program->browse->cookie['programType'] = 'code';
$filter->program->browse->cookie['mine'] = 'code';
$filter->program->export->cookie['checkedItem'] = 'reg::checked';
$filter->program->prjbrowse->cookie['PRJMine'] = 'code';
$filter->program->export->cookie['checkedItem'] = 'reg::checked';
$filter->project->default->cookie['lastProject'] = 'int';
$filter->project->default->cookie['projectMode'] = 'code';
+8
View File
@@ -9,6 +9,9 @@ $config->program->editor->pgmactivate = array('id' => 'comment', 'tools' => 'sim
$config->program->editor->pgmfinish = array('id' => 'comment', 'tools' => 'simpleTools');
$config->program->editor->pgmsuspend = array('id' => 'comment', 'tools' => 'simpleTools');
$config->program->editor->prjcreate = array('id' => 'desc', 'tools' => 'simpleTools');
$config->program->editor->prjedit = array('id' => 'desc', 'tools' => 'simpleTools');
$config->program->list = new stdclass();
$config->program->list->exportFields = 'id,name,code,template,category,status,begin,end,budget,PM,end,desc';
@@ -16,3 +19,8 @@ $config->program->PGMCreate = new stdclass();
$config->program->PGMEdit = new stdclass();
$config->program->PGMCreate->requiredFields = 'name,code,begin,end';
$config->program->PGMEdit->requiredFields = 'name,code,begin,end';
$config->program->PRJCreate = new stdclass();
$config->program->PRJEdit = new stdclass();
$config->program->PRJCreate->requiredFields = 'name,code,begin,end';
$config->program->PRJEdit->requiredFields = 'name,code,begin,end';
+64 -5
View File
@@ -836,15 +836,74 @@ class program extends control
}
/**
* Delete a project.
* Create a project.
*
* @param int $projectID
* @param varchar $confirm
* @param string $template
* @param int $programID
* @param int $parentProgramID
* @param int $copyProgramID
* @access public
* @return void
*/
public function PRJDelete($projectID, $confirm = 'no')
public function PRJCreate($template = 'waterfall', $programID = 0, $parentProgramID = 0, $copyProgramID = '')
{
die(js::reload('parent'));
if($_POST)
{
$projectID = $this->program->PRJCreate();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
$this->loadModel('action')->create('project', $projectID, 'opened');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('PRJBrowse', array('programID' => $programID, 'browseType' => 'doing'))));
}
$name = '';
$code = '';
$team = '';
$whitelist = '';
$acl = 'open';
$privway = 'extend';
if($parentProgramID)
{
$parentProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($parentProgramID)->fetch();
if($this->program->checkHasContent($parentProgramID))
{
echo js::alert($this->lang->program->cannotCreateChild);
die(js::locate('back'));
}
if(empty($template)) $template = $parentProgram->template;
}
if($copyProgramID)
{
$copyProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($copyProgramID)->fetch();
$name = $copyProgram->name;
$code = $copyProgram->code;
$team = $copyProgram->team;
$acl = $copyProgram->acl;
$privway = $copyProgram->privway;
$whitelist = $copyProgram->whitelist;
if(empty($template)) $template = $copyProgram->template;
}
$this->view->title = $this->lang->program->PRJCreate;
$this->view->position[] = $this->lang->program->PRJCreate;
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->pmUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst');
$this->view->programs = array('' => '') + $this->program->getPairsByTemplate($template);
$this->view->template = $template;
$this->view->name = $name;
$this->view->code = $code;
$this->view->team = $team;
$this->view->acl = $acl;
$this->view->privway = $privway;
$this->view->whitelist = $whitelist;
$this->view->parentProgram = $parentProgramID ? $parentProgram : '';
$this->view->copyProgramID = $copyProgramID;
$this->view->programID = $programID;
$this->view->programList = $this->program->getParentPairs();
$this->display();
}
}
+9
View File
@@ -33,3 +33,12 @@
#projectTree ul > li.item-meas a.selected{color: #0c64eb;}
.side-col {padding-right: 20px; width: 18%}
#sidebar>.cell {width: 100%;}
#guideDialog h2 {margin: 10px 0 30px 0; font-size: 16px; font-weight: normal}
#guideDialog h3 {margin: 5px 0; font-size: 20px;}
#guideDialog .modal-footer {border-top: none; text-align: center; padding-top: 10px; padding-bottom: 40px;}
#guideDialog .modal-footer .btn + .btn {margin-left: 20px}
#guideDialog .program-type {padding: 0 40px}
#guideDialog .program-type-img {width: 280px; border: 1px solid #CBD0DB; border-radius: 2px; margin-bottom: 10px; cursor: pointer; margin-top: 1px}
#guideDialog .program-type-img:hover {border-color: #006AF1; box-shadow: 0 0 10px 0 rgba(0,0,0,.25);}
#guideDialog .program-type.active img {border-color: #006AF1; border-width: 2px; margin-top: 0}
+12
View File
@@ -0,0 +1,12 @@
$(function()
{
$('#PRJMine1').click(function()
{
var PRJMine = $(this).is(':checked') ? 1 : 0;
$.cookie('PRJMine', PRJMine, {expires:config.cookieLife, path:config.webRoot});
window.location.reload();
});
});
$('#project<?php echo $programID;?>').addClass('active');
$(".tree .active").parent('li').addClass('active');
+2 -2
View File
@@ -152,8 +152,8 @@ $lang->program->PRJParentBeginEnd = "父项目起止时间:%s ~ %s";
$lang->program->PRJParentBudget = "父项目预算:%s";
$lang->program->PRJBeginLetterParent = "父项目的开始日期:%s,开始日期不能小于父项目的开始日期";
$lang->program->PRJEndGreaterParent = "父项目的完成日期:%s,完成日期不能大于父项目的完成日期";
$lang->program->PRJBeginGreateChild = "子项目的最小开始日期:%s,父项目的开始日期不能大于子项目的最小开始日期";
$lang->program->PRJEndLetterChild = "子项目的最大完成日期:%s,父项目的完成日期不能小于子项目的最大完成日期";
$lang->program->PRJBeginGreateChild = "项目的最小开始日期:%s,项目集的开始日期不能大于项目的最小开始日期";
$lang->program->PRJEndLetterChild = "项目的最大完成日期:%s,项目集的完成日期不能小于项目的最大完成日期";
$lang->program->PRJChildLongTime = "子项目中有长期项目,父项目也应该是长期项目";
/* Actions. */
+117 -2
View File
@@ -828,12 +828,25 @@ class programModel extends model
* @access public
* @return bool
*/
public function getPRJList($programID = 0, $browseType = 'all', $queryID = 0, $orderBy = 'id_desc', $pager = null, $moduleStatus = 0)
public function getPRJList($programID = 0, $browseType = 'all', $queryID = 0, $orderBy = 'id_desc', $pager = null, $moduleStatus = 0, $PRJMine = 0)
{
$path = '';
if($programID)
{
$program = $this->getPRJByID($programID);
$path = $program->path;
}
$projectList = $this->dao->select('*')->from(TABLE_PROJECT)
->where('type')->eq('project')
->beginIF($browseType != 'all')->andWhere('status')->eq($browseType)->fi()
->beginIF($programID)->andWhere('program')->eq($programID)->fi()
->beginIF($path)->andWhere('path')->like($path . '%')->fi()
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->programs)->fi()
->beginIF($this->cookie->PRJMine or $PRJMine)
->andWhere('openedBy', true)->eq($this->app->user->account)
->orWhere('PM')->eq($this->app->user->account)
->markRight(1)
->fi()
->andWhere('deleted')->eq('0')
->orderBy($orderBy)
->page($pager)
@@ -962,4 +975,106 @@ class programModel extends model
$icon = $project->type == 'program' ? '<i class="icon icon-stack"></i> ' : '<i class="icon icon-menu-doc"></i> ';
return html::a($link, $icon . $project->name, '_self', "id=project{$project->id} title='{$project->name}' class='text-ellipsis'");
}
/**
* Create a project.
*
* @access public
* @return void
*/
public function PRJCreate()
{
$project = fixer::input('post')
->setDefault('status', 'wait')
->add('type', 'project')
->setIF($this->post->acl != 'custom', 'whitelist', '')
->setDefault('openedBy', $this->app->user->account)
->setDefault('end', '')
->setDefault('openedDate', helper::now())
->setDefault('team', substr($this->post->name, 0, 30))
->join('whitelist', ',')
->cleanInt('budget')
->stripTags($this->config->program->editor->prjcreate['id'], $this->config->allowedTags)
->get();
if($project->parent)
{
$parentProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($project->parent)->fetch();
if($parentProgram)
{
/* Child project begin cannot less than parent. */
if($project->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->PRJBeginGreateChild, $parentProgram->begin);
/* When parent set end then child project end cannot greater than parent. */
if($parentProgram->end != '0000-00-00' and $project->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->PRJEndLetterChild, $parentProgram->end);
if(dao::isError()) return false;
}
}
$project = $this->loadModel('file')->processImgURL($project, $this->config->program->editor->prjcreate['id'], $this->post->uid);
$this->dao->insert(TABLE_PROJECT)->data($project)
->autoCheck()
->batchcheck($this->config->program->PRJCreate->requiredFields, 'notempty')
->check('name', 'unique', "deleted='0'")
->check('code', 'unique', "deleted='0'")
->exec();
/* Add the creater to the team. */
if(!dao::isError())
{
$projectID = $this->dao->lastInsertId();
$today = helper::today();
if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project');
/* Save order. */
$this->dao->update(TABLE_PROJECT)->set('`order`')->eq($projectID * 5)->where('id')->eq($projectID)->exec();
$this->file->updateObjectID($this->post->uid, $projectID, 'project');
$this->setTreePath($projectID);
/* Add project admin. */
$groupPriv = $this->dao->select('t1.*')->from(TABLE_USERGROUP)->alias('t1')
->leftJoin(TABLE_GROUP)->alias('t2')->on('t1.group = t2.id')
->where('t1.account')->eq($this->app->user->account)
->andWhere('t2.role')->eq('PRJadmin')
->fetch();
if(!empty($groupPriv))
{
$newProject = $groupPriv->PRJ . ",$projectID";
$this->dao->update(TABLE_USERGROUP)->set('PRJ')->eq($newProject)->where('account')->eq($groupPriv->account)->andWhere('`group`')->eq($groupPriv->group)->exec();
}
else
{
$PRJAdminID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('PRJadmin')->fetch('id');
$groupPriv = new stdclass();
$groupPriv->account = $this->app->user->account;
$groupPriv->group = $PRJAdminID;
$groupPriv->PRJ = $projectID;
$this->dao->insert(TABLE_USERGROUP)->data($groupPriv)->exec();
}
if($project->template == 'waterfall')
{
$product = new stdclass();
$product->name = $project->name;
$product->PRJ = $projectID;
$product->status = 'normal';
$product->createdBy = $this->app->user->account;
$product->createdDate = helper::now();
$this->dao->insert(TABLE_PRODUCT)->data($product)->exec();
$productID = $this->dao->lastInsertId();
$this->dao->update(TABLE_PRODUCT)->set('`order`')->eq($productID * 5)->where('id')->eq($productID)->exec();
$data = new stdclass();
$data->project = $projectID;
$data->product = $productID;
$this->dao->insert(TABLE_PROJECTPRODUCT)->data($data)->exec();
}
return $projectID;
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
<div class='modal-dialog' id='guideDialog'>
<div class='modal fade modal-dialog' id='guideDialog'>
<style>
#guideDialog {width: 780px}
#guideDialog h2 {margin: 10px 0 30px 0; font-size: 16px; font-weight: normal}
+6 -9
View File
@@ -1,17 +1,17 @@
<?php
/**
* The html template file of projectlist method of project module of ZenTaoPMS.
* The html template file of PRJBrowse method of program module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package project
* @package program
* @version $Id: index.html.php 5094 2013-07-10 08:46:15Z chencongzhi520@gmail.com $
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php
js::set('projectID', $programID);
js::set('programID', $programID);
js::set('browseType', $browseType);
?>
<div id="mainMenu" class="clearfix">
@@ -28,10 +28,10 @@ js::set('browseType', $browseType);
<?php if($browseType == $key) $label .= " <span class='label label-light label-badge'>{$pager->recTotal}</span>";?>
<?php echo html::a(inlink('PRJBrowse', "programID=$programID&browseType=$key"), $label, '', "class='btn btn-link $active'");?>
<?php endforeach;?>
<?php echo html::checkbox('mine', array('1' => $lang->program->mine), '', $this->cookie->mine ? 'checked=checked' : '');?>
<?php echo html::checkbox('PRJMine', array('1' => $lang->program->mine), '', $this->cookie->PRJMine ? 'checked=checked' : '');?>
</div>
<div class="btn-toolbar pull-right">
<?php common::printLink('program', 'PRJCreate', "programID=$programID", '<i class="icon icon-plus"></i>' . $lang->program->PRJCreate, '', 'class="btn btn-primary"');?>
<?php echo html::commonButton('<i class="icon icon-plus"></i>' . $lang->program->PRJCreate, 'data-toggle="modal" data-target="#guideDialog"', 'btn btn-primary');?>
</div>
</div>
<div id='mainContent' class="main-row fade">
@@ -96,8 +96,5 @@ js::set('browseType', $browseType);
</form>
</div>
</div>
<script>
$('#project<?php echo $programID;?>').addClass('active');
$(".tree .active").parent('li').addClass('active');
</script>
<?php include 'prjcreateguide.html.php';?>
<?php include '../../common/view/footer.html.php';?>
+20 -25
View File
@@ -1,13 +1,12 @@
<?php
/**
* The create view of project module of ZenTaoPMS.
* The html template file of PRJCreate method of program module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package project
* @version $Id: create.html.php 4728 2013-05-03 06:14:34Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
* @author Yidong Wang <yidong@cnezsoft.com>
* @package program
* @version $Id: index.html.php 5094 2013-07-10 08:46:15Z chencongzhi520@gmail.com $
*/
?>
<?php if(isset($tips)):?>
@@ -46,18 +45,16 @@
<table class='table table-form'>
<tr>
<th class='w-120px'><?php echo $lang->program->PRJTemplate;?></th>
<td><?php echo zget($lang->program->templateList, $template, '');?></td><td></td><td></td>
<td><?php echo zget($lang->program->templateList, $template, '');?></td><td></td><td>
</td>
</tr>
<tr>
<th><?php echo $lang->program->PGMParent;?></th>
<td><?php echo html::select('parent', $programList, $programID, "class='form-control chosen'");?></td><td></td><td></td>
</tr>
<tr>
<th><?php echo $lang->program->PRJName;?></th>
<td class="col-main"><?php echo html::input('name', $name, "class='form-control' required");?></td>
<td>
<div class="checkbox-primary">
<input type="checkbox" name="isCat" value="1" id="isCat">
<label for="isCat"><?php echo $lang->program->PRJParent;?></label>
</div>
</td>
<td></td>
<td class="col-main"><?php echo html::input('name', $name, "class='form-control' required");?></td><td></td><td></td>
</tr>
<tr>
<th><?php echo $lang->program->PRJCode;?></th>
@@ -66,7 +63,7 @@
<?php if($template == 'waterfall'):?>
<tr>
<th><?php echo $lang->program->PRJCategory;?></th>
<td><?php echo html::select('category', $lang->program->categoryList, '', "class='form-control'");?></td><td></td><td></td>
<td><?php echo html::select('category', $lang->program->PRJCategoryList, '', "class='form-control'");?></td><td></td><td></td>
</tr>
<?php endif;?>
<tr>
@@ -74,7 +71,7 @@
<td><?php echo html::select('PM', $pmUsers, '', "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->program->budget;?></th>
<th><?php echo $lang->program->PRJBudget;?></th>
<td>
<div class='input-group'>
<?php echo html::input('budget', '', "class='form-control'");?>
@@ -127,19 +124,19 @@
</tr>
<?php $this->printExtendFields('', 'table');?>
<tr>
<th><?php echo $lang->program->desc;?></th>
<th><?php echo $lang->program->PRJDesc;?></th>
<td colspan='3'>
<?php echo $this->fetch('user', 'ajaxPrintTemplates', 'type=project&link=desc');?>
<?php echo html::textarea('desc', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?>
</td>
</tr>
<tr>
<th><?php echo $lang->program->privway;?></th>
<td colspan='3'><?php echo html::radio('privway', $lang->program->privwayList, $privway, '', 'block');?></td>
<th><?php echo $lang->program->auth;?></th>
<td colspan='3'><?php echo html::radio('privway', $lang->program->PRJAuthList, $privway, '', 'block');?></td>
</tr>
<tr>
<th><?php echo $lang->project->acl;?></th>
<td colspan='3'><?php echo nl2br(html::radio('acl', $lang->program->aclList, $acl, "onclick='setWhite(this.value);'", 'block'));?></td>
<td colspan='3'><?php echo nl2br(html::radio('acl', $lang->program->PRJAclList, $acl, "onclick='setWhite(this.value);'", 'block'));?></td>
</tr>
<tr id='whitelistBox' class='hidden'>
<th><?php echo $lang->project->whitelist;?></th>
@@ -147,16 +144,14 @@
</tr>
<tr>
<td colspan='4' class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php echo html::backButton();?>
<?php
echo html::hidden('template', $template);
echo html::hidden('parent', isset($parentProgram->id) ? $parentProgram->id : 0);
echo html::hidden('template', $template);
echo html::submitButton();
echo html::backButton();
?>
</td>
</tr>
</table>
<?php echo html::hidden('products[]') . html::hidden('plans[]');?>
</form>
</div>
</div>
@@ -0,0 +1,37 @@
<div class="modal fade" id='guideDialog'>
<div class="modal-dialog">
<div class='modal-content'>
<div class='modal-body'>
<h2 class='text-center'><?php echo $lang->program->chooseProgramType; ?></h2>
<div class='row'>
<div class='col-xs-6'>
<div class='program-type text-center'>
<img class='program-type-img' data-type='scrum' src='<?php echo $config->webRoot . 'theme/default/images/main/scrum.png'?>'>
<h3><?php echo $lang->program->scrum; ?></h3>
<p><?php echo $lang->program->scrumTitle; ?></p>
</div>
</div>
<div class='col-xs-6'>
<div class='program-type text-center'>
<img class='program-type-img' data-type='waterfall' src='<?php echo $config->webRoot . 'theme/default/images/main/waterfall.png'?>'>
<h3><?php echo $lang->program->waterfall; ?></h3>
<p><?php echo $lang->program->waterfallTitle; ?></p>
</div>
</div>
</div>
<div class='modal-footer text-center'>
<a class='btn btn-primary btn-wide disabled' id='guideBtn'><?php echo $lang->program->nextStep; ?></a>
<button type='button' class='btn btn-default btn-wide' data-dismiss='modal'><?php echo $lang->cancel; ?></button>
</div>
</div>
</div>
</div>
<script>
$('#guideDialog').on('click', '.program-type-img', function()
{
var $this = $(this);
$('#guideDialog .program-type.active').removeClass('active');
$this.parent().addClass('active');
$('#guideBtn').removeClass('disabled').attr('href', createLink('program', 'PRJCreate', 'template=' + $this.data('type') + "&programID=" + programID));
});
</script>
+11
View File
@@ -1,3 +1,14 @@
<?php
/**
* The html template file of PRJStart method of program module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package program
* @version $Id: index.html.php 5094 2013-07-10 08:46:15Z chencongzhi520@gmail.com $
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div id='mainContent' class='main-content'>
+13 -12
View File
@@ -1,13 +1,12 @@
<?php
/**
* The setprjmodule file of program module of ZenTaoPMS.
* The html template file of SetPRJModule method of program module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author chunsheng wang <chunsheng@cnezsoft.com>
* @author Yidong Wang <yidong@cnezsoft.com>
* @package program
* @version $Id: setprjmodule.html.php 935 2010-07-06 07:49:24Z jajacn@126.com $
* @link http://www.zentao.net
* @version $Id: index.html.php 5094 2013-07-10 08:46:15Z chencongzhi520@gmail.com $
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
@@ -17,14 +16,16 @@
<div class="modal-body" style="max-height: 564px; overflow: visible;">
<form class="form-condensed" method="post" target="hiddenwin">
<table class="table table-form">
<tbody><tr>
<td class="w-150px"><?php echo $lang->program->PRJModuleOpen;?></td>
<td><?php echo html::radio('PRJModuleStatus', $lang->program->PRJModuleStatus, $status);?></td>
</tr>
<tr>
<td colspan="2" class="text-center"><?php echo html::submitButton();?></td>
</tr>
</tbody></table>
<tbody>
<tr>
<td class="w-150px"><?php echo $lang->program->PRJModuleOpen;?></td>
<td><?php echo html::radio('PRJModuleStatus', $lang->program->PRJModuleStatus, $status);?></td>
</tr>
<tr>
<td colspan="2" class="text-center"><?php echo html::submitButton();?></td>
</tr>
</tbody>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>
+6 -6
View File
@@ -821,7 +821,7 @@ class userModel extends model
}
else
{
$groups = $this->dao->select('t1.acl, t1.program')->from(TABLE_GROUP)->alias('t1')
$groups = $this->dao->select('t1.acl, t1.PRJ')->from(TABLE_GROUP)->alias('t1')
->leftJoin(TABLE_USERGROUP)->alias('t2')->on('t1.id=t2.group')
->where('t2.account')->eq($account)
->andWhere('t1.role')->ne('PRJadmin')
@@ -836,7 +836,7 @@ class userModel extends model
foreach($groups as $group)
{
$acl = json_decode($group->acl, true);
if($group->program)
if($group->PRJ)
{
if(empty($group->acl))
{
@@ -891,7 +891,7 @@ class userModel extends model
->leftJoin(TABLE_USERGROUP)->alias('t2')->on('t1.id = t2.group')
->leftJoin(TABLE_GROUPPRIV)->alias('t3')->on('t2.group = t3.group')
->where('t2.account')->eq($account)
->andWhere('t1.program')->eq(0);
->andWhere('t1.PRJ')->eq(0);
}
$stmt = $sql->query();
@@ -903,7 +903,7 @@ class userModel extends model
/* Get can manage programs by user. */
$PRJadminGroupID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('PRJadmin')->fetch('id');
$canManagePrograms = $this->dao->select('program')->from(TABLE_USERGROUP)->where('`group`')->eq($PRJadminGroupID)->andWhere('account')->eq($account)->fetch('program');
$canManagePrograms = $this->dao->select('PRJ')->from(TABLE_USERGROUP)->where('`group`')->eq($PRJadminGroupID)->andWhere('account')->eq($account)->fetch('program');
return array('rights' => $rights, 'acls' => $acls, 'programs' => $canManagePrograms);
}
@@ -1461,7 +1461,7 @@ class userModel extends model
->fetchAll('id');
$openedPrograms = join(',', array_keys($openedPrograms));
$userView->programs = rtrim($userView->programs, ',') . ',' . $openedPrograms;
$userView->programs = rtrim($userView->PRJ, ',') . ',' . $openedPrograms;
if(isset($_SESSION['user']->admin)) $isAdmin = $this->session->user->admin;
if(!isset($isAdmin)) $isAdmin = strpos($this->app->company->admins, ",{$account},") !== false;
@@ -1533,7 +1533,7 @@ class userModel extends model
if(!is_array($objectIdList)) return false;
$allGroups = $this->dao->select('account,`group`')->from(TABLE_USERGROUP)->fetchAll();
$managePrograms = $this->dao->select('account, program')->from(TABLE_USERGROUP)->where('program')->ne('')->fetchPairs();
$managePrograms = $this->dao->select('account, PRJ')->from(TABLE_USERGROUP)->where('program')->ne('')->fetchPairs();
$userGroups = array();
$groupUsers = array();
foreach($allGroups as $group)