Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
home/lmsyaran/public_html/libraries/joomla/form/fields/sql.php000064400000016204151157414320020610
0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('list');
/**
* Supports a custom SQL select list
*
* @since 1.7.0
*/
class JFormFieldSQL extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 1.7.0
*/
public $type = 'SQL';
/**
* The keyField.
*
* @var string
* @since 3.2
*/
protected $keyField;
/**
* The valueField.
*
* @var string
* @since 3.2
*/
protected $valueField;
/**
* The translate.
*
* @var boolean
* @since 3.2
*/
protected $translate = false;
/**
* The query.
*
* @var string
* @since 3.2
*/
protected $query;
/**
* Method to get certain otherwise inaccessible properties from the form
field object.
*
* @param string $name The property name for which to get the value.
*
* @return mixed The property value or null.
*
* @since 3.2
*/
public function __get($name)
{
switch ($name)
{
case 'keyField':
case 'valueField':
case 'translate':
case 'query':
return $this->$name;
}
return parent::__get($name);
}
/**
* Method to set certain otherwise inaccessible properties of the form
field object.
*
* @param string $name The property name for which to set the value.
* @param mixed $value The value of the property.
*
* @return void
*
* @since 3.2
*/
public function __set($name, $value)
{
switch ($name)
{
case 'keyField':
case 'valueField':
case 'translate':
case 'query':
$this->$name = (string) $value;
break;
default:
parent::__set($name, $value);
}
}
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return)
{
// Check if its using the old way
$this->query = (string) $this->element['query'];
if (empty($this->query))
{
// Get the query from the form
$query = array();
$defaults = array();
$sql_select = (string) $this->element['sql_select'];
$sql_from = (string) $this->element['sql_from'];
if ($sql_select && $sql_from)
{
$query['select'] = $sql_select;
$query['from'] = $sql_from;
$query['join'] = (string)
$this->element['sql_join'];
$query['where'] = (string)
$this->element['sql_where'];
$query['group'] = (string)
$this->element['sql_group'];
$query['order'] = (string)
$this->element['sql_order'];
// Get the filters
$filters = isset($this->element['sql_filter']) ?
explode(',', $this->element['sql_filter']) :
'';
// Get the default value for query if empty
if (is_array($filters))
{
foreach ($filters as $filter)
{
$name = "sql_default_{$filter}";
$attrib = (string) $this->element[$name];
if (!empty($attrib))
{
$defaults[$filter] = $attrib;
}
}
}
// Process the query
$this->query = $this->processQuery($query, $filters, $defaults);
}
}
$this->keyField = (string) $this->element['key_field']
?: 'value';
$this->valueField = (string)
$this->element['value_field'] ?: (string)
$this->element['name'];
$this->translate = (string) $this->element['translate']
?: false;
$this->header = (string) $this->element['header'] ?:
false;
}
return $return;
}
/**
* Method to process the query from form.
*
* @param array $conditions The conditions from the form.
* @param string $filters The columns to filter.
* @param array $defaults The defaults value to set if condition is
empty.
*
* @return JDatabaseQuery The query object.
*
* @since 3.5
*/
protected function processQuery($conditions, $filters, $defaults)
{
// Get the database object.
$db = JFactory::getDbo();
// Get the query object
$query = $db->getQuery(true);
// Select fields
$query->select($conditions['select']);
// From selected table
$query->from($conditions['from']);
// Join over the groups
if (!empty($conditions['join']))
{
$query->join('LEFT', $conditions['join']);
}
// Where condition
if (!empty($conditions['where']))
{
$query->where($conditions['where']);
}
// Group by
if (!empty($conditions['group']))
{
$query->group($conditions['group']);
}
// Process the filters
if (is_array($filters))
{
$html_filters =
JFactory::getApplication()->getUserStateFromRequest($this->context .
'.filter', 'filter', array(), 'array');
foreach ($filters as $k => $value)
{
if (!empty($html_filters[$value]))
{
$escape = $db->quote($db->escape($html_filters[$value]), false);
$query->where("{$value} = {$escape}");
}
elseif (!empty($defaults[$value]))
{
$escape = $db->quote($db->escape($defaults[$value]), false);
$query->where("{$value} = {$escape}");
}
}
}
// Add order to query
if (!empty($conditions['order']))
{
$query->order($conditions['order']);
}
return $query;
}
/**
* Method to get the custom field options.
* Use the query attribute to supply a query to generate the list.
*
* @return array The field option objects.
*
* @since 1.7.0
*/
protected function getOptions()
{
$options = array();
// Initialize some field attributes.
$key = $this->keyField;
$value = $this->valueField;
$header = $this->header;
if ($this->query)
{
// Get the database object.
$db = JFactory::getDbo();
// Set the query and get the result list.
$db->setQuery($this->query);
try
{
$items = $db->loadObjectlist();
}
catch (JDatabaseExceptionExecuting $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
}
// Add header.
if (!empty($header))
{
$header_title = JText::_($header);
$options[] = JHtml::_('select.option', '',
$header_title);
}
// Build the field options.
if (!empty($items))
{
foreach ($items as $item)
{
if ($this->translate == true)
{
$options[] = JHtml::_('select.option', $item->$key,
JText::_($item->$value));
}
else
{
$options[] = JHtml::_('select.option', $item->$key,
$item->$value);
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}
home/lmsyaran/public_html/j3/plugins/fields/sql/tmpl/sql.php000064400000001771151157556330020173
0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Sql
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$value = $field->value;
if ($value == '')
{
return;
}
$db = JFactory::getDbo();
$value = (array) $value;
$condition = '';
foreach ($value as $v)
{
if (!$v)
{
continue;
}
$condition .= ', ' . $db->q($v);
}
$query = $fieldParams->get('query', '');
// Run the query with a having condition because it supports aliases
$db->setQuery($query . ' having value in (' . trim($condition,
',') . ')');
try
{
$items = $db->loadObjectlist();
}
catch (Exception $e)
{
// If the query failed, we fetch all elements
$db->setQuery($query);
$items = $db->loadObjectlist();
}
$texts = array();
foreach ($items as $item)
{
if (in_array($item->value, $value))
{
$texts[] = $item->text;
}
}
echo htmlentities(implode(', ', $texts));
home/lmsyaran/public_html/j3/libraries/joomla/form/fields/sql.php000064400000016204151160074210021116
0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('list');
/**
* Supports a custom SQL select list
*
* @since 1.7.0
*/
class JFormFieldSQL extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 1.7.0
*/
public $type = 'SQL';
/**
* The keyField.
*
* @var string
* @since 3.2
*/
protected $keyField;
/**
* The valueField.
*
* @var string
* @since 3.2
*/
protected $valueField;
/**
* The translate.
*
* @var boolean
* @since 3.2
*/
protected $translate = false;
/**
* The query.
*
* @var string
* @since 3.2
*/
protected $query;
/**
* Method to get certain otherwise inaccessible properties from the form
field object.
*
* @param string $name The property name for which to get the value.
*
* @return mixed The property value or null.
*
* @since 3.2
*/
public function __get($name)
{
switch ($name)
{
case 'keyField':
case 'valueField':
case 'translate':
case 'query':
return $this->$name;
}
return parent::__get($name);
}
/**
* Method to set certain otherwise inaccessible properties of the form
field object.
*
* @param string $name The property name for which to set the value.
* @param mixed $value The value of the property.
*
* @return void
*
* @since 3.2
*/
public function __set($name, $value)
{
switch ($name)
{
case 'keyField':
case 'valueField':
case 'translate':
case 'query':
$this->$name = (string) $value;
break;
default:
parent::__set($name, $value);
}
}
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return)
{
// Check if its using the old way
$this->query = (string) $this->element['query'];
if (empty($this->query))
{
// Get the query from the form
$query = array();
$defaults = array();
$sql_select = (string) $this->element['sql_select'];
$sql_from = (string) $this->element['sql_from'];
if ($sql_select && $sql_from)
{
$query['select'] = $sql_select;
$query['from'] = $sql_from;
$query['join'] = (string)
$this->element['sql_join'];
$query['where'] = (string)
$this->element['sql_where'];
$query['group'] = (string)
$this->element['sql_group'];
$query['order'] = (string)
$this->element['sql_order'];
// Get the filters
$filters = isset($this->element['sql_filter']) ?
explode(',', $this->element['sql_filter']) :
'';
// Get the default value for query if empty
if (is_array($filters))
{
foreach ($filters as $filter)
{
$name = "sql_default_{$filter}";
$attrib = (string) $this->element[$name];
if (!empty($attrib))
{
$defaults[$filter] = $attrib;
}
}
}
// Process the query
$this->query = $this->processQuery($query, $filters, $defaults);
}
}
$this->keyField = (string) $this->element['key_field']
?: 'value';
$this->valueField = (string)
$this->element['value_field'] ?: (string)
$this->element['name'];
$this->translate = (string) $this->element['translate']
?: false;
$this->header = (string) $this->element['header'] ?:
false;
}
return $return;
}
/**
* Method to process the query from form.
*
* @param array $conditions The conditions from the form.
* @param string $filters The columns to filter.
* @param array $defaults The defaults value to set if condition is
empty.
*
* @return JDatabaseQuery The query object.
*
* @since 3.5
*/
protected function processQuery($conditions, $filters, $defaults)
{
// Get the database object.
$db = JFactory::getDbo();
// Get the query object
$query = $db->getQuery(true);
// Select fields
$query->select($conditions['select']);
// From selected table
$query->from($conditions['from']);
// Join over the groups
if (!empty($conditions['join']))
{
$query->join('LEFT', $conditions['join']);
}
// Where condition
if (!empty($conditions['where']))
{
$query->where($conditions['where']);
}
// Group by
if (!empty($conditions['group']))
{
$query->group($conditions['group']);
}
// Process the filters
if (is_array($filters))
{
$html_filters =
JFactory::getApplication()->getUserStateFromRequest($this->context .
'.filter', 'filter', array(), 'array');
foreach ($filters as $k => $value)
{
if (!empty($html_filters[$value]))
{
$escape = $db->quote($db->escape($html_filters[$value]), false);
$query->where("{$value} = {$escape}");
}
elseif (!empty($defaults[$value]))
{
$escape = $db->quote($db->escape($defaults[$value]), false);
$query->where("{$value} = {$escape}");
}
}
}
// Add order to query
if (!empty($conditions['order']))
{
$query->order($conditions['order']);
}
return $query;
}
/**
* Method to get the custom field options.
* Use the query attribute to supply a query to generate the list.
*
* @return array The field option objects.
*
* @since 1.7.0
*/
protected function getOptions()
{
$options = array();
// Initialize some field attributes.
$key = $this->keyField;
$value = $this->valueField;
$header = $this->header;
if ($this->query)
{
// Get the database object.
$db = JFactory::getDbo();
// Set the query and get the result list.
$db->setQuery($this->query);
try
{
$items = $db->loadObjectlist();
}
catch (JDatabaseExceptionExecuting $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
}
// Add header.
if (!empty($header))
{
$header_title = JText::_($header);
$options[] = JHtml::_('select.option', '',
$header_title);
}
// Build the field options.
if (!empty($items))
{
foreach ($items as $item)
{
if ($this->translate == true)
{
$options[] = JHtml::_('select.option', $item->$key,
JText::_($item->$value));
}
else
{
$options[] = JHtml::_('select.option', $item->$key,
$item->$value);
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}
home/lmsyaran/public_html/j3/htaccess.back/fof/form/field/sql.php000064400000004700151160760720020752
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JFormHelper::loadFieldClass('sql');
/**
* Form Field class for FOF
* Radio selection listGeneric list from an SQL statement
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormFieldSql extends JFormFieldSql implements FOFFormField
{
protected $static;
protected $repeatable;
/** @var FOFTable The item being rendered in a repeatable form field */
public $item;
/** @var int A monotonically increasing number, denoting the row number in
a repeatable view */
public $rowid;
/**
* Method to get certain otherwise inaccessible properties from the form
field object.
*
* @param string $name The property name for which to the the value.
*
* @return mixed The property value or null.
*
* @since 2.0
*/
public function __get($name)
{
switch ($name)
{
case 'static':
if (empty($this->static))
{
$this->static = $this->getStatic();
}
return $this->static;
break;
case 'repeatable':
if (empty($this->repeatable))
{
$this->repeatable = $this->getRepeatable();
}
return $this->repeatable;
break;
default:
return parent::__get($name);
}
}
/**
* Get the rendering of this field type for static display, e.g. in a
single
* item view (typically a "read" task).
*
* @since 2.0
*
* @return string The field HTML
*/
public function getStatic()
{
$class = $this->element['class'] ? ' class="'
. (string) $this->element['class'] . '"' :
'';
return '<span id="' . $this->id . '"
' . $class . '>' .
htmlspecialchars(FOFFormFieldList::getOptionName($this->getOptions(),
$this->value), ENT_COMPAT, 'UTF-8') .
'</span>';
}
/**
* Get the rendering of this field type for a repeatable (grid) display,
* e.g. in a view listing many item (typically a "browse" task)
*
* @since 2.0
*
* @return string The field HTML
*/
public function getRepeatable()
{
$class = $this->element['class'] ? (string)
$this->element['class'] : '';
return '<span class="' . $this->id . ' ' .
$class . '">' .
htmlspecialchars(FOFFormFieldList::getOptionName($this->getOptions(),
$this->value), ENT_COMPAT, 'UTF-8') .
'</span>';
}
}
home/lmsyaran/public_html/j3/plugins/fields/sql/sql.php000064400000003533151161056400017201
0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Sql
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::import('components.com_fields.libraries.fieldslistplugin',
JPATH_ADMINISTRATOR);
/**
* Fields Sql Plugin
*
* @since 3.7.0
*/
class PlgFieldsSql extends FieldsListPlugin
{
/**
* Transforms the field into a DOM XML element and appends it as a child
on the given parent.
*
* @param stdClass $field The field.
* @param DOMElement $parent The field node parent.
* @param JForm $form The form.
*
* @return DOMElement
*
* @since 3.7.0
*/
public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm
$form)
{
$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);
if (!$fieldNode)
{
return $fieldNode;
}
$fieldNode->setAttribute('value_field', 'text');
$fieldNode->setAttribute('key_field', 'value');
return $fieldNode;
}
/**
* The save event.
*
* @param string $context The context
* @param JTable $item The table
* @param boolean $isNew Is new item
* @param array $data The validated data
*
* @return boolean
*
* @since 3.7.0
*/
public function onContentBeforeSave($context, $item, $isNew, $data =
array())
{
// Only work on new SQL fields
if ($context != 'com_fields.field' || !isset($item->type) ||
$item->type != 'sql')
{
return true;
}
// If we are not a super admin, don't let the user create or update
a SQL field
if (!JAccess::getAssetRules(1)->allow('core.admin',
JFactory::getUser()->getAuthorisedGroups()))
{
$item->setError(JText::_('PLG_FIELDS_SQL_CREATE_NOT_POSSIBLE'));
return false;
}
return true;
}
}
home/lmsyaran/public_html/j3/htaccess.back/joomla/form/fields/sql.php000064400000016204151161323570021645
0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage Form
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
JFormHelper::loadFieldClass('list');
/**
* Supports a custom SQL select list
*
* @since 1.7.0
*/
class JFormFieldSQL extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 1.7.0
*/
public $type = 'SQL';
/**
* The keyField.
*
* @var string
* @since 3.2
*/
protected $keyField;
/**
* The valueField.
*
* @var string
* @since 3.2
*/
protected $valueField;
/**
* The translate.
*
* @var boolean
* @since 3.2
*/
protected $translate = false;
/**
* The query.
*
* @var string
* @since 3.2
*/
protected $query;
/**
* Method to get certain otherwise inaccessible properties from the form
field object.
*
* @param string $name The property name for which to get the value.
*
* @return mixed The property value or null.
*
* @since 3.2
*/
public function __get($name)
{
switch ($name)
{
case 'keyField':
case 'valueField':
case 'translate':
case 'query':
return $this->$name;
}
return parent::__get($name);
}
/**
* Method to set certain otherwise inaccessible properties of the form
field object.
*
* @param string $name The property name for which to set the value.
* @param mixed $value The value of the property.
*
* @return void
*
* @since 3.2
*/
public function __set($name, $value)
{
switch ($name)
{
case 'keyField':
case 'valueField':
case 'translate':
case 'query':
$this->$name = (string) $value;
break;
default:
parent::__set($name, $value);
}
}
/**
* Method to attach a JForm object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object
representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
* @param string $group The field name group control
value. This acts as an array container for the field.
* For example if the field has
name="foo" and the group value is set to "bar" then the
* full field name would end up being
"bar[foo]".
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @since 3.2
*/
public function setup(SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return)
{
// Check if its using the old way
$this->query = (string) $this->element['query'];
if (empty($this->query))
{
// Get the query from the form
$query = array();
$defaults = array();
$sql_select = (string) $this->element['sql_select'];
$sql_from = (string) $this->element['sql_from'];
if ($sql_select && $sql_from)
{
$query['select'] = $sql_select;
$query['from'] = $sql_from;
$query['join'] = (string)
$this->element['sql_join'];
$query['where'] = (string)
$this->element['sql_where'];
$query['group'] = (string)
$this->element['sql_group'];
$query['order'] = (string)
$this->element['sql_order'];
// Get the filters
$filters = isset($this->element['sql_filter']) ?
explode(',', $this->element['sql_filter']) :
'';
// Get the default value for query if empty
if (is_array($filters))
{
foreach ($filters as $filter)
{
$name = "sql_default_{$filter}";
$attrib = (string) $this->element[$name];
if (!empty($attrib))
{
$defaults[$filter] = $attrib;
}
}
}
// Process the query
$this->query = $this->processQuery($query, $filters, $defaults);
}
}
$this->keyField = (string) $this->element['key_field']
?: 'value';
$this->valueField = (string)
$this->element['value_field'] ?: (string)
$this->element['name'];
$this->translate = (string) $this->element['translate']
?: false;
$this->header = (string) $this->element['header'] ?:
false;
}
return $return;
}
/**
* Method to process the query from form.
*
* @param array $conditions The conditions from the form.
* @param string $filters The columns to filter.
* @param array $defaults The defaults value to set if condition is
empty.
*
* @return JDatabaseQuery The query object.
*
* @since 3.5
*/
protected function processQuery($conditions, $filters, $defaults)
{
// Get the database object.
$db = JFactory::getDbo();
// Get the query object
$query = $db->getQuery(true);
// Select fields
$query->select($conditions['select']);
// From selected table
$query->from($conditions['from']);
// Join over the groups
if (!empty($conditions['join']))
{
$query->join('LEFT', $conditions['join']);
}
// Where condition
if (!empty($conditions['where']))
{
$query->where($conditions['where']);
}
// Group by
if (!empty($conditions['group']))
{
$query->group($conditions['group']);
}
// Process the filters
if (is_array($filters))
{
$html_filters =
JFactory::getApplication()->getUserStateFromRequest($this->context .
'.filter', 'filter', array(), 'array');
foreach ($filters as $k => $value)
{
if (!empty($html_filters[$value]))
{
$escape = $db->quote($db->escape($html_filters[$value]), false);
$query->where("{$value} = {$escape}");
}
elseif (!empty($defaults[$value]))
{
$escape = $db->quote($db->escape($defaults[$value]), false);
$query->where("{$value} = {$escape}");
}
}
}
// Add order to query
if (!empty($conditions['order']))
{
$query->order($conditions['order']);
}
return $query;
}
/**
* Method to get the custom field options.
* Use the query attribute to supply a query to generate the list.
*
* @return array The field option objects.
*
* @since 1.7.0
*/
protected function getOptions()
{
$options = array();
// Initialize some field attributes.
$key = $this->keyField;
$value = $this->valueField;
$header = $this->header;
if ($this->query)
{
// Get the database object.
$db = JFactory::getDbo();
// Set the query and get the result list.
$db->setQuery($this->query);
try
{
$items = $db->loadObjectlist();
}
catch (JDatabaseExceptionExecuting $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
}
}
// Add header.
if (!empty($header))
{
$header_title = JText::_($header);
$options[] = JHtml::_('select.option', '',
$header_title);
}
// Build the field options.
if (!empty($items))
{
foreach ($items as $item)
{
if ($this->translate == true)
{
$options[] = JHtml::_('select.option', $item->$key,
JText::_($item->$value));
}
else
{
$options[] = JHtml::_('select.option', $item->$key,
$item->$value);
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}
home/lmsyaran/public_html/libraries/fof/form/field/sql.php000064400000004700151161751530017716
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JFormHelper::loadFieldClass('sql');
/**
* Form Field class for FOF
* Radio selection listGeneric list from an SQL statement
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormFieldSql extends JFormFieldSql implements FOFFormField
{
protected $static;
protected $repeatable;
/** @var FOFTable The item being rendered in a repeatable form field */
public $item;
/** @var int A monotonically increasing number, denoting the row number in
a repeatable view */
public $rowid;
/**
* Method to get certain otherwise inaccessible properties from the form
field object.
*
* @param string $name The property name for which to the the value.
*
* @return mixed The property value or null.
*
* @since 2.0
*/
public function __get($name)
{
switch ($name)
{
case 'static':
if (empty($this->static))
{
$this->static = $this->getStatic();
}
return $this->static;
break;
case 'repeatable':
if (empty($this->repeatable))
{
$this->repeatable = $this->getRepeatable();
}
return $this->repeatable;
break;
default:
return parent::__get($name);
}
}
/**
* Get the rendering of this field type for static display, e.g. in a
single
* item view (typically a "read" task).
*
* @since 2.0
*
* @return string The field HTML
*/
public function getStatic()
{
$class = $this->element['class'] ? ' class="'
. (string) $this->element['class'] . '"' :
'';
return '<span id="' . $this->id . '"
' . $class . '>' .
htmlspecialchars(FOFFormFieldList::getOptionName($this->getOptions(),
$this->value), ENT_COMPAT, 'UTF-8') .
'</span>';
}
/**
* Get the rendering of this field type for a repeatable (grid) display,
* e.g. in a view listing many item (typically a "browse" task)
*
* @since 2.0
*
* @return string The field HTML
*/
public function getRepeatable()
{
$class = $this->element['class'] ? (string)
$this->element['class'] : '';
return '<span class="' . $this->id . ' ' .
$class . '">' .
htmlspecialchars(FOFFormFieldList::getOptionName($this->getOptions(),
$this->value), ENT_COMPAT, 'UTF-8') .
'</span>';
}
}