* @package datatable * @version $Id$ * @link http://www.zentao.net */ ?> config->$module)) $this->loadModel($module); if($this->session->currentProductType === 'normal') unset($this->config->$module->datatable->fieldList['branch']); foreach($this->config->$module->datatable->fieldList as $field => $items) { if($field === 'branch') { if($this->session->currentProductType === 'branch') $this->config->$module->datatable->fieldList[$field]['title'] = $this->lang->datatable->branch; if($this->session->currentProductType === 'platform') $this->config->$module->datatable->fieldList[$field]['title'] = $this->lang->datatable->platform; continue; } $title = zget($this->lang->$module, $items['title'], zget($this->lang, $items['title'], $items['title'])); $this->config->$module->datatable->fieldList[$field]['title'] = $title; } return $this->config->$module->datatable->fieldList; } /** * Get save setting field. * * @param string $module * @access public * @return object */ public function getSetting($module) { $datatableId = $module . ucfirst($this->app->getMethodName()); $module = zget($this->config->datatable->moduleAlias, $module, $module); if(!isset($this->config->$module)) $this->loadModel($module); if(isset($this->config->datatable->$datatableId->cols)) $setting = json_decode($this->config->datatable->$datatableId->cols); $fieldList = $this->getFieldList($module); if(empty($setting)) { $setting = $this->config->$module->datatable->defaultField; $order = 1; foreach($setting as $key => $value) { $id = $value; $set = new stdclass();; $set->order = $order++; $set->id = $id; $set->show = true; $set->width = $fieldList[$id]['width']; $set->fixed = $fieldList[$id]['fixed']; $set->title = $fieldList[$id]['title']; $setting[$key] = $set; } } else { foreach($setting as $key => $set) { if($this->session->currentProductType === 'normal' and $set->id === 'branch') { unset($setting[$key]); continue; } $set->title = $fieldList[$set->id]['title']; } } usort($setting, array('datatableModel', 'sortCols')); return $setting; } /** * Sort cols. * * @param int $a * @param int $b * @static * @access public * @return void */ public static function sortCols($a, $b) { if(!isset($a->order)) return 0; return $a->order - $b->order; } /** * Print table head. * * @param object $col * @param string $orderBy * @param string $vars * @access public * @return void */ public function printHead($col, $orderBy, $vars) { $id = $col->id; if($col->show) { echo "