.. php:namespace:: Nos
.. php:class:: Renderer_Datetime_Picker | Extends :php:class:`Nos\\Renderer`. | This renderer is used to pick a date and time. | It's based on `jQuery UI Date Time Picker addon <http://trentrichardson.com/examples/timepicker/>`__.
.. php:attr:: wrapper HTML string to wrap the ``<input>`` + the generated image to open the datetimepicker
.. php:attr:: format (Default: ``datetime``). Format saved and displayed : ``date`` or ``datetime`` .. versionadded:: chiba.2.2
.. php:attr:: null_allowed (Default: ``false``). Set to ``true`` if the date can be null. .. versionadded:: chiba.2.3
.. php:attr:: datetimepicker Options for the datepicker widget used to render the UI. See the `jQuery UI documentation <http://api.jqueryui.com/datepicker/>`__ for all available options. .. Strange syntax here, we need a dummy text and double-indentation for :labels: to keep the case Default values below: :showOn: both :buttonImage: static/novius-os/admin/novius-os/img/icons/date-picker.png :buttonImageOnly: true :autoSize: true :hiddenTimeFormat: HH:mm:ss :hiddenDateFormat: yy-mm-dd :dateFormat: HH:mm:ss :timeFormat: HH:mm :dateFormat: dd/mm/yy :altFieldTimeOnly: false :showButtonPanel: true :changeMonth: true :changeYear: true :showOtherMonths: true :selectOtherMonths: true :gotoCurrent: true :firstDay: 1 :showAnim: slideDown
.. php:attr:: mysql_input_format (Datetime default: %Y-%m-%d %H:%M:%S, Date default: %Y-%m-%d). Defines how to decode input value .. versionadded:: chiba.2.2
.. php:attr:: mysql_store_format (Datetime default: mysql, Date default: mysql_date). Defines how to store value in the database .. versionadded:: chiba.2.2
.. php:attr:: plugin (Datetime default: datetimepicker, Date default: datepicker). Defines which jquery ui plugin to call on the form input .. versionadded:: chiba.2.2
.. php:method:: renderer($renderer) :param Model $renderer: HTML attributes (``name``, ``class``, ``id``, ``value``, etc.), with a special key ``renderer_options`` :return: The <input> tag with JavaScript to initialise it Displays a date time picker in a standalone manner.
Adding a date time picker in a CRUD form configuration:
<?php
return array(
'label' => '',
'renderer' => 'Nos\Renderer_Datetime_Picker',
'renderer_options' => array(
'datepicker' => array(),
'wrapper' => '<div class="datetimepicker-customwrapper"></div>',
),
);
Displaying a date time picker:
<?php
echo Nos\Renderer_Datetime_Picker::renderer(array(
'name' => 'my_datetime',
'class' => 'some_class',
'value' => '2013-02-13',
'renderer_options' => array(
'datetimepicker' => array(),
'wrapper' => '<div class="datetimepicker-customwrapper"></div>',
),
));