Ignore:
Timestamp:
2012/05/11 17:36:40 (12 years ago)
Author:
shutta
Message:

#1800 (SC_FormParamのパラメーター定義を削除する関数追加)
SC_FormParam::addParam()の逆の機能で、パラメーター定義を削除する関数を追加。
カスタマイズおよびプラグインで使用されることを想定しています。

File:
1 edited

Legend:

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

    r21661 r21822  
    498498        return $arrRet; 
    499499    } 
     500 
     501    /** 
     502     * パラメーターの削除 
     503     * addParamの逆の関数 
     504     * カスタマイズおよびプラグインで使用されるのを想定 
     505     */ 
     506    function removeParam($keyname) 
     507    { 
     508        $index = array_search($keyname, $this->keyname); 
     509 
     510        if ($index !== FALSE) { 
     511            // $this->paramに歯抜けが存在する場合は、NULLで埋めておく。 
     512            // 最後に配列を詰める際に、全ての項目が埋まっている必要がある。 
     513            foreach ($this->keyname as $key => $val) { 
     514                if (!isset($this->param[$key])) { 
     515                    $this->param[$key] = NULL; 
     516                } 
     517            } 
     518            // $this->paramがソートされていない時があるのでソート。 
     519            ksort($this->param); 
     520 
     521            // 削除 
     522            unset($this->disp_name[$index]); 
     523            unset($this->keyname[$index]); 
     524            unset($this->length[$index]); 
     525            unset($this->convert[$index]); 
     526            unset($this->arrCheck[$index]); 
     527            unset($this->default[$index]); 
     528            unset($this->input_db[$index]); 
     529            unset($this->param[$index]); 
     530 
     531            // 歯抜けになった配列を詰める 
     532            $this->disp_name = array_merge($this->disp_name); 
     533            $this->keyname = array_merge($this->keyname); 
     534            $this->length = array_merge($this->length); 
     535            $this->convert = array_merge($this->convert); 
     536            $this->arrCheck = array_merge($this->arrCheck); 
     537            $this->default = array_merge($this->default); 
     538            $this->input_db = array_merge($this->input_db); 
     539            $this->param = array_merge($this->param); 
     540        } 
     541    } 
    500542} 
Note: See TracChangeset for help on using the changeset viewer.