* @package design * @link https://www.zentao.net */ namespace zin; jsVar('+type', strtolower($type)); jsVar('projectID', $projectID); jsVar('productID', $productID); /* zin: Define the set::module('design') feature bar on main menu. */ featureBar ( li(searchToggle(set::open($type == 'bySearch'))) ); /* zin: Define the toolbar on main menu. */ $canBeChanged = common::canModify('project', $project); $canCreate = $canBeChanged && hasPriv('design', 'create'); $canBatchCreate = $canBeChanged && hasPriv('design', 'batchCreate'); $createItem = array('text' => $lang->design->create, 'url' => helper::createLink('design', 'create', "projectID={$projectID}&productID={$productID}&type={$type}")); $batchCreateItem = array('text' => $lang->design->batchCreate, 'url' => helper::createLink('design', 'batchCreate', "projectID={$projectID}&productID={$productID}&type={$type}")); toolbar ( $canCreate && $canBatchCreate ? btnGroup ( btn(setClass('btn primary design-create-btn'), set::icon('plus'), set::url($createItem['url']), $lang->design->create), dropdown ( btn(setClass('btn primary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))), set::items(array_filter(array($createItem, $batchCreateItem))), set::placement('bottom-end') ) ) : null, $canCreate && !$canBatchCreate ? item(set($createItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null, $canBatchCreate && !$canCreate ? item(set($batchCreateItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null ); jsVar('confirmDelete', $lang->design->confirmDelete); $tableData = initTableData($designs, $config->design->dtable->fieldList, $this->design); foreach($tableData as $design) { if(!isset($design->actions)) continue; foreach($design->actions as &$action) { $actionName = $action['name']; if(!empty($design->frozen) && in_array($actionName, array('edit', 'delete'))) $action['hint'] = sprintf($this->lang->design->frozenTip, $this->lang->design->$actionName); } } dtable ( set::userMap($users), set::cols($config->design->dtable->fieldList), set::data($tableData), set::orderBy($orderBy), set::sortLink(createLink('design', 'browse', "projectID={$projectID}&productID={$productID}&type={$type}¶m={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")), set::footPager( usePager() ) ); /* ====== Render page ====== */ render();