<?php
/**
 * @package Sj Latest Jobs For Js Jobs
 * @version 1.0.0
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @copyright (c) 2015 YouTech Company. All Rights Reserved.
 * @author YouTech Company http://www.smartaddons.com
 *
 */

defined('_JEXEC') or die;
 
JFormHelper::loadFieldClass('list');

if (!class_exists('JFormFieldSjJobsCompany')) {
	class JFormFieldSjJobsCompany extends JFormFieldList
	{

		

		protected function getOptions()
		{			
			$db = JFactory::getDBO();
			$query = "SELECT id, name FROM `#__js_job_companies`";
			$query.= " ORDER BY name ASC ";
			try {
				$db->setQuery($query);
				$rows = $db->loadObjectList();
			}
			catch (Exception $e){
				echo $e->getMessage();
			}

			foreach($rows as $row){
				$options[] = JHtml::_('select.option', $row->id, $row->name);
			}
			
			return $options;
		}

	}
}