Plugin for Cotonti CMF. It replaces common date/time selection controls with unified pretty style jQueryUI controls.
Authors: Andrey Matsovkin (https://github.com/macik), Alexey Kalnov (https://github.com/Alex300)
GitHub: https://github.com/Alex300/ui_datetime
Current date/time selection controls are presented as several separated dropdown select box. Separate for year, month, day for date and hour, minutes for time. The plugin hides this controls and bring to user unified one input field for date and one field for time respectively. In addition this fields supplied with easy-to-use dropdown UI controls to selec date/time in one-click.
Current version uses:
Plugin must works out from the box. Tested on Nemesis
, HTML Kickstart
, SymiSun-03
themes and must work on most common themes or extension that uses standard date/time controls that relies on cot_selectbox_date
function and $R['input_date*']
resource strings.
But if your use highly customized theme or your custom resource strings ($R['input_date*']
) than extension may work uncorrectly.
Old style controls simply hides with inline styles but still work as input fields for transfer parameters to server (while you save the data). New fancy style UI controls use jQuery UI library and dynamically added in pages in specially marked DIV containers.
Simply it maked by changing controls template in resource strings $R['input_date']
and $R['input_date_short']
.
The default ui_date/time template for 'short' date is:
<div class="uidt_date">{$day} {$month} {$year}</div>
<div class="uidt_datetarget"></div>
(See ui_datetime.global.php
for details.)
Most part of magic happened after page loads. JS script searches for elements with uidt_date
and uidt_time
class then parse it and linked with new controls added in block with class uidt_datetarget
and uidt_timetarget
class respectively.
By default extension tracks controls only on these pages: add/edit page, edit users, user profile. You can switch on global mode
in settings for trace all controls on all pages, but it's not recommened because will load extension files all the time.
This implementation was relevant in older versions of Cotonti. In the modern versions, the cot_import_date()
function can parse string dates and convert them to an integer timestamp. Supported date and time formats: https://www.php.net/manual/en/datetime.formats.php
Administration panel → Extensions
)!Note: If you upgrade extension from version prior to 1.6.0 make full uninstall previous version through admin panel and install new one. Do not update it with «update» button, or be sure to check actual path for new timepicker library. After that you can delete old js time picker library time_pickr
(./js/time_pickr
- old folder for deletion. ./js/time_picker
is new one. Do not delete).
After install you can see and test extension on Admin → Tools page (Administration panel → Extensions → UI date/time picker → Administration
). You can Enable/Disable date and time controls separately via settings.
Bedankt: 74 tijden
Very nice plugin, macik.
Thanks.
Bedankt: 7 tijden
coll! tnanks!
Bedankt: 83 tijden
Идеально встало, только долго под свой диз сам css допиливал) Спасибо тезка!