* @package program * @link https://www.zentao.net */ declare(strict_types=1); namespace zin; /* Feature bar. */ $navLinkParams = array('program' => $programID); featureBar ( li ( set::class('nav-item'), a ( set::href($this->createLink('program', 'stakeholder', $navLinkParams)), set('data-app', $app->tab), $lang->program->stakeholder ) ), set::current('all') ); /* Toolbar. */ $createLink = $this->createLink('program', 'createstakeholder', "programID=$programID"); if(common::hasPriv('program', 'createstakeholder')) { toolbar ( btngroup ( btn(setClass('btn primary'), set::icon('plus'), set::url($createLink), $lang->program->createStakeholder), ) ); } /* Create datatable with reusing stakeholder module. */ $this->loadModel('stakeholder'); $role = array(); $role['id'] = 'role'; $role['title'] = $lang->user->role; $role['name'] = 'role'; $role['type'] = 'text'; $role['show'] = true; $fieldListKeys = array_keys($this->config->stakeholder->dtable->fieldList); array_splice($fieldListKeys, array_search('phone', array_keys($this->config->stakeholder->dtable->fieldList), true), 0, 'role'); $fieldListExtend = array(); foreach($fieldListKeys as $key) { if($key == 'role') $fieldListExtend[$key] = $role; else $fieldListExtend[$key] = $this->config->stakeholder->dtable->fieldList[$key]; } $fieldListExtend['id']['type'] = 'checkID'; $this->config->stakeholder->dtable->fieldList = $fieldListExtend; $cols = $this->loadModel('datatable')->getSetting('stakeholder'); /* Set list and menu of actions to customize the actions of stakeholder in program module. */ $cols['actions']['list'] = array('unlinkStakeholder' => array( "icon" => 'unlink', "text" => $lang->program->unlinkStakeholder, "hint" => $lang->program->unlinkStakeholder, "url" => $this->createLink('program', 'unlinkStakeholder', "id={id}&programID={$programID}&confirm=no" ) )); $cols['actions']['menu'] = array('unlinkStakeholder'); $data = initTableData($stakeholders, $cols, $this->stakeholder); foreach($data as $rowData) { $rowData->name = $rowData->realname; $rowData->from = $lang->stakeholder->fromList[$rowData->from]; $rowData->role = $lang->user->roleList[$rowData->role]; } jsVar('summeryTpl', $lang->program->checkedProjects); dtable ( set::customCols(false), set::cols($cols), set::data($data), set::footPager(usePager()), set::showToolbarOnChecked(true), set::footToolbar(array( 'items' => array( array( 'text' => $lang->unlink, 'class' => 'btn secondary toolbar-item batch-btn size-sm', 'data-url' => createLink('program', 'batchUnlinkStakeholders', "programID={$programID}") ) ) )), set::footer(jsRaw('function() {return window.footerGenerator.call(this);}')), ); render();