• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

calendar/includes/inc.inbox.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                                                                                       |
00005         |       Dateplaner Modul                                                                                                                  |                                                                                                     
00006         +-----------------------------------------------------------------------------+
00007         | Copyright (c) 2004 ILIAS open source & University of Applied Sciences Bremen|
00008         |                                                                             |
00009         | This program is free software; you can redistribute it and/or               |
00010         | modify it under the terms of the GNU General Public License                 |
00011         | as published by the Free Software Foundation; either version 2              |
00012         | of the License, or (at your option) any later version.                      |
00013         |                                                                             |
00014         | This program is distributed in the hope that it will be useful,             |
00015         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00016         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00017         | GNU General Public License for more details.                                |
00018         |                                                                             |
00019         | You should have received a copy of the GNU General Public License           |
00020         | along with this program; if not, write to the Free Software                 |
00021         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00022         +-----------------------------------------------------------------------------+
00023 */
00024 
00035 //******************************************************************************
00047 function formatDate($timestampStart, $timestampEnd, $singleRotation)
00048 {
00049         
00050         $start = new TimestampToDate();
00051         $end = new TimestampToDate();
00052 
00053         $start->ttd( $timestampStart );
00054         $end->ttd( $timestampEnd );
00055                          
00056         if ($start->day_of_year == $end->day_of_year)
00057         {
00058                 // Start and End of date on the same day
00059                 // hour:minute-hour:minute day. month year
00060                 
00061                 $timestring =   "$start->hour_long:$start->minutes-$end->hour_long:$end->minutes 
00062                                                 $start->day_of_month. $start->monthname $start->year_long";
00063         }
00064         else
00065         {
00066                 if ( $start->monthnumber == $end->monthnumber)
00067                 {
00068                         // Start and End of date in the same month
00069                         // hour:minute-hour:minute
00070                         // day. - day. month year
00071                 
00072                         $timestring =   "$start->hour_long:$start->minutes-$end->hour_long:$end->minutes<br>
00073                                                          $start->day_of_month. - $end->day_of_month. $start->monthname $start->year_long";
00074                 }
00075                 else
00076                 {
00077                         // other cases
00078                         // hour:minute-hour:minute
00079                         // day. month year -
00080                         // day. month year
00081                         
00082                         $timestring =   "$start->hour_long:$start->minutes-$end->hour_long:$end->minutes<br>
00083                                                          $start->day_of_month. $start->monthname $end->year_long - <br>
00084                                                          $end->day_of_month. $end->monthname $start->year_long";
00085                 
00086                 }
00087         }
00088         if ($singleRotation)
00089         {
00090                 $timestring =   "$start->hour_long:$end->minutes-$end->hour_long:$end->minutes $end->day_of_month. $end->monthname $end->year_long";
00091                                 
00092         }
00093          
00094         
00095         return $timestring;
00096 }
00097 //******************************************************************************
00117 function createTable($Dates,$DateID, $Gui , $db, $mode)
00118 {
00119 global $DP_language;
00120 for ( $i = 0; $i < sizeof($Dates); $i++ )
00121 {
00122         if ( $Dates[$i][6] == 0 )
00123         {
00124                 // Not a single rotation date
00125                 $formattedtime = formatDate($Dates[$i][1], $Dates[$i][2], false);
00126         }
00127         else
00128         {
00129                 // single rotation date
00130                 $formattedtime = formatDate($Dates[$i][6], $Dates[$i][2], true);
00131         }
00132         
00133         $timestamp = $Dates[$i][6];
00134         $id = $Dates[$i][0];
00135         if ($mode != "0")
00136         {
00137                 // view for new and changed dates
00138                 
00139                 $col1 = "<input type='radio' name=$DateID value='ok-$id-$timestamp'>";
00140         }
00141         else
00142         {
00143                 // view for deleted dates
00144                 $col1 = "";
00145         }
00146         $col2 = "<input type='radio' name=$DateID value='del-$id-$timestamp'>";
00147         $col3 = "<input type='radio' checked name=$DateID value='noChange-$id-$timestamp'>";    
00148         $col4 = "$formattedtime";// Time / Date 
00149         $col5 = $Dates[$i][3];// Shorttext 
00150         $col6 = $db->getGroupName($Dates[$i][4]);// Groupname 
00151         
00152         if ( $Dates[$i][6] == 0 )
00153         {
00154                 // not a single rotation date   
00155                 switch ($Dates[$i][5])
00156                 {
00157                         // type of rotation
00158                         case 0:
00159                                 $col7 = $DP_language[r_nonrecurring];
00160                                 break;
00161                         case 1:
00162                                 $col7 = $DP_language[r_day];
00163                                 break;
00164                         case 2:
00165                                 $col7 = $DP_language[r_week];
00166                                 break;
00167                         case 3:
00168                                 $col7 = $DP_language[r_14];
00169                                 break;
00170                         case 4:
00171                                 $col7 = $DP_language[r_4_weeks];
00172                                 break;
00173                         case 5:
00174                                 $col7 = $DP_language[r_month];
00175                                 break;
00176                         case 6:
00177                                 $col7 = $DP_language[r_halfyear];
00178                                 break;
00179                         case 7:
00180                                 $col7 = $DP_language[r_year];
00181                                 break;
00182                         default:
00183                                 $col7 = " ";
00184                 }               
00185         }
00186         else
00187         {
00188                 // single rotation date
00189                 $col7 = $DP_language[singleDate];
00190                         
00191         }
00192         
00193                         
00194         eval ("\$Termine = \"".$Gui->getTemplate("inbox_dates")."\";");
00195         $x = $x.$Termine;       // attach row
00196         
00197         $DateID++;
00198 }
00199 $Termine = $x;
00200 $retArray = array($DateID, $Termine); 
00201 return $retArray;       
00202 }
00203 
00214 function getContent($DB)
00215 {
00216 
00217         global $DP_UId;
00218 
00219         // Get Dates from Database
00220         $newDates                       = $DB->getchangedDates($DP_UId, 0);
00221         $changedDates           = $DB->getchangedDates($DP_UId, 1);
00222         $deletedDates           = $DB->getchangedDates($DP_UId, 2);
00223 
00224         $DATE[0]=$newDates;
00225         $DATE[1]=$changedDates;
00226         $DATE[2]=$deletedDates;
00227         return $DATE;
00228 
00229 } // end func
00230 
00248 function setInboxView($Gui, $DB) 
00249 {
00250         global $DP_language, $DP_CSS, $_SESSION, $templatefolder , $actualtemplate;
00251 
00252         $DATE                   = getContent($DB);
00253         $newDates               = $DATE[0];
00254         $changedDates   = $DATE[1];
00255         $deletedDates   = $DATE[2];
00256 
00257         //*******************************************************************************************************
00258     $DateID = 0;
00259         // fill table with new dates 
00260         if ($newDates != false)
00261         {
00262                 
00263         $array  = createTable($newDates, $DateID, $Gui, $DB, 1);
00264         $DateID = $array[0];
00265         $neueTermine = $array[1];
00266                 eval ("\$tblhead_newdates = \"".$Gui->getTemplate("inbox_tblheadnewdates")."\";");
00267     }
00268     else
00269     {
00270         $neueTermine = "<tr class='tblrow2'><td align='center' colspan=7 >$DP_language[no_entry]</td></tr>";
00271     }
00272     
00273     //*******************************************************************************************************
00274     // fill table with changed dates 
00275     if ($changedDates != false)
00276     {
00277         $array  = createTable($changedDates,$DateID, $Gui, $DB, 1);
00278         $DateID = $array[0];
00279         $geaenderteTermine = $array[1];
00280                 eval ("\$tblhead_changeddates = \"".$Gui->getTemplate("inbox_tblheadchangeddates")."\";");
00281     }
00282     else
00283     {
00284                 $geaenderteTermine = "<tr class='tblrow2'><td align='center' colspan=7 >$DP_language[no_entry]</td></tr>";
00285     }
00286     //*******************************************************************************************************
00287     // fill table with deletet dates 
00288     if ($deletedDates != false)
00289     {
00290         $array  = createTable($deletedDates,$DateID, $Gui, $DB, 0);
00291         $DateID = $array[0];
00292         $geloeschteTermine = $array[1];
00293                 eval ("\$tblhead_deleteddates = \"".$Gui->getTemplate("inbox_tblheaddeleteddates")."\";");
00294     }
00295     else
00296     {
00297                 $geloeschteTermine = "<tr class='tblrow2'><td align='center' colspan=7 >$DP_language[no_entry]</td></tr>";
00298     }
00299     //*******************************************************************************************************
00300     $tableBorder = 1;
00301 
00302         if($tblhead_deleteddates or $tblhead_changeddates or $tblhead_newdates) {
00303                 eval ("\$execute = \"".$Gui->getTemplate("inbox_btnexecute")."\";");
00304         }
00305     
00306     eval ("\$centertxt = \"".$Gui->getTemplate("inbox_main")."\";");
00307     
00308         Return $centertxt;
00309 }
00310 ?>

Generated on Fri Dec 13 2013 17:56:47 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1