]> git.mjollnir.org Git - moodle.git/commitdiff
Improvements to print_date_selector, print_time_selector etc to allow them
authormoodler <moodler>
Mon, 27 Mar 2006 03:42:44 +0000 (03:42 +0000)
committermoodler <moodler>
Mon, 27 Mar 2006 03:42:44 +0000 (03:42 +0000)
to be returned as strings

lib/weblib.php

index 9ac524b239acbb1c1717539dc738bee78a374fb3..44afa07e2f424abd9cf7a554e8eed9350714a340 100644 (file)
@@ -3829,13 +3829,13 @@ function navmenulist($course, $sections, $modinfo, $isteacher, $strsection, $str
 /**
  * Prints form items with the names $day, $month and $year
  *
- * @param int $day ?
- * @param int $month ?
- * @param int $year ?
+ * @param string $day   fieldname
+ * @param string $month  fieldname
+ * @param string $year  fieldname
  * @param int $currenttime A default timestamp in GMT
- * @todo Finish documenting this function
+ * @param boolean $return 
  */
-function print_date_selector($day, $month, $year, $currenttime=0) {
+function print_date_selector($day, $month, $year, $currenttime=0, $return=false) {
 
     if (!$currenttime) {
         $currenttime = time();
@@ -3851,21 +3851,22 @@ function print_date_selector($day, $month, $year, $currenttime=0) {
     for ($i=2000; $i<=2010; $i++) {
         $years[$i] = $i;
     }
-    choose_from_menu($days,   $day,   $currentdate['mday'], '');
-    choose_from_menu($months, $month, $currentdate['mon'],  '');
-    choose_from_menu($years,  $year,  $currentdate['year'], '');
+    return choose_from_menu($days,   $day,   $currentdate['mday'], '', '', '0', $return)
+          .choose_from_menu($months, $month, $currentdate['mon'],  '', '', '0', $return)
+          .choose_from_menu($years,  $year,  $currentdate['year'], '', '', '0', $return);
+
 }
 
 /**
  *Prints form items with the names $hour and $minute
  *
- * @param ? $hour ?
- * @param ? $minute ?
+ * @param string $hour  fieldname
+ * @param string ? $minute  fieldname
  * @param $currenttime A default timestamp in GMT
- * @param int $step ?
- * @todo Finish documenting this function
+ * @param int $step minute spacing
+ * @param boolean $return 
  */
-function print_time_selector($hour, $minute, $currenttime=0, $step=5 ,$return=false) {
+function print_time_selector($hour, $minute, $currenttime=0, $step=5$return=false) {
 
     if (!$currenttime) {
         $currenttime = time();
@@ -3881,19 +3882,20 @@ function print_time_selector($hour, $minute, $currenttime=0, $step=5 ,$return=fa
         $minutes[$i] = sprintf("%02d",$i);
     }
 
-    return choose_from_menu($hours,   $hour,   $currentdate['hours'],   '','','',$return)
-        .choose_from_menu($minutes, $minute, $currentdate['minutes'], '','','',$return);
+    return choose_from_menu($hours,   $hour,   $currentdate['hours'],   '','','0',$return)
+          .choose_from_menu($minutes, $minute, $currentdate['minutes'], '','','0',$return);
 }
 
 /**
  * Prints time limit value selector
  *
  * @uses $CFG
- * @param int $timelimit ?
- * @param string $unit ?
- * @todo Finish documenting this function
+ * @param int $timelimit default
+ * @param string $unit 
+ * @param string $name 
+ * @param boolean $return 
  */
-function print_timer_selector($timelimit = 0, $unit = '', $name = 'timelimit') {
+function print_timer_selector($timelimit = 0, $unit = '', $name = 'timelimit', $return=false) {
 
     global $CFG;
 
@@ -3907,7 +3909,7 @@ function print_timer_selector($timelimit = 0, $unit = '', $name = 'timelimit') {
     for ($i=1; $i<=$maxvalue; $i++) {
         $minutes[$i] = $i.$unit;
     }
-    choose_from_menu($minutes, $name, $timelimit, get_string('none'));
+    return choose_from_menu($minutes, $name, $timelimit, get_string('none'), '','','0',$return);
 }
 
 /**