* Finish task #73291.
This commit is contained in:
@@ -50,3 +50,45 @@ $config->program->search['params']['lastEditedDate'] = array('operator' => '=',
|
||||
$config->program->search['params']['realBegan'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
$config->program->search['params']['realEnd'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
$config->program->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
|
||||
/* Data table field config. */
|
||||
global $lang;
|
||||
$config->program->dtable = new stdclass();
|
||||
|
||||
$config->program->dtable->fieldList['name']['name'] = 'name';
|
||||
$config->program->dtable->fieldList['name']['title'] = $lang->nameAB;
|
||||
$config->program->dtable->fieldList['name']['type'] = 'html';
|
||||
$config->program->dtable->fieldList['name']['flex'] = 1;
|
||||
|
||||
$config->program->dtable->fieldList['status']['name'] = 'status';
|
||||
$config->program->dtable->fieldList['status']['title'] = $lang->program->status;
|
||||
$config->program->dtable->fieldList['status']['width'] = 65;
|
||||
$config->program->dtable->fieldList['status']['type'] = 'html';
|
||||
|
||||
$config->program->dtable->fieldList['pm']['name'] = 'pm';
|
||||
$config->program->dtable->fieldList['pm']['title'] = $lang->program->PM;
|
||||
$config->program->dtable->fieldList['pm']['width'] = 100;
|
||||
$config->program->dtable->fieldList['pm']['type'] = 'html';
|
||||
|
||||
$config->program->dtable->fieldList['budget']['name'] = 'budget';
|
||||
$config->program->dtable->fieldList['budget']['title'] = $lang->program->budget;
|
||||
$config->program->dtable->fieldList['budget']['width'] = 100;
|
||||
|
||||
$config->program->dtable->fieldList['begin']['name'] = 'begin';
|
||||
$config->program->dtable->fieldList['begin']['title'] = $lang->program->begin;
|
||||
$config->program->dtable->fieldList['begin']['width'] = 100;
|
||||
|
||||
$config->program->dtable->fieldList['end']['name'] = 'end';
|
||||
$config->program->dtable->fieldList['end']['title'] = $lang->program->end;
|
||||
$config->program->dtable->fieldList['end']['width'] = 100;
|
||||
|
||||
$config->program->dtable->fieldList['progress']['name'] = 'progress';
|
||||
$config->program->dtable->fieldList['progress']['title'] = $lang->program->progressAB;
|
||||
$config->program->dtable->fieldList['progress']['width'] = 100;
|
||||
$config->program->dtable->fieldList['progress']['type'] = 'circleProgress';
|
||||
|
||||
$config->program->dtable->fieldList['actions']['name'] = 'actions';
|
||||
$config->program->dtable->fieldList['actions']['title'] = $lang->actions;
|
||||
$config->program->dtable->fieldList['actions']['width'] = 160;
|
||||
$config->program->dtable->fieldList['actions']['type'] = 'html';
|
||||
$config->program->dtable->fieldList['actions']['fixed'] = 'right';
|
||||
|
||||
@@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = 'The『exchange rate』should not be n
|
||||
$lang->program->changePRJUnit = 'Update the budget unit of the project';
|
||||
|
||||
$lang->program->progress = 'Progress';
|
||||
$lang->program->progressAB = 'Progress';
|
||||
$lang->program->children = 'Child';
|
||||
$lang->program->allInvest = 'Input';
|
||||
$lang->program->teamCount = 'Team';
|
||||
|
||||
@@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = 'The『exchange rate』should not be n
|
||||
$lang->program->changePRJUnit = 'Update the budget unit of the project';
|
||||
|
||||
$lang->program->progress = 'Progress';
|
||||
$lang->program->progressAB = 'Progress';
|
||||
$lang->program->children = 'Add Child';
|
||||
$lang->program->allInvest = 'Input';
|
||||
$lang->program->teamCount = 'Team';
|
||||
|
||||
@@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = 'The『exchange rate』should not be n
|
||||
$lang->program->changePRJUnit = 'Update the budget unit of the project';
|
||||
|
||||
$lang->program->progress = 'Progress';
|
||||
$lang->program->progressAB = 'Progress';
|
||||
$lang->program->children = 'Child';
|
||||
$lang->program->allInvest = 'Input';
|
||||
$lang->program->teamCount = 'Team';
|
||||
|
||||
@@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = '『汇率』不能是负数。';
|
||||
$lang->program->changePRJUnit = '更新项目预算单位';
|
||||
|
||||
$lang->program->progress = '项目进度';
|
||||
$lang->program->progressAB = '进度';
|
||||
$lang->program->children = '添加子项目集';
|
||||
$lang->program->allInvest = '项目集总投入';
|
||||
$lang->program->teamCount = '总人数';
|
||||
|
||||
@@ -1593,4 +1593,77 @@ class programModel extends model
|
||||
}
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build datatable cell.
|
||||
*
|
||||
* @param array $field
|
||||
* @param object $program
|
||||
* @param array $users
|
||||
* @param array $userIdPairs
|
||||
* @param array $PMList
|
||||
* @param array $progressList
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function buildCell($field, $program, $users, $usersAvatar, $userIdPairs, $PMList, $progressList)
|
||||
{
|
||||
$id = $field['name'];
|
||||
$html = '';
|
||||
switch($id)
|
||||
{
|
||||
case 'name':
|
||||
if($program->type == 'program') $icon = ' icon-program';
|
||||
if($program->type == 'project') $icon = ' icon-common icon-' . $program->model;
|
||||
$class = $program->type == 'program' ? ' table-nest-toggle' : '';
|
||||
$html = "<span class='table-nest-icon icon $class $icon'></span>";
|
||||
|
||||
if($program->type == 'program')
|
||||
{
|
||||
$html .= "<span class='icon icon-cards-view' style='color: #888fa1;'></span>";
|
||||
$html .= ($this->app->user->admin or strpos(",{$this->app->user->view->programs},", ",$program->id,") !== false) ? html::a(helper::createLink('program', 'product', "programID=$program->id"), $program->name) : $program->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$projectType = $this->lang->project->{$program->model};
|
||||
$html .= html::a(helper::createLink('project', 'index', "projectID=$program->id", '', '', $program->id), $program->name, '', "class='text-ellipsis text-primary' title='{$program->name} ($projectType)'");
|
||||
|
||||
if($program->status != 'done' and $program->status != 'closed' and $program->status != 'suspended')
|
||||
{
|
||||
$delay = helper::diffDate(helper::today(), $program->end);
|
||||
if($delay > 0) $html .= "<span class='label label-danger label-badge'>{$this->lang->project->statusList['delay']}</span>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'status':
|
||||
$html = "<span class='status-program status-{$program->status}'>" . zget($this->lang->project->statusList, $program->status, '') . '</span>';
|
||||
break;
|
||||
case 'pm':
|
||||
if(!empty($program->PM))
|
||||
{
|
||||
$userName = zget($users, $program->PM);
|
||||
$html = html::smallAvatar(array('avatar' => $usersAvatar[$program->PM], 'account' => $program->PM, 'name' => $userName), (($program->type == 'program' and $program->grade == 1 )? 'avatar-circle avatar-top avatar-' : 'avatar-circle avatar-') . zget($userIdPairs, $program->PM));
|
||||
$userID = isset($PMList[$program->PM]) ? $PMList[$program->PM]->id : '';
|
||||
$html .= html::a(helper::createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'");
|
||||
}
|
||||
break;
|
||||
case 'budget':
|
||||
$programBudget = $this->project->getBudgetWithUnit($program->budget);
|
||||
$html = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future;
|
||||
break;
|
||||
case 'begin':
|
||||
$html = $program->begin;
|
||||
break;
|
||||
case 'end':
|
||||
$html = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end;
|
||||
break;
|
||||
case 'progress':
|
||||
$html = round($progressList[$program->id]);
|
||||
break;
|
||||
case 'actions':
|
||||
$html = $this->buildOperateMenu($program, 'browse');
|
||||
break;
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
common::sortFeatureMenu();
|
||||
|
||||
/* Toolbar. */
|
||||
$toolbar = toolbar();
|
||||
foreach($this->lang->program->featureBar['browse'] as $key => $label)
|
||||
@@ -21,6 +20,7 @@ if(common::hasPriv('project', 'create'))
|
||||
$button = button('<i class="icon icon-plus"></i> ' . $this->lang->project->create)->link($this->createLink('project', 'createGuide', "programID=0&from=PGM"))->misc('class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"');
|
||||
$actionbar->append($button);
|
||||
}
|
||||
|
||||
if(isset($lang->pageActions))
|
||||
{
|
||||
$actionbar->append($lang->pageActions);
|
||||
@@ -32,49 +32,23 @@ $menu->actionbar = $actionbar;
|
||||
|
||||
/* Table. */
|
||||
$table = dtable();
|
||||
$table->col('name', $this->lang->nameAB)->flex(1);
|
||||
$table->col('status', $this->lang->program->status)->width(60)->type('html');
|
||||
$table->col('pm', $this->lang->program->PM)->width(100)->type('html');
|
||||
$table->col('budget', $this->lang->project->budget)->width(60);
|
||||
$table->col('begin', $this->lang->project->begin)->width(60);
|
||||
$table->col('end', $this->lang->project->end)->width(60);
|
||||
$table->col('progress', $this->lang->project->progress)->width(100)->type('html');
|
||||
$table->col('actions', $this->lang->actions)->width(60);
|
||||
$table->buildCols($this->config->program->dtable->fieldList);
|
||||
|
||||
$rows = array();
|
||||
$this->loadModel('project');
|
||||
foreach($programs as $program)
|
||||
{
|
||||
$row = new stdclass();
|
||||
$row->name = $program->name;
|
||||
$row->status = '<span class="status-program status-<?php echo $program->status?>">' . zget($lang->project->statusList, $program->status, '') . '</span>';
|
||||
foreach($this->config->program->dtable->fieldList as $field)
|
||||
{
|
||||
$fieldName = $field['name'];
|
||||
$row->$fieldName = $this->program->buildCell($field, $program, $users, $usersAvatar, $userIdPairs, $PMList, $progressList);
|
||||
}
|
||||
|
||||
$row->parent = $program->parent;
|
||||
|
||||
$row->pm = '';
|
||||
if(!empty($program->PM))
|
||||
{
|
||||
$userName = zget($users, $program->PM);
|
||||
$row->pm .= html::smallAvatar(array('avatar' => $usersAvatar[$program->PM], 'account' => $program->PM, 'name' => $userName), (($program->type == 'program' and $program->grade == 1 )? 'avatar-circle avatar-top avatar-' : 'avatar-circle avatar-') . zget($userIdPairs, $program->PM));
|
||||
$userID = isset($PMList[$program->PM]) ? $PMList[$program->PM]->id : '';
|
||||
$row->pm .= html::a($this->createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'");
|
||||
}
|
||||
|
||||
$programBudget = $this->project->getBudgetWithUnit($program->budget);
|
||||
$row->budget = $program->budget != 0 ? zget($lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future;
|
||||
$row->begin = $program->begin;
|
||||
$row->end = $program->end == LONG_TIME ? $lang->program->longTime : $program->end;
|
||||
|
||||
$row->progress = '';
|
||||
if(isset($progressList[$program->id]))
|
||||
{
|
||||
$row->progress = "<div class='progress-pie' data-doughnut-size='85' data-color='#00DA88' data-value='" . round($progressList[$program->id]) . "' data-width='26' data-height='26' data-back-color='#e8edf3'>";
|
||||
$row->progress = "<div class='progress-info'>" . round($progressList[$program->id]) . "</div></div>";
|
||||
}
|
||||
|
||||
$row->actions = array();
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$table->search($status, $moduleName);
|
||||
$table->data($rows);
|
||||
|
||||
@@ -87,3 +61,11 @@ $page->top->menu = $menu;
|
||||
$page->right->content = $content;
|
||||
|
||||
$page->x();
|
||||
|
||||
js::set('status', $status);
|
||||
js::set('orderBy', $orderBy);
|
||||
js::set('edit', $lang->edit);
|
||||
js::set('selectAll', $lang->selectAll);
|
||||
js::set('hasProject', $hasProject);
|
||||
js::set('checkedProjects', $lang->program->checkedProjects);
|
||||
js::set('cilentLang', $this->app->getClientLang());
|
||||
|
||||
Reference in New Issue
Block a user