functions.php 5.5 KB

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