Location: PHPKode > projects > EMIHR > emihr-0.1.3/includes/COMPANY/companyCollection.class.php
<?php
// +----------------------------------------------------------------------+
// | PHP Version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005 Ematic Interactive                                |
// +----------------------------------------------------------------------+
// | EMIHR is free software; you can redistribute it and/or modify	      |	
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or    |
// | (at your option) any later version.								  |
// |																	  |
// | EMIHR is distributed in the hope that it will be useful,			  |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of		  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the		  |
// | GNU General Public License for more details.						  |
// | 																	  |
// | You should have received a copy of the GNU General Public License	  |
// | along with EMIHR; if not, write to the Free Software Foundation,     |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA		  |
// +----------------------------------------------------------------------+
// | Author: René de Kat <hide@address.com>                	              |
// +----------------------------------------------------------------------+
//
// $Id: companyCollection.class.php,v 1.00 2005/09/04 13:31:00 RdK Exp $
/**
 * CompanyCollection class. 
 * This class holds a collection of all companies in the database. Limited by offSet,MAX_RECORDS_PER_PAGE
 *
 * @category EMIHR
 * @package COMPANY
 * @version $Id: companyCollection.class.php,v 1.10 2005/02/04 13:31:00 RdK Exp $
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @copyright (c) 2005 Ematic Interactive
 * @author   René de Kat <hide@address.com> 
 */
 
/**
 * CompanyCollection class. 
 * This class holds a collection of all companies in the database. Limited by offSet,MAX_RECORDS_PER_PAGE
 *
 * @category EMIHR
 * @package COMPANY
 * @version $Id: companyCollection.class.php,v 1.10 2005/02/04 13:31:00 RdK Exp $
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @copyright (c) 2005 Ematic Interactive
 * @author   René de Kat <hide@address.com> 
 */
class CompanyCollection extends Collection
{
    // {{{ constructor

    /**
     * CompanyCollection constructor.
	 * @param int $offSet start index
	  * @param int $max_records Optional maximum nr of records to be loaded. If 0 all records will be returned. 
     * @access public
     */
	function CompanyCollection($offSet = 0, $max_records = 0)
	{		
		//A litle variable initialization
		settype($offSet, "integer");
		$this->className = "Company";
		
		//Initialize the SQL query
		$strLimit = '';
		if ($max_records > 0)
			$strLimit = sprintf('LIMIT %d,%d',$offSet,$max_records);		
		$strSQL = "SELECT company.* FROM company ORDER BY company.name %s";
		$strSQL = sprintf($strSQL, $strLimit);

		//Let's load the collection
		$this->loadElements($strSQL);
		
		//Free some memory
		unset($strSQL);
		unset($offSet);
	}
	
	// }}}
}
?>
Return current item: EMIHR