Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/vendors/Textpattern/Admin/Table.php - 112 lines - 3110 bytes - Summary - Text - Print

Description: List tables.

   1  <?php
   2  
   3  /*
   4   * Textpattern Content Management System
   5   * https://textpattern.com/
   6   *
   7   * Copyright (C) 2020 The Textpattern Development Team
   8   *
   9   * This file is part of Textpattern.
  10   *
  11   * Textpattern is free software; you can redistribute it and/or
  12   * modify it under the terms of the GNU General Public License
  13   * as published by the Free Software Foundation, version 2.
  14   *
  15   * Textpattern is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
  22   */
  23  
  24  /**
  25   * List tables.
  26   *
  27   * @since   4.7.0
  28   * @package Admin\Table
  29   */
  30  
  31  namespace Textpattern\Admin;
  32  
  33  class Table
  34  {
  35      /**
  36       * Textpattern event (panel) to which this table applies.
  37       *
  38       * @var string
  39       */
  40  
  41      protected $event = null;
  42  
  43      /**
  44       * Constructor.
  45       *
  46       * @param string $evt Textpattern event (panel)
  47       */
  48  
  49      public function __construct($evt = null)
  50      {
  51          global $event;
  52  
  53          if ($evt === null) {
  54              $evt = $event;
  55          }
  56  
  57          $this->event = $evt;
  58      }
  59  
  60      /**
  61       * Renders a widget to display lists.
  62       *
  63       * @param  array $data Current search/pagination settings
  64       * @return string      HTML
  65       */
  66  
  67      public function render($data = array(), $search = null, $create = null, $content = null, $footer = null)
  68      {
  69          $event = $this->event;
  70          extract($data + array(
  71              'heading'  => 'tab_'.$event,
  72              'total'    => 0,
  73              'crit'     => '',
  74              'html_id'  => 'txp-list-container',
  75              'help'     => null,
  76          ));
  77  
  78          $out = n.'<div class="txp-layout">'.
  79              n.tag(
  80                  hed(gTxt($heading).($help ? popHelp($help) : ''), 1, array('class' => 'txp-heading')),
  81                  'div', array('class' => 'txp-layout-4col-alt')
  82              ).n.$search;
  83  
  84          $out .= tag_start('div', array(
  85                  'class' => 'txp-layout-1col',
  86                  'id'    => $event.'_container',
  87              )).
  88              n.tag($create, 'div', array('class' => 'txp-layout-cell-row txp-list-head'));
  89  
  90          $out .= n.tag_start('div', array('id' => $html_id, 'class' => $html_id ? 'txp-async-update' : false));
  91  
  92          if ($total >= 1) {
  93              $out .= script_js('$(".txp-search").show()');
  94          } elseif ($crit === '') {
  95              $out .= script_js('$(".txp-search").hide()');
  96          }
  97  
  98          $out .= $content;
  99          $out .= n.tag_start('div', array(
 100                  'class' => 'txp-layout-cell-row txp-navigation',
 101                  'id'    => $event.'_navigation',
 102                  'style' => $total < 1 ? 'display:none' : false,
 103              )).
 104              $footer.
 105              n.tag_end('div').
 106              n.'</div>'. // End of #txp-list-container.
 107              n.'</div>'. // End of .txp-layout-1col.
 108              n.'</div>'; // End of .txp-layout.
 109  
 110          return $out;
 111      }
 112  }

title

Description

title

Description

title

Description

title

title

Body