[ Index ]

PHP Cross Reference of Joomla 1.5.25

title

Body

[close]

/administrator/components/com_content/views/element/ -> view.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: view.php 17299 2010-05-27 16:06:54Z ian $
   4   * @package        Joomla
   5   * @subpackage    Content
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant to the
   9   * GNU General Public License, and as distributed it includes or is derivative
  10   * of works licensed under the GNU General Public License or other free or open
  11   * source software licenses. See COPYRIGHT.php for copyright notices and
  12   * details.
  13   */
  14  
  15  // no direct access
  16  defined('_JEXEC') or die('Restricted access');
  17  
  18  jimport('joomla.application.component.view');
  19  
  20  /**
  21   * HTML Article Element View class for the Content component
  22   *
  23   * @package        Joomla
  24   * @subpackage    Content
  25   * @since 1.5
  26   */
  27  class ContentViewElement extends JView
  28  {
  29  	function display()
  30      {
  31          global $mainframe;
  32  
  33          // Initialize variables
  34          $db            = &JFactory::getDBO();
  35          $nullDate    = $db->getNullDate();
  36  
  37          $document    = & JFactory::getDocument();
  38          $document->setTitle(JText::_('Article Selection'));
  39  
  40          JHTML::_('behavior.modal');
  41  
  42          $template = $mainframe->getTemplate();
  43          $document->addStyleSheet("templates/$template/css/general.css");
  44  
  45          $limitstart = JRequest::getVar('limitstart', '0', '', 'int');
  46  
  47          $lists = $this->_getLists();
  48  
  49          //Ordering allowed ?
  50          $ordering = ($lists['order'] == 'section_name' && $lists['order_Dir'] == 'ASC');
  51  
  52          $rows = &$this->get('List');
  53          $page = &$this->get('Pagination');
  54          JHTML::_('behavior.tooltip');
  55          ?>
  56          <form action="index.php?option=com_content&amp;task=element&amp;tmpl=component&amp;object=id" method="post" name="adminForm">
  57  
  58              <table>
  59                  <tr>
  60                      <td width="100%">
  61                          <?php echo JText::_( 'Filter' ); ?>:
  62                          <input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
  63                          <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
  64                          <button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
  65                      </td>
  66                      <td nowrap="nowrap">
  67                          <?php
  68                          echo $lists['sectionid'];
  69                          echo $lists['catid'];
  70                          ?>
  71                      </td>
  72                  </tr>
  73              </table>
  74  
  75              <table class="adminlist" cellspacing="1">
  76              <thead>
  77                  <tr>
  78                      <th width="5">
  79                          <?php echo JText::_( 'Num' ); ?>
  80                      </th>
  81                      <th class="title">
  82                          <?php echo JHTML::_('grid.sort',   'Title', 'c.title', @$lists['order_Dir'], @$lists['order'] ); ?>
  83                      </th>
  84                      <th width="7%">
  85                          <?php echo JHTML::_('grid.sort',   'Access', 'groupname', @$lists['order_Dir'], @$lists['order'] ); ?>
  86                      </th>
  87                      <th width="2%" class="title">
  88                          <?php echo JHTML::_('grid.sort',   'ID', 'c.id', @$lists['order_Dir'], @$lists['order'] ); ?>
  89                      </th>
  90                      <th class="title" width="15%" nowrap="nowrap">
  91                          <?php echo JHTML::_('grid.sort',   'Section', 'section_name', @$lists['order_Dir'], @$lists['order'] ); ?>
  92                      </th>
  93                      <th  class="title" width="15%" nowrap="nowrap">
  94                          <?php echo JHTML::_('grid.sort',   'Category', 'cc.title', @$lists['order_Dir'], @$lists['order'] ); ?>
  95                      </th>
  96                      <th align="center" width="10">
  97                          <?php echo JHTML::_('grid.sort',   'Date', 'c.created', @$lists['order_Dir'], @$lists['order'] ); ?>
  98                      </th>
  99                  </tr>
 100              </thead>
 101              <tfoot>
 102              <tr>
 103                  <td colspan="15">
 104                      <?php echo $page->getListFooter(); ?>
 105                  </td>
 106              </tr>
 107              </tfoot>
 108              <tbody>
 109              <?php
 110              $k = 0;
 111              for ($i=0, $n=count( $rows ); $i < $n; $i++)
 112              {
 113                  $row = &$rows[$i];
 114  
 115                  $link     = '';
 116                  $date    = JHTML::_('date',  $row->created, JText::_('DATE_FORMAT_LC4') );
 117                  $access    = JHTML::_('grid.access',   $row, $i, $row->state );
 118                  ?>
 119                  <tr class="<?php echo "row$k"; ?>">
 120                      <td>
 121                          <?php echo $page->getRowOffset( $i ); ?>
 122                      </td>
 123                      <td>
 124                          <a style="cursor: pointer;" onclick="window.parent.jSelectArticle('<?php echo $row->id; ?>', '<?php echo str_replace(array("'", "\""), array("\\'", ""),$row->title); ?>', '<?php echo JRequest::getVar('object'); ?>');">
 125                              <?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?></a>
 126                      </td>
 127                      <td align="center">
 128                          <?php echo $row->groupname;?>
 129                      </td>
 130                      <td>
 131                          <?php echo $row->id; ?>
 132                      </td>
 133                          <td>
 134                              <?php echo $row->section_name; ?>
 135                          </td>
 136                      <td>
 137                          <?php echo $row->cctitle; ?>
 138                      </td>
 139                      <td nowrap="nowrap">
 140                          <?php echo $date; ?>
 141                      </td>
 142                  </tr>
 143                  <?php
 144                  $k = 1 - $k;
 145              }
 146              ?>
 147              </tbody>
 148              </table>
 149  
 150          <input type="hidden" name="boxchecked" value="0" />
 151          <input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
 152          <input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" />
 153          </form>
 154          <?php
 155      }
 156  
 157  	function _getLists()
 158      {
 159          global $mainframe;
 160  
 161          // Initialize variables
 162          $db        = &JFactory::getDBO();
 163  
 164          // Get some variables from the request
 165          $sectionid            = JRequest::getVar( 'sectionid', -1, '', 'int' );
 166          $redirect            = $sectionid;
 167          $option                = JRequest::getCmd( 'option' );
 168          $filter_order        = $mainframe->getUserStateFromRequest('articleelement.filter_order',        'filter_order',        '',    'cmd');
 169          $filter_order_Dir    = $mainframe->getUserStateFromRequest('articleelement.filter_order_Dir',    'filter_order_Dir',    '',    'word');
 170          $filter_state        = $mainframe->getUserStateFromRequest('articleelement.filter_state',        'filter_state',        '',    'word');
 171          $catid                = $mainframe->getUserStateFromRequest('articleelement.catid',                'catid',            0,    'int');
 172          $filter_authorid    = $mainframe->getUserStateFromRequest('articleelement.filter_authorid',        'filter_authorid',    0,    'int');
 173          $filter_sectionid    = $mainframe->getUserStateFromRequest('articleelement.filter_sectionid',    'filter_sectionid',    -1,    'int');
 174          $limit                = $mainframe->getUserStateFromRequest('global.list.limit',                    'limit', $mainframe->getCfg('list_limit'), 'int');
 175          $limitstart            = $mainframe->getUserStateFromRequest('articleelement.limitstart',            'limitstart',        0,    'int');
 176          $search                = $mainframe->getUserStateFromRequest('articleelement.search',                'search',            '',    'string');
 177          if (strpos($search, '"') !== false) {
 178              $search = str_replace(array('=', '<'), '', $search);
 179          }
 180          $search = JString::strtolower($search);
 181  
 182          // get list of categories for dropdown filter
 183          $filter = ($filter_sectionid >= 0) ? ' WHERE cc.section = '.$db->Quote($filter_sectionid) : '';
 184  
 185          // get list of categories for dropdown filter
 186          $query = 'SELECT cc.id AS value, cc.title AS text, section' .
 187                  ' FROM #__categories AS cc' .
 188                  ' INNER JOIN #__sections AS s ON s.id = cc.section' .
 189                  $filter .
 190                  ' ORDER BY s.ordering, cc.ordering';
 191  
 192          $lists['catid'] = ContentHelper::filterCategory($query, $catid);
 193  
 194          // get list of sections for dropdown filter
 195          $javascript = 'onchange="document.adminForm.submit();"';
 196          $lists['sectionid'] = JHTML::_('list.section', 'filter_sectionid', $filter_sectionid, $javascript);
 197  
 198          // table ordering
 199          $lists['order_Dir']    = $filter_order_Dir;
 200          $lists['order']        = $filter_order;
 201  
 202          // search filter
 203          $lists['search'] = $search;
 204  
 205          return $lists;
 206      }
 207  }


Generated: Mon Nov 14 16:47:20 2011 Cross-referenced by PHPXref 0.7.1