Smarty
[ class tree: Smarty ] [ index: Smarty ] [ all elements ]

Source for file function.jscalendar.php

Documentation is available at function.jscalendar.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9.  * Smarty {jscalendar} plugin
  10.  *
  11.  * Type:     function<br>
  12.  * Name:     jscalendar<br>
  13.  * Purpose:  Prints the dropdowns for date selection.
  14.  *
  15.  * ChangeLog:<br>
  16.  *           - 1.0 initial release
  17.  * @version 1.0
  18.  * @author   Stephan Borg
  19.  * @param array 
  20.  * @param Smarty 
  21.  * @return string 
  22. */
  23. function smarty_function_jscalendar($params&$gBitSmarty{
  24.     global $gBitSystem;
  25.     if$gBitSystem->isFeatureActive'site_use_jscalendar' ) ) {
  26.  
  27.         // Default values
  28.         $inputField   '';      // ID of the input field
  29.         $fieldFormat  '%s';    // format of the input field
  30.         $electric     'false'// ID of the span where the date is to be shown
  31.         $time         time();  // override the currently set date
  32.         $onUpdate     '';      // execute the following javascript function when a link is pressed
  33.         $daFormat     $gBitSystem->getConfig'site_short_date_format' ).' '.$gBitSystem->getConfig'site_short_time_format' )// format of output date
  34.         $displayArea  '';
  35.  
  36.         // override default values
  37.         extract$params );
  38.  
  39.         $time $gBitSystem->mServerTimestamp->getDisplayDateFromUTC$time );
  40.         $time strftime"%m/%d/%Y %H:%M"$time );
  41.  
  42.         if$readonly {
  43.             $html_result $time;
  44.         else {
  45.             $html_result =
  46.                 "<script type=\"text/javascript\">//<![CDATA[
  47.                     Calendar.setup({
  48.                         date        : \"$time\",
  49.                         inputField  : \"$inputField\",
  50.                         ifFormat    : \"$fieldFormat\",
  51.                         daFormat    : \"$daFormat\",
  52.                         displayArea : \"$displayArea\",
  53.                         electric    : $electric,
  54.                         onUpdate    : $onUpdate
  55.                     });
  56.                 //]]></script>"
  57.             ;
  58.         }
  59.  
  60.         return $html_result;
  61.     else {
  62.         return '';
  63.     }
  64. }
  65. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:38 +0000 by phpDocumentor 1.5.0-lsces