home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / calendar-2010-08-23.tar.gz / calendar-2010-08-23.tar / calendar / includes / sidebar.php < prev    next >
PHP Script  |  2003-10-12  |  17KB  |  381 lines

  1. <?php
  2. // Get the real date to display in the sidebar, not the date displayed in the calendar
  3. $really_unix_time = strtotime(date('Ymd'));
  4. $really_today_today = date ('Ymd', $really_unix_time);
  5.  
  6. if ($cal == $ALL_CALENDARS_COMBINED) {
  7.     $cal_displayname2 = $all_cal_comb_lang;
  8. } else {
  9.     $cal_displayname2 = $calendar_name . " $calendar_lang";
  10. }
  11. if (strlen($cal_displayname2) > 24) {
  12.     $cal_displayname2 = substr("$cal_displayname2", 0, 21);
  13.     $cal_displayname2 = $cal_displayname2 . "...";
  14. }
  15.     
  16. $search_box = '<form style="margin-bottom:0;" action="search.php" method="GET"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" style="font-size:10px" size="15" class="search_style" name="query" value="'.$search_lang.'" onfocus="javascript:if(this.value==\''.$search_lang.'\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\''.$search_lang.'\'}"><INPUT type="image" src="styles/'.$style_sheet.'/search.gif" name="submit" value="Search"></form>';
  17.  
  18. ?>
  19. <table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
  20.     <tr>
  21.         <td align="left" valign="top" width="24" class="sideback"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$yesterdays_date\"><img src=\"styles/$style_sheet/left_arrows.gif\" alt=\"[$prev_lang]\" width=\"16\" height=\"20\" border=\"0\" align=\"left\"></a>"; ?></td>
  22.         <td align="center" width="112" class="sideback"><font class="G10BOLD"><?php echo "$thisday2"; ?></font></td>
  23.         <td align="right" valign="top" width="24" class="sideback"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$tomorrows_date\"><img src=\"styles/$style_sheet/right_arrows.gif\" alt=\"[$next_lang]\" width=\"16\" height=\"20\" border=\"0\" align=\"right\"></a>"; ?></td>
  24.     </tr>
  25.     <tr>
  26.         <td colspan="3" bgcolor="#FFFFFF" align="left">
  27.             <?php 
  28.                 echo '<div style="padding: 5px;">';
  29.                 echo '<font class="G10BOLD">'.$cal_displayname2.'</font><br>';
  30.                 echo '<span class="G10">';
  31.                 echo "<a class=\"psf\" href=\"day.php?cal=$cal&getdate=$really_today_today\">$goday_lang</a><br>\n";
  32.                 echo "<a class=\"psf\" href=\"week.php?cal=$cal&getdate=$really_today_today\">$goweek_lang</a><br>\n";
  33.                 echo "<a class=\"psf\" href=\"month.php?cal=$cal&getdate=$really_today_today\">$gomonth_lang</a><br>\n";
  34.                 echo "<a class=\"psf\" href=\"year.php?cal=$cal&getdate=$really_today_today\">$goyear_lang</a><br>\n";
  35.                 echo "<a class=\"psf\" href=\"print.php?cal=$cal&getdate=$getdate&printview=$current_view\">$goprint_lang</a><br>\n";
  36.                 if ($allow_preferences != 'no') echo "<a class=\"psf\" href=\"preferences.php?cal=$cal&getdate=$getdate\">$preferences_lang</a><br>\n";
  37.                 if ($cal != $ALL_CALENDARS_COMBINED) echo "<a class=\"psf\" href=\"$subscribe_path\">$subscribe_lang</a> | <a class=\"psf\" href=\"$download_filename\">$download_lang</a>\n";
  38.                 echo '</span></div>';
  39.              ?>
  40.         </td>
  41.     </tr>
  42. </table>
  43. <img src="images/spacer.gif" width="1" height="10" alt=" "><br>
  44. <table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
  45.     <tr height="20">
  46.         <td align="center" class="sideback"><div style="height: 20px; margin-top: 3px;" class="G10BOLD"><?php echo "$jump_lang"; ?></div></td>
  47.     </tr>
  48.     <tr>
  49.         <td bgcolor="#FFFFFF" align="left">
  50.             <?php 
  51.             
  52.             echo '<div style="padding: 5px;">';
  53.             echo '<form style="margin-bottom:0;" action="day.php" method="GET">';
  54.             echo "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value+'$query');\">";
  55.             include('./functions/list_icals.php');
  56.             include('./functions/list_years.php');
  57.             include('./functions/list_months.php');
  58.             include('./functions/list_weeks.php');
  59.             echo '</form>';
  60.             if ($show_search == 'yes') {
  61.                 echo $search_box;
  62.             }
  63.             if ($display_custom_goto == "yes") {
  64.                 echo '<form style="margin-bottom:0;" action="day.php" method="GET">';
  65.                 echo '<input type="hidden" name="cal" value="'.urlencode($cal).'">';    
  66.                 echo '<input type="text" style="width:160px; font-size:10px" name="jumpto_day">';
  67.                 echo '<input type="submit" value="Go">';
  68.                 echo '</form>';
  69.             } 
  70.             echo '</div>';
  71.             ?>
  72.         </td>
  73.     </tr>
  74. </table>
  75. <img src="images/spacer.gif" width="1" height="10" alt=" "><br>
  76.     
  77. <?php if (isset($master_array[($tomorrows_date)]) && sizeof($master_array[($tomorrows_date)]) > 0) { ?>
  78. <table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
  79.     <tr height="20">
  80.         <td align="center" class="sideback"><div style="height: 20px; margin-top: 3px;" class="G10BOLD"><?php echo "$tomorrows_lang"; ?></div></td>
  81.     </tr>
  82.     <tr>
  83.         <td bgcolor="#FFFFFF" align="center">
  84.             <table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" width="100%">
  85.                 <tr>
  86.                     <td colspan="7"><img src="images/spacer.gif" width="21" height="6" alt=" "></td>
  87.                 </tr>
  88.                 
  89.                 <?php
  90.                     echo "<tr>\n";
  91.                     echo "<td width=\"1%\"><img src=\"images/spacer.gif\" width=\"4\" height=\"1\" alt=\" \"></td>";
  92.                     echo "<td colspan=\"6\" class=\"G10B\" align=\"left\">\n";
  93.                     foreach ($master_array[("$tomorrows_date")] as $event_times) {
  94.                         foreach ($event_times as $val) {
  95.                             $event_text = stripslashes(urldecode($val["event_text"]));
  96.                             $event_text = strip_tags($event_text, '<b><i><u>');
  97.                             if ($event_text != "") {    
  98.                                 $event_text2     = rawurlencode(addslashes($val["event_text"]));
  99.                                 $description     = addslashes(urlencode($val["description"]));
  100.                                 $event_start     = @$val["event_start"];
  101.                                 $event_end         = @$val["event_end"];
  102.                                 $event_start     = date ($timeFormat, @strtotime ("$event_start"));
  103.                                 $event_end         = date ($timeFormat, @strtotime ("$event_end"));
  104.                                 $calendar_name2    = addslashes($calendar_name);
  105.                                 $calendar_name2 = urlencode($calendar_name2);
  106.                                 $event_text = word_wrap($event_text, 21, $tomorrows_events_lines);
  107.                                 
  108.                                 if (!isset($val["event_start"])) { 
  109.                                     $event_start = $all_day_lang; 
  110.                                     $event_end = ''; 
  111.                                     openevent($calendar_name2, $event_start, 
  112.                                     $event_end, $val, $tomorrows_events_lines, 21, '<i>', '</i>', 'psf'); 
  113.                                     echo "<br>\n"; 
  114.                                 } else { 
  115.                                     openevent($calendar_name2, $event_start, 
  116.                                     $event_end, $val, $tomorrows_events_lines, 21, '<font class="G10B">• ', '</font>', 'psf'); 
  117.                                     echo "<br>\n"; 
  118.                                 }
  119.  
  120.  
  121.                                 
  122.                             }
  123.                         }
  124.                     }
  125.                     echo "</td>\n";
  126.                     echo "</tr>\n";
  127.                 ?>
  128.             </table>
  129.         </td>
  130.     </tr>
  131.     <tr>
  132.         <td colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="148" height="6" alt=" "></td>
  133.     </tr>
  134. </table>
  135. <img src="images/spacer.gif" width="1" height="10" alt=" "><br>
  136.  
  137. <?php } if ((isset($master_array['-2'])) && ($show_todos == 'yes')) { ?>
  138. <table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
  139.     <tr height="20">
  140.         <td align="center" width="98%" class="sideback"><div style="height: 20px; margin-top: 3px;" class="G10BOLD"><?php echo "$todo_lang"; ?></div></td>
  141.     </tr>
  142.     <tr>
  143.         <td bgcolor="#FFFFFF" align="center">
  144.             <table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" width="100%">
  145.                 <tr>
  146.                     <td colspan="7"><img src="images/spacer.gif" width="21" height="6" alt=" "></td>
  147.                 </tr>
  148.                 
  149.                 <?php
  150.                     echo "<tr>\n";
  151.                     echo "<td width=\"1%\"><img src=\"images/spacer.gif\" width=\"4\" height=\"1\" alt=\" \"></td>";
  152.                     echo "<td colspan=\"6\" class=\"G10B\" align=\"left\">\n";
  153.                     echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
  154.                     foreach ($master_array['-2'] as $vtodo_times) {
  155.                         foreach ($vtodo_times as $val) {
  156.                             $vtodo_text = stripslashes(urldecode($val["vtodo_text"]));
  157.                             if ($vtodo_text != "") {    
  158.                                 if (isset($val["description"])) { 
  159.                                     $description     = urldecode($val["description"]);
  160.                                 } else {
  161.                                     $description = ""; 
  162.                                 }
  163.                                 $completed_date = $val['completed_date'];
  164.                                 $status         = $val["status"];
  165.                                 $priority         = $val['priority'];
  166.                                 $start_date     = $val["start_date"];
  167.                                 $due_date         = $val['due_date'];
  168.                                 $vtodo_array     = array(
  169.                                     'cal'            => $calendar_name,
  170.                                     'completed_date'=> $completed_date,
  171.                                     'description'    => $description,
  172.                                     'due_date'        => $due_date,
  173.                                     'priority'        => $priority,
  174.                                     'start_date'    => $start_date,
  175.                                     'status'        => $status,
  176.                                     'vtodo_text'     => $vtodo_text);
  177.  
  178.                                 $vtodo_array     = base64_encode(serialize($vtodo_array));
  179.                                 
  180.                                 $vtodo_text     = word_wrap(strip_tags(str_replace('<br>',' ',$vtodo_text), '<b><i><u>'), 21, $tomorrows_events_lines);
  181.                                         $vtodo_link = "<a class=\"psf\" href=\"javascript:openTodoInfo('$vtodo_array')\">";
  182.                                 
  183.                                 if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) {
  184.                                     if ($show_completed == 'yes') {
  185.                                         $vtodo_text = "<S>$vtodo_text</S>";
  186.                                         echo "<tr><td>$vtodo_link<img src=\"images/completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
  187.                                         echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>$vtodo_link<font class=\"G10B\"> $vtodo_text</font></a></td></tr>\n";
  188.                                     }
  189.                                 } elseif (isset($val['priority']) && ($val['priority'] != 0) && ($val['priority'] <= 5)) {
  190.                                     echo "<tr><td>$vtodo_link<img src=\"images/important.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
  191.                                     echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>$vtodo_link<font class=\"G10B\"> $vtodo_text</font></a></td></tr>\n";
  192.                                 } else {
  193.                                     echo "<tr><td>$vtodo_link<img src=\"images/not_completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
  194.                                     echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>$vtodo_link<font class=\"G10B\"> $vtodo_text</font></a></td></tr>\n";
  195.                                 }
  196.                             }
  197.                         }
  198.                     }
  199.                     echo "</table>\n";
  200.                     echo "</td>\n";
  201.                     echo "</tr>\n";
  202.                 ?>
  203.             </table>
  204.         </td>
  205.     </tr>
  206.     <tr>
  207.         <td colspan="3" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="148" height="6" alt=" "></td>
  208.     </tr>
  209. </table>
  210. <img src="images/spacer.gif" width="1" height="10" alt=" "><br>
  211. <?php } 
  212.         $fake_getdate_time = strtotime($this_year.'-'.$this_month.'-15');
  213. ?>    
  214. <table width="170" border="0" cellpadding="3" cellspacing="0" class="calborder">
  215.     <tr height="20">
  216.         <td align="center" class="sideback"><font class="G10BOLD"><?php print (localizeDate ($dateFormat_month, strtotime("-1 month", $fake_getdate_time))); ?></font></td>
  217.     </tr>
  218.     <tr>
  219.         <td bgcolor="#FFFFFF" align="center">
  220.             <table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
  221.                 <?php
  222.                     $start_day = strtotime($week_start_day);
  223.                     echo '<tr>';
  224.                     for ($i=0; $i<7; $i++) {
  225.                         $day_num = date("w", $start_day);
  226.                         $day = $daysofweekreallyshort_lang[$day_num];
  227.                         echo '<td align="center" class="G10BOLD">'.$day.'</td>';
  228.                         $start_day = strtotime("+1 day", $start_day); 
  229.                     }
  230.                     echo '</tr>';
  231.                     $minical_time         = strtotime("-1 month", $fake_getdate_time);
  232.                     $minical_month         = date("m", $minical_time);
  233.                     $minical_year         = date("Y", $minical_time);
  234.                     $first_of_month     = $minical_year.$minical_month."01";
  235.                     $start_day             = strtotime(dateOfWeek($first_of_month, $week_start_day));
  236.                     $i                     = 0;
  237.                     $whole_month         = TRUE;
  238.                     $num_of_events         = 0;
  239.                     do {
  240.                         $day             = date ("j", $start_day);
  241.                         $daylink         = date ("Ymd", $start_day);
  242.                         $check_month     = date ("m", $start_day);
  243.                         if ($check_month != $minical_month) $day = '<font class="G10G">'.$day.'</font>';
  244.                         if ($i == 0) echo "<tr>\n";
  245.                         if (isset($master_array[("$daylink")]) && ($check_month == $minical_month)) {
  246.                             echo '<td width="22" align="center" class="G10B">';
  247.                             echo '<a class="ps2" href="'.$minical_view.'.php?cal='.$cal.'&getdate='.$daylink.'">'.$day.'</a>';
  248.                             echo '</td>';
  249.                         } else {
  250.                             echo '<td width="22" align="center" class="G10B">';
  251.                             echo '<a class="psf" href="'.$minical_view.'.php?cal='.$cal.'&getdate='.$daylink.'">'.$day.'</a>';
  252.                             echo '</td>';
  253.                         }
  254.                         $start_day = strtotime("+1 day", $start_day); 
  255.                         $i++;
  256.                         if ($i == 7) { 
  257.                             echo '</tr>';
  258.                             $i = 0;
  259.                             $checkagain = date ("m", $start_day);
  260.                             if ($checkagain != $minical_month) $whole_month = FALSE;    
  261.                         }
  262.                     } while ($whole_month == TRUE);
  263.                 ?>
  264.             </table>
  265.             <img src="images/spacer.gif" width="1" height="3" alt=" "><br>
  266.         </td>
  267.     </tr>
  268. </table>
  269. <img src="images/spacer.gif" width="1" height="10" alt=" "><br>
  270. <table width="170" border="0" cellpadding="3" cellspacing="0" class="calborder">
  271.     <tr height="20">
  272.         <td align="center" class="sideback"><font class="G10BOLD"><?php print (localizeDate ($dateFormat_month, strtotime($getdate))); ?></font></td>
  273.     </tr>
  274.     <tr>
  275.         <td bgcolor="#FFFFFF" align="center">
  276.             <table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
  277.                 <?php
  278.                     $start_day = strtotime($week_start_day);
  279.                     echo '<tr>';
  280.                     for ($i=0; $i<7; $i++) {
  281.                         $day_num = date("w", $start_day);
  282.                         $day = $daysofweekreallyshort_lang[$day_num];
  283.                         echo '<td align="center" class="G10BOLD">'.$day.'</td>';
  284.                         $start_day = strtotime("+1 day", $start_day); 
  285.                     }
  286.                     echo '</tr>';
  287.                     $minical_time         = $fake_getdate_time;
  288.                     $minical_month         = date("m", $minical_time);
  289.                     $minical_year         = date("Y", $minical_time);
  290.                     $first_of_month     = $minical_year.$minical_month."01";
  291.                     $start_day             = strtotime(dateOfWeek($first_of_month, $week_start_day));
  292.                     $i                     = 0;
  293.                     $whole_month         = TRUE;
  294.                     $num_of_events         = 0;
  295.                     do {
  296.                         $day             = date ("j", $start_day);
  297.                         $daylink         = date ("Ymd", $start_day);
  298.                         $check_month     = date ("m", $start_day);
  299.                         if ($check_month != $minical_month) $day = '<font class="G10G">'.$day.'</font>';
  300.                         if ($i == 0) echo "<tr>\n";
  301.                         if (isset($master_array[("$daylink")]) && ($check_month == $minical_month)) {
  302.                             echo '<td width="22" align="center" class="G10B">';
  303.                             echo '<a class="ps2" href="'.$minical_view.'.php?cal='.$cal.'&getdate='.$daylink.'">'.$day.'</a>';
  304.                             echo '</td>';
  305.                         } else {
  306.                             echo '<td width="22" align="center" class="G10B">';
  307.                             echo '<a class="psf" href="'.$minical_view.'.php?cal='.$cal.'&getdate='.$daylink.'">'.$day.'</a>';
  308.                             echo '</td>';
  309.                         }
  310.                         $start_day = strtotime("+1 day", $start_day); 
  311.                         $i++;
  312.                         if ($i == 7) { 
  313.                             echo '</tr>';
  314.                             $i = 0;
  315.                             $checkagain = date ("m", $start_day);
  316.                             if ($checkagain != $minical_month) $whole_month = FALSE;    
  317.                         }
  318.                     } while ($whole_month == TRUE);
  319.                 ?>
  320.             </table>
  321.             <img src="images/spacer.gif" width="1" height="3" alt=" "><br>
  322.         </td>
  323.     </tr>
  324. </table>
  325. <img src="images/spacer.gif" width="1" height="10" alt=" "><br>
  326. <table width="170" border="0" cellpadding="3" cellspacing="0" class="calborder">
  327.     <tr height="20">
  328.         <td align="center" class="sideback"><font class="G10BOLD"><?php print (localizeDate ($dateFormat_month, strtotime("+1 month", strtotime($getdate)))); ?></font></td>
  329.     </tr>
  330.     <tr>
  331.         <td bgcolor="#FFFFFF" align="center">
  332.             <table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
  333.                 <?php
  334.                     $start_day = strtotime($week_start_day);
  335.                     echo '<tr>';
  336.                     for ($i=0; $i<7; $i++) {
  337.                         $day_num = date("w", $start_day);
  338.                         $day = $daysofweekreallyshort_lang[$day_num];
  339.                         echo '<td align="center" class="G10BOLD">'.$day.'</td>';
  340.                         $start_day = strtotime("+1 day", $start_day); 
  341.                     }
  342.                     echo '</tr>';
  343.                     $minical_time         = strtotime("+1 month", $fake_getdate_time);
  344.                     $minical_month         = date("m", $minical_time);
  345.                     $minical_year         = date("Y", $minical_time);
  346.                     $first_of_month     = $minical_year.$minical_month."01";
  347.                     $start_day             = strtotime(dateOfWeek($first_of_month, $week_start_day));
  348.                     $i                     = 0;
  349.                     $whole_month         = TRUE;
  350.                     $num_of_events         = 0;
  351.                     do {
  352.                         $day             = date ("j", $start_day);
  353.                         $daylink         = date ("Ymd", $start_day);
  354.                         $check_month     = date ("m", $start_day);
  355.                         if ($check_month != $minical_month) $day = '<font class="G10G">'.$day.'</font>';
  356.                         if ($i == 0) echo "<tr>\n";
  357.                         if (isset($master_array[("$daylink")]) && ($check_month == $minical_month)) {
  358.                             echo '<td width="22" align="center" class="G10B">';
  359.                             echo '<a class="ps2" href="'.$minical_view.'.php?cal='.$cal.'&getdate='.$daylink.'">'.$day.'</a>';
  360.                             echo '</td>';
  361.                         } else {
  362.                             echo '<td width="22" align="center" class="G10B">';
  363.                             echo '<a class="psf" href="'.$minical_view.'.php?cal='.$cal.'&getdate='.$daylink.'">'.$day.'</a>';
  364.                             echo '</td>';
  365.                         }
  366.                         $start_day = strtotime("+1 day", $start_day); 
  367.                         $i++;
  368.                         if ($i == 7) { 
  369.                             echo '</tr>';
  370.                             $i = 0;
  371.                             $checkagain = date ("m", $start_day);
  372.                             if ($checkagain != $minical_month) $whole_month = FALSE;    
  373.                         }
  374.                     } while ($whole_month == TRUE);
  375.                 ?>
  376.             </table>
  377.             <img src="images/spacer.gif" width="1" height="3" alt=" "><br>
  378.         </td>
  379.     </tr>
  380. </table>
  381.