Exemple #1
0
 /**
  * 获取“是否隐藏”所有选项
  * @return array
  */
 public static function getIsHideEnum()
 {
     static $enum = null;
     if ($enum === null) {
         $enum = array(self::IS_HIDE_Y => Lang::_('SRV_ENUM_GLOBAL_YES'), self::IS_HIDE_N => Lang::_('SRV_ENUM_GLOBAL_NO'));
     }
     return $enum;
 }
Exemple #2
0
 /**
  * 获取“类型名”验证规则
  * @param mixed $value
  * @return array
  */
 public function getTypeNameRule($value)
 {
     return array('MinLength' => new validator\MinLengthValidator($value, 2, Lang::_('SRV_FILTER_MENU_TYPES_TYPE_NAME_MINLENGTH')), 'MaxLength' => new validator\MaxLengthValidator($value, 50, Lang::_('SRV_FILTER_MENU_TYPES_TYPE_NAME_MAXLENGTH')));
 }
Exemple #3
0
 /**
  * 递归方式获取指定类型下的菜单,默认用空格填充子菜单左边用于和父菜单错位
  * (只返回ID和菜单名的键值对)(可用于Select表单的Option选项)
  * @param string $typeKey
  * @param integer $menuPid
  * @param string $allowUnregistered
  * @param string $padStr
  * @param string $leftPad
  * @param string $rightPad
  * @return array
  */
 public function getOptions($typeKey, $menuPid = -1, $allowUnregistered = true, $padStr = '    ', $leftPad = '', $rightPad = null)
 {
     if ($menuPid === -1) {
         $tmpLeftPad = is_string($leftPad) ? $leftPad . $padStr : null;
         $tmpRightPad = is_string($rightPad) ? $rightPad . $padStr : null;
         $data = array(0 => Lang::_('SRV_ENUM_MENUS_MENU_TOP'));
         $data += $this->getOptions($typeKey, 0, $allowUnregistered, $padStr, $tmpLeftPad, $tmpRightPad);
         return $data;
     }
     $data = array();
     $rows = $this->findLists($typeKey, $menuPid, $allowUnregistered, $padStr, $leftPad, $rightPad);
     if (is_array($rows)) {
         foreach ($rows as $row) {
             if (!isset($row['menu_id']) || !isset($row['menu_name'])) {
                 continue;
             }
             $menuId = (int) $row['menu_id'];
             $data[$menuId] = $row['menu_name'];
         }
     }
     return $data;
 }
Exemple #4
0
 /**
  * 获取“排序”验证规则
  * @param mixed $value
  * @return array
  */
 public function getSortRule($value)
 {
     return array('Integer' => new validator\IntegerValidator($value, true, Lang::_('SRV_FILTER_MENUS_SORT_INTEGER')));
 }