cakephp2.doc_063
R e i - D r e a m
for Laravel
TOP > CakePHP2 > Plugin関連(自作)
Guest
login

最終投稿日:2019年11月20日

Plugin関連(自作)
概要
■ 概要
本プラグインは、CSS のフレームワークである Bootstrap3 を利用した Helper となります。 ※Bootstrap3 は、本プラグインには実装していません。 【設置場所】 [app] | [Plugin] | [Hoge] | [View] | [Helper] | [BootstrapCssHelper.php] 【Controller】 <?php App::uses('AppController', 'Controller'); CakePlugin::load("Hoge"); class HogeController extends AppController { public $name = 'Users'; public $uses = array('User'); public $helpers = array('Html', 'Form','Hoge.BootstrapCss');
使用例
【全体に影響】
//ラベルの高さ指定(View 側から設定できる[$this->BootstrapCss->marginTop = "50";])
public $marginTop  = "20";
//ラベルの左端からの余白を指定(上記と同様 View から指定できる)
public $marginLeft = "0";

【メモ】
    確認画面は、入力画面に使用したコードに『readonly』
     属性を追加するだけで、見栄えの良いレイアウトになる。
    例)
        $this->BootstrapCss->input("username",array(
            "type"=>"text","label"=>"アカウント名","style"=>"width:400px;","height"=>"100px"
            ,"placeholder"=>"Account Name","bs_type"=>"col1","class"=>"form-control"
            ,"v_error"=>@$this->Form->validationErrors["User"]["username"][0]
            ,"readonly"=>"readonly"));


【個々のヘルパー】
■ create
    基本的に Form ヘルパーを使用する。以下必要パラメータ

        [class] => form-horizontal
        [style] => margin-left:50px ※ドキュメントの左端からのマージン

        例)
            $this->Form->create("User",array("controller"=>"users","action"=>"index"
            ,"novalidate" => true,"class"=>"form-horizontal"
            ,"style"=>"margin-left:50px","autocomplete"=>"off"));

■ input
    テキストボックス用

        必須パラメータ
        
            [type]    => [text]or[password]
            [label]
            [style]   => 項目フィールドの width 等定義
            [class]   -> form-control
            [bs_type] => 同クラスの変数定義参照
            [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]

        任意パラメータ
        
            ※低すぎると次のエレメントが回り込む
            [height] => **px  エレメント全体を DIV で囲い height 属性を付加する([**px]指定) 

        【完成イメージ】
        
        <div style="height:100px;">
        <div class="form-group">
            <label for="name1" class="control-label col-sm-2">Name</label>
            <div class="col-sm-10" style="width:300px;">
                <input type="text" name="name1" class="form-control">
            </div>
        </div>
    </div>

    例)
        $this->BootstrapCss->input("username",array("type"=>"text"
        ,"label"=>"アカウント名","style"=>"width:400px;","height"=>"100px"
        ,"placeholder"=>"Account Name","bs_type"=>"col1","class"=>"form-control"
        ,"v_error"=>@$this->Form->validationErrors["User"]["username"][0]));


    ラジオボタン用

            必須パラメータ
            [type]    => radio
            [label]
            [style]   => 項目フィールドの width 等定義
            [bs_type] => 同クラスの変数定義参照
            [options] => ラジオの配列
            [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
            [div]     => radio-horizontal 横レイアウト 
                ※縦レイアウトにする場合は "div"=>false,"separator"=>"<br />"

            任意パラメータ
            
            [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する


            【完成イメージ】
            
            <div class="form-group">
                <label class="control-label col-sm-2"  for="UserUsername"">性別</label>
                    <div class="col-sm-10" style="width:400px;">
                        <input type="radio" name="radio_group">男性
                        <input type="radio" name="radio_group">女性
                    </div>
            </div>
        
            例)
            echo $this->BootstrapCss->input('sex',array(
                "legend"=>false,"label"=>"性別","style"=>"width:400px;","bs_type"=>"col1"
                ,"type"=>"radio","separator"=>" ","div"=>"radio-horizontal"
                ,"v_error"=>@$this->Form->validationErrors["User"]["sex"][0]
                ,"options"=>array(1 => '男',2 => '女')));


    チェックボックス用
            必須パラメータ
            [multiple] => checkbox
            [label]
            [style]   => 項目フィールドの width 等定義
            [bs_type] => 同クラスの変数定義参照
            [options] => チェックボックスの配列
            [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
            [div]     => false 横レイアウト ※縦レイアウトにする場合は "div"=>true
        
            任意パラメータ
            
            [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
        
            【完成イメージ】
            
            <div class="form-group">
                <label class="control-label col-sm-2"  for="UserUsername"">趣味</label>
                <div class="col-sm-10" style="width:400px;">
                    <input type="hidden" name="data[User][syumi]" value="" id="UserSyumi"/>
                    <input type="checkbox" name="data[User][syumi][]" value="1" id="UserSyumi1" />
                    <label for="UserSyumi1">あああ</label>
                    <input type="checkbox" name="data[User][syumi][]" value="2" id="UserSyumi2" />
                    <label for="UserSyumi2">いいい</label>
                    <input type="checkbox" name="data[User][syumi][]" value="3" id="UserSyumi3" />
                    <label for="UserSyumi3">ううう</label>
                </div>
            </div>
        
            例)
            $this->BootstrapCss->input('syumi',array(
                "multiple"=>"checkbox","label"=>"趣味","style"=>"width:400px;"
                ,"bs_type"=>"col1","div"=>false,"v_error"=>@$this->Form->
                validationErrors["User"]["syumi"][0],"options"=>array(
                    "1"=>"a","2"=>"b","3"=>"c")));


    セレクトボックス用
            必須パラメータ
            [type]    => select
            [label]
            [style]   => 項目フィールドの width 等定義
            [bs_type] => 同クラスの変数定義参照
            [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
            
            任意パラメータ
            
            [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
        
            【完成イメージ】
            
            <div class="form-group">
                <div class="input select">
                    <label class="control-label col-sm-2" for="UserSyokugyo">職業</label>
                    <div class="col-sm-10" style="width:400px;">
                        <select class="form-control" name="data[User][syokugyo]" id="UserSyokugyo">
                            <option value=""></option>
                            <option value="2">会社員</option>
                            <option value="3">自営業</option>
                            <option value="1">その他</option>
                        </select>
                    </div>
                </div>
            </div>
        
            例)
            $this->BootstrapCss->input("syokugyo",array(
                "empty"=>"","type"=>"select","label"=>"職業","style"=>"width:400px;"
                ,"bs_type"=>"col1","v_error"=>@$this->Form->
                validationErrors["User"]["syokugyo"][0],"options"=>array(
                    "2"=>"会社員","3"=>"自営業","1"=>"その他")));


    ファイル選択用
            必須パラメータ
            [type]    => file
            [label]
            [style]   => 項目フィールドの width 等定義
            [bs_type] => 同クラスの変数定義参照
            [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
            
            任意パラメータ
            
            [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
        
            【完成イメージ】
            
            <div style="height:70px;">
                <div class="form-group">
                    <div class="input file required">
                        <label style="margin-top:20px;" class="control-label col-sm-2" 
                            for="UserFilename">ファイル名</label>
                        <div> </div>
                        <div class="col-sm-10" style="width:400px;">
                            <input class="form-control" type="file" name="data[User][filename]" 
                                class="form-control" id="UserFilename" required="required"/>
                        </div>
                    </div>
                </div>
            </div>
        
            例)
            $this->BootstrapCss->input("filename",array(
                "type"=>"file","label"=>"ファイル名","style"=>"width:400px;"
                ,"height"=>"70px","bs_type"=>"col1","class"=>"form-control"
                ,"v_error"=>@$this->Form->validationErrors["User"]["filename"][0]));

        ※[v_error]の先頭7文字の内容が以下の場合はファイル選択状態の表示となります。
        
            『OKFILE.』 (Controller がからセットして利用する
                $this->[Model]->validationErrors[項目名][0]="OKFILE.ファイルは選択されています")


■ textarea
    テキストエリア用
            必須パラメータ
            [label]
            [style]   => 項目フィールドの width 等定義
            [bs_type] => 同クラスの変数定義参照
            [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
            [cols]
            [rows]
            
            任意パラメータ
            
            [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
        
            【完成イメージ】
            
            <div class="form-group">
                <label class="control-label col-sm-2"  for="UserUsername" 
                    style="margin-top:20px;">テキストエリア</label>
                    <div class="col-sm-10" style="width:400px;">
                        <textarea name="data[User][message]" class="form-control" 
                        placeholder="textarea..." cols="40" rows="5" label="" 
                        id="UserMessage"></textarea>
                    </div>
                </div>
            </div>
        
            例)
            $this->BootstrapCss->textarea("message",array(
                "cols"=>"40" ,"rows"=>"5","label"=>"メッセージ","style"=>
                "width:400px;","bs_type"=>"col1","v_error"=>@$this->Form->
                validationErrors["User"]["message"][0],"placeholder"=>"message..."));

■ button
    ボタン出力
        必須パラメータ(第2引数は、空で良い)
    
            第1引数 ボタン名
            第2引数 配列([type]を省略すると submit となる)
                   [bs_type] => 同クラスの変数定義参照
        
            第3引数 配列 Bootstrap Class 名 [0]=>[btn btn-success]等、
             [1]=>[glyphicon glyphicon-ok-circle]等
    
        任意パラメータ
    
            第2引数 [div]=>false ボタンのデザインのみ(ボタンを横に並べられる)
                    [separator]=>** エレメントの最後に付与する
    
    【完成イメージ】
    
        <div class="form-group">
            <div class="control-label col-sm-2" style="margin-left:0px;">
                <button class="btn btn-success" bs_type="col1" type="submit">
                    <span class="glyphicon glyphicon-ok-circle"></span> 確認
                </button>
            </div>
        </div>
        例)
        $this->BootstrapCss->button("確認",array("bs_type"=>"col1")
            ,array("btn btn-success","glyphicon glyphicon-ok-circle"));
        $this->BootstrapCss->button("確認",array("bs_type"=>"col1","div"=>false
        ,"separator"=>" "),array("btn btn-success","glyphicon glyphicon-ok-circle"));

■ link
    リンク出力
    【お作法】
        リンク文字をなくして、マークだけにするには、リンク名を『_』とする
        必須パラメータ(第2引数は、空で良い)
    
        第3引数       [class]     <a> 内の class      『btn btn-success』等
                        [img]       <span> 内の class   『glyphicon glyphicon-pencil』等
    
    【完成イメージ】
    
        <a href="/cake2612/admin/users/insert" class="btn btn-success">
        <span class="glyphicon glyphicon-pencil"></span> アカウント新規登録</a>
        例)
        $this->BootstrapCss->link("アカウント新規登録",array(
            "controller"=>"users","action"=>"insert","profiles"=>true)
            ,array("class"=>"btn btn-success","img"=>"glyphicon glyphicon-pencil"));

■ prev (ページング)
        【お作法】
        本ヘルパーは、[prev][next]をセットで出力する必要がある。(<ul>の関係で)
            
        必須パラメータ
    
            第3引数       配列 [width]=>**px
    
    【完成イメージ】
    
        <ul class="pager" style="width:**px;">
            <li class="previous">
                <a href="***" rel="prev"><< </a>
            </li>
        例)
        $this->BootstrapCss->prev('<< ',array("url"=>array(
            "controller"=>"users","action"=>"index")),array("width"=>"500px"));

■ next (ページング)
        【お作法】
        本ヘルパーは、[prev][next]をセットで出力する必要がある。(<ul>の関係で)
    
        必須パラメータ        特になし(通常の書式。。。)
    
    【完成イメージ】
    
            <li class="next">
                <a href="***" rel="next"> >></a>
            </li>
        </ul>
        例)
        $this->BootstrapCss->next(' >>',array(
            "url"=>array("controller"=>"users","action"=>"index")));

■ numbers (ページング)
        【お作法】

        必須パラメータ
        
        [separator]         半角の空白は禁止。(『 』で記述する)
    
    【完成イメージ】
    
        <li>
            <a href="***">5</a>
        </li>
        例)
        $this->BootstrapCss->numbers(array("modulus"=>5,"separator"=>""));
            
ソース
<?php

App::uses('AppHelper', 'View/Helper');

class BootstrapCssHelper extends AppHelper {

    public $helpers = array('Form','Html','Paginator');

    /***************************************************
    * BootstrapCss 変数定義
    ***************************************************/
    //[bs_type]
    public $bs_class = array(
        "col1" => array("control-label col-sm-2","col-sm-10"),
        
    );

    //エレメント全体に height 領域を作成する
    private $start_tag = "";
    //エレメント全体に height 領域を作成する
    private $end_tag   = "";
    //View から渡る option
    private $options   = array();
    //エレメントの幅(width:400px 等)
    private $style     = "";
    //Bootstrap3 の Class の中身を決めるKey
    private $bs_type   = "";
    //エラーメッセージ
    private $v_error   = "";
    
    //ラベルの高さ指定(View 側から設定できる[$this->BootstrapCss->marginTop = "50";])
    public $marginTop  = "20";
    //ラベルの左端からの余白を指定(上記と同様 View から指定できる)
    public $marginLeft = "0";


    /*************************************************
    * BootstrapCss メソッド定義
    *************************************************/

 ### 初期設定 ###

    function init($options = array()){
        $this->options = $options;
        
        //エレメント全体に height 領域を作成するか判断
        if(isset($options["height"])){
            $this->start_tag = '<div style="height:'.$options["height"].';">';
            $this->end_tag   = '</div>';
            unset($this->options["height"]);
        }else{
            $this->start_tag = '';
            $this->end_tag = '';
        }

        $this->options["error"] = false;

        if(isset($options["v_error"])){$this->v_error = $options["v_error"];}
        if(isset($options["style"])){$this->style = $options["style"];}

        $this->bs_type = $options["bs_type"];
        
        unset($this->options["style"]);
        unset($this->options["bs_type"]);
        unset($this->options["v_error"]);
    }


 ### 各エレメント全体の前後の div 付与 ###
 
    function heightDivCreate($result = null){
        return $this->start_tag.$result.$this->end_tag;
    }


        /*******************************************************************
        * create について
        * 
        * 基本的に Form ヘルパーを使用する。以下必要パラメータ
        *
        * [class] => form-horizontal
        * [style] => margin-left:50px ドキュメントの左端からのマージン
        *
        *例)
        * $this->Form->create("User",
        *      array("controller"=>"users","action"=>"index"
        *      ,"novalidate" => true,"class"=>"form-horizontal",
        *      "style"=>"margin-left:50px","autocomplete"=>"off"));
        *********************************************************************/

 ### input メソッド オーバーライド ###

    public function input($fieldName, $options = array()){
        
        /********************************************************************
        * テキストボックス用
        * 
        * 必須パラメータ
        *   [type]    => [text]or[password]
        *   [label]
        *   [style]   => 項目フィールドの width 等定義
        *   [class]   -> form-control
        *   [bs_type] => 同クラスの変数定義参照
        *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
        * 
        * 任意パラメータ
        *   ※低すぎると次のエレメントが回り込む
        *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する([**px]指定)
        *
        * 【完成イメージ】
        * <div style="height:100px;">
        *    <div class="form-group">
        *        <label for="name1" class="control-label col-sm-2">Name</label>
        *        <div class="col-sm-10" style="width:300px;">
        *            <input type="text" name="name1" class="form-control">
        *        </div>
        *    </div>
        *</div>
        *
        * 例)
        * $this->BootstrapCss->input("username",array("type"=>"text","label"=>
        *   "アカウント名","style"=>"width:400px;","height"=>"100px"
        *   "placeholder"=>"Account Name","bs_type"=>"col1","class"=>"form-control"
        *   ,"v_error"=>@$this->Form->validationErrors["User"]["username"][0]));
        ********************************************************************/
        if(isset($options["type"]) and ($options["type"] == "text" 
            or $options["type"] == "password") and $options["v_error"] == NULL){

            //パラメータ整理
            $this->init($options);
            $this->options["div"] = false;
            
            //[label][inpt]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
            //[label]タグ修正
            $results[0] = str_replace('<label','<label class="'.$this->bs_class[$this->
                bs_type][0].'" style="margin-top:'.$this->marginTop.'px;margin-left:'.$this->
                marginLeft.'px;" ',$results[0]).'</label>';
            
            //タグ作成
            $tag1 = '<div class="form-group">';
            $tag2 = '<div> </div>';
            $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                        style="'.$this->style.'">';
            $tag4 = '</div></div>';
            
            return $this->heightDivCreate($tag1.$results[0].$tag2.$tag3.$results[1].$tag4);
        
        
        /******************************************************************
        * テキストボックス用(エラー表示)
        * 
        * 
        * 【完成イメージ】
        * 
        *    <div class="form-group">
        *        <label for="name2" class="control-label col-sm-2">PassWord</label>
        *        <div style="color:red;">エラーだよ。。。。</div>
        *        <div class="form-group has-error has-feedback">
        *        <div class="col-sm-10" style="width:300px;">
        *            <input type="text" name="name2" class="form-control" 
        *            style="background-color:#ffeeff;">
        *            <span class="glyphicon glyphicon-remove form-control-feedback"></span>
        *        </div>
        *        </div>
        *    </div>
        *
        *****************************************************************/
        }else if(isset($options["type"]) and ($options["type"] == "text" 
            or $options["type"] == "password") and !empty($options["v_error"])){

            //パラメータ整理
            $this->init($options);
            $this->options["div"] = false;
            
            //[label][inpt]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
            //[label]タグ修正
            $results[0] = str_replace('<label','<label class="'.$this->bs_class[$this->
                bs_type][0].'" style="margin-top:'.$this->marginTop.'px;margin-left:'.$this->
                marginLeft.'px;" ',$results[0]).'</label>';
            //[input]タグ修正
            $results[1] = str_replace('>',' style="background-color:#ffeeff;">',$results[1]);
            
            //タグ作成
            $tag1 = '<div class="form-group">';
            $tag2 = '<div style="color:red;"> '.$this->v_error.'</div>';
            $tag3 = '<div class="form-group has-error has-feedback">';
            $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                        style="'.$this->style.'">';
            $tag5 = '<span class="glyphicon glyphicon-remove form-control-feedback"></span>';
            $tag6 = '</div></div></div>';
            
            return $this->heightDivCreate($tag1.$results[0]
                .$tag2.$tag3.$tag4.$results[1].$tag5.$tag6);


        /****************************************************************
        * ラジオボタン用
        * 
        * 必須パラメータ
        *   [type]    => radio
        *   [label]
        *   [style]   => 項目フィールドの width 等定義
        *   [bs_type] => 同クラスの変数定義参照
        *   [options] => ラジオの配列
        *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
        *   [div]     => radio-horizontal 横レイアウト 
        *                       ※縦レイアウトにする場合は "div"=>false,"separator"=>"<br />"
        *
        * 任意パラメータ
        *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
        *
        * 【完成イメージ】
        * 
        *    <div class="form-group">
        *        <label class="control-label col-sm-2"  for="UserUsername"">性別</label>
        *            <div class="col-sm-10" style="width:400px;">
        *                <input type="radio" name="radio_group">男性
        *                <input type="radio" name="radio_group">女性
        *            </div>
        *    </div>
        *
        * 例)
        * echo $this->BootstrapCss->input(
        *     'sex',array("legend"=>false,"label"=>"性別","style"=>"width:400px;",
        *     "bs_type"=>"col1","type"=>"radio","separator"=>" ","div"=>"radio-horizontal",
        *     "v_error"=>@$this->Form->validationErrors["User"]["sex"][0]
        *         ,"options"=>array(1 => '男',2 => '女')));
        *****************************************************************/
        }else if(isset($options["type"]) and $options["type"] == "radio" 
            and $options["v_error"] == NULL){
            
            //パラメータ整理
            $this->init($options);
            
            $result = $this->Form->input($fieldName,$this->options);
            
            $tag1 = '<div class="form-group">';
            $tag2 = '<label class="'.$this->bs_class[$this->
                bs_type][0].'"  for="'.$fieldName.'" style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;">'
                .$this->options["label"].'</label>';
            $tag3 = '<div> </div>';
            $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                style="'.$this->style.'">';
            $tag5 = '</div></div>';
            
            
            return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$result.$tag5);
        
        
        /******************************************************************
        * ラジオボタン用(エラー表示)
        *
        * 【完成イメージ】
        * 
        *    <div class="form-group">
        *        <label class="control-label col-sm-2"  for="UserUsername" 
        *           style="margin-top:20px;">性別</label>
        *        <div style="color:red;"> だめ</div>
        *           <div class="form-group has-error has-feedback">
        *            <div class="col-sm-10" style="width:400px;">
        *                <div class="form-control form-error" style="background-color:#ffeeff;">
        *                    <input type="radio" name="radio_group">男性
        *                    <input type="radio" name="radio_group">女性
        *                    <span class="glyphicon glyphicon-remove 
        *                       form-control-feedback"></span>
        *                </div>
        *            </div>
        *        </div>
        *    </div>
        *
        ******************************************************************/
        }else if(isset($options["type"]) and $options["type"] == "radio" 
            and !empty($options["v_error"])){
            
            //パラメータ整理
            $this->init($options);

            $result = $this->Form->input($fieldName,$this->options);
        
            $tag1 = '<div class="form-group">';
            $tag2 = '<label class="'.$this->bs_class[$this->
                bs_type][0].'"  for="'.$fieldName.'" style="margin-top:'
                .$this->marginTop.'px;margin-left:'.$this->marginLeft.'px;">'
                .$this->options["label"].'</label>';
            $tag3 = '<div style="color:red;"> '.$this->v_error.'</div>
                <div class="form-group has-error has-feedback">';
            $tag4 = '<div class="'.$this->bs_class[$this->
                bs_type][1].'" style="'.$this->style.'">';
            if($options["div"]){
                $tag5 = '<div class="form-control form-error" 
                style="background-color:#ffeeff;">';
            }else{
                $tag5 = '<div class="form-control form-error" 
                style="background-color:#ffeeff;height:100%;">';
            }
            $tag6 = '<span class="glyphicon glyphicon-remove form-control-feedback"></span>';
            $tag7 = '</div></div></div></div>';
            
            return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$tag5.$result.$tag6.$tag7);
        
        
        /*****************************************************************
        * チェックボックス用
        * 
        * 必須パラメータ
        *   [multiple] => checkbox
        *   [label]
        *   [style]    => 項目フィールドの width 等定義
        *   [bs_type]  => 同クラスの変数定義参照
        *   [options]  => チェックボックスの配列
        *   [v_error]  => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
        *   [div]      => false      横レイアウト    ※縦レイアウトにする場合は "div"=>true
        *
        * 任意パラメータ
        *   [height]   => **px  エレメント全体を DIV で囲い height 属性を付加する
        *
        * 【完成イメージ】
        * 
        *    <div class="form-group">
        *        <label class="control-label col-sm-2"  for="UserUsername"">趣味</label>
        *        <div class="col-sm-10" style="width:400px;">
        *            <input type="hidden" name="data[User][syumi]" value="" id="UserSyumi"/>
        *            <input type="checkbox" name="data[User][syumi][]" 
        *               value="1" id="UserSyumi1" /><label for="UserSyumi1">あああ</label> 
        *            <input type="checkbox" name="data[User][syumi][]" 
        *               value="2" id="UserSyumi2" /><label for="UserSyumi2">いいい</label> 
        *            <input type="checkbox" name="data[User][syumi][]" 
        *               value="3" id="UserSyumi3" /><label for="UserSyumi3">ううう</label> 
        *        </div>
        *    </div>
        *
        * 例)
        * $this->BootstrapCss->input('syumi',array("multiple"=>"checkbox","label"=>
        *   "趣味","style"=>"width:400px;","bs_type"=>"col1","div"=>false,
        *   "v_error"=>@$this->Form->validationErrors["User"]["syumi"][0],
        *   "options"=>array("1"=>"a","2"=>"b","3"=>"c")));
        ******************************************************************/
        }else if(!isset($options["type"]) and $options["multiple"]=="checkbox" 
            and $options["v_error"] == NULL){
            //パラメータ整理
            $this->init($options);
            
            //[label]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
            //[label]タグ修正
            $results[0] = str_replace('<label','<label style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
                bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
            $results[0] = str_replace('<div class="input select">','',$results[0]);
            
            $join = "";
            if($this->options["div"] == false){
                //横レイアウト
                for($i=1;$i<count($results);$i++){
                    $results[$i] = str_replace('<div class="checkbox">','',$results[$i]);
                    $results[$i] = str_replace('</div>','</label> ',$results[$i]);
                    $join .= $results[$i];
                }
                $tag5 = '</div></div>';
            }else{
                //縦レイアウト
                for($i=1;$i<count($results)-1;$i++){
                    $results[$i] = str_replace('div class="checkbox"','div',$results[$i]);
                    $results[$i] = str_replace('</div>','</label></div>',$results[$i]);
                    $join .= $results[$i];
                }
                $tag5 = '</label></div></div></div></div>';
            }
            
            $tag1 = '<div class="form-group">';
            $tag2 = '<div> </div>';
            $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                        style="'.$this->style.'">';
                            
            
            return $this->heightDivCreate($tag1.$results[0].$tag2.$tag3.$join.$tag5);
        
        
        /***************************************************************
        * チェックボックス用(エラー用)
        *
        * 【完成イメージ】
        * 
        *    <div class="form-group">
        *        <label class="control-label col-sm-2"  for="UserUsername"">趣味</label>
        *        <div class="col-sm-10" style="width:400px;">
        *            <input type="hidden" name="data[User][syumi]" value="" id="UserSyumi"/>
        *            <input type="checkbox" name="data[User][syumi][]" 
        *               value="1" id="UserSyumi1" /><label for="UserSyumi1">あああ</label> 
        *            <input type="checkbox" name="data[User][syumi][]" 
        *               value="2" id="UserSyumi2" /><label for="UserSyumi2">いいい</label> 
        *            <input type="checkbox" name="data[User][syumi][]" 
        *               value="3" id="UserSyumi3" /><label for="UserSyumi3">ううう</label> 
        *        </div>
        *    </div>
        ***************************************************************/
        }else if(!isset($options["type"]) and $options["multiple"]=="checkbox" 
            and !empty($options["v_error"])){
            //パラメータ整理
            $this->init($options);
            
            //[label]タグを分ける
            $results = explode("</label>",$this->
                Form->input($fieldName,$this->options));
            //[label]タグ修正
            $results[0] = str_replace('<label','<label style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
                bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
            $results[0] = str_replace('<div class="input select">','',$results[0]);
            
            $join = "";
            if($this->options["div"] == false){
                //横レイアウト
                for($i=1;$i<count($results);$i++){
                    $results[$i] = str_replace('
                        <div class="checkbox form-error">','',$results[$i]);
                    $results[$i] = str_replace('</div>','</label> ',$results[$i]);
                    $join .= $results[$i];
                }
                $tag6 = '</div></div>';
            }else{
                //縦レイアウト
                for($i=1;$i<count($results)-1;$i++){
                    $results[$i] = str_replace(
                        'div class="checkbox form-error"','div',$results[$i]);
                    $results[$i] = str_replace('</div>'
                    ,'</label></div>',$results[$i]);
                    $join .= $results[$i];
                }
                $tag6 = '</label></div></div></div></div>';
            }
            
            $tag1 = '<div class="form-group">';
            $tag2 = '<div style="color:red;"> '.$this->
                v_error.'</div><div class="form-group has-error has-feedback">';
            $tag3 = '<div class="form-control form-error" 
                style="background-color:#ffeeff;height:100%;">';
            $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                style="'.$this->style.'">';
            $tag5 = '<span class="glyphicon glyphicon-remove 
                form-control-feedback"></span>';
            $tag7 = '</div></div>';
            
                            
            
            return $this->heightDivCreate($tag1.$results[0]
                        .$tag2.$tag4.$tag3.$tag5.$join.$tag6.$tag7);
        
        
        /************************************************************
        * セレクトボックス用
        * 
        * 必須パラメータ
        *   [type]    => select
        *   [label]
        *   [style]   => 項目フィールドの width 等定義
        *   [bs_type] => 同クラスの変数定義参照
        *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
        * 
        * 任意パラメータ
        *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
        *
        * 【完成イメージ】
        *    <div class="form-group">
        *        <div class="input select">
        *            <label class="control-label col-sm-2" for="UserSyokugyo">職業</label>
        *            <div class="col-sm-10" style="width:400px;">
        *                <select class="form-control" 
        *                   name="data[User][syokugyo]" id="UserSyokugyo">
        *                    <option value=""></option>
        *                    <option value="2">会社員</option>
        *                    <option value="3">自営業</option>
        *                    <option value="1">その他</option>
        *                </select>
        *            </div>
        *        </div>
        *    </div>
        *
        * 例)
        * $this->BootstrapCss->input("syokugyo",array("empty"=>"","type"=>
        *     "select","label"=>"職業","style"=>"width:400px;","bs_type"=>"col1",
        *     "v_error"=>@$this->Form->validationErrors["User"]["syokugyo"][0],
        *     "options"=>array("2"=>"会社員","3"=>"自営業","1"=>"その他")));
        ************************************************************/
        }else if(isset($options["type"]) and $options["type"] == "select" 
            and $options["v_error"] == NULL){
            //パラメータ整理
            $this->init($options);
            
            //[label]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
            
            //[label]タグ修正
            $results[0] = str_replace('<label','<label style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
                bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
            $results[1] = str_replace('<select','<select class="form-control"',$results[1]);

            $tag1 = '<div class="form-group">';
            $tag2 = '<div> </div>';
            $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                        style="'.$this->style.'">';
            $tag4 = '</div></div>';

            return $this->heightDivCreate($tag1.$results[0].$tag2.$tag3.$results[1].$tag4);
            

        
        /***************************************************************
        * セレクトボックス用(エラー)
        *
        * 【完成イメージ】
        *    <div class="form-group">
        *        <div class="input select required">
        *            <label style="margin-top:20px;" class="control-label col-sm-2" 
                        for="UserSyokugyo">職業</label>
        *            <div style="color:red;"> ふ~選択して</div>
        *            <div class="form-group has-error has-feedback">
        *                <div class="col-sm-10" style="width:400px;">
        *                    <span class="glyphicon glyphicon-remove 
                                form-control-feedback"></span>
        *                    <select style="background-color:#ffeeff;" 
                                class="form-control form-error" name="data[User][syokugyo]" 
                                class="form-error" id="UserSyokugyo" required="required">
        *                        <option value=""></option>
        *                        <option value="2">会社員</option>
        *                        <option value="3">自営業</option>
        *                        <option value="1">その他</option>
        *                    </select>
        *                </div>
        *            </div>
        *        </div>
        *    </div>
        ****************************************************************/
        }else if(isset($options["type"]) and $options["type"] == "select" 
            and !empty($options["v_error"])){
            //パラメータ整理
            $this->init($options);
            
            //[label]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        
            //[label]タグ修正
            $results[0] = str_replace('<label','<label style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
                bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
            $results[1] = str_replace('<select','<select 
                style="background-color:#ffeeff;" class="form-control form-error"',$results[1]);
            
            $tag1 = '<div class="form-group">';
            $tag2 = '<div style="color:red;"> '.$this->v_error.'</div>';
            $tag3 = '<div class="form-group has-error has-feedback">';
            $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                        style="'.$this->style.'">';
            $tag5 = '<span class="glyphicon glyphicon-remove form-control-feedback"></span>';
            $tag6 = '</div></div></div>';
            
            return $this->heightDivCreate($tag1.$results[0]
                        .$tag2.$tag3.$tag4.$tag5.$results[1].$tag6);

        
        
        /************************************************************
        * ファイル選択用
        * 
        * 必須パラメータ
        *   [type]    => file
        *   [label]
        *   [style]   => 項目フィールドの width 等定義
        *   [bs_type] => 同クラスの変数定義参照
        *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
        * 
        * 任意パラメータ
        *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
        *
        * 【完成イメージ】
        *    <div style="height:70px;">
        *        <div class="form-group">
        *            <div class="input file required">
        *                <label style="margin-top:20px;" class="control-label col-sm-2" 
        *                   for="UserFilename">ファイル名</label>
        *                <div> </div>
        *                <div class="col-sm-10" style="width:400px;">
        *                    <input class="form-control" type="file" name="data[User][filename]" 
        *                       class="form-control" id="UserFilename" required="required"/>
        *                </div>
        *            </div>
        *        </div>
        *    </div>
        *
        * 例)
        * $this->BootstrapCss->input("filename",array("type"=>"file","label"=>
        *     "ファイル名","style"=>"width:400px;","height"=>"70px",
        *      "bs_type"=>"col1","class"=>"form-control","v_error"=>@$this->
        *      Form->validationErrors["User"]["filename"][0]));
        ************************************************************/
        }else if(isset($options["type"]) and $options["type"] == "file" 
            and $options["v_error"] == NULL){
            //パラメータ整理
            $this->init($options);
            
            //[label]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
            
            //[label]タグ修正
            $results[0] = str_replace('<label','<label style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
                bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
            $results[1] = str_replace('<input','<input class="form-control"',$results[1]);
            
            $tag1 = '<div class="form-group">';
            $tag2 = '<div> </div><div class="form-group has-feedback">';
            $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                style="'.$this->style.'">';
            $tag4 = '</div></div></div>';
            
            return $this->heightDivCreate($tag1.$results[0].$tag2.$tag3.$results[1].$tag4);
        
        
        /***************************************************************
        * ファイル選択用(エラー)
        *
        * 【完成イメージ】
        *    <div style="height:70px;">
        *        <div class="form-group">
        *            <div class="input file required">
        *                <label style="margin-top:20px;" class="control-label col-sm-2 
        *                   for="UserFilename">ファイル名</label>
        *                <div style="color:red;"> 何か書いて。。。</div>
        *                <div class="form-group has-error has-feedback">
        *                    <div class="col-sm-10" style="width:400px;">
        *                        <span class="glyphicon glyphicon-remove 
        *                           form-control-feedback"></span>
        *                        <input style="background-color:#ffeeff;" class="form-control 
        *                           form-error" type="file" name="data[User][filename]" 
        *                           class="form-control form-error" id="UserFilename" 
        *                           required="required"/>
        *                    </div>
        *                </div>
        *            </div>
        *        </div>
        *    </div>
        *****************************************************************/
        }else if(isset($options["type"]) and $options["type"] == "file" 
            and !empty($options["v_error"])){
            //パラメータ整理
            $this->init($options);
            
            //[label]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
            
            //[label]タグ修正
            $results[0] = str_replace('<label','<label style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
                bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
            $results[1] = str_replace('<input','<input style="background-color:#ffeeff;" 
                class="form-control form-error"',$results[1]);
            
            $tag1 = '<div class="form-group">';
            $tag2 = '<div style="color:red;"> '.$this->v_error.'</div>';
            $tag3 = '<div class="form-group has-error has-feedback">';
            $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                        style="'.$this->style.'">';
            $tag5 = '<span class="glyphicon glyphicon-remove form-control-feedback"></span>';
            $tag6 = '</div></div></div>';
            
            return $this->heightDivCreate($tag1.$results[0]
                        .$tag2.$tag3.$tag4.$tag5.$results[1].$tag6);


        /****************************************************************
        * ファイル選択用(OK用)
        *
        * 【完成イメージ】
        *    <div style="height:70px;">
        *        <div class="form-group">
        *            <div class="input file required">
        *                <label style="margin-top:20px;" class="control-label col-sm-2 
        *                   for="UserFilename">ファイル名</label>
        *                <div style="color:green;"> 何か書いて。。。</div>
        *                <div class="form-group has-success has-feedback">
        *                    <div class="col-sm-10" style="width:400px;">
        *                        <span class="glyphicon glyphicon-ok 
        *                           form-control-feedback"></span>
        *                        <input style="background-color:#ffeeff;color:#ccff99;" 
        *                           class="form-control form-error" type="file" 
        *                           name="data[User][filename]" 
        *                           class="form-control form-error" id="UserFilename" 
        *                           required="required"/>
        *                    </div>
        *                </div>
        *            </div>
        *        </div>
        *    </div>
        ******************************************************************/
        }else if(isset($options["type"]) and $options["type"] == "file" 
            and !empty($options["v_error"]) and mb_substr($options["v_error"],0,7) == "OKFILE."){
            //パラメータ整理
            $options["v_error"] = mb_substr($options["v_error"],7);
            $this->init($options);
            
            //[label]タグを分ける
            $results = explode("</label>",$this->Form->input($fieldName,$this->options));
            
            //[label]タグ修正
            $results[0] = str_replace('<label','<label style="margin-top:'.$this->
                marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
                bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
            $results[1] = str_replace('<input','<input 
                style="background-color:#ccff99;color:#ccff99;" 
                class="form-control form-error"',$results[1]);
            
            $tag1 = '<div class="form-group">';
            $tag2 = '<div style="color:green;"> '.$this->v_error.'</div>';
            $tag3 = '<div class="form-group has-success has-feedback">';
            $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                        style="'.$this->style.'">';
            $tag5 = '<span class="glyphicon glyphicon-ok form-control-feedback"></span>';
            $tag6 = '</div></div></div>';
            
            return $this->heightDivCreate($tag1.$results[0]
                        .$tag2.$tag3.$tag4.$tag5.$results[1].$tag6);
        }

    }


 ### textarea メソッド オーバーライド ###

        public function textarea($fieldName, $options = array()){
        
            /*************************************************************
            * テキストエリア用
            * 
            * 必須パラメータ
            *   [label]
            *   [style]   => 項目フィールドの width 等定義
            *   [bs_type] => 同クラスの変数定義参照
            *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
            *   [cols]
            *   [rows]
            * 
            * 任意パラメータ
            *   [height] => **px  エレメント全体を DIV で囲い height 属性を付加する
            *
            * 【完成イメージ】
            *    <div class="form-group">
            *        <label class="control-label col-sm-2"  for="UserUsername" 
            *           style="margin-top:20px;">テキストエリア</label>
            *            <div class="col-sm-10" style="width:400px;">
            *                <textarea name="data[User][message]" class="form-control" 
            *                   placeholder="textarea..." cols="40" rows="5" label="" 
            *                   id="UserMessage"></textarea>
            *            </div>
            *        </div>
            *    </div>
            *
            * 例)
            * $this->BootstrapCss->textarea("message",array(
            *    "cols"=>"40" ,"rows"=>"5","label"=>"メッセージ","style"=>"width:400px;",
            *     "bs_type"=>"col1","v_error"=>@$this->Form->
            *     validationErrors["User"]["message"][0],"placeholder"=>"message..."));
            ***************************************************************/
            if($options["v_error"] == NULL){
                
                //パラメータ整理
                $this->init($options);
                
                $result = $this->Form->textarea($fieldName,$this->options);
                $result = str_replace('<textarea','<textarea class="form-control"',$result);

                $tag1 = '<div class="form-group">';
                $tag2 = '<label class="'.$this->bs_class[$this->bs_type][0].'"  
                    for="UserUsername" style="margin-top:'.$this->
                    marginTop.'px;margin-left:'.$this->marginLeft.'px;">'.$this->
                    options["label"].'</label>';
                $tag3 = '<div> </div>';
                $tag4 = '<div class="'.$this->bs_class[$this->
                    bs_type][1].'" style="'.$this->style.'">';
                $tag5 = '</div></div>';
                
                return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$result.$tag5);
            
            
            /**************************************************************
            * テキストエリア用(エラー用)
            * 
            * 必須パラメータ
            *   [label]
            *   [style]   => 項目フィールドの width 等定義
            *   [bs_type] => 同クラスの変数定義参照
            *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
            *   [cols]
            *   [rows]
            * 
            * 任意パラメータ
            *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
            *
            * 【完成イメージ】
            *    <div class="form-group">
            *        <label class="control-label col-sm-2"  for="UserUsername">メッセージ</label>
            *        <div style="color:red;"> 何か書いて。。。</div>
            *        <div class="form-group has-error has-feedback">
            *            <div class="col-sm-10" style="width:400px;">
            *                <span class="glyphicon glyphicon-remove 
            *                   form-control-feedback"></span>
            *                <textarea class="form-control form-error" 
            *                   style="background-color:#ffeeff;" name="data[User][message]" 
            *                   cols="40" rows="5" label="メッセージ" 
            *                   placeholder="message..." id="UserMessage" 
            *                   class="form-error" required="required"></textarea>
            *            </div>
            *        </div>
            *    </div>
            ****************************************************************/
            }else if(!empty($options["v_error"])){
                
                //パラメータ整理
                $this->init($options);
                
                $result = $this->Form->textarea($fieldName,$this->options);
                $result = str_replace('<textarea','<textarea class="form-control 
                    form-error" style="background-color:#ffeeff;"',$result);
                
                $tag1 = '<div class="form-group">';
                $tag2 = '<label class="'.$this->bs_class[$this->bs_type][0].'"  
                    for="UserUsername" style="margin-top:'.$this->
                    marginTop.'px;margin-left:'.$this->
                    marginLeft.'px;">'.$this->options["label"].'</label>';
                $tag3 = '<div style="color:red;"> '.$this->v_error.'</div>';
                $tag4 = '<div class="form-group has-error has-feedback">';
                $tag5 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
                $tag6 = '<span class="glyphicon glyphicon-remove 
                    form-control-feedback"></span>';
                $tag7 = '</div></div></div>';
                
                return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$tag5.$tag6.$result.$tag7);
            }
        }


/*************************************************
* ボタン用メソッド
*************************************************/

 ### button メソッド オーバーライド ###

    /*********************************************
    * ボタン出力
    *
    * 必須パラメータ(第2引数は、空で良い)
    *
    * 第1引数       ボタン名
    * 第2引数       配列([type]を省略すると submit となる)
    *               [bs_type] => 同クラスの変数定義参照
    *
    * 第3引数       配列 Bootstrap Class 名 [0]=>[btn btn-success]等、
    *                [1]=>[glyphicon glyphicon-ok-circle]等
    *
    * 任意パラメータ
    *
    * 第2引数       [div]=>false            ボタンのデザインのみ(ボタンを横に並べられる)
    *               [separator]=>**         エレメントの最後に付与する
    *
    *【完成イメージ】
    *    <div class="form-group">
    *        <div class="control-label col-sm-2" style="margin-left:0px;">
    *            <button class="btn btn-success" bs_type="col1" type="submit">
    *                <span class="glyphicon glyphicon-ok-circle"></span> 確認
    *            </button>
    *        </div>
    *    </div>
    * 例)
    *   $this->BootstrapCss->button("確認",array("bs_type"=>"col1")
    *       ,array("btn btn-success","glyphicon glyphicon-ok-circle"));
    *   $this->BootstrapCss->button("確認",array("bs_type"=>"col1"
    *       ,"div"=>false,"separator"=>" "),array(
    *       "btn btn-success","glyphicon glyphicon-ok-circle"));
    ***********************************************/
    
    public function button($fieldName,$options = array(),$params = array()){
        
        //パラメータ整理
        $this->init($options);
        if(isset($options["separator"])){
            $separator = $options["separator"];
            unset($options["separator"]);
        }else{$separator = "";}
        
        $result = $this->Form->button($fieldName,$this->options);
        
        $result = str_replace('<button','<button class="'.$params[0].'"',$result);
        $result = str_replace($fieldName,'<span class="'
            .$params[1].'"></span> '.$fieldName,$result);

        if(isset($options["div"]) and $options["div"] == false){
            return $this->heightDivCreate($result.$separator);
        }else{

            $tag1 = '<div class="form-group">';
            $tag2 = '<div class="'.$this->bs_class[$this->bs_type][0].'" 
                style="margin-left:'.$this->marginLeft.'px;">';
            $tag3 = '</div></div>';
            
            return $this->heightDivCreate($tag1.$tag2.$result.$tag3.$separator);
        }
    }



/***********************************************
* リンク用メソッド
************************************************/

 ### link メソッド オーバーライド ###

    /****************************************
    * リンク出力
    *
    *【お作法】
    *   リンク文字をなくして、マークだけにするには、リンク名を『_』とする
    *
    * 必須パラメータ(第2引数は、空で良い)
    *
    * 第3引数       [class]     <a> 内の class      『btn btn-success』等
    *               [img]       <span> 内の class   『glyphicon glyphicon-pencil』等
    *
    *
    *【完成イメージ】
    *    <a href="/cake2612/admin/users/insert" class="btn btn-success">
    *    <span class="glyphicon glyphicon-pencil"></span> アカウント新規登録</a>
    * 例)
    *   $this->BootstrapCss->link("アカウント新規登録",array(
    *    "controller"=>"users","action"=>"insert","profiles"=>true),
    *         array("class"=>"btn btn-success","img"=>"glyphicon glyphicon-pencil"));
    ******************************************/
    function link($linkName = null,$options = array(),$params = array()){

        $tag = '<span class="'.$params["img"].'"></span>';
        unset($params["img"]);
        
        $result = $this->Html->link($linkName,$options,$params);
        if($linkName == "_"){
            $result = str_replace($linkName,$tag,$result);
        }else{
            $result = str_replace($linkName,$tag.' '.$linkName,$result);
        }
        
        return $result;
    }


/**********************************
* ページング用メソッド
**********************************/

 ### prev メソッド オーバーライド ###

    /*****************************
    * prev 用リンク出力
    *
    * 【お作法】
    *   本ヘルパーは、[prev][next]をセットで出力する必要がある。(<ul>の関係で。。。)
    
    * 必須パラメータ
    *
    * 第3引数       配列 [width]=>**px
    *
    *【完成イメージ】
    *    <ul class="pager" style="width:**px;">
    *        <li class="previous">
    *            <a href="***" rel="prev"><< </a>
    *        </li>
    * 例)
    *   $this->BootstrapCss->prev('<< ',array("url"=>array(
    *       "controller"=>"users","action"=>"index")),array("width"=>"500px"));
    *****************************/
    
    function prev($mark = null,$options = array(),$params = array()){
        
        $options["class"]=false;
        $result = $this->Paginator->prev($mark,$options);
        
        if(strpos($result,'</a>')){
            $result = str_replace('<span>','',$result);
            $result = str_replace('</span>','',$result);
            
            $tag2 = '<li class="previous">';
        
        }else{
            $result = str_replace('<span>','<a href="#">',$result);
            $result = str_replace('</span>','</a>',$result);
            
            $tag2 = '<li class="previous disabled">';
        }
        
        $tag1 = '<ul class="pager" style="width:'.$params["width"].';">';
        
        $tag3 = '</li>';
        
        return $tag1.$tag2.$result.$tag3;
    }


 ### next メソッド オーバーライド ###

    /**************************************
    * next 用リンク出力
    *
    * 【お作法】
    *   本ヘルパーは、[prev][next]をセットで出力する必要がある。(<ul>の関係で。。。)
    
    * 必須パラメータ        特になし(通常の書式。。。)
    *
    *【完成イメージ】
    *        <li class="next">
    *            <a href="***" rel="next"> >></a>
    *        </li>
    *    </ul>
    * 例)
    *   $this->BootstrapCss->next(' >>',array(
    *   "url"=>array("controller"=>"users","action"=>"index")));
    ****************************************/
    function next($mark = null,$options = array()){
    
        $options["class"]=false;
        $result = $this->Paginator->next($mark,$options);
        
        if(strpos($result,'</a>')){
            $result = str_replace('<span>','',$result);
            $result = str_replace('</span>','',$result);
            
            $tag1 = '<li class="next">';
        }else{
        
            $result = str_replace('<span>','<a href="#">',$result);
            $result = str_replace('</span>','</a>',$result);
            
            $tag1 = '<li class="next disabled">';
        }
        
        $tag2 = '</li>';
        $tag3 = '</ul>';
        
        return $tag1.$result.$tag2.$tag3;
    }


 ### numbers メソッド オーバーライド ###

        /****************************************
        * numbers 用リンク出力
        *
        * 【お作法】
        *   
        
        * 必須パラメータ
        *   [separator]         半角の空白は禁止。(『 』で記述する)
        *
        *【完成イメージ】
        *    <li>
        *        <a href="***">5</a>
        *    </li>
        * 例)
        *   $this->BootstrapCss->numbers(array("modulus"=>5,"separator"=>""));
        *****************************************/
        function numbers($options = array()){
        
            $options["class"]=false;
            $results = explode('</span>',$this->Paginator->numbers($options));
            
            for($i=0;$i<count($results);$i++){
                $results[$i] = str_replace('<span>','',$results[$i]);
                
                if(strpos($results[$i],'span class')){
                    $results[$i] = str_replace('<span class="current">','',$results[$i]);
                    $results[$i] = str_replace($options["separator"],'',$results[$i]);
                    $results[$i] = '<a href="#">'.$results[$i].'</a>';
                
                    $results[$i] = 
                        '<li class="disabled">'.$options["separator"].$results[$i].'</li>';
                }else{
                    $results[$i] = '<li>'.$results[$i].'</li>';
                }
            }
            $join = implode("",$results);
            
            return $join;
        }
    }
?>
            
Bootstrap4CssHelper
【Bootstrap4 用のヘルパとなります】

使用方法は同一です。(以下ソース)

<?php

    App::uses('AppHelper', 'View/Helper');

    class Bootstrap4CssHelper extends AppHelper {

        public $helpers = array('Form','Html','Paginator');

        /*****************************************
        * BootstrapCss 変数定義
        ******************************************/
        //[bs_type]
        public $bs_class = array(
            "col1" => array("form-control-label col-sm-2","col-sm-10"),
            
        );

        //エレメント全体に height 領域を作成する
        private $start_tag = "";
        //エレメント全体に height 領域を作成する
        private $end_tag   = "";
        //View から渡る option
        private $options   = array();
        //エレメントの幅(width:400px 等)
        private $style     = "";
        //Bootstrap4 の Class の中身を決めるKey
        private $bs_type   = "";
        //エラーメッセージ
        private $v_error   = "";
        
        //ラベルの高さ指定(View 側から設定できる[$this->BootstrapCss->marginTop = "50";])
        public $marginTop  = "20";
        //ラベルの左端からの余白を指定(上記と同様 View から指定できる)
        public $marginLeft = "0";


        /*******************************************
        * BootstrapCss メソッド定義
        ********************************************/

    ### 初期設定 ###

    function init($options = array()){
        $this->options = $options;
        
        //エレメント全体に height 領域を作成するか判断
        if(isset($options["height"])){
            $this->start_tag = '<div style="height:'.$options["height"].';">';
            $this->end_tag   = '</div>';
            unset($this->options["height"]);
        }else{
            $this->start_tag = '';
            $this->end_tag = '';
        }


        $this->options["error"] = false;

        if(isset($options["v_error"])){$this->v_error = $options["v_error"];}
        if(isset($options["style"])){$this->style = $options["style"];}

        $this->bs_type = $options["bs_type"];
        
        unset($this->options["style"]);
        unset($this->options["bs_type"]);
        unset($this->options["v_error"]);
    }


    ### 各エレメント全体の前後の div 付与 ###
    
    function heightDivCreate($result = null){
        return $this->start_tag.$result.$this->end_tag;
    }


        /***************************************************
        * create について
        * 
        * 基本的に Form ヘルパーを使用する。以下必要パラメータ
        *
        * [class] => form-horizontal
        * [style] => margin-left:50px ドキュメントの左端からのマージン
        *
        *例)
        * $this->Form->create("User",
        *      array("controller"=>"users","action"=>"index","novalidate" 
        *           => true,"class"=>"form-horizontal",
        *      "style"=>"margin-left:50px","autocomplete"=>"off"));
        ****************************************************/


### input メソッド オーバーライド ###

public function input($fieldName, $options = array()){
    
    /***********************************************
    * テキストボックス用
    * 
    * 必須パラメータ
    *   [type]    => [text]or[password]
    *   [label]
    *   [style]   => 項目フィールドの width 等定義
    *   [class]   -> form-control
    *   [bs_type] => 同クラスの変数定義参照
    *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
    * 
    * 任意パラメータ
    *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する([**px]指定) 
    *               ※低すぎると次のエレメントが回り込む
    *
    * 【完成イメージ】
    * <div style="height:100px;">
    *    <div class="form-group row">
    *        <label for="name1" class="form-control-label col-sm-2">Name</label>
    *        <div class="col-sm-10" style="width:300px;">
    *            <input type="text" name="name1" class="form-control">
    *        </div>
    *    </div>
    *</div>
    *
    * 例)
    * $this->BootstrapCss->input("username",array("type"=>"text"
    *    ,"label"=>"アカウント名","style"=>"width:400px;","height"=>"100px"
    *    "placeholder"=>"Account Name","bs_type"=>"col1","class"=>"form-control"
    *    ,"v_error"=>@$this->Form->validationErrors["User"]["username"][0]));
    ************************************************/
    if(isset($options["type"]) and ($options["type"] == "text" 
        or $options["type"] == "password") and $options["v_error"] == NULL){

        //パラメータ整理
        $this->init($options);
        $this->options["div"] = false;
        
        //[label][inpt]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        $results[0] = str_replace('<label','<label class="'.$this->bs_class[$this->
            bs_type][0].'" style="margin-top:'.$this->marginTop.'px;margin-left:'
            .$this->marginLeft.'px;" ',$results[0]).'</label>';    //[label]タグ修正
        
        //タグ作成
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div> </div>';
        $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1]
                    .'" style="'.$this->style.'">';
        $tag4 = '</div></div>';
        
        return $this->heightDivCreate($tag1.$results[0].$tag2.$tag3.$results[1].$tag4);
    
    
    /********************************************************
    * テキストボックス用(エラー表示)
    * 
    * 
    * 【完成イメージ】
    * 
    *    <div class="form-group row">
    *        <label for="name2" class="form-control-label col-sm-2">PassWord</label>
    *        <div style="color:red;"> <i class="fa fa-times"></i> エラーだよ。</div>
    *        <div class="form-group has-error has-feedback">
    *        <div class="col-sm-10" style="width:300px;">
    *            <input type="text" name="name2" class="form-control" 
    *               style="background-color:#ffeeff;">
    *        </div>
    *        </div>
    *    </div>
    *
    ********************************************************/
    }else if(isset($options["type"]) and ($options["type"] == "text" 
        or $options["type"] == "password") and !empty($options["v_error"])){

        //パラメータ整理
        $this->init($options);
        $this->options["div"] = false;
        
        //[label][inpt]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        //[label]タグ修正
        $results[0] = str_replace('<label','<label class="'.$this->bs_class[
            $this->bs_type][0].'" style="margin-top:'.$this->marginTop.'px;margin-left:'
            .$this->marginLeft.'px;" ',$results[0]).'</label>';
        //[input]タグ修正
        $results[1] = str_replace('>',' style="background-color:#ffeeff;">',$results[1]);
        
        //タグ作成
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div style="color:red;"> <i class="fa fa-times">
                    </i> '.$this->v_error.'</div>';
        $tag3 = '<div class="form-group has-error has-feedback">';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
        $tag5 = '';
        $tag6 = '</div></div></div>';
        
        return $this->heightDivCreate($tag1.$results[0]
                .$tag2.$tag3.$tag4.$results[1].$tag5.$tag6);


    /***************************************************
    * ラジオボタン用
    * 
    * 必須パラメータ
    *   [type]    => radio
    *   [label]
    *   [style]   => 項目フィールドの width 等定義
    *   [bs_type] => 同クラスの変数定義参照
    *   [options] => ラジオの配列
    *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
    *   [div]     => radio-horizontal 横レイアウト 
    *                       ※縦レイアウトにする場合は "div"=>false,"separator"=>"<br />"
    *
    * 任意パラメータ
    *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
    *
    * 【完成イメージ】
    * 
    *    <div class="form-group row">
    *        <label class="control-label col-sm-2"  for="UserUsername"">性別</label>
    *            <div class="col-sm-10" style="width:400px;">
    *                <input type="radio" name="radio_group">男性
    *                <input type="radio" name="radio_group">女性
    *            </div>
    *    </div>
    *
    * 例)
    * echo $this->BootstrapCss->input('sex',array(
    *       "legend"=>false,"label"=>"性別","style"=>"width:400px;",
    *       "bs_type"=>"col1","type"=>"radio","separator"=>" ","div"=>"radio-horizontal",
    *       "v_error"=>@$this->Form->validationErrors["User"]["sex"][0]
    *       ,"options"=>array(1 => '男',2 => '女')));
    ****************************************************/
    }else if(isset($options["type"]) and $options["type"] == "radio" 
        and $options["v_error"] == NULL){
        
        //パラメータ整理
        $this->init($options);
        
        $result = $this->Form->input($fieldName,$this->options);
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<label class="'.$this->bs_class[$this->bs_type][0].'"  
                    for="'.$fieldName.'" style="margin-top:'.$this->marginTop.'px;margin-left:'
                    .$this->marginLeft.'px;">'.$this->options["label"].'</label>';
        $tag3 = '<div> </div>';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1]
                    .'" style="'.$this->style.'">';
        $tag5 = '</div></div>';
        
        
        return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$result.$tag5);
    
    
    /*****************************************************
    * ラジオボタン用(エラー表示)
    *
    * 【完成イメージ】
    * 
    *    <div class="form-group">
    *        <label class="control-label col-sm-2"  for="UserUsername" 
    *           style="margin-top:20px;">性別</label>
    *        <div style="color:red;"> <i class="fa fa-times">
    *        </i> だめ</div><div class="form-group has-error has-feedback">
    *            <div class="col-sm-10" style="width:400px;">
    *                <div class="form-control form-error" style="background-color:#ffeeff;">
    *                    <input type="radio" name="radio_group">男性
    *                    <input type="radio" name="radio_group">女性
    *                </div>
    *            </div>
    *        </div>
    *    </div>
    *
    *****************************************************/
    }else if(isset($options["type"]) and $options["type"] == "radio" 
        and !empty($options["v_error"])){
        
        //パラメータ整理
        $this->init($options);

        $result = $this->Form->input($fieldName,$this->options);
    
        $tag1 = '<div class="form-group row">';
        $tag2 = '<label class="'.$this->bs_class[$this->bs_type][0].'"  
            for="'.$fieldName.'" style="margin-top:'.$this->marginTop.'px;margin-left:'
            .$this->marginLeft.'px;">'.$this->options["label"].'</label>';
        $tag3 = '<div style="color:red;"> <i class="fa fa-times">
                    </i> '.$this->v_error.'</div>
                    <div class="form-group has-error has-feedback">';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
        if($options["div"]){
            $tag5 = '<div class="form-control form-error" 
            style="background-color:#ffeeff;">';
        }else{
            $tag5 = '<div class="form-control form-error" 
            style="background-color:#ffeeff;height:100%;">';
        }
        $tag6 = '';
        $tag7 = '</div></div></div></div>';
        
        return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$tag5.$result.$tag6.$tag7);
    
    
    /***************************************************
    * チェックボックス用
    * 
    * 必須パラメータ
    *   [multiple] => checkbox
    *   [label]
    *   [style]   => 項目フィールドの width 等定義
    *   [bs_type] => 同クラスの変数定義参照
    *   [options] => チェックボックスの配列
    *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
    *   [div]     => false 横レイアウト ※縦レイアウトにする場合は "div"=>true
    *
    * 任意パラメータ
    *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
    *
    * 【完成イメージ】
    * 
    *    <div class="form-group row">
    *        <label class="control-label col-sm-2"  for="UserUsername"">趣味</label>
    *        <div class="col-sm-10" style="width:400px;">
    *            <input type="hidden" name="data[User][syumi]" value="" id="UserSyumi"/>
    *            <input type="checkbox" name="data[User][syumi][]" value="1" id="UserSyumi1" />
    *               <label for="UserSyumi1">あああ</label> 
    *            <input type="checkbox" name="data[User][syumi][]" value="2" id="UserSyumi2" />
    *               <label for="UserSyumi2">いいい</label> 
    *            <input type="checkbox" name="data[User][syumi][]" value="3" id="UserSyumi3" />
    *               <label for="UserSyumi3">ううう</label> 
    *        </div>
    *    </div>
    *
    * 例)
    * $this->BootstrapCss->input('syumi',array("multiple"=>"checkbox","label"=>"趣味"
    *    ,"style"=>"width:400px;","bs_type"=>"col1","div"=>false,
    *    "v_error"=>@$this->Form->validationErrors["User"]["syumi"][0]
    *    ,"options"=>array("1"=>"a","2"=>"b","3"=>"c")));
    *****************************************************/
    }else if(!isset($options["type"]) and $options["multiple"]=="checkbox" 
        and $options["v_error"] == NULL){
        //パラメータ整理
        $this->init($options);
        
        //[label]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        //[label]タグ修正
        $results[0] = str_replace('<label','<label style="margin-top:'.$this->
            marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
            bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
        $results[0] = str_replace('<div class="input select">','',$results[0]);
        
        $join = "";
        if($this->options["div"] == false){
            //横レイアウト
            for($i=1;$i<count($results);$i++){
                $results[$i] = str_replace('<div class="checkbox">','',$results[$i]);
                $results[$i] = str_replace('</div>','</label> ',$results[$i]);
                $join .= $results[$i];
            }
            $tag5 = '</div></div>';
        }else{
            //縦レイアウト
            for($i=1;$i<count($results)-1;$i++){
                $results[$i] = str_replace('div class="checkbox"','div',$results[$i]);
                $results[$i] = str_replace('</div>','</label></div>',$results[$i]);
                $join .= $results[$i];
            }
            $tag5 = '</label></div></div></div></div>';
        }
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div> </div>';
        $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1]
                    .'" style="'.$this->style.'">';
                        
        
        return $this->heightDivCreate($tag1.$results[0].$tag2.$tag3.$join.$tag5);
    
    
    /*******************************************************
    * チェックボックス用(エラー用)
    *
    * 【完成イメージ】
    * 
    *    <div class="form-group row">
    *        <label class="control-label col-sm-2"  for="UserUsername"">趣味</label>
    *        <div class="col-sm-10" style="width:400px;">
    *            <input type="hidden" name="data[User][syumi]" value="" id="UserSyumi"/>
    *            <input type="checkbox" name="data[User][syumi][]" value="1" id="UserSyumi1" />
    *               <label for="UserSyumi1">あああ</label> 
    *            <input type="checkbox" name="data[User][syumi][]" value="2" id="UserSyumi2" />
    *               <label for="UserSyumi2">いいい</label> 
    *            <input type="checkbox" name="data[User][syumi][]" value="3" id="UserSyumi3" />
    *               <label for="UserSyumi3">ううう</label> 
    *        </div>
    *    </div>
    ********************************************************/
    }else if(!isset($options["type"]) and $options["multiple"]=="checkbox" 
        and !empty($options["v_error"])){
        //パラメータ整理
        $this->init($options);
        
        //[label]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        //[label]タグ修正
        $results[0] = str_replace('<label','<label style="margin-top:'.$this->
            marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
            bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
        $results[0] = str_replace('<div class="input select">','',$results[0]);
        
        $join = "";
        if($this->options["div"] == false){
            //横レイアウト
            for($i=1;$i<count($results);$i++){
                $results[$i] = str_replace('<div class="checkbox 
                    form-error">','',$results[$i]);
                $results[$i] = str_replace('</div>','</label> ',$results[$i]);
                $join .= $results[$i];
            }
            $tag6 = '</div></div>';
        }else{
            //縦レイアウト
            for($i=1;$i<count($results)-1;$i++){
                $results[$i] = str_replace('div class="checkbox 
                    form-error"','div',$results[$i]);
                $results[$i] = str_replace('</div>','</label>
                    </div>',$results[$i]);
                $join .= $results[$i];
            }
            $tag6 = '</label></div></div></div></div>';
        }
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div style="color:red;"> <i class="fa fa-times">
                    </i> '.$this->v_error.'</div>
                    <div class="form-group has-error has-feedback">';
        $tag3 = '<div class="form-control form-error" 
                    style="background-color:#ffeeff;height:100%;">';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
        $tag5 = '';
        $tag7 = '</div></div>';
        
                        
        
        return $this->heightDivCreate($tag1.$results[0]
                    .$tag2.$tag4.$tag3.$tag5.$join.$tag6.$tag7);
    
    
    /*****************************************************
    * セレクトボックス用
    * 
    * 必須パラメータ
    *   [type]    => select
    *   [label]
    *   [style]   => 項目フィールドの width 等定義
    *   [bs_type] => 同クラスの変数定義参照
    *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
    * 
    * 任意パラメータ
    *   [height] => **px  エレメント全体を DIV で囲い height 属性を付加する
    *
    * 【完成イメージ】
    *    <div class="form-group row">
    *        <div class="input select">
    *            <label class="control-label col-sm-2" for="UserSyokugyo">職業</label>
    *            <div class="col-sm-10" style="width:400px;">
    *                <select class="form-control" name="data[User][syokugyo]" 
    *                   id="UserSyokugyo">
    *                    <option value=""></option>
    *                    <option value="2">会社員</option>
    *                    <option value="3">自営業</option>
    *                    <option value="1">その他</option>
    *                </select>
    *            </div>
    *        </div>
    *    </div>
    *
    * 例)
    * $this->BootstrapCss->input("syokugyo",array(
    *       "empty"=>"","type"=>"select","label"=>"職業","style"=>"width:400px;"
    *       ,"bs_type"=>"col1", "v_error"=>@$this->Form->
    *       validationErrors["User"]["syokugyo"][0]
    *       ,"options"=>array("2"=>"会社員","3"=>"自営業","1"=>"その他")));
    *******************************************************/
    }else if(isset($options["type"]) and $options["type"] == "select" 
        and $options["v_error"] == NULL){
        //パラメータ整理
        $this->init($options);
        
        //[label]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        
        //[label]タグ修正
        $results[0] = str_replace('<label','<label style="margin-top:'.$this->
            marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
            bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
        $results[1] = str_replace('<select','<select class="form-control"',$results[1]);

        $tag1 = '<div class="form-group row">';
        $tag2 = '<div> </div>';
        $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1]
            .'" style="'.$this->style.'">';
        $tag4 = '</div></div>';

        return $this->heightDivCreate($tag1.$results[0].$tag2.$tag3.$results[1].$tag4);
        

    
    /*********************************************************
    * セレクトボックス用(エラー)
    *
    * 【完成イメージ】
    *    <div class="form-group row">
    *        <div class="input select required">
    *            <label style="margin-top:20px;" 
    *               class="control-label col-sm-2" for="UserSyokugyo">職業</label>
    *            <div style="color:red;"> <i class="fa fa-times"></i> ふ~選択して</div>
    *            <div class="form-group has-error has-feedback">
    *                <div class="col-sm-10" style="width:400px;">
    *                    <select style="background-color:#ffeeff;" 
    *                       class="form-control form-error" name="data[User][syokugyo]" 
    *                       class="form-error" id="UserSyokugyo" required="required">
    *                        <option value=""></option>
    *                        <option value="2">会社員</option>
    *                        <option value="3">自営業</option>
    *                        <option value="1">その他</option>
    *                    </select>
    *                </div>
    *            </div>
    *        </div>
    *    </div>
    *********************************************************/
    }else if(isset($options["type"]) and $options["type"] == "select" 
        and !empty($options["v_error"])){
        //パラメータ整理
        $this->init($options);
        
        //[label]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
    
        //[label]タグ修正
        $results[0] = str_replace('<label','<label style="margin-top:'.$this->
            marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
            bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
        $results[1] = str_replace('<select','<select style="background-color:#ffeeff;" 
            class="form-control form-error"',$results[1]);
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div style="color:red;"> <i class="fa fa-times">
                    </i> '.$this->v_error.'</div>';
        $tag3 = '<div class="form-group has-error has-feedback">';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
        $tag5 = '';
        $tag6 = '</div></div></div>';
        
        return $this->heightDivCreate($tag1.$results[0]
                .$tag2.$tag3.$tag4.$tag5.$results[1].$tag6);

    
    
    /*****************************************************
    * ファイル選択用
    * 
    * 必須パラメータ
    *   [type]    => file
    *   [label]
    *   [style]   => 項目フィールドの width 等定義
    *   [bs_type] => 同クラスの変数定義参照
    *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
    * 
    * 任意パラメータ
    *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
    *
    * 【完成イメージ】
    *    <div style="height:70px;">
    *        <div class="form-group row">
    *            <div class="form-control-file">
    *                <label style="margin-top:20px;" class="control-label 
    *                   col-sm-2" for="UserFilename">ファイル名</label>
    *                <div> </div>
    *                <div class="col-sm-10" style="width:400px;">
    *                    <input class="form-control" type="file" 
    *                       name="data[User][filename]" class="form-control" 
    *                       id="UserFilename" required="required"/>
    *                </div>
    *            </div>
    *        </div>
    *    </div>
    *
    * 例)
    * $this->BootstrapCss->input("filename",array("type"=>"file"
    *       ,"label"=>"ファイル名","style"=>"width:400px;","height"=>"70px",
    *       "bs_type"=>"col1","class"=>"form-control","v_error"=>@$this->
    *       Form->validationErrors["User"]["filename"][0]));
    *****************************************************/
    }else if(isset($options["type"]) and $options["type"] == "file" 
        and $options["v_error"] == NULL){
        //パラメータ整理
        $this->init($options);
        
        //[label]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        //[label]タグ修正
        $results[0] = str_replace('input file required','form-control-file',$results[0]);
        $results[0] = str_replace('<label','<label style="margin-top:'.$this->
            marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
            bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
        $results[1] = str_replace('<input','<input class="form-control"',$results[1]);
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div> </div><div class="form-group has-feedback">';
        $tag3 = '<div class="'.$this->bs_class[$this->bs_type][1].'" style="'.$this->style.'">';
        $tag4 = '</div></div></div>';
        
        return $this->heightDivCreate($tag1.$results[0]
                    .$tag2.$tag3.$results[1].$tag4);
    
    
    /*******************************************************
    * ファイル選択用(エラー)
    *
    * 【完成イメージ】
    *    <div style="height:70px;">
    *        <div class="form-group row">
    *            <div class="form-control-file">
    *                <label style="margin-top:20px;" class="control-label col-sm-2 
    *                   for="UserFilename">ファイル名</label>
    *                <div style="color:red;"> <i class="fa fa-times"></i> 何か書いて。</div>
    *                <div class="form-group has-error has-feedback">
    *                    <div class="col-sm-10" style="width:400px;">
    *                        <input style="background-color:#ffeeff;" 
    *                           class="form-control form-error" type="file" 
    *                           name="data[User][filename]" 
    *                           class="form-control form-error" id="UserFilename" 
    *                           required="required"/>
    *                    </div>
    *                </div>
    *            </div>
    *        </div>
    *    </div>
    ********************************************************/
    }else if(isset($options["type"]) and $options["type"] == "file" 
        and !empty($options["v_error"]) and mb_substr($options["v_error"],0,7) != "OKFILE."){
        //パラメータ整理
        $this->init($options);
        
        //[label]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        
        //[label]タグ修正
        $results[0] = str_replace('input file required','form-control-file',$results[0]);
        $results[0] = str_replace('<label','<label style="margin-top:'.$this->
            marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
            bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
        $results[1] = str_replace(
                '<input','<input style="background-color:#ffeeff;" 
                class="form-control form-error"',$results[1]);
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div style="color:red;"> <i class="fa fa-times">
                    </i> '.$this->v_error.'</div>';
        $tag3 = '<div class="form-group has-error has-feedback">';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
        $tag5 = '';
        $tag6 = '</div></div></div>';
        
        return $this->heightDivCreate($tag1.$results[0]
                .$tag2.$tag3.$tag4.$tag5.$results[1].$tag6);
    
    
    /****************************************************
    * ファイル選択用(OK用)
    *
    * 【完成イメージ】
    *    <div style="height:70px;">
    *        <div class="form-group row">
    *            <div class="form-control-file">
    *                <label style="margin-top:20px;" 
    *                   class="control-label col-sm-2 for="UserFilename">ファイル名</label>
    *                <div style="color:green;"> 何か書いて。。。</div>
    *                <div class="form-group has-success has-feedback">
    *                    <div class="col-sm-10" style="width:400px;">
    *                        <input style="background-color:#ffeeff;color:#ccff99;" 
    *                           class="form-control form-error" 
    *                           type="file" name="data[User][filename]" 
    *                           class="form-control form-error" id="UserFilename" 
    *                           required="required"/>
    *                    </div>
    *                </div>
    *            </div>
    *        </div>
    *    </div>
    ******************************************************/
    }else if(isset($options["type"]) and $options["type"] == "file" 
        and !empty($options["v_error"]) and mb_substr($options["v_error"],0,7) == "OKFILE."){
        //パラメータ整理
        $options["v_error"] = mb_substr($options["v_error"],7);
        $this->init($options);
        
        //[label]タグを分ける
        $results = explode("</label>",$this->Form->input($fieldName,$this->options));
        
        //[label]タグ修正
        $results[0] = str_replace('input file required','form-control-file',$results[0]);
        $results[0] = str_replace('<label','<label style="margin-top:'.$this->
            marginTop.'px;margin-left:'.$this->marginLeft.'px;" class="'.$this->
            bs_class[$this->bs_type][0].'" ',$results[0]).'</label>';
        $results[1] = str_replace('<input','<input 
            style="background-color:#ccff99;color:#ccff99;" 
            class="form-control form-error"',$results[1]);
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<div style="color:green;"> <i class="fa 
                    fa-check"></i> '.$this->v_error.'</div>';
        $tag3 = '<div class="form-group has-success has-feedback">';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
        $tag5 = '';
        $tag6 = '</div></div></div>';
        
        return $this->heightDivCreate($tag1.$results[0]
            .$tag2.$tag3.$tag4.$tag5.$results[1].$tag6);
    }
}


    ### textarea メソッド オーバーライド ###

public function textarea($fieldName, $options = array()){

    /************************************************
    * テキストエリア用
    * 
    * 必須パラメータ
    *   [label]
    *   [style]   => 項目フィールドの width 等定義
    *   [bs_type] => 同クラスの変数定義参照
    *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
    *   [cols]
    *   [rows]
    * 
    * 任意パラメータ
    *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
    *
    * 【完成イメージ】
    *    <div class="form-group row">
    *        <label class="control-label col-sm-2"  for="UserUsername" 
    *           style="margin-top:20px;">テキストエリア</label>
    *            <div class="col-sm-10" style="width:400px;">
    *                <textarea name="data[User][message]" class="form-control" 
    *                   placeholder="textarea..." cols="40" rows="5" label="" 
    *                   id="UserMessage"></textarea>
    *            </div>
    *        </div>
    *    </div>
    *
    * 例)
    * $this->BootstrapCss->textarea("message",array("cols"=>"40" 
    *       ,"rows"=>"5","label"=>"メッセージ","style"=>"width:400px;",
    *       "bs_type"=>"col1","v_error"=>@$this->
    *       Form->validationErrors["User"]["message"][0],"placeholder"=>"message..."));
    ************************************************/
    if($options["v_error"] == NULL){
        
        //パラメータ整理
        $this->init($options);
        
        $result = $this->Form->textarea($fieldName,$this->options);
        $result = str_replace('<textarea','<textarea class="form-control"',$result);

        $tag1 = '<div class="form-group row">';
        $tag2 = '<label class="'.$this->bs_class[$this->bs_type][0].'"  
                    for="UserUsername" style="margin-top:'.$this->
                    marginTop.'px;margin-left:'
                    .$this->marginLeft.'px;">'.$this->options["label"].'</label>';
        $tag3 = '<div> </div>';
        $tag4 = '<div class="'.$this->bs_class[$this->bs_type][1].'" 
                    style="'.$this->style.'">';
        $tag5 = '</div></div>';
        
        return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$result.$tag5);
    
    
    /***********************************************
    * テキストエリア用(エラー用)
    * 
    * 必須パラメータ
    *   [label]
    *   [style]   => 項目フィールドの width 等定義
    *   [bs_type] => 同クラスの変数定義参照
    *   [v_error] => @$this->Form->validationErrors["モデル名"]["カラム名"][0]
    *   [cols]
    *   [rows]
    * 
    * 任意パラメータ
    *   [height]  => **px  エレメント全体を DIV で囲い height 属性を付加する
    *
    * 【完成イメージ】
    *    <div class="form-group row">
    *        <label class="control-label col-sm-2"  for="UserUsername">メッセージ</label>
    *        <div style="color:red;"> 何か書いて。。。</div>
    *        <div class="form-group has-error has-feedback">
    *            <div class="col-sm-10" style="width:400px;">
    *                <span class="glyphicon glyphicon-remove 
    *                   form-control-feedback"></span>
    *                <textarea class="form-control form-error" 
    *                   style="background-color:#ffeeff;" 
    *                   name="data[User][message]" cols="40" 
    *                   rows="5" label="メッセージ" 
    *                   placeholder="message..." id="UserMessage" 
    *                   class="form-error" required="required"></textarea>
    *            </div>
    *        </div>
    *    </div>
    ***********************************************/
    }else if(!empty($options["v_error"])){
        
        //パラメータ整理
        $this->init($options);
        
        $result = $this->Form->textarea($fieldName,$this->options);
        $result = str_replace('<textarea','<textarea class="form-control 
            form-error" style="background-color:#ffeeff;"',$result);
        
        $tag1 = '<div class="form-group row">';
        $tag2 = '<label class="'.$this->bs_class[$this->bs_type][0].'"  
            for="UserUsername" style="margin-top:'.$this->marginTop.'px;margin-left:'
            .$this->marginLeft.'px;">'.$this->options["label"].'</label>';
        $tag3 = '<div style="color:red;"> <i class="fa fa-times"></i> '
            .$this->v_error.'</div>';
        $tag4 = '<div class="form-group has-error has-feedback">';
        $tag5 = '<div class="'.$this->bs_class[$this->bs_type][1].'" style="'
            .$this->style.'">';
        $tag6 = '';
        $tag7 = '</div></div></div>';
        
        return $this->heightDivCreate($tag1.$tag2.$tag3.$tag4.$tag5.$tag6.$result.$tag7);
    }
    }


/*************************************************
* ボタン用メソッド
**************************************************/

    ### button メソッド オーバーライド ###

    /********************************************
    * ボタン出力
    *
    * 必須パラメータ(第2引数は、空で良い)
    *
    * 第1引数       ボタン名
    * 第2引数       配列([type]を省略すると submit となる)
    *               [bs_type]                  => 同クラスの変数定義参照
    *
    * 第3引数       配列 Bootstrap Class 名 [0]=>[btn btn-success]等、[1]=>[fa fa-floppy-o]等
    *
    * 任意パラメータ
    *
    * 第2引数       [div]=>false            ボタンのデザインのみ(ボタンを横に並べられる)
    *               [separator]=>**         エレメントの最後に付与する
    *
    *【完成イメージ】
    *    <div class="form-group row">
    *        <div class="control-label col-sm-2" style="margin-left:0px;">
    *            <button class="btn btn-success" bs_type="col1" type="submit">
    *                <span class="glyphicon glyphicon-ok-circle"></span> 確認
    *            </button>
    *        </div>
    *    </div>
    * 例)
    *   $this->BootstrapCss->button("確認",array("bs_type"=>"col1")
    *       ,array("btn btn-success","fa fa-check-square-o"));
    *   $this->BootstrapCss->button("確認",array(
    *   "bs_type"=>"col1","div"=>false,"separator"=>" ")
    *   ,array("btn btn-success","fa fa-floppy-o"));
    ********************************************/
    
    public function button($fieldName,$options = array(),$params = array()){
        
        //パラメータ整理
        $this->init($options);
        if(isset($options["separator"])){
            $separator = $options["separator"];
            unset($options["separator"]);
        }else{$separator = "";}
        
        $result = $this->Form->button($fieldName,$this->options);
        
        $result = str_replace('<button','<button class="'.$params[0].'"',$result);
        $result = str_replace($fieldName,'<span class="'.$params[1].'">
                    </span> '.$fieldName,$result);

        if(isset($options["div"]) and $options["div"] == false){
            return $this->heightDivCreate($result.$separator);
        }else{

            $tag1 = '<div class="form-group row">';
            $tag2 = '<div class="'.$this->bs_class[$this->bs_type][0].'" 
                        style="margin-left:'.$this->marginLeft.'px;">';
            $tag3 = '</div></div>';
            
            return $this->heightDivCreate($tag1.$tag2.$result.$tag3.$separator);
        }
    }

    

/*******************************************
* リンク用メソッド
********************************************/

    ### link メソッド オーバーライド ###

    /**************************************
    * リンク出力
    *
    *【お作法】
    *   リンク文字をなくして、マークだけにするには、リンク名を『_』とする
    *
    * 必須パラメータ(第2引数は、空で良い)
    *
    * 第3引数       [class]     <a> 内の class      『btn btn-success』等
    *               [img]       <span> 内の class   『glyphicon glyphicon-pencil』等
    *
    *
    *【完成イメージ】
    *    <a href="/cake2612/admin/users/insert" class="btn btn-success">
    *       <span class="glyphicon glyphicon-pencil"></span> アカウント新規登録</a>
    * 例)
    *   $this->BootstrapCss->link("アカウント新規登録",array(
    *       "controller"=>"users","action"=>"insert","profiles"=>true),
    *       array("class"=>"btn btn-success","img"=>"fa fa-floppy-o"));
    **************************************/
    function link($linkName = null,$options = array(),$params = array()){

        $tag = '<span class="'.$params["img"].'"></span>';
        unset($params["img"]);
        
        $result = $this->Html->link($linkName,$options,$params);
        if($linkName == "_"){
            $result = str_replace($linkName,$tag,$result);
        }else{
            $result = str_replace($linkName,$tag.' '.$linkName,$result);
        }
        
        return $result;
    }

/******************************************
* ページング用メソッド
*******************************************/


    ### prev メソッド オーバーライド ###

    /************************************
    * prev 用リンク出力
    *
    * 【お作法】
    *   本ヘルパーは、[prev][next]をセットで出力する必要がある。(<ul>の関係で。。。)
    
    * 必須パラメータ
    *
    * 第3引数       配列 [width]=>**px
    *
    *【完成イメージ】
    *    <ul class="pager" style="width:**px;">
    *        <li class="previous">
    *            <a href="***" rel="prev"><< </a>
    *        </li>
    * 例)
    *   $this->BootstrapCss->prev('<< ',array("url"=>array(
    *       "controller"=>"users","action"=>"index")),array("width"=>"500px"));
    *************************************/
    
    function prev($mark = null,$options = array(),$params = array()){
        
        $options["class"]=false;
        $result = $this->Paginator->prev($mark,$options);
        
        if(strpos($result,'</a>')){
            $result = str_replace('<span>','',$result);
            $result = str_replace('</span>','',$result);
            
            $tag2 = '<li class="previous">';
        
        }else{
            $result = str_replace('<span>','<a href="#">',$result);
            $result = str_replace('</span>','</a>',$result);
            
            $tag2 = '<li class="previous disabled">';
        }
        
        $tag1 = '<ul class="pager" style="width:'.$params["width"].';">';
        
        $tag3 = '</li>';
        
        return $tag1.$tag2.$result.$tag3;
    }




    ### next メソッド オーバーライド ###

    /********************************************
    * next 用リンク出力
    *
    * 【お作法】
    *   本ヘルパーは、[prev][next]をセットで出力する必要がある。(<ul>の関係で。。。)
    
    * 必須パラメータ        特になし(通常の書式。。。)
    *
    *【完成イメージ】
    *        <li class="next">
    *            <a href="***" rel="next"> >></a>
    *        </li>
    *    </ul>
    * 例)
    *   $this->BootstrapCss->next(' >>',array(
    *       "url"=>array("controller"=>"users","action"=>"index")));
    *********************************************/
    function next($mark = null,$options = array()){
    
        $options["class"]=false;
        $result = $this->Paginator->next($mark,$options);
        
        if(strpos($result,'</a>')){
            $result = str_replace('<span>','',$result);
            $result = str_replace('</span>','',$result);
            
            $tag1 = '<li class="next">';
        }else{
        
            $result = str_replace('<span>','<a href="#">',$result);
            $result = str_replace('</span>','</a>',$result);
            
            $tag1 = '<li class="next disabled">';
        }
        
        $tag2 = '</li>';
        $tag3 = '</ul>';
        
        return $tag1.$result.$tag2.$tag3;
    }



    ### numbers メソッド オーバーライド ###

    /****************************************
    * numbers 用リンク出力
    *
    * 【お作法】
    *   
    
    * 必須パラメータ
    *   [separator]         半角の空白は禁止。(『 』で記述する)
    *
    *【完成イメージ】
    *    <li>
    *        <a href="***">5</a>
    *    </li>
    * 例)
    *   $this->BootstrapCss->numbers(array("modulus"=>5,"separator"=>""));
    ****************************************/
    function numbers($options = array()){
    
        $options["class"]=false;
        $results = explode('</span>',$this->Paginator->numbers($options));
        
        for($i=0;$i<count($results);$i++){
            $results[$i] = str_replace('<span>','',$results[$i]);
            
            if(strpos($results[$i],'span class')){
                $results[$i] = str_replace('<span class="current">','',$results[$i]);
                $results[$i] = str_replace($options["separator"],'',$results[$i]);
                $results[$i] = '<a href="#">'.$results[$i].'</a>';
            
                $results[$i] = '<li class="disabled">'.
                    $options["separator"].$results[$i].'</li>';
            }else{
                $results[$i] = '<li>'.$results[$i].'</li>';
            }
        }
        $join = implode("",$results);
        
        return $join;
    }
}
?>
            
レンズモード 【新規購入限定用】
ログインしてコメントを残そう!!


きっぷる