Changeset 23486


Ignore:
Timestamp:
2014/06/02 04:08:23 (10 years ago)
Author:
shutta
Message:

#2564 SC_FormParam> フォームパラメーターの設定情報取得関数を追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/class/SC_FormParam.php

    r23124 r23486  
    592592        } 
    593593    } 
     594 
     595    /** 
     596     * パラメーターの設定情報を取得 
     597     * 
     598     * @param   string  $keyname    取得するキー名 
     599     * @param   string  $target     項目名(disp_name,length,convert等) 
     600     * @return  mixed   パラメーターの設定情報 
     601     */ 
     602    public function getParamSetting($keyname = null, $target = null) 
     603    { 
     604        $arrSetting = array( 
     605            'disp_name', 
     606            'keyname', 
     607            'length', 
     608            'convert', 
     609            'arrCheck', 
     610            'arrDefault', 
     611            'input_db', 
     612        ); 
     613 
     614        if (is_null($keyname)) { 
     615            // 全ての設定情報を取得 
     616            $ret = array(); 
     617            foreach ($this->keyname as $index=>$key) { 
     618                foreach ($arrSetting as $item) { 
     619                    $ret[$key][$item] = $this->{$item}[$index]; 
     620                } 
     621            } 
     622            return $ret; 
     623        } 
     624 
     625        $index = array_search($keyname, $this->keyname); 
     626 
     627        if ($index !== false) { 
     628            if (is_null($target)) { 
     629                // 指定のkeynameの全ての設定情報を取得 
     630                $ret = array(); 
     631                foreach ($arrSetting as $item) { 
     632                    $ret[$item] = $this->{$item}[$index]; 
     633                } 
     634                return $ret; 
     635            } 
     636 
     637            return $this->{$target}[$index]; 
     638        } 
     639    } 
    594640} 
Note: See TracChangeset for help on using the changeset viewer.