| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Other calendar plugin functions. |
| 5 | * |
| 6 | * @copyright © 2002-2006 The SquirrelMail Project Team |
| 7 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 8 | * @version $Id$ |
| 9 | * @package plugins |
| 10 | * @subpackage calendar |
| 11 | */ |
| 12 | |
| 13 | /** |
| 14 | * Adds second layer of calendar links to upper menu |
| 15 | * @return void |
| 16 | */ |
| 17 | function calendar_header() { |
| 18 | global $color,$year,$day,$month; |
| 19 | |
| 20 | echo html_tag( 'table', '', '', $color[0], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) . |
| 21 | html_tag( 'tr' ) . |
| 22 | html_tag( 'td', '', 'left', '', 'width="100%"' ); |
| 23 | |
| 24 | displayInternalLink("plugins/calendar/calendar.php?year=$year&month=$month",_("Month View"),"right"); |
| 25 | echo " \n"; |
| 26 | displayInternalLink("plugins/calendar/day.php?year=$year&month=$month&day=$day",_("Day View"),"right"); |
| 27 | echo " \n"; |
| 28 | // displayInternalLink("plugins/calendar/event_create.php?year=$year&month=$month&day=$day",_("Add Event"),"right"); |
| 29 | // echo " \n"; |
| 30 | echo '</td></tr>'; |
| 31 | |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Generates html option tags with length values |
| 36 | * |
| 37 | * Hardcoded values from 0 minutes to 6 hours |
| 38 | * @param integer $selected selected option length |
| 39 | * @return void |
| 40 | */ |
| 41 | function select_option_length($selected) { |
| 42 | $eventlength = array( |
| 43 | '0' => _("0 min."), |
| 44 | '15' => _("15 min."), |
| 45 | '30' => _("30 min."), |
| 46 | '45' => _("45 min."), |
| 47 | '60' => _("1 hr."), |
| 48 | '90' => _("1.5 hr."), |
| 49 | '120' => _("2 hr."), |
| 50 | '150' => _("2.5 hr."), |
| 51 | '180' => _("3 hr."), |
| 52 | '210' => _("3.5 hr."), |
| 53 | '240' => _("4 hr."), |
| 54 | '300' => _("5 hr."), |
| 55 | '360' => _("6 hr.") |
| 56 | ); |
| 57 | |
| 58 | while( $bar = each($eventlength)) { |
| 59 | if($bar['key']==$selected){ |
| 60 | echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n"; |
| 61 | } else { |
| 62 | echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n"; |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Generates html option tags with minute values |
| 69 | * |
| 70 | * Hardcoded values in 5 minute intervals |
| 71 | * @param integer $selected selected value |
| 72 | * @return void |
| 73 | */ |
| 74 | function select_option_minute($selected) { |
| 75 | $eventminute = array( |
| 76 | '00'=>'00', |
| 77 | '05'=>'05', |
| 78 | '10'=>'10', |
| 79 | '15'=>'15', |
| 80 | '20'=>'20', |
| 81 | '25'=>'25', |
| 82 | '30'=>'30', |
| 83 | '35'=>'35', |
| 84 | '40'=>'40', |
| 85 | '45'=>'45', |
| 86 | '50'=>'50', |
| 87 | '55'=>'55' |
| 88 | ); |
| 89 | |
| 90 | while ( $bar = each($eventminute)) { |
| 91 | if ($bar['key']==$selected){ |
| 92 | echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n"; |
| 93 | } else { |
| 94 | echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n"; |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Generates html option tags with hour values |
| 101 | * @param integer $selected selected value |
| 102 | * @return void |
| 103 | * @todo 12/24 hour format |
| 104 | */ |
| 105 | function select_option_hour($selected) { |
| 106 | |
| 107 | for ($i=0;$i<24;$i++){ |
| 108 | ($i<10)? $ih = "0" . $i : $ih = $i; |
| 109 | if ($ih==$selected){ |
| 110 | echo ' <option value="'.$ih.'" selected="selected">'.$i."</option>\n"; |
| 111 | } else { |
| 112 | echo ' <option value="'.$ih.'">'.$i."</option>\n"; |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Generates html option tags with priority values |
| 119 | * @param integer $selected selected value |
| 120 | * @return void |
| 121 | */ |
| 122 | function select_option_priority($selected) { |
| 123 | $eventpriority = array( |
| 124 | '0' => _("Normal"), |
| 125 | '1' => _("High"), |
| 126 | ); |
| 127 | |
| 128 | while( $bar = each($eventpriority)) { |
| 129 | if($bar['key']==$selected){ |
| 130 | echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n"; |
| 131 | } else { |
| 132 | echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n"; |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Generates html option tags with year values |
| 139 | * |
| 140 | * Hardcoded values from 1902 to 2037 |
| 141 | * @param integer $selected selected value |
| 142 | * @return void |
| 143 | */ |
| 144 | function select_option_year($selected) { |
| 145 | |
| 146 | for ($i=1902;$i<2038;$i++){ |
| 147 | if ($i==$selected){ |
| 148 | echo ' <option value="'.$i.'" selected="selected">'.$i."</option>\n"; |
| 149 | } else { |
| 150 | echo ' <option value="'.$i.'">'.$i."</option>\n"; |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Generates html option tags with month values |
| 157 | * @param integer $selected selected value |
| 158 | * @return void |
| 159 | */ |
| 160 | function select_option_month($selected) { |
| 161 | |
| 162 | for ($i=1;$i<13;$i++){ |
| 163 | $im=date('m',mktime(0,0,0,$i,1,1)); |
| 164 | $is = getMonthAbrv( date('m',mktime(0,0,0,$i,1,1)) ); |
| 165 | if ($im==$selected){ |
| 166 | echo ' <option value="'.$im.'" selected="selected">'.$is."</option>\n"; |
| 167 | } else { |
| 168 | echo ' <option value="'.$im.'">'.$is."</option>\n"; |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Generates html option tags with day of month values |
| 175 | * |
| 176 | * Hardcoded values from 1 to 31 |
| 177 | * @param integer $selected selected value |
| 178 | * @return void |
| 179 | */ |
| 180 | function select_option_day($selected) { |
| 181 | |
| 182 | for ($i=1;$i<32;$i++){ |
| 183 | ($i<10)? $ih="0".$i : $ih=$i; |
| 184 | if ($i==$selected){ |
| 185 | echo ' <option value="'.$ih.'" selected="selected">'.$i."</option>\n"; |
| 186 | } else { |
| 187 | echo ' <option value="'.$ih.'">'.$i."</option>\n"; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |