Пример #1
0
 /**
  * 基础表单
  */
 public static function baseForm()
 {
     $data['model_id'] = self::isP('model_id', '丢失模型ID');
     if (!(self::$model = \Model\ModelManage::findModel($data['model_id']))) {
         self::error('不存在的模型');
     }
     if (self::p('method') == 'PUT') {
         $data['noset']['field_id'] = self::isP('field_id', '丢失字段ID');
         if (!self::findField($data['noset']['field_id'])) {
             self::error('不存在的模型');
         }
     } else {
         $data['field_type'] = self::isP('field_type', '请选择字段类型');
         $data['field_name'] = self::isP('field_name', '请填写字段名称');
     }
     $data['display_name'] = self::isP('display_name', '请填写字段显示名称');
     $data['field_option'] = self::splitOption();
     if ($data['field_option'] === false) {
         self::error('拆分字段选项出错');
     }
     if (!($data['field_required'] = self::p('field_required')) && !is_numeric($_POST['field_required'])) {
         return self::error('请选择是否为必填');
     }
     if (!($data['field_status'] = self::p('field_status')) && !is_numeric($_POST['field_status'])) {
         return self::error('请选择启用状态');
     }
     $data['field_default'] = self::p('field_default');
     $data['field_listsort'] = self::p('field_listsort');
     $data['field_explain'] = self::p('field_explain');
     $data['field_list'] = self::p('field_list');
     return $data;
 }
Пример #2
0
 /**
  * 基础表单
  */
 public static function baseForm()
 {
     if (!($data['model_id'] = self::isP('model_id'))) {
         return self::error($GLOBALS['_LANG']['MODEL']['LOST_MODEL_ID']);
     }
     if (!(self::$model = \Model\Model::findModel($data['model_id']))) {
         return self::error($GLOBALS['_LANG']['MODEL']['NOT_EXIST_MODEL']);
     }
     if (self::p('method') == 'PUT') {
         if (!($data['noset']['field_id'] = self::isP('field_id'))) {
             return self::error($GLOBALS['_LANG']['MODEL']['LOST_FIELD_ID']);
         }
         if (!self::findField($data['noset']['field_id'])) {
             return self::error($GLOBALS['_LANG']['MODEL']['NOT_EXIST_FIELD']);
         }
     } else {
         if (!($data['field_type'] = self::isP('field_type'))) {
             return self::error($GLOBALS['_LANG']['MODEL']['SELECT_FIELD_TYPE']);
         }
         if (!($data['field_name'] = self::isP('field_name'))) {
             return self::error($GLOBALS['_LANG']['MODEL']['ENTER_FIELD_NAME']);
         }
     }
     if (!($data['display_name'] = self::isP('display_name'))) {
         return self::error($GLOBALS['_LANG']['MODEL']['ENTER_DISPLAY_NAME']);
     }
     if (!($data['field_option'] = self::splitOption())) {
         self::error($GLOBALS['_LANG']['MODEL']['SPLIT_OPTION_ERROR']);
     }
     if (!($data['field_required'] = self::isP('field_required')) && !is_numeric($data['field_required'])) {
         return self::error($GLOBALS['_LANG']['MODEL']['SELECT_REQUIRED']);
     }
     if (!($data['field_status'] = self::isP('field_status')) && !is_numeric($data['field_status'])) {
         return self::error($GLOBALS['_LANG']['MODEL']['SELECT_FIELD_STATUS']);
     }
     $data['field_default'] = self::p('field_default');
     $data['field_listsort'] = self::p('field_listsort');
     return self::success($data);
 }
Пример #3
0
 /**
  * 基础表单
  */
 public static function baseForm()
 {
     if (!(self::$model = \Model\ModelManage::findModel(self::isP('model_id', '丢失模型ID')))) {
         self::error('不存在的模型');
     }
     $option = self::splitOption(self::p('option'));
     if ($option === false) {
         self::error('拆分字段选项出错');
     }
     $_POST['option'] = (string) $option;
 }