Source for file calendar.php
Documentation is available at calendar.php
* @package FrameworkOnFramework
* @copyright Copyright (C) 2010 - 2012 Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
// Protect from unauthorized access
require_once JPATH_LIBRARIES .
'/joomla/form/fields/calendar.php';
* Form Field class for the FOF framework
* Supports a calendar / date field.
* @package FrameworkOnFramework
/** @var FOFTable The item being rendered in a repeatable form field */
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
* 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.
public function __get($name)
// ATTENTION: Redirected getInput() to getStatic()
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).
* @return string The field HTML
* Get the rendering of this field type for a repeatable (grid) display,
* e.g. in a view listing many item (typically a "browse" task)
* @return string The field HTML
* Method to get the calendar input markup.
* @param string $display The display to render ('static' or 'repeatable')
* @return string The field input markup.
// Initialize some field attributes.
$format =
$this->element['format'] ? (string)
$this->element['format'] :
'%Y-%m-%d';
$class =
$this->element['class'] ? (string)
$this->element['class'] :
'';
// PHP date doesn't use percentages (%) for the format, but the calendar Javascript
// DOES use it (@see: calendar-uncompressed.js). Therefore we have to convert it.
// Get some system objects.
// If a known filter is given use it.
// Convert a date to UTC based on the server timezone.
// Get a date object based on the correct timezone.
$date->setTimezone(new DateTimeZone($config->get('offset')));
// Convert a date to UTC based on the user timezone.
// Get a date object based on the correct timezone.
$date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
// Transform the date string.
$this->value =
$date->format($formatPHP, true, false);
if ($display ==
'static')
// Build the attributes array.
$attributes['size'] = (int)
$this->element['size'];
$attributes['maxlength'] = (int)
$this->element['maxlength'];
$attributes['class'] = (string)
$this->element['class'];
if ((string)
$this->element['readonly'] ==
'true')
$attributes['readonly'] =
'readonly';
if ((string)
$this->element['disabled'] ==
'true')
$attributes['disabled'] =
'disabled';
$attributes['onchange'] = (string)
$this->element['onchange'];
$attributes['required'] =
'required';
$attributes['aria-required'] =
'true';
return JHtml::_('calendar', $this->value, $this->name, $this->id, $formatJS, $attributes);
return '<span class="' .
$this->id .
' ' .
$class .
'">' .
Documentation generated on Tue, 19 Nov 2013 14:54:59 +0100 by phpDocumentor 1.4.3