All this document.write stuff is overkill when we already have checkForJavascript...
[squirrelmail.git] / plugins / calendar / functions.php
index d7cbb6b9bb5d9e915ab6de68461c3e5a195c58ef..e29617bad9b3dec9f48ba147f042fc778ce48b0a 100644 (file)
@@ -1,43 +1,44 @@
 <?php
 
 /**
- * functions.php
+ * Other calendar plugin functions.
  *
- * Copyright (c) 2002-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
- *
- * miscelenous functions.
- *
- * $Id$
+ * @copyright &copy; 2002-2007 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
  * @package plugins
  * @subpackage calendar
  */
 
 /**
+ * Adds second layer of calendar links to upper menu
  * @return void
  */
 function calendar_header() {
-    //Add Second layer ofCalendar links to upper menu
     global $color,$year,$day,$month;
 
     echo html_tag( 'table', '', '', $color[0], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) .
          html_tag( 'tr' ) .
          html_tag( 'td', '', 'left', '', 'width="100%"' );
 
-    displayInternalLink("plugins/calendar/calendar.php?year=$year&month=$month",_("Month View"),"right");
+    displayInternalLink("plugins/calendar/calendar.php?year=$year&amp;month=$month",_("Month View"),"right");
     echo "&nbsp;&nbsp;\n";
-    displayInternalLink("plugins/calendar/day.php?year=$year&month=$month&day=$day",_("Day View"),"right");
+    displayInternalLink("plugins/calendar/day.php?year=$year&amp;month=$month&amp;day=$day",_("Day View"),"right");
     echo "&nbsp;&nbsp;\n";
-    // displayInternalLink("plugins/calendar/event_create.php?year=$year&month=$month&day=$day",_("Add Event"),"right");
+    // displayInternalLink("plugins/calendar/event_create.php?year=$year&amp;month=$month&amp;day=$day",_("Add Event"),"right");
     // echo "&nbsp;&nbsp;\n";
     echo '</td></tr>';
 
 }
 
+/**
+ * Generates html option tags with length values
+ * 
+ * Hardcoded values from 0 minutes to 6 hours
+ * @param integer $selected selected option length
+ * @return void
+ */
 function select_option_length($selected) {
-
     $eventlength = array(
         '0' => _("0 min."),
         '15' => _("15 min."),
@@ -55,39 +56,52 @@ function select_option_length($selected) {
     );
 
     while( $bar = each($eventlength)) {
-        if($selected==$bar['key']){
-                echo '        <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
+        if($bar['key']==$selected){
+            echo '        <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
         } else {
-                echo '        <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
+            echo '        <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
         }
     }
 }
 
+/**
+ * Generates html option tags with minute values
+ *
+ * Hardcoded values in 5 minute intervals
+ * @param integer $selected selected value
+ * @return void
+ */
 function select_option_minute($selected) {
     $eventminute = array(
-    '00'=>'00',
-    '05'=>'05',
-    '10'=>'10',
-    '15'=>'15',
-    '20'=>'20',
-    '25'=>'25',
-    '30'=>'30',
-    '35'=>'35',
-    '40'=>'40',
-    '45'=>'45',
-    '50'=>'50',
-    '55'=>'55'
+        '00'=>'00',
+        '05'=>'05',
+        '10'=>'10',
+        '15'=>'15',
+        '20'=>'20',
+        '25'=>'25',
+        '30'=>'30',
+        '35'=>'35',
+        '40'=>'40',
+        '45'=>'45',
+        '50'=>'50',
+        '55'=>'55'
     );
 
     while ( $bar = each($eventminute)) {
-        if ($selected==$bar['key']){
-                echo '        <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
+        if ($bar['key']==$selected){
+            echo '        <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
         } else {
-                echo '        <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
+            echo '        <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
         }
     }
 }
 
+/**
+ * Generates html option tags with hour values
+ * @param integer $selected selected value
+ * @return void
+ * @todo 12/24 hour format
+ */
 function select_option_hour($selected) {
 
     for ($i=0;$i<24;$i++){
@@ -100,6 +114,11 @@ function select_option_hour($selected) {
     }
 }
 
+/**
+ * Generates html option tags with priority values
+ * @param integer $selected selected value
+ * @return void
+ */
 function select_option_priority($selected) {
     $eventpriority = array(
         '0' => _("Normal"),
@@ -107,14 +126,21 @@ function select_option_priority($selected) {
     );
 
     while( $bar = each($eventpriority)) {
-        if($selected==$bar['key']){
-                echo '        <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
+        if($bar['key']==$selected){
+            echo '        <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
         } else {
-                echo '        <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
+            echo '        <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
         }
     }
 }
 
+/**
+ * Generates html option tags with year values
+ * 
+ * Hardcoded values from 1902 to 2037
+ * @param integer $selected selected value
+ * @return void
+ */
 function select_option_year($selected) {
 
     for ($i=1902;$i<2038;$i++){
@@ -126,6 +152,11 @@ function select_option_year($selected) {
     }
 }
 
+/**
+ * Generates html option tags with month values
+ * @param integer $selected selected value
+ * @return void
+ */
 function select_option_month($selected) {
 
     for ($i=1;$i<13;$i++){
@@ -139,6 +170,13 @@ function select_option_month($selected) {
     }
 }
 
+/**
+ * Generates html option tags with day of month values
+ * 
+ * Hardcoded values from 1 to 31
+ * @param integer $selected selected value
+ * @return void
+ */
 function select_option_day($selected) {
 
     for ($i=1;$i<32;$i++){
@@ -151,4 +189,3 @@ function select_option_day($selected) {
     }
 }
 
-?>
\ No newline at end of file