diff --git a/module/port/control.php b/module/port/control.php index 7a76856d4e..2f11b54bb6 100644 --- a/module/port/control.php +++ b/module/port/control.php @@ -1,44 +1,84 @@ initFieldList($model); + } + /** + * Init FieldList . + * + * @param int $model + * @access public + * @return void + */ + public function initFieldList($model) + { + $portFieldList = $this->config->port->fieldList; + + $this->loadModel($model); + $fields = isset($this->config->$model->exportFields) ? $this->config->$model->exportFields : ''; + + if(empty($fields)) return false; + + $fields = explode(',', $fields); + + /* build module fieldList. */ + foreach ($fields as $field) + { + $field = trim($field); + + $modelFieldList = isset($this->config->$model->fieldList[$field]) ? $this->config->$model->fieldList[$field] : array(); + + foreach ($portFieldList as $portField => $value) + { + $funcName = 'init' . ucfirst($portField); + if(!array_key_exists($portField, $modelFieldList)) $modelFieldList[$portField] = $this->port->$funcName($model, $field); + } + + $this->config->$model->fieldList[$field] = $modelFieldList; + } + + a($this->config->$model->fieldList); + } + + /** + * Export Template. + * + * @access public + * @return void + */ + public function exportTemplate() + { + + } + + /** + * Import. + * + * @access public + * @return void + */ + public function import() + { + + } + + /** + * Show Import datas . + * + * @access public + * @return void + */ + public function showImport() + { + + } } diff --git a/module/port/lang/zh-cn.php b/module/port/lang/zh-cn.php index 40ecba9e68..8495e3d8f4 100644 --- a/module/port/lang/zh-cn.php +++ b/module/port/lang/zh-cn.php @@ -1,11 +1,12 @@ importexport = new stdclass(); +$lang->port = new stdclass(); -$lang->importexport->default->key['id'] = '编号'; -$lang->importexport->default->key['type'] = '类型'; -$lang->importexport->default->key['project'] = '所属项目'; -$lang->importexport->default->key['execution'] = '所属执行'; -$lang->importexport->default->key['product'] = '所属产品'; -$lang->importexport->default->key['code'] = '代号'; -$lang->importexport->default->key['name'] = '名称'; -$lang->importexport->default->key['title'] = '标题'; +$lang->port->reservedWord['id'] = '编号'; +$lang->port->reservedWord['type'] = '类型'; +$lang->port->reservedWord['project'] = '所属项目'; +$lang->port->reservedWord['execution'] = '所属执行'; +$lang->port->reservedWord['product'] = '所属产品'; +$lang->port->reservedWord['code'] = '代号'; +$lang->port->reservedWord['name'] = '名称'; +$lang->port->reservedWord['title'] = '标题'; +$lang->port->reservedWord['asdawdadw'] = '测试字段'; diff --git a/module/port/model.php b/module/port/model.php index e69de29bb2..37e0db4076 100644 --- a/module/port/model.php +++ b/module/port/model.php @@ -0,0 +1,84 @@ +app->loadLang($model); + + if(array_key_exists($field, $this->lang->$model)) + { + $title = $this->lang->$model->$field; + } + elseif(array_key_exists($field . 'AB', $this->lang->$model)) + { + $title = $this->lang->$model->$field . 'AB'; + } + elseif(array_key_exists($field, $this->lang->port->reservedWord)) + { + $title = $this->lang->port->reservedWord[$field]; + } + + return $title; + } + + public function initWidth($model, $field) + { + return '120px'; + + } + + public function initControl($model, $field) + { + return 'select'; + } + + public function initValues($model, $field) + { + return 'value'; + } + + public function initSort($model, $field) + { + return 'no'; + } + + /** + * Init Required. + * + * @param int $model + * @param int $field + * @access public + * @return void + */ + public function initRequired($model, $field) + { + if(empty($this->config->$model->create->requiredFields)) return 'no'; + + $requiredFields = "," . $this->config->$model->create->requiredFields . ","; + + if(strpos($requiredFields, $field) !== false) return 'yes'; + return 'no'; + } + + public function initFixed($model, $field) + { + return 'left'; + } + + public function initClass($model, $field) + { + return ''; + } +} +