[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/modules/mod_latest/ -> mod_latest.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: mod_latest.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   6  * @license        GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_JEXEC' ) or die( 'Restricted access' );
  16  
  17  // Get the user object for the logged in user
  18  $db        =& JFactory::getDBO();
  19  $user    =& JFactory::getUser();
  20  $userId    = (int) $user->get('id');
  21  
  22  $where    = 'WHERE a.state <> -2';
  23  
  24  // User Filter
  25  switch ($params->get( 'user_id' ))
  26  {
  27      case 'by_me':
  28          $where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')';
  29          break;
  30      case 'not_me':
  31          $where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')';
  32          break;
  33  }
  34  
  35  // Ordering
  36  switch ($params->get( 'ordering' ))
  37  {
  38      case 'm_dsc':
  39          $ordering        = 'modified DESC, created DESC';
  40          $dateProperty    = 'modified';
  41          break;
  42      case 'c_dsc':
  43      default:
  44          $ordering        = 'created DESC';
  45          $dateProperty    = 'created';
  46          break;
  47  }
  48  
  49  $query = 'SELECT a.id, a.sectionid, a.title, a.created, a.modified, u.name, a.created_by_alias, a.created_by'
  50  . ' FROM #__content AS a'
  51  . ' LEFT JOIN #__users AS u ON u.id = a.created_by'
  52  . ' '. $where
  53  . ' ORDER BY '. $ordering
  54  ;
  55  $db->setQuery( $query, 0, 10 );
  56  $rows = $db->loadObjectList();
  57  ?>
  58  
  59  <table class="adminlist">
  60  <tr>
  61      <td class="title">
  62          <strong><?php echo JText::_( 'Latest Items' ); ?></strong>
  63      </td>
  64      <td class="title">
  65          <strong><?php echo JText::_( 'Created' ); ?></strong>
  66      </td>
  67      <td class="title">
  68          <strong><?php echo JText::_( 'Creator' ); ?></strong>
  69      </td>
  70  </tr>
  71  <?php
  72  if (count( $rows ))
  73  {
  74      foreach ($rows as $row)
  75      {
  76          $link = 'index.php?option=com_content&amp;task=edit&amp;id='. $row->id;
  77  
  78          if ( $user->authorize( 'administration', 'manage', 'components', 'com_users' ) ) {
  79              if ( $row->created_by_alias )
  80              {
  81                  $author = $row->created_by_alias;
  82              }
  83              else
  84              {
  85                  $linkA     = 'index.php?option=com_users&amp;task=edit&amp;cid[]='. $row->created_by;
  86                  $author = '<a href="'. $linkA .'" title="'. JText::_( 'Edit User' ) .'">'. htmlspecialchars( $row->name, ENT_QUOTES, 'UTF-8' ) .'</a>';
  87              }
  88          }
  89          else
  90          {
  91              if ( $row->created_by_alias )
  92              {
  93                  $author = $row->created_by_alias;
  94              }
  95              else
  96              {
  97                  $author = htmlspecialchars( $row->name, ENT_QUOTES, 'UTF-8' );
  98              }
  99          }
 100          ?>
 101          <tr>
 102              <td>
 103                  <a href="<?php echo $link; ?>">
 104                      <?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8');?></a>
 105              </td>
 106              <td>
 107                  <?php echo JHTML::_('date', $row->$dateProperty, '%Y-%m-%d %H:%M:%S'); ?>
 108              </td>
 109              <td>
 110                  <?php echo $author;?>
 111              </td>
 112          </tr>
 113          <?php
 114      }
 115  }
 116  else
 117  {
 118  ?>
 119          <tr>
 120              <td colspan="3">
 121                  <?php echo JText::_( 'No matching results' );?>
 122              </td>
 123          </tr>
 124  <?php
 125  }
 126  ?>
 127  </table>


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