Plugin Directory

Changeset 1217932


Ignore:
Timestamp:
08/11/2015 07:04:12 AM (11 years ago)
Author:
s-hiroshi
Message:

Refactor controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • min-calendar/trunk/admin/class-admin-controller.php

    r1217917 r1217932  
    55 *
    66 * @property MC_List_Table $list_table
    7  * @property MC_Post_Form $post_form
     7 * @property MC_Post_Form $form
    88 * @property MC_Appearance $appearance
    9  * @property MC_Manage_Form_Action $action
     9 * @property MC_Manage_Form_Action $form_action
    1010 */
    1111class MC_Admin_Controller
    1212{
    13 
     13    /** @var MC_Post_Form */
     14    public $form;
    1415    /** @var MC_Manage_Form_Action */
    15     public $action;
    16     /** @var MC_Post_Form */
    17     public $porst_form;
     16    public $form_action;
    1817    /** @var MC_Appearance */
    1918    public $appearance;
     
    2120    public $list_table;
    2221
    23 
    2422    function __construct()
    2523    {
    26         $this->porst_form = new MC_Post_Form();
    27         $this->action    = new MC_Manage_Form_Action();
    28         $this->appearance = new MC_Appearance();
     24        $this->form        = new MC_Post_Form();
     25        $this->form_action = new MC_Manage_Form_Action();
     26        $this->appearance  = new MC_Appearance();
    2927    }
    3028
     
    3230     * 管理画面作成
    3331     */
    34     public function setup() {
     32    public function setup()
     33    {
    3534        add_action( 'admin_menu', array( &$this, 'admin_menu' ), 9 );
    3635        add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
     
    6160            );
    6261            // MC_Manage_Form_Action->manage_postをコールバックに設定
    63             add_action( 'load-' . $list_page, array( $this->action, 'manage_post' ) );
     62            add_action( 'load-' . $list_page, array( $this->form_action, 'manage_post' ) );
    6463            // 外観ページ(カレンダーオプション)
    6564            add_submenu_page(
     
    8180    public function admin_management_page()
    8281    {
    83         $post_wrapper = $this->action->get_post_wrapper();
     82        $post_wrapper = $this->form_action->get_post_wrapper();
    8483        if ( $post_wrapper ) {
    8584            // 編集画面
    86             echo $this->get_edit_page($post_wrapper);
     85            echo $this->get_edit_page( $post_wrapper );
    8786        } else {
    8887            // 一覧画面
     
    9089        }
    9190    }
    92    
     91
    9392    /**
    9493     * 編集画面マークアップ取得
    95      * 
     94     *
    9695     * @return string マークアップ
    9796     */
    98     public function get_edit_page($post_wrapper) {
    99         $post_form = new MC_Post_Form();
    100         $html      = $post_form->get_form( $post_wrapper );
     97    public function get_edit_page( $post_wrapper )
     98    {
     99        $form = new MC_Post_Form();
     100        $html = $form->get_form( $post_wrapper );
    101101        MC_Custom_Field::set_field( $post_wrapper, $html );
    102102        // get_htmlはエスケープ済みマークアップを返す
     
    106106    /**
    107107     * 一覧画面マークアップ取得
    108      * 
     108     *
    109109     * @return string マークアップ
    110110     */
    111     public function get_list_page() {
     111    public function get_list_page()
     112    {
    112113        $this->list_table = new MC_List_Table();
    113114        $this->list_table->prepare_items();
     
    137138
    138139        $html .= '</form>' . PHP_EOL . '</div>';
    139        
     140
    140141        return $html;
    141142    }
     
    211212    }
    212213
    213 
    214214    /**
    215215     * add_meta_boxのコールバック関数
     
    221221        MC_Custom_Field::set_field( $params[0], $params[1] );
    222222    }
    223 
    224223}
Note: See TracChangeset for help on using the changeset viewer.