Timepicker

pokemon 10 Sep, 2010
How can I use the 'Opening time'-timepicker of Watchman? Where can I find the code?
GreyHead 10 Sep, 2010
Hi pokemon,

The images, javascript and css are in the administrator/components/com_chronocontact/assets/timespinner folder.

The code is more or less this
<input type='text' name='time' id='time' value='' />
<?php
if ( !$mainframe->isSite() ) { return; }
        $start = 0;
        if ( $selected ) {
            $time_array = explode(':', $selected);
            $start = $time_array[0] * 60 + $time_array[1];
        }
        $script = "
            window.addEvent('domready', function() {
                var spinner1 = new TimeSpinner($('time'), {
                    $config
                },
                $start );
            });
            ";
        $doc =& JFactory::getDocument();
        $doc->addScriptDeclaration($script);
        $doc->addScript(JURI::base().'administrator/components/com_chronocontact/assets/timespinner/timespinner.js');
        $doc->addStylesheet(JURI::base().'administrator/components/com_chronocontact/assets/timespinner/timespinner.css');
?>
This has been put together from various bits and pieces and probably needs debugging. The Timespinner docs and code are here.

Bob
pokemon 12 Sep, 2010
This seems to work so far(I didn't test the databaseconnection yet). Thanks for the code.
This topic is locked and no more replies can be posted.