primo commit
This commit is contained in:
43
libraries/f0f/form/header/accesslevel.php
Normal file
43
libraries/f0f/form/header/accesslevel.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Access level field header
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderAccesslevel extends F0FFormHeaderFieldselectable
|
||||
{
|
||||
/**
|
||||
* Method to get the list of access levels
|
||||
*
|
||||
* @return array A list of access levels.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$db = F0FPlatform::getInstance()->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select('a.id AS value, a.title AS text');
|
||||
$query->from('#__viewlevels AS a');
|
||||
$query->group('a.id, a.title, a.ordering');
|
||||
$query->order('a.ordering ASC');
|
||||
$query->order($query->qn('title') . ' ASC');
|
||||
|
||||
// Get the options.
|
||||
$db->setQuery($query);
|
||||
$options = $db->loadObjectList();
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
44
libraries/f0f/form/header/field.php
Normal file
44
libraries/f0f/form/header/field.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic field header, without any filters
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderField extends F0FFormHeader
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
$sortable = ($this->element['sortable'] != 'false');
|
||||
|
||||
$label = $this->getLabel();
|
||||
|
||||
if ($sortable)
|
||||
{
|
||||
$view = $this->form->getView();
|
||||
|
||||
return JHTML::_('grid.sort', $label, $this->name,
|
||||
$view->getLists()->order_Dir, $view->getLists()->order,
|
||||
$this->form->getModel()->task
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JText::_($label);
|
||||
}
|
||||
}
|
||||
}
|
||||
127
libraries/f0f/form/header/fielddate.php
Normal file
127
libraries/f0f/form/header/fielddate.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic field header, with text input (search) filter
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFielddate extends F0FFormHeaderField
|
||||
{
|
||||
/**
|
||||
* Get the filter field
|
||||
*
|
||||
* @return string The HTML
|
||||
*/
|
||||
protected function getFilter()
|
||||
{
|
||||
// Initialize some field attributes.
|
||||
$format = $this->element['format'] ? (string) $this->element['format'] : '%Y-%m-%d';
|
||||
$attributes = array();
|
||||
|
||||
if ($this->element['size'])
|
||||
{
|
||||
$attributes['size'] = (int) $this->element['size'];
|
||||
}
|
||||
|
||||
if ($this->element['maxlength'])
|
||||
{
|
||||
$attributes['maxlength'] = (int) $this->element['maxlength'];
|
||||
}
|
||||
|
||||
if ($this->element['filterclass'])
|
||||
{
|
||||
$attributes['class'] = (string) $this->element['filterclass'];
|
||||
}
|
||||
|
||||
if ((string) $this->element['readonly'] == 'true')
|
||||
{
|
||||
$attributes['readonly'] = 'readonly';
|
||||
}
|
||||
|
||||
if ((string) $this->element['disabled'] == 'true')
|
||||
{
|
||||
$attributes['disabled'] = 'disabled';
|
||||
}
|
||||
|
||||
if ($this->element['onchange'])
|
||||
{
|
||||
$attributes['onchange'] = (string) $this->element['onchange'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$onchange = 'document.adminForm.submit()';
|
||||
}
|
||||
|
||||
if ((string) $this->element['placeholder'])
|
||||
{
|
||||
$attributes['placeholder'] = JText::_((string) $this->element['placeholder']);
|
||||
}
|
||||
|
||||
$name = $this->element['searchfieldname'] ? $this->element['searchfieldname'] : $this->name;
|
||||
|
||||
if ($this->element['searchfieldname'])
|
||||
{
|
||||
$model = $this->form->getModel();
|
||||
$searchvalue = $model->getState((string) $this->element['searchfieldname']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$searchvalue = $this->value;
|
||||
}
|
||||
|
||||
// Get some system objects.
|
||||
$config = F0FPlatform::getInstance()->getConfig();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// If a known filter is given use it.
|
||||
switch (strtoupper((string) $this->element['filter']))
|
||||
{
|
||||
case 'SERVER_UTC':
|
||||
// Convert a date to UTC based on the server timezone.
|
||||
if ((int) $this->value)
|
||||
{
|
||||
// Get a date object based on the correct timezone.
|
||||
$date = F0FPlatform::getInstance()->getDate($searchvalue, 'UTC');
|
||||
$date->setTimezone(new DateTimeZone($config->get('offset')));
|
||||
|
||||
// Transform the date string.
|
||||
$searchvalue = $date->format('Y-m-d H:i:s', true, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'USER_UTC':
|
||||
// Convert a date to UTC based on the user timezone.
|
||||
if ((int) $searchvalue)
|
||||
{
|
||||
// Get a date object based on the correct timezone.
|
||||
$date = F0FPlatform::getInstance()->getDate($this->value, 'UTC');
|
||||
$date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
|
||||
|
||||
// Transform the date string.
|
||||
$searchvalue = $date->format('Y-m-d H:i:s', true, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return JHtml::_('calendar', $searchvalue, $name, $name, $format, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the buttons HTML code
|
||||
*
|
||||
* @return string The HTML
|
||||
*/
|
||||
protected function getButtons()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
75
libraries/f0f/form/header/fieldfilterable.php
Normal file
75
libraries/f0f/form/header/fieldfilterable.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic field header, with text input (search) filter
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFieldfilterable extends F0FFormHeaderFieldsearchable
|
||||
{
|
||||
/**
|
||||
* Get the filter field
|
||||
*
|
||||
* @return string The HTML
|
||||
*/
|
||||
protected function getFilter()
|
||||
{
|
||||
$valide = array('yes', 'true', '1');
|
||||
|
||||
// Initialize some field(s) attributes.
|
||||
$size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
|
||||
$maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : '';
|
||||
$filterclass = $this->element['filterclass'] ? ' class="' . (string) $this->element['filterclass'] . '"' : '';
|
||||
$placeholder = $this->element['placeholder'] ? $this->element['placeholder'] : $this->getLabel();
|
||||
$name = $this->element['searchfieldname'] ? $this->element['searchfieldname'] : $this->name;
|
||||
$placeholder = ' placeholder="' . JText::_($placeholder) . '"';
|
||||
|
||||
$single = in_array($this->element['single'], $valide) ? true : false;
|
||||
$showMethod = in_array($this->element['showmethod'], $valide) ? true : false;
|
||||
$method = $this->element['method'] ? $this->element['method'] : 'between';
|
||||
$fromName = $this->element['fromname'] ? $this->element['fromname'] : 'from';
|
||||
$toName = $this->element['toname'] ? $this->element['toname'] : 'to';
|
||||
|
||||
$values = $this->form->getModel()->getState($name);
|
||||
$fromValue = $values[$fromName];
|
||||
$toValue = $values[$toName];
|
||||
|
||||
// Initialize JavaScript field attributes.
|
||||
if ($this->element['onchange'])
|
||||
{
|
||||
$onchange = ' onchange="' . (string) $this->element['onchange'] . '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$onchange = ' onchange="document.adminForm.submit();"';
|
||||
}
|
||||
|
||||
if ($showMethod)
|
||||
{
|
||||
$html = '<input type="text" name="' . $name . '[method]" value="'. $method . '" />';
|
||||
} else
|
||||
{
|
||||
$html = '<input type="hidden" name="' . $name . '[method]" value="'. $method . '" />';
|
||||
}
|
||||
|
||||
$html .= '<input type="text" name="' . $name . '[from]" id="' . $this->id . '_' . $fromName . '"' . ' value="'
|
||||
. htmlspecialchars($fromValue, ENT_COMPAT, 'UTF-8') . '"' . $filterclass . $size . $placeholder . $onchange . $maxLength . '/>';
|
||||
|
||||
if (!$single)
|
||||
{
|
||||
$html .= '<input type="text" name="' . $name . '[to]" id="' . $this->id . '_' . $toName . '"' . ' value="'
|
||||
. htmlspecialchars($toValue, ENT_COMPAT, 'UTF-8') . '"' . $filterclass . $size . $placeholder . $onchange . $maxLength . '/>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
85
libraries/f0f/form/header/fieldsearchable.php
Normal file
85
libraries/f0f/form/header/fieldsearchable.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic field header, with text input (search) filter
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFieldsearchable extends F0FFormHeaderField
|
||||
{
|
||||
/**
|
||||
* Get the filter field
|
||||
*
|
||||
* @return string The HTML
|
||||
*/
|
||||
protected function getFilter()
|
||||
{
|
||||
// Initialize some field attributes.
|
||||
$size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
|
||||
$maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : '';
|
||||
$filterclass = $this->element['filterclass'] ? ' class="' . (string) $this->element['filterclass'] . '"' : '';
|
||||
$placeholder = $this->element['placeholder'] ? $this->element['placeholder'] : $this->getLabel();
|
||||
$name = $this->element['searchfieldname'] ? $this->element['searchfieldname'] : $this->name;
|
||||
$placeholder = ' placeholder="' . JText::_($placeholder) . '"';
|
||||
|
||||
if ($this->element['searchfieldname'])
|
||||
{
|
||||
$model = $this->form->getModel();
|
||||
$searchvalue = $model->getState((string) $this->element['searchfieldname']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$searchvalue = $this->value;
|
||||
}
|
||||
|
||||
// Initialize JavaScript field attributes.
|
||||
if ($this->element['onchange'])
|
||||
{
|
||||
$onchange = ' onchange="' . (string) $this->element['onchange'] . '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$onchange = ' onchange="document.adminForm.submit();"';
|
||||
}
|
||||
|
||||
return '<input type="text" name="' . $name . '" id="' . $this->id . '"' . ' value="'
|
||||
. htmlspecialchars($searchvalue, ENT_COMPAT, 'UTF-8') . '"' . $filterclass . $size . $placeholder . $onchange . $maxLength . '/>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the buttons HTML code
|
||||
*
|
||||
* @return string The HTML
|
||||
*/
|
||||
protected function getButtons()
|
||||
{
|
||||
$buttonclass = $this->element['buttonclass'] ? (string) $this->element['buttonclass'] : 'btn hasTip hasTooltip';
|
||||
$buttonsState = strtolower($this->element['buttons']);
|
||||
$show_buttons = !in_array($buttonsState, array('no', 'false', '0'));
|
||||
|
||||
if (!$show_buttons)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$html = '';
|
||||
|
||||
$html .= '<button class="' . $buttonclass . '" onclick="this.form.submit();" title="' . JText::_('JSEARCH_FILTER') . '" >' . "\n";
|
||||
$html .= '<i class="icon-search"></i>';
|
||||
$html .= '</button>' . "\n";
|
||||
$html .= '<button class="' . $buttonclass . '" onclick="document.adminForm.' . $this->id . '.value=\'\';this.form.submit();" title="' . JText::_('JSEARCH_RESET') . '">' . "\n";
|
||||
$html .= '<i class="icon-remove"></i>';
|
||||
$html .= '</button>' . "\n";
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
109
libraries/f0f/form/header/fieldselectable.php
Normal file
109
libraries/f0f/form/header/fieldselectable.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic field header, with drop down filters
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFieldselectable extends F0FFormHeaderField
|
||||
{
|
||||
/**
|
||||
* Create objects for the options
|
||||
*
|
||||
* @return array The array of option objects
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
// Get the field $options
|
||||
foreach ($this->element->children() as $option)
|
||||
{
|
||||
// Only add <option /> elements.
|
||||
if ($option->getName() != 'option')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create a new option object based on the <option /> element.
|
||||
$options[] = JHtml::_(
|
||||
'select.option',
|
||||
(string) $option['value'],
|
||||
JText::alt(
|
||||
trim((string) $option),
|
||||
preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)
|
||||
),
|
||||
'value', 'text', ((string) $option['disabled'] == 'true')
|
||||
);
|
||||
}
|
||||
|
||||
// Do we have a class and method source for our options?
|
||||
$source_file = empty($this->element['source_file']) ? '' : (string) $this->element['source_file'];
|
||||
$source_class = empty($this->element['source_class']) ? '' : (string) $this->element['source_class'];
|
||||
$source_method = empty($this->element['source_method']) ? '' : (string) $this->element['source_method'];
|
||||
$source_key = empty($this->element['source_key']) ? '*' : (string) $this->element['source_key'];
|
||||
$source_value = empty($this->element['source_value']) ? '*' : (string) $this->element['source_value'];
|
||||
$source_translate = empty($this->element['source_translate']) ? 'true' : (string) $this->element['source_translate'];
|
||||
$source_translate = in_array(strtolower($source_translate), array('true','yes','1','on')) ? true : false;
|
||||
$source_format = empty($this->element['source_format']) ? '' : (string) $this->element['source_format'];
|
||||
|
||||
if ($source_class && $source_method)
|
||||
{
|
||||
// Maybe we have to load a file?
|
||||
if (!empty($source_file))
|
||||
{
|
||||
$source_file = F0FTemplateUtils::parsePath($source_file, true);
|
||||
|
||||
if (F0FPlatform::getInstance()->getIntegrationObject('filesystem')->fileExists($source_file))
|
||||
{
|
||||
include_once $source_file;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the class exists
|
||||
if (class_exists($source_class, true))
|
||||
{
|
||||
// ...and so does the option
|
||||
if (in_array($source_method, get_class_methods($source_class)))
|
||||
{
|
||||
// Get the data from the class
|
||||
if ($source_format == 'optionsobject')
|
||||
{
|
||||
$options = array_merge($options, $source_class::$source_method());
|
||||
}
|
||||
else
|
||||
{
|
||||
$source_data = $source_class::$source_method();
|
||||
|
||||
// Loop through the data and prime the $options array
|
||||
foreach ($source_data as $k => $v)
|
||||
{
|
||||
$key = (empty($source_key) || ($source_key == '*')) ? $k : $v[$source_key];
|
||||
$value = (empty($source_value) || ($source_value == '*')) ? $v : $v[$source_value];
|
||||
|
||||
if ($source_translate)
|
||||
{
|
||||
$value = JText::_($value);
|
||||
}
|
||||
|
||||
$options[] = JHtml::_('select.option', $key, $value, 'value', 'text');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reset($options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
62
libraries/f0f/form/header/fieldsql.php
Normal file
62
libraries/f0f/form/header/fieldsql.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic field header, with drop down filters based on a SQL query
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFieldsql extends F0FFormHeaderFieldselectable
|
||||
{
|
||||
/**
|
||||
* Create objects for the options
|
||||
*
|
||||
* @return array The array of option objects
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
// Initialize some field attributes.
|
||||
$key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
|
||||
$value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
|
||||
$translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
|
||||
$query = (string) $this->element['query'];
|
||||
|
||||
// Get the database object.
|
||||
$db = F0FPlatform::getInstance()->getDbo();
|
||||
|
||||
// Set the query and get the result list.
|
||||
$db->setQuery($query);
|
||||
$items = $db->loadObjectlist();
|
||||
|
||||
// Build the field options.
|
||||
if (!empty($items))
|
||||
{
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if ($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;
|
||||
}
|
||||
}
|
||||
28
libraries/f0f/form/header/filterdate.php
Normal file
28
libraries/f0f/form/header/filterdate.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic filter, text box entry with calendar button
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.3.3
|
||||
*/
|
||||
class F0FFormHeaderFilterdate extends F0FFormHeaderFielddate
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
28
libraries/f0f/form/header/filterfilterable.php
Normal file
28
libraries/f0f/form/header/filterfilterable.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic filter, text box entry with optional buttons
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFilterfilterable extends F0FFormHeaderFieldfilterable
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
28
libraries/f0f/form/header/filtersearchable.php
Normal file
28
libraries/f0f/form/header/filtersearchable.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic filter, text box entry with optional buttons
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFiltersearchable extends F0FFormHeaderFieldsearchable
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
28
libraries/f0f/form/header/filterselectable.php
Normal file
28
libraries/f0f/form/header/filterselectable.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic filter, drop-down based on fixed options
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFilterselectable extends F0FFormHeaderFieldselectable
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
28
libraries/f0f/form/header/filtersql.php
Normal file
28
libraries/f0f/form/header/filtersql.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Generic filter, drop-down based on SQL query
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderFiltersql extends F0FFormHeaderFieldsql
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
43
libraries/f0f/form/header/language.php
Normal file
43
libraries/f0f/form/header/language.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Language field header
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderLanguage extends F0FFormHeaderFieldselectable
|
||||
{
|
||||
/**
|
||||
* Method to get the filter options.
|
||||
*
|
||||
* @return array The filter option objects.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Initialize some field attributes.
|
||||
$client = (string) $this->element['client'];
|
||||
|
||||
if ($client != 'site' && $client != 'administrator')
|
||||
{
|
||||
$client = 'site';
|
||||
}
|
||||
|
||||
// Merge any additional options in the XML definition.
|
||||
$options = array_merge(
|
||||
parent::getOptions(), JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true, true)
|
||||
);
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
105
libraries/f0f/form/header/model.php
Normal file
105
libraries/f0f/form/header/model.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
if (!class_exists('JFormFieldSql'))
|
||||
{
|
||||
require_once JPATH_LIBRARIES . '/joomla/form/fields/sql.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Form Field class for F0F
|
||||
* Generic list from a model's results
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderModel extends F0FFormHeaderFieldselectable
|
||||
{
|
||||
/**
|
||||
* Method to get the field options.
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
// Initialize some field attributes.
|
||||
$key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
|
||||
$value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
|
||||
$applyAccess = $this->element['apply_access'] ? (string) $this->element['apply_access'] : 'false';
|
||||
$modelName = (string) $this->element['model'];
|
||||
$nonePlaceholder = (string) $this->element['none'];
|
||||
$translate = empty($this->element['translate']) ? 'true' : (string) $this->element['translate'];
|
||||
$translate = in_array(strtolower($translate), array('true','yes','1','on')) ? true : false;
|
||||
|
||||
if (!empty($nonePlaceholder))
|
||||
{
|
||||
$options[] = JHtml::_('select.option', null, JText::_($nonePlaceholder));
|
||||
}
|
||||
|
||||
// Process field atrtibutes
|
||||
$applyAccess = strtolower($applyAccess);
|
||||
$applyAccess = in_array($applyAccess, array('yes', 'on', 'true', '1'));
|
||||
|
||||
// Explode model name into model name and prefix
|
||||
$parts = F0FInflector::explode($modelName);
|
||||
$mName = ucfirst(array_pop($parts));
|
||||
$mPrefix = F0FInflector::implode($parts);
|
||||
|
||||
// Get the model object
|
||||
$config = array('savestate' => 0);
|
||||
$model = F0FModel::getTmpInstance($mName, $mPrefix, $config);
|
||||
|
||||
if ($applyAccess)
|
||||
{
|
||||
$model->applyAccessFiltering();
|
||||
}
|
||||
|
||||
// Process state variables
|
||||
foreach ($this->element->children() as $stateoption)
|
||||
{
|
||||
// Only add <option /> elements.
|
||||
if ($stateoption->getName() != 'state')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$stateKey = (string) $stateoption['key'];
|
||||
$stateValue = (string) $stateoption;
|
||||
|
||||
$model->setState($stateKey, $stateValue);
|
||||
}
|
||||
|
||||
// Set the query and get the result list.
|
||||
$items = $model->getItemList(true);
|
||||
|
||||
// Build the field options.
|
||||
if (!empty($items))
|
||||
{
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if ($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;
|
||||
}
|
||||
}
|
||||
73
libraries/f0f/form/header/ordering.php
Normal file
73
libraries/f0f/form/header/ordering.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Ordering field header
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderOrdering extends F0FFormHeader
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
$sortable = ($this->element['sortable'] != 'false');
|
||||
|
||||
$view = $this->form->getView();
|
||||
$model = $this->form->getModel();
|
||||
|
||||
$hasAjaxOrderingSupport = $view->hasAjaxOrderingSupport();
|
||||
|
||||
if (!$sortable)
|
||||
{
|
||||
// Non sortable?! I'm not sure why you'd want that, but if you insist...
|
||||
return JText::_('JGRID_HEADING_ORDERING');
|
||||
}
|
||||
|
||||
if (!$hasAjaxOrderingSupport)
|
||||
{
|
||||
// Ye olde Joomla! 2.5 method
|
||||
$html = JHTML::_('grid.sort', 'JFIELD_ORDERING_LABEL', 'ordering', $view->getLists()->order_Dir, $view->getLists()->order, 'browse');
|
||||
$html .= JHTML::_('grid.order', $model->getList());
|
||||
|
||||
return $html;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The new, drag'n'drop ordering support WITH a save order button
|
||||
$html = JHtml::_(
|
||||
'grid.sort',
|
||||
'<i class="icon-menu-2"></i>',
|
||||
'ordering',
|
||||
$view->getLists()->order_Dir,
|
||||
$view->getLists()->order,
|
||||
null,
|
||||
'asc',
|
||||
'JGRID_HEADING_ORDERING'
|
||||
);
|
||||
|
||||
$ordering = $view->getLists()->order == 'ordering';
|
||||
|
||||
if ($ordering)
|
||||
{
|
||||
$html .= '<a href="javascript:saveorder(' . (count($model->getList()) - 1) . ', \'saveorder\')" ' .
|
||||
'rel="tooltip" class="save-order btn btn-micro pull-right" title="' . JText::_('JLIB_HTML_SAVE_ORDER') . '">'
|
||||
. '<span class="icon-ok"></span></a>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
67
libraries/f0f/form/header/published.php
Normal file
67
libraries/f0f/form/header/published.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Field header for Published (enabled) columns
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderPublished extends F0FFormHeaderFieldselectable
|
||||
{
|
||||
/**
|
||||
* Create objects for the options
|
||||
*
|
||||
* @return array The array of option objects
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$config = array(
|
||||
'published' => 1,
|
||||
'unpublished' => 1,
|
||||
'archived' => 0,
|
||||
'trash' => 0,
|
||||
'all' => 0,
|
||||
);
|
||||
|
||||
$stack = array();
|
||||
|
||||
if ($this->element['show_published'] == 'false')
|
||||
{
|
||||
$config['published'] = 0;
|
||||
}
|
||||
|
||||
if ($this->element['show_unpublished'] == 'false')
|
||||
{
|
||||
$config['unpublished'] = 0;
|
||||
}
|
||||
|
||||
if ($this->element['show_archived'] == 'true')
|
||||
{
|
||||
$config['archived'] = 1;
|
||||
}
|
||||
|
||||
if ($this->element['show_trash'] == 'true')
|
||||
{
|
||||
$config['trash'] = 1;
|
||||
}
|
||||
|
||||
if ($this->element['show_all'] == 'true')
|
||||
{
|
||||
$config['all'] = 1;
|
||||
}
|
||||
|
||||
$options = JHtml::_('jgrid.publishedOptions', $config);
|
||||
|
||||
reset($options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
30
libraries/f0f/form/header/rowselect.php
Normal file
30
libraries/f0f/form/header/rowselect.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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('F0F_INCLUDED') or die;
|
||||
|
||||
/**
|
||||
* Row selection checkbox
|
||||
*
|
||||
* @package FrameworkOnFramework
|
||||
* @since 2.0
|
||||
*/
|
||||
class F0FFormHeaderRowselect extends F0FFormHeader
|
||||
{
|
||||
/**
|
||||
* Get the header
|
||||
*
|
||||
* @return string The header HTML
|
||||
*/
|
||||
protected function getHeader()
|
||||
{
|
||||
return '<input type="checkbox" name="checkall-toggle" value="" title="'
|
||||
. JText::_('JGLOBAL_CHECK_ALL')
|
||||
. '" onclick="Joomla.checkAll(this)" />';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user