[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_frontpage/views/ -> frontpage.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: frontpage.php 19343 2010-11-03 18:12:02Z 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
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  /**
  19  * @package        Joomla
  20  * @subpackage    Content
  21  */
  22  class FrontpageView
  23  {
  24      /**
  25      * Writes a list of the articles
  26      * @param array An array of content objects
  27      */
  28  	function showList( &$rows, $page, $option, $lists )
  29      {
  30          $limitstart = JRequest::getVar('limitstart', '0', '', 'int');
  31  
  32          $user         =& JFactory::getUser();
  33          $db         =& JFactory::getDBO();
  34          $nullDate     = $db->getNullDate();
  35          $config        =& JFactory::getConfig();
  36          $now        =& JFactory::getDate();
  37  
  38          //Ordering allowed ?
  39          $ordering = (($lists['order'] == 'fpordering'));
  40  
  41          JHTML::_('behavior.tooltip');
  42          ?>
  43          <form action="index.php?option=com_frontpage" method="post" name="adminForm">
  44  
  45              <table>
  46                  <tr>
  47                      <td width="100%" class="filter">
  48                          <?php echo JText::_( 'Filter' ); ?>:
  49                          <input type="text" name="search" id="search" value="<?php echo htmlspecialchars($lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
  50                          <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
  51                          <button onclick="document.getElementById('search').value=''; this.form.getElementById('filter_sectionid').value='-1'; this.form.getElementById('catid').value='0'; this.form.getElementById('filter_authorid').value='0'; this.form.getElementById('filter_state').value=''; this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
  52                      </td>
  53                      <td nowrap="nowrap">
  54                          <?php
  55                          echo $lists['sectionid'];
  56                          echo $lists['catid'];
  57                          echo $lists['authorid'];
  58                          echo $lists['state'];
  59                          ?>
  60                      </td>
  61                  </tr>
  62              </table>
  63  
  64              <table class="adminlist">
  65              <thead>
  66                  <tr>
  67                      <th width="5">
  68                          <?php echo JText::_( 'Num' ); ?>
  69                      </th>
  70                      <th width="20">
  71                          <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
  72                      </th>
  73                      <th class="title">
  74                          <?php echo JHTML::_('grid.sort',   'Title', 'c.title', @$lists['order_Dir'], @$lists['order'] ); ?>
  75                      </th>
  76                      <th width="10%" nowrap="nowrap">
  77                          <?php echo JHTML::_('grid.sort',   'Published', 'c.state', @$lists['order_Dir'], @$lists['order'] ); ?>
  78                      </th>
  79                      <th width="80" nowrap="nowrap">
  80                          <?php echo JHTML::_('grid.sort',   'Order', 'fpordering', @$lists['order_Dir'], @$lists['order'] ); ?>
  81                       </th>
  82                      <th width="1%">
  83                          <?php if ($ordering) echo JHTML::_('grid.order',  $rows ); ?>
  84                      </th>
  85                      <th width="8%" nowrap="nowrap">
  86                          <?php echo JHTML::_('grid.sort',   'Access', 'groupname', @$lists['order_Dir'], @$lists['order'] ); ?>
  87                      </th>
  88                      <th width="2%" class="title" align="center" nowrap="nowrap">
  89                          <?php echo JHTML::_('grid.sort',   'ID', 'c.id', @$lists['order_Dir'], @$lists['order'] ); ?>
  90                      </th>
  91                      <th width="10%" class="title">
  92                          <?php echo JHTML::_('grid.sort',   'Section', 'sect_name', @$lists['order_Dir'], @$lists['order'] ); ?>
  93                      </th>
  94                      <th width="10%" class="title">
  95                          <?php echo JHTML::_('grid.sort',   'Category', 'cc.title', @$lists['order_Dir'], @$lists['order'] ); ?>
  96                      </th>
  97                      <th width="10%" class="title">
  98                          <?php echo JHTML::_('grid.sort',   'Author', 'author', @$lists['order_Dir'], @$lists['order'] ); ?>
  99                      </th>
 100                  </tr>
 101              </thead>
 102              <tfoot>
 103              <tr>
 104                  <td colspan="13">
 105                      <?php echo $page->getListFooter(); ?>
 106                  </td>
 107              </tr>
 108              </tfoot>
 109              <tbody>
 110              <?php
 111              $k = 0;
 112              for ($i=0, $n=count( $rows ); $i < $n; $i++)
 113              {
 114                  $row = &$rows[$i];
 115  
 116                  $link = JRoute::_( 'index.php?option=com_content&task=edit&cid[]='. $row->id );
 117  
 118                  $publish_up =& JFactory::getDate($row->publish_up);
 119                  $publish_down =& JFactory::getDate($row->publish_down);
 120                  $publish_up->setOffset($config->getValue('config.offset'));
 121                  $publish_down->setOffset($config->getValue('config.offset'));
 122                  if ( $now->toUnix() <= $publish_up->toUnix() && $row->state == 1 ) {
 123                      $img = 'publish_y.png';
 124                      $alt = JText::_( 'Published' );
 125                  } else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) && $row->state == 1 ) {
 126                      $img = 'publish_g.png';
 127                      $alt = JText::_( 'Published' );
 128                  } else if ( $now->toUnix() > $publish_down->toUnix() && $row->state == 1 ) {
 129                      $img = 'publish_r.png';
 130                      $alt = JText::_( 'Expired' );
 131                  } else if ( $row->state == 0 ) {
 132                      $img = 'publish_x.png';
 133                      $alt = JText::_( 'Unpublished' );
 134                  } else if ( $row->state == -1 ) {
 135                      $img = 'disabled.png';
 136                      $alt = JText::_( 'Archived' );
 137                  }
 138                  $times = '';
 139                  if (isset($row->publish_up)) {
 140                      if ($row->publish_up == $nullDate) {
 141                          $times .= JText::_( 'Start: Always' );
 142                      } else {
 143                          $times .= JText::_( 'Start' ) .": ". $publish_up->toFormat();
 144                      }
 145                  }
 146                  if (isset($row->publish_down)) {
 147                      if ($row->publish_down == $nullDate) {
 148                          $times .= "<br />". JText::_( 'Finish: No Expiry' );
 149                      } else {
 150                          $times .= "<br />". JText::_( 'Finish' ) .": ". $publish_down->toFormat();
 151                      }
 152                  }
 153  
 154                  $access     = JHTML::_('grid.access',   $row, $i );
 155                  $checked     = JHTML::_('grid.checkedout',   $row, $i );
 156  
 157                  if ( $user->authorize( 'com_users', 'manage' ) ) {
 158                      if ( $row->created_by_alias ) {
 159                          $author = $row->created_by_alias;
 160                      } else {
 161                          $linkA     = JRoute::_( 'index.php?option=com_users&task=edit&cid[]='. $row->created_by );
 162                          $author='<span class="editlinktip hasTip" title="'.JText::_( 'Edit User' ).'::'.$row->author.'">' .
 163                                  '<a href="'. $linkA .'">'. $row->author .'</a><span>';
 164                      }
 165                  } else {
 166                      if ( $row->created_by_alias ) {
 167                          $author = $row->created_by_alias;
 168                      } else {
 169                          $author = $row->author;
 170                      }
 171                  }
 172  
 173                  // section handling
 174                  if ($row->sectionid) {
 175                      $row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid );
 176                      $title_sec        = JText::_( 'Edit Section' );
 177                  }
 178  
 179                  // category handling
 180                  if ($row->catid) {
 181                      $row->cat_link     = JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid );
 182                      $title_cat        = JText::_( 'Edit Category' );
 183                  }
 184                  ?>
 185                  <tr class="<?php echo "row$k"; ?>">
 186                      <td>
 187                          <?php echo $page->getRowOffset( $i ); ?>
 188                      </td>
 189                      <td>
 190                          <?php echo $checked; ?>
 191                      </td>
 192                      <td>
 193                          <?php
 194                          if (  JTable::isCheckedOut($user->get ('id'), $row->checked_out ) ) {
 195                              echo $row->title;
 196                          } else {
 197                              ?>
 198                              <span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Content' );?>::<?php echo $row->name; ?>">
 199                              <a href="<?php echo $link; ?>">
 200                                  <?php echo $row->title; ?></a></span>
 201                              <?php
 202                          }
 203                          ?>
 204                      </td>
 205                      <?php
 206                      if ( $times ) {
 207                          ?>
 208                          <td align="center">
 209                              <span class="editlinktip hasTip" title="<?php echo JText::_( 'Publish Information' );?>::<?php echo $times; ?>">
 210                              <a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $row->state ? 'unpublish' : 'publish' ?>')">
 211                                  <img src="images/<?php echo $img;?>" width="16" height="16" border="0" alt="<?php echo $alt;?>" /></a></span>
 212                          </td>
 213                          <?php
 214                      }
 215                      ?>
 216                      <td class="order" colspan="2">
 217                          <span><?php echo $page->orderUpIcon( $i, true, 'orderup', 'Move Up', $ordering ); ?></span>
 218                          <span><?php echo $page->orderDownIcon( $i, $n, true, 'orderdown', 'Move Down', $ordering ); ?></span>
 219                          <?php $disabled = $ordering ?  '' : 'disabled="disabled"'; ?>
 220                          <input type="text" name="order[]" size="5" value="<?php echo $row->fpordering;?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
 221                      </td>
 222                      <td align="center">
 223                          <?php echo $access;?>
 224                      </td>
 225                      <td align="center">
 226                          <?php echo $row->id;?>
 227                      </td>
 228                      <td>
 229                          <?php if ($row->sectionid) : ?>
 230                          <span class="editlinktip hasTip" title="<?php echo $title_sec; ?>::<?php echo $row->sect_name; ?>">
 231                              <a href="<?php echo $row->sect_link; ?>">
 232                                  <?php echo $row->sect_name; ?></a></span>
 233                          <?php endif; ?>
 234                      </td>
 235                      <td>
 236                          <?php if ($row->catid) : ?>
 237                          <span class="editlinktip hasTip" title="<?php echo $title_cat; ?>::<?php echo $row->name; ?>">
 238                              <a href="<?php echo $row->cat_link; ?>" title="<?php echo $title_cat; ?>">
 239                                  <?php echo $row->name; ?></a></span>
 240                          <?php endif; ?>
 241                      </td>
 242                      <td>
 243                          <?php echo $author; ?>
 244                      </td>
 245                  </tr>
 246                  <?php
 247                  $k = 1 - $k;
 248              }
 249              ?>
 250              </tbody>
 251              </table>
 252              <?php JHTML::_('content.legend'); ?>
 253  
 254          <input type="hidden" name="option" value="<?php echo $option;?>" />
 255          <input type="hidden" name="task" value="" />
 256          <input type="hidden" name="boxchecked" value="0" />
 257          <input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?>" />
 258          <input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?>" />
 259          <?php echo JHTML::_( 'form.token' ); ?>
 260          </form>
 261          <?php
 262      }
 263  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1