public function html_wrapper_close() { // Should the widget include time picker? $timepicker = json_encode($this->timepicker); $html = <<<EOF \t\t\t<script type='text/javascript'> \t\t\t\t( function( \$ ) { \t\t\t\t\t\$( function() { \t\t\t\t\t\t\$( '.{$this->meta_name}[type=text]' ).datetimepicker( { \t\t\t\t\t\t\tformat: '{$this->date_format}', \t\t\t\t\t\t\ttimepicker:{$timepicker}, \t\t\t\t\t\t\tonChangeDateTime:function(dp, input){ \t\t\t\t\t\t\t\t// format must be: 'YYYY-MM-DDTHH:MM:SSZ' from '2014/11/21 04:00' \t\t\t\t\t\t\t\tvar currentDate = input.val() \t\t\t\t\t\t\t\t\t.replace(/(\\d{4})\\/(\\d{2})\\/(\\d{2}) (\\d{2}):(\\d{2})/,'\$1-\$2-\$3T\$4:\$5:00Z'); \t\t\t\t\t\t\t\t// store value to save in the hidden input field \t\t\t\t\t\t\t\t\$( '.{$this->meta_name}[type=hidden]' ).val( currentDate ); \t\t\t\t\t\t\t} \t\t\t\t\t\t}); \t\t\t\t\t} ); \t\t\t\t} ) ( jQuery ); \t\t\t</script> EOF; $html .= parent::html_wrapper_close(); return $html; }
public function __construct($args) { parent::__construct($args['sameas']); }