## Overview A view controller to allow to manage a standard WordPress view. A standard view is: [ header with icon and title - optional button add] [single or more view] ### Subclassing notes
Author: =undo= (info@wpxtre.me)
Inheritance: extends WPDKObject
    /**
     * Return the HTML markup for list table view.
     *
     * @brief Get the list table view
     *
     * @note  This is a low level method that create the HTML markup for list table view. You'll notice that the display
     *        method above has an input param for echo/display. For now this method html() is here for backward compatibility.
     *
     * @return string
     */
    public function html()
    {
        // Buffering...
        WPDKHTML::startCompress();
        // Fetch, prepare, sort, and filter our data...
        if (!$this->prepare_items()) {
            $this->before_views();
            $this->views();
            ?>

      <form id="<?php 
            echo $this->id;
            ?>
" class="wpdk-list-table-form" method="get" action="">

      <?php 
            $this->search_box_field();
            ?>

      <?php 
            // Standard input hidden
            $input_hidden = array('page', 'post_type', 'orderby', 'order', '_action_result');
            // TODO think to a filter
            foreach ($input_hidden as $name) {
                if (isset($_REQUEST[$name])) {
                    // TODO Warning!
                    $value = is_array($_REQUEST[$name]) ? esc_attr($_REQUEST[$name][0]) : esc_attr($_REQUEST[$name]);
                    ?>
          <input type="hidden" name="<?php 
                    echo $name;
                    ?>
" value="<?php 
                    echo $value;
                    ?>
"/>
        <?php 
                }
            }
            ?>

      <?php 
            $this->before_display();
            // since 1.5.1
            ?>

      <?php 
            parent::display();
            ?>

      <?php 
            $this->after_display();
            // since 1.5.1
            ?>

    </form>
    <?php 
        }
        ?>
    <?php 
        // Get the content
        $this->viewController->viewHead->content = WPDKHTML::endCompress();
        // Fires into the the title TAG.
        add_action('wpdk_header_view_inner_title', array($this, 'wpdk_header_view_inner_title'));
        return $this->viewController->html();
    }
示例#2
0
 /**
  * Create an instane of WPDKjQueryTabsViewController class
  *
  * @brief Construct
  *
  * @param string             $id         A lowercase id used in HTML markup
  * @param string             $title      The view controller title
  * @param WPDKjQueryTabsView $view       An instance of WPDKjQueryTabView class
  *
  * @return WPDKjQueryTabsViewController
  */
 public function __construct($id, $title, $view)
 {
     parent::__construct($id, $title);
     $this->view->addSubview($view);
 }