functions.php 5.2 KB

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