File: /home/centralexf/www/modules/mod_janewsticker/elements/section.php
<?php
/*
# ------------------------------------------------------------------------
# JA News Ticker module for Joomla 1.5
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license - PHP files are GNU/GPL V2. CSS / JS are Copyrighted Commercial,
# bound by Proprietary License of JoomlArt. For details on licensing,
# Please Read Terms of Use at http://www.joomlart.com/terms_of_use.html.
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com
# Redistribution, Modification or Re-licensing of this file in part of full,
# is bound by the License applied.
# ------------------------------------------------------------------------
*/
/**
* JA News Sticker module allows display of article's title from sections or categories. \
* You can configure the setttings in the right pane. Mutiple options for animations are also added, choose any one.
* If you are using this module on Teline III template, * then the default module position is "headlines".
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* JElementSection class.
*/
class JElementSection extends JElement
{
/*
* Section name
*
* @access protected
* @var string
*/
var $_name = 'Section';
function fetchElement($name, $value, &$node, $control_name)
{
$arrOpt = array();
$options = $this->getSections();
for($i=0; $i < count($options); $i++){
$arrOpt[$i]['keys'] = $options[$i]->id;
$arrOpt[$i]['value'] = $options[$i]->title;
}
return JHTML::_('select.genericlist', $arrOpt, ''.$control_name.'['.$name.'][]', 'class="inputbox" multiple=""', 'keys', 'value', $value, $control_name.$name );
}
function getSections()
{
$db = JFactory::getDBO();
$query = 'SELECT s.id, s.title' .
' FROM #__sections AS s' .
' ORDER BY s.ordering';
$db->setQuery($query);
$sections[] = JHTML::_('select.option', '-1', '- '.JText::_('Select Section').' -', 'id', 'title');
$sections = array_merge($sections, $db->loadObjectList());
return $sections;
}
}
?>