From: <txm...@us...> - 2012-06-29 16:48:40
|
Revision: 9738 http://xoops.svn.sourceforge.net/xoops/?rev=9738&view=rev Author: txmodxoops Date: 2012-06-29 16:48:30 +0000 (Fri, 29 Jun 2012) Log Message: ----------- Added Class formdatepicker.php Added Paths: ----------- XoopsCore/tags/2.6 timgno/htdocs/class/xoopsform/formdatepicker.php Added: XoopsCore/tags/2.6 timgno/htdocs/class/xoopsform/formdatepicker.php =================================================================== --- XoopsCore/tags/2.6 timgno/htdocs/class/xoopsform/formdatepicker.php (rev 0) +++ XoopsCore/tags/2.6 timgno/htdocs/class/xoopsform/formdatepicker.php 2012-06-29 16:48:30 UTC (rev 9738) @@ -0,0 +1,68 @@ +<?php +/** + * XOOPS form datepicker + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage form + * @since 2.5.0 + * @author TXMod Xoops (AKA timgno) http://www.txmodxoops.org/ + * @version $Id: formdatepicker.php 9679 2012-06-19 01:18:38Z timgno $ + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * A text field with jquery ui calendar popup + */ + +class XoopsFormDatePicker extends XoopsFormText +{ + + function XoopsFormDatePicker($caption, $name, $size = 15, $value = 0) + { + $value = !is_numeric($value) ? time() : intval($value); + $value = ($value == 0) ? time() : $value; + $this->XoopsFormText($caption, $name, $size, 25, $value); + } + + function render() + { + static $included = false; + + $ele_name = $this->getName(); + $ele_value = $this->getValue(false); + if (is_string($ele_value)) { + $display_value = $ele_value; + $ele_value = time(); + } else { + $display_value = ''; + } + + //$jqtime = formatTimestamp($ele_value, _CAL_FORMAT); + if (is_object($GLOBALS['xoTheme'])) { + $GLOBALS['xoTheme']->addStylesheet( XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); + $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js'); + $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); + if (!$included) { + $included = true; + $GLOBALS['xoTheme']->addScript('','', ' + $(function() { + $( ".datepicker" ).datepicker(); + }); + '); + } + } + return "<input type='text' name='" . $ele_name . "' id='" . $ele_name . "' class='datepicker' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $display_value . "'" . $this->getExtra() . " /> + <input type='reset' name='" . $ele_name . "' value='" . _RESET . "'>"; + } +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |