• 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 
00038 //******************************************************************************
00050 function formatDate($timestampStart, $timestampEnd, $singleRotation)
00051 {
00052         
00053         $start = new TimestampToDate();
00054         $end = new TimestampToDate();
00055 
00056         $start->ttd( $timestampStart );
00057         $end->ttd( $timestampEnd );
00058                          
00059         if ($start->day_of_year == $end->day_of_year)
00060         {
00061                 // Start and End of date on the same day
00062                 // hour:minute-hour:minute day. month year
00063                 
00064                 $timestring =   "$start->hour_long:$start->minutes-$end->hour_long:$end->minutes 
00065                                                 $start->day_of_month. $start->monthname $start->year_long";
00066         }
00067         else
00068         {
00069                 if ( $start->monthnumber == $end->monthnumber)
00070                 {
00071                         // Start and End of date in the same month
00072                         // hour:minute-hour:minute
00073                         // day. - day. month year
00074                 
00075                         $timestring =   "$start->hour_long:$start->minutes-$end->hour_long:$end->minutes<br>
00076                                                          $start->day_of_month. - $end->day_of_month. $start->monthname $start->year_long";
00077                 }
00078                 else
00079                 {
00080                         // other cases
00081                         // hour:minute-hour:minute
00082                         // day. month year -
00083                         // day. month year
00084                         
00085                         $timestring =   "$start->hour_long:$start->minutes-$end->hour_long:$end->minutes<br>
00086                                                          $start->day_of_month. $start->monthname $end->year_long - <br>
00087                                                          $end->day_of_month. $end->monthname $start->year_long";
00088                 
00089                 }
00090         }
00091         if ($singleRotation)
00092         {
00093                 $timestring =   "$start->hour_long:$end->minutes-$end->hour_long:$end->minutes $end->day_of_month. $end->monthname $end->year_long";
00094                                 
00095         }
00096          
00097         
00098         return $timestring;
00099 }
00100 //******************************************************************************
00120 function createTable($Dates,$DateID, $Gui , $db, $mode)
00121 {
00122 global $DP_language;
00123 for ( $i = 0; $i < sizeof($Dates); $i++ )
00124 {
00125         if ( $Dates[$i][6] == 0 )
00126         {
00127                 // Not a single rotation date
00128                 $formattedtime = formatDate($Dates[$i][1], $Dates[$i][2], false);
00129         }
00130         else
00131         {
00132                 // single rotation date
00133                 $formattedtime = formatDate($Dates[$i][6], $Dates[$i][2], true);
00134         }
00135         
00136         $timestamp = $Dates[$i][6];
00137         $id = $Dates[$i][0];
00138         if ($mode != "0")
00139         {
00140                 // view for new and changed dates
00141                 
00142                 $col1 = "<input type='radio' name=$DateID value='ok-$id-$timestamp'>";
00143         }
00144         else
00145         {
00146                 // view for deleted dates
00147                 $col1 = "";
00148         }
00149         $col2 = "<input type='radio' name=$DateID value='del-$id-$timestamp'>";
00150         $col3 = "<input type='radio' checked name=$DateID value='noChange-$id-$timestamp'>";    
00151         $col4 = "$formattedtime";// Time / Date 
00152         $col5 = $Dates[$i][3];// Shorttext 
00153         $col6 = $db->getGroupName($Dates[$i][4]);// Groupname 
00154         
00155         if ( $Dates[$i][6] == 0 )
00156         {
00157                 // not a single rotation date   
00158                 switch ($Dates[$i][5])
00159                 {
00160                         // type of rotation
00161                         case 0:
00162                                 $col7 = $DP_language[r_nonrecurring];
00163                                 break;
00164                         case 1:
00165                                 $col7 = $DP_language[r_day];
00166                                 break;
00167                         case 2:
00168                                 $col7 = $DP_language[r_week];
00169                                 break;
00170                         case 3:
00171                                 $col7 = $DP_language[r_14];
00172                                 break;
00173                         case 4:
00174                                 $col7 = $DP_language[r_4_weeks];
00175                                 break;
00176                         case 5:
00177                                 $col7 = $DP_language[r_month];
00178                                 break;
00179                         case 6:
00180                                 $col7 = $DP_language[r_halfyear];
00181                                 break;
00182                         case 7:
00183                                 $col7 = $DP_language[r_year];
00184                                 break;
00185                         default:
00186                                 $col7 = " ";
00187                 }               
00188         }
00189         else
00190         {
00191                 // single rotation date
00192                 $col7 = $DP_language[singleDate];
00193                         
00194         }
00195         
00196                         
00197         eval ("\$Termine = \"".$Gui->getTemplate("inbox_dates")."\";");
00198         $x = $x.$Termine;       // attach row
00199         
00200         $DateID++;
00201 }
00202 $Termine = $x;
00203 $retArray = array($DateID, $Termine); 
00204 return $retArray;       
00205 }
00206 
00217 function getContent($DB)
00218 {
00219 
00220         global $DP_UId;
00221 
00222         // Get Dates from Database
00223         $newDates                       = $DB->getchangedDates($DP_UId, 0);
00224         $changedDates           = $DB->getchangedDates($DP_UId, 1);
00225         $deletedDates           = $DB->getchangedDates($DP_UId, 2);
00226 
00227         $DATE[0]=$newDates;
00228         $DATE[1]=$changedDates;
00229         $DATE[2]=$deletedDates;
00230         return $DATE;
00231 
00232 } // end func
00233 
00251 function setInboxView($Gui, $DB) 
00252 {
00253         global $DP_language, $DP_CSS, $_SESSION, $templatefolder , $actualtemplate;
00254 
00255         $DATE                   = getContent($DB);
00256         $newDates               = $DATE[0];
00257         $changedDates   = $DATE[1];
00258         $deletedDates   = $DATE[2];
00259 
00260         //*******************************************************************************************************
00261     $DateID = 0;
00262         // fill table with new dates 
00263         if ($newDates != false)
00264         {
00265                 
00266         $array  = createTable($newDates, $DateID, $Gui, $DB, 1);
00267         $DateID = $array[0];
00268         $neueTermine = $array[1];
00269                 eval ("\$tblhead_newdates = \"".$Gui->getTemplate("inbox_tblheadnewdates")."\";");
00270     }
00271     else
00272     {
00273         $neueTermine = "<tr class='tblrow2'><td align='center' colspan=7 >$DP_language[no_entry]</td></tr>";
00274     }
00275     
00276     //*******************************************************************************************************
00277     // fill table with changed dates 
00278     if ($changedDates != false)
00279     {
00280         $array  = createTable($changedDates,$DateID, $Gui, $DB, 1);
00281         $DateID = $array[0];
00282         $geaenderteTermine = $array[1];
00283                 eval ("\$tblhead_changeddates = \"".$Gui->getTemplate("inbox_tblheadchangeddates")."\";");
00284     }
00285     else
00286     {
00287                 $geaenderteTermine = "<tr class='tblrow2'><td align='center' colspan=7 >$DP_language[no_entry]</td></tr>";
00288     }
00289     //*******************************************************************************************************
00290     // fill table with deletet dates 
00291     if ($deletedDates != false)
00292     {
00293         $array  = createTable($deletedDates,$DateID, $Gui, $DB, 0);
00294         $DateID = $array[0];
00295         $geloeschteTermine = $array[1];
00296                 eval ("\$tblhead_deleteddates = \"".$Gui->getTemplate("inbox_tblheaddeleteddates")."\";");
00297     }
00298     else
00299     {
00300                 $geloeschteTermine = "<tr class='tblrow2'><td align='center' colspan=7 >$DP_language[no_entry]</td></tr>";
00301     }
00302     //*******************************************************************************************************
00303     $tableBorder = 1;
00304 
00305         if($tblhead_deleteddates or $tblhead_changeddates or $tblhead_newdates) {
00306                 eval ("\$execute = \"".$Gui->getTemplate("inbox_btnexecute")."\";");
00307         }
00308     
00309     eval ("\$centertxt = \"".$Gui->getTemplate("inbox_main")."\";");
00310     
00311         Return $centertxt;
00312 }
00313 ?>

Generated on Fri Dec 13 2013 13:52:06 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1