/[cvs]/nfo/php/libs/net.php.smarty/plugins/function.html_select_time.php
ViewVC logotype

Diff of /nfo/php/libs/net.php.smarty/plugins/function.html_select_time.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by cvsjoko, Wed Oct 9 00:53:36 2002 UTC revision 1.2 by joko, Wed Jun 16 21:58:16 2004 UTC
# Line 1  Line 1 
1  <?php  <?php
2    /**
 /*  
3   * Smarty plugin   * Smarty plugin
4   * -------------------------------------------------------------   * @package Smarty
5   * Type:     function   * @subpackage plugins
6   * Name:     html_select_time   */
7    
8    
9    /**
10     * Smarty {html_select_time} function plugin
11     *
12     * Type:     function<br>
13     * Name:     html_select_time<br>
14   * Purpose:  Prints the dropdowns for time selection   * Purpose:  Prints the dropdowns for time selection
15   * -------------------------------------------------------------   * @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time}
16     *          (Smarty online manual)
17     * @param array
18     * @param Smarty
19     * @return string
20     * @uses smarty_make_timestamp()
21   */   */
 require_once $this->_get_plugin_filepath('shared','make_timestamp');  
 require_once $this->_get_plugin_filepath('function','html_options');  
22  function smarty_function_html_select_time($params, &$smarty)  function smarty_function_html_select_time($params, &$smarty)
23  {  {
24        require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
25        require_once $smarty->_get_plugin_filepath('function','html_options');
26      /* Default values. */      /* Default values. */
27      $prefix             = "Time_";      $prefix             = "Time_";
28      $time               = time();      $time               = time();
# Line 33  function smarty_function_html_select_tim Line 44  function smarty_function_html_select_tim
44      $second_extra       = null;      $second_extra       = null;
45      $meridian_extra     = null;      $meridian_extra     = null;
46    
47      extract($params);      foreach ($params as $_key=>$_value) {
48            switch ($_key) {
49                case 'prefix':
50                case 'time':
51                case 'field_array':
52                case 'all_extra':
53                case 'hour_extra':
54                case 'minute_extra':
55                case 'second_extra':
56                case 'meridian_extra':
57                    $$_key = (string)$_value;
58                    break;
59    
60                case 'display_hours':
61                case 'display_minutes':
62                case 'display_seconds':
63                case 'display_meridian':
64                case 'use_24_hours':
65                    $$_key = (bool)$_value;
66                    break;
67    
68                case 'minute_interval':
69                case 'second_interval':
70                    $$_key = (int)$_value;
71                    break;
72    
73                default:
74                    $smarty->trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING);
75            }
76        }
77    
78      $time = smarty_make_timestamp($time);      $time = smarty_make_timestamp($time);
79    
# Line 144  function smarty_function_html_select_tim Line 184  function smarty_function_html_select_tim
184          $html_result .= "</select>\n";          $html_result .= "</select>\n";
185      }      }
186    
187      print $html_result;      return $html_result;
188  }  }
189    
190  /* vim: set expandtab: */  /* vim: set expandtab: */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed