Current File : /home/pacjaorg/wpt.pacja.org/km/plugins/djclassifieds/acymailing/fields/djcfacymailing.php
<?php
/**
 * @package DJ-Classifieds
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email: contact@dj-extensions.com
 */

defined('_JEXEC') or die();

class JFormFieldDjcfacymailing extends JFormField {
	
	protected $type = 'Djcfacymailing';
	
	protected function getInput()
	{
		$html = array();

		$acymailing_ver = '';
		if(JComponentHelper::isInstalled('com_acym')){
			$acymailing_ver = 'com_acym';
		}elseif(JComponentHelper::isInstalled('com_acymailing')){
			$acymailing_ver = 'com_acymailing';
		}
				
		if($acymailing_ver){
			$options = $this->getOptions($acymailing_ver);

			$attr = '';
			$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
			$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
			$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
			$attr .= $this->element['multiple']=='true' ? ' multiple="multiple"' : '';
			
			$html = JHTML::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value);
		}else{
			$html = JText::_('PLG_DJCLASSIFIEDS_ACYMAILING_PLEASE_INSTALL_ACYMAILING');
		}
		
		return $html;
	}
	
	protected function getOptions($acymailing_ver)
	{
		$db = JFactory::getDbo();
		$options = array();
		
		if($acymailing_ver == 'com_acym'){
			$db->setQuery('SELECT id listid, name FROM #__acym_list ORDER BY id');
		}else{
			$db->setQuery('SELECT listid, name FROM #__acymailing_list ORDER BY listid');
		}
		$rows = $db->loadObjectList('listid');
	
		foreach($rows as $option){
			$disabled = false;

			$tmp = JHtml::_(
				'select.option', (string) $option->listid, trim((string) $option->name), 'value', 'text',
				$disabled
			);
			$tmp->class = 'djcf_acymailing';

			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
}
?>
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!