| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/news/modules/mod_aidanews2_K2/elements/ |
Upload File : |
<?php
/**
* @copyright Copyright (C) 2009 Open Source Matters. All rights reserved.
* @license GNU/GPL
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
* Renders a multiple item select element
* using SQL result and explicitly specified params
*
*/
class JElementmulti extends JElement
{
/**
* Element name
*
* @access protected
* @var string
*/
var $_name = 'multi';
function fetchElement($name, $value, &$node, $control_name)
{
// Base name of the HTML control.
$ctrl = $control_name .'['. $name .']';
// Construct the various argument calls that are supported.
$attribs = ' ';
if ($v = $node->attributes( 'size' )) {
$attribs .= 'size="'.$v.'"';
}
if ($v = $node->attributes( 'class' )) {
$attribs .= 'class="'.$v.'"';
} else {
$attribs .= 'class="inputbox"';
}
if ($m = $node->attributes( 'multiple' ))
{
$attribs .= ' multiple="multiple"';
$ctrl .= '[]';
}
// Query items for list.
$db = & JFactory::getDBO();
$db->setQuery($node->attributes('sql'));
$key = ($node->attributes('key_field') ? $node->attributes('key_field') : 'value');
$val = ($node->attributes('value_field') ? $node->attributes('value_field') : $name);
$options = array ();
foreach ($node->children() as $option)
{
$options[]= array($key=> $option->attributes('value'),$val => $option->data());
}
$rows = $db->loadAssocList();
foreach ($rows as $row){
$options[]=array($key=>$row[$key],$val=>$row[$val]);
}
if($options){
return JHTML::_('select.genericlist',$options, $ctrl, $attribs, $key, $val, $value, $control_name.$name);
}
}
}