Location: PHPKode > projects > Pygalle > admin/tables/production.php
<?php
/**
 * @package		Pygalle
 * @copyright	Copyright (C) 2009 Erik Finnegan. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * @author 		hide@address.com
 * Joomla! and Pygalle EVE Corporate Intranet are free software.
 * This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
pyimport( 'tables.table');

class PyTableProduction extends PyTable {
	
	/**
	* @access 	protected
	*/
	function __construct( &$db ) {
		parent::__construct( '#__py_production', 'id', $db);
	}
	
	function getProductionLogs($limit = 100, $ids = null) {
		$querylimit = "";
		$exactid = "";
		if ( $ids === null) {
			if ($limit !== null) {
				/* this is calculating the last n rows. Not needed for now.
				$query = 'SELECT count(*) FROM #__py_production WHERE `published` = 1';
				$db->setQuery($query);
				$numrows = $db->loadResult();
				$this->_log->trace($db);
				$limit = $numrows - $limit;
				*/
				$querylimit = " LIMIT $limit";
			}
		} else {
			if ( !is_array($ids)) { $ids = array( $ids); }
			$exactid = ' AND (';
			$_first = true;
			foreach ($ids as $oneId) {
				if ( $_first) {
					$_first = false;
				} else {
					$exactid .= ' OR ';
				}
				$exactid .= "y.`id` = $oneId";
			}
			$exactid .= ') '; 
		}
		$query = 'SELECT y.*, u.`name` AS `createdByName`, o.`name` AS `itemtype`'
		 . ' FROM #__py_production AS y'
		 . ' LEFT OUTER JOIN #__users AS u ON y.`modifiedBy` = u.`id`' 
		 . ' LEFT OUTER JOIN #__py_items AS o ON y.`typeId` = o.`eveTypeId`' 
		 . ' WHERE y.`published` = 1'
		 . $exactid
		 . ' GROUP BY y.`id`' 
		 . ' ORDER BY y.`date` DESC ' 
		 . $querylimit;
		
		return $this->loadObjectList( $query);
	}
}
?>
Return current item: Pygalle