Namespaces | Functions

calendar/includes/inc.week.php File Reference

Go to the source code of this file.

Namespaces

namespace  dateplaner
 

Database Class.


Functions

 setNavigation ($timestamp, $rowSpan)
 void function setNavigation($timestamp,$rowSpan) set variables in the setNavigation of week
 setDateInTblHead ($timestamp)
 void function setDateInTblHead($timestamp) set the Stings for the date format in the week view at the table top
 getContent ($begin_ts, $end_ts, $DB)
 function getContent($begin_ts, $end_ts) get Content for the Week View from the sortdates functions
 setDatesInWeek ($date_ts, $Dates, $day_ts, $row_height, &$style)
 void function setDatesInWeek($date_ts, $Dates, $row_height, &$style) set the Output for normal Dates into the Week view
 setDayDatesInWeek ($date_ts, $Dates, $row_height, &$style)
 void function setDayDatesInWeek($date_ts, $Dates, $row_height, &$style) set the Output for one Day Dates into the Week view
 setWeekView ($week_ts, $DB)
 void function setWeekView($week_ts, $DB) the Main function of the week view called from the executed file

Function Documentation

getContent ( begin_ts,
end_ts,
DB 
)

function getContent($begin_ts, $end_ts) get Content for the Week View from the sortdates functions

Parameters:
int $begin_ts
int $end_ts
int $DB (object of th db class ) string $DP_UId ( current User ID ) Array $DP_Keywords ( current Keywords)
Returns:
Array [][][] $DATE [0] $Dates ( normal Dates ) [1] $WholeDates ( one day Dates )

Definition at line 121 of file inc.week.php.

References $_SESSION, $DB, $DP_UId, getDateList(), and getWholeDayDateList().

{

        global $DP_UId , $_SESSION ;

        $Dates                          = getDateList ($DP_UId, $begin_ts, $end_ts, $_SESSION[DP_Keywords], $DB);
        $WholeDates                     = getWholeDayDateList ($DP_UId, $begin_ts, $end_ts, $_SESSION[DP_Keywords], $DB);
        $DATE[0]=$Dates;
        $DATE[1]=$WholeDates;
        return $DATE;

} // end func

Here is the call graph for this function:

setDateInTblHead ( timestamp  ) 

void function setDateInTblHead($timestamp) set the Stings for the date format in the week view at the table top

Parameters:
int $timestamp
Returns:
string $S_Datum

Definition at line 71 of file inc.week.php.

References $S_Datum.

{
        $ttd                    = new TimestampToDate;

        $ttd->ttd($timestamp);

        $S_Datum[monday_full]           = $ttd->shorttime ;
        $S_Datum[monday_link]           = $timestamp ;
        $S_Datum[week]                          = $ttd->weeknumber;

        $ttd->ttd(strtotime ("+1 day" , $timestamp));
        $S_Datum[tuesday_full]          = $ttd->shorttime ;
        $S_Datum[tuesday_link]          = strtotime ("+1 day" , $timestamp) ;

        $ttd->ttd(strtotime ("+2 day" , $timestamp));
        $S_Datum[wednesday_full]        = $ttd->shorttime ;
        $S_Datum[wednesday_link]        = strtotime ("+2 day" , $timestamp) ;

        $ttd->ttd(strtotime ("+3 day" , $timestamp));
        $S_Datum[thursday_full]         = $ttd->shorttime ;
        $S_Datum[thursday_link]         = strtotime ("+3 day" , $timestamp) ;

        $ttd->ttd(strtotime ("+4 day" , $timestamp));
        $S_Datum[friday_full]           = $ttd->shorttime ;
        $S_Datum[friday_link]           = strtotime ("+4 day" , $timestamp) ;

        $ttd->ttd(strtotime ("+5 day" , $timestamp));
        $S_Datum[saturday_full]         = $ttd->shorttime ;
        $S_Datum[saturday_link]         = strtotime ("+5 day" , $timestamp) ;

        $ttd->ttd(strtotime ("+6 day" , $timestamp));
        $S_Datum[sunday_full]           = $ttd->shorttime ;
        $S_Datum[sunday_link]           = strtotime ("+6 day" , $timestamp) ;

        Return  $S_Datum; 

} // end func

setDatesInWeek ( date_ts,
Dates,
day_ts,
row_height,
&$  style 
)

void function setDatesInWeek($date_ts, $Dates, $row_height, &$style) set the Output for normal Dates into the Week view

Parameters:
int $date_ts
int $day_ts ( Day Timestamp )
Array $Dates ( Date Data )
string $style ( to format rows, control variable )
string $row_height ( to format the height of rows, control variable ) Array $DP_language ( include Languageproperties ) Array $_SESSION ( DP_JSscript is 0 if JavaScript disabled )
Returns:
string $week_float ( contains the output )

Definition at line 146 of file inc.week.php.

References $_SESSION, $DP_CSS, $DP_language, $Gui, $id, and $week_float.

{

                global $DP_language, $DP_CSS, $_SESSION;

                $ttd = new TimestampToDate;
                $Gui = new Gui();

                $datesperhalfhourmax    = 4 ; // max dates in a day
                $shorttextmax                   = 10; // max lenght of shorttext in normal dates
                $today_style                    = $DP_CSS[tblrow1];

                $ttd->ttd($date_ts);
                $day = $ttd->day_of_month ;

                $week_float = $week_float."<td width=\"11%\" height=\"".$row_height."%\" style=\"border-style: solid;  border-width: 1 \"  ";

                // if today change background
                if ($date_ts >=  mktime(0,0,0) and $date_ts <=  mktime(23,59,59)) 
                {
                        $week_float = $week_float.$today_style."  >";
                }
                else 
                {
                        $week_float = $week_float.$style.">";
                }

                // filter Dates of the day out of the array
                $datebeginend_ts = strtotime ("+30 minutes", $date_ts); 
                for ($i=0;$i< count($Dates);$i++) 
                {
                        if ($Dates[$i][1] >= $date_ts and $Dates[$i][1] < $datebeginend_ts)  
                        {
                                $datesperhalfhour++;
                                $ttd->ttd($Dates[$i][1]);
                                // count sting lenght
                                if (strlen ($Dates[$i][5]) >= $shorttextmax) 
                                {
                                        $shortext = substr($Dates[$i][5], 0, $shorttextmax)." .."; 
                                }
                                else 
                                {
                                        $shortext = $Dates[$i][5];
                                }
                                $starttime      = $ttd->hour_long.":".$ttd->minutes ;

                                $ttd->ttd($Dates[$i][2]);
                                $endtime        = $ttd->hour_long.":".$ttd->minutes ;

                                $alttag         = $starttime." bis ".$endtime." [ ".$Dates[$i][5]." ]";

                                $text = $Dates[$i][6];
                                $id = rand(1,100);

                                if($_SESSION[DP_JSscript] != 1 ) {
                                        $week_float = $week_float."<span ".$DP_CSS[small]."><a  TITLE=\"".$alttag."\" href=\"dateplaner.php?app=date&timestamp=".$day_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."\" target=\"_blank\">".$starttime." - ".$endtime."</a> <br>".$shortext."</span><br>"; 
                                }else {
                                        $week_float = $week_float."<span ".$DP_CSS[small]."><a onMouseOver=show('".$id."') onMouseOut=hide('".$id."')  href=\"javascript:popup('dateplaner.php?app=date&timestamp=".$day_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."','Date','width=600,height=650,directories=no,toolbar=no,location=no,menubar=no,scrollbars=yes,status=yes,resizable=yes,dependent=no')\" >".$starttime." - ".$endtime."</a> <br>".$shortext."</span><br>"; 
                                        $week_float.= $Gui->setToolTip($starttime, $endtime, $Dates[$i][5], $text, $id );
                                }

                        }

                        if ($datesperhalfhourmax == $datesperhalfhour) 
                        {
                                $week_float = $week_float."<span ".$DP_CSS[small]."><a href=\"day.php?timestamp=".$date_ts."\">".$DP_language[more]."</a> </span>";
                                break ;  
                        }
                }

                $week_float = $week_float."</td>";      

                Return $week_float;
} // end func

setDayDatesInWeek ( date_ts,
Dates,
row_height,
&$  style 
)

void function setDayDatesInWeek($date_ts, $Dates, $row_height, &$style) set the Output for one Day Dates into the Week view

Parameters:
int $date_ts
Array $Dates ( Date Data )
string $style ( to format rows, control variable )
string $row_height ( to format the height of rows, control variable ) Array $DP_language ( include Languageproperties ) array $DP_CSS ( contains CSS Strings from the conf.gui file ) Array $_SESSION ( $DP_JSscriptis 0 if JavaScript disabled )
Returns:
string $week_float ( contains the output )

Definition at line 233 of file inc.week.php.

References $_SESSION, $DP_CSS, $DP_language, $Gui, $id, and $week_float.

{
                global $DP_language, $DP_CSS, $_SESSION;
                $ttd = new TimestampToDate;
                $Gui = new Gui();

                $datesperhalfhourmax    = 4 ; // maximale Termine pro Tag
                $shorttextmax                   = 12; // maximale Lšnge des shorttextes

                $today_style                    = $DP_CSS[tblrow1];

                $ttd->ttd($date_ts);
                $day = $ttd->day_of_month ;

                $week_float = $week_float."<td width=\"11%\" height=\"".$row_height."%\" style=\"border-style: solid;  border-width: 1 \" ";

                // if today change background
                if ($date_ts >=  mktime(0,0,0) and $date_ts <=  mktime(23,59,59)) 
                {
                        $week_float = $week_float.$today_style."  >";
                }
                else 
                {
                        $week_float = $week_float.$style.">";
                }

                // filter Dates of the day out of the array
                $dayend_ts = strtotime ("+23 hours +59 minutes +59 seconds", $date_ts); 
                for ($i=0;$i< count($Dates);$i++) 
                {
                        if ($Dates[$i][1] >= $date_ts and $Dates[$i][2] <= $dayend_ts)  
                        {
                                $datesperhalfhour++;
                                $ttd->ttd($Dates[$i][1]);

                                // count sting lenght
                                if (strlen ($Dates[$i][5]) >= $shorttextmax) 
                                {
                                        $shortext = substr($Dates[$i][5], 0, $shorttextmax)." .."; 
                                }
                                else 
                                {
                                        $shortext = $Dates[$i][5];
                                }
                                $alttag         = " [ ".$Dates[$i][5]." ]";

                                $text = $Dates[$i][6];
                                $id = rand(100,200);


                                if($_SESSION[DP_JSscript] != 1 ) {
                                        $week_float = $week_float."<span ".$DP_CSS[small]."><a  TITLE=\"".$alttag."\" href=\"dateplaner.php?app=date&timestamp=".$day_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."\" target=\"_blank\"><b>".$shortext."</b></a> </span><br>"; 
                                }else {
                                        $week_float = $week_float."<span ".$DP_CSS[small]."><a onMouseOver=show('".$id."') onMouseOut=hide('".$id."')  href=\"javascript:popup('dateplaner.php?app=date&timestamp=".$date_ts."&date_id=".$Dates[$i][0]."&PHPSESSID=".session_id()."','Date','width=600,height=650,directories=no,toolbar=no,location=no,menubar=no,scrollbars=yes,status=yes,resizable=yes,dependent=no')\" ><b>".$shortext."</b></a></span><br>"; 
                                        $week_float.= $Gui->setToolTip($starttime, $endtime, $Dates[$i][5], $text, $id );
                                }



                        }
                        if ($datesperhalfhourmax == $datesperhalfhour) 
                        {
                                $week_float = $week_float."<span ".$DP_CSS[small]."><a href=\"day.php?timestamp=".$date_ts."\">".$DP_language[more]."</a> </span>";
                                break ;  
                        }
                }

                $week_float = $week_float."</td>";
                Return $week_float;
} // end func

setNavigation ( timestamp,
rowSpan 
)

void function setNavigation($timestamp,$rowSpan) set variables in the setNavigation of week

Parameters:
int $timestamp
string $rowSpan ( to format the Span of rows, control variable ) Array $DP_language ( include languageproperties )
Returns:
string $week_navigation ( contains the output )

Definition at line 47 of file inc.week.php.

References $DP_language, and $Gui.

{
        global $DP_language;

        $Gui            = new Gui();

        $today          = mktime(0,0,0);
        $lastweek       = strtotime ("last week" , $timestamp) ;
        $nextweek       = strtotime ("+7 days" , $timestamp) ;
        $rowSpan = $rowSpan+1;

        eval ("\$week_navigation = \"".$Gui->getTemplate("week_navigation")."\";");

        Return $week_navigation;

} // end func

setWeekView ( week_ts,
DB 
)

void function setWeekView($week_ts, $DB) the Main function of the week view called from the executed file

Parameters:
int $week_ts ( one timestamp in the week, which should be shown )
int $DB (object of th db class ) array $S_Datum ( contains Date from Table Top ) array $DP_language ( include Languageproperties ) array $DP_CSS ( contains CSS Strings from the conf.gui file ) array $_SESSION ( DP_Starttime include Start Time of during on day in week view and DP_Endtimeinclude End Time of during on day in week view)
Returns:
Array $Return [0] string week_navigation ( contains the navigation output ) [1] string week_float ( contains the output ) [2] array S_Datum ( contains Date from Table Top )

Definition at line 320 of file inc.week.php.

References $_SESSION, $DB, $DP_CSS, $DP_language, $S_Datum, $week_float, getContent(), setDateInTblHead(), and setNavigation().

{
        global $DP_language, $DP_CSS, $_SESSION;

        srand(microtime()*1000000);

        // time period for view

        $from_time      = $_SESSION[DP_Starttime]; 
        $to_time        = $_SESSION[DP_Endtime];

        $ttd = new TimestampToDate;

        $ttd->ttd($week_ts);

        // if the timestamp into the week , set to the first day 
        if ($ttd->weekdaynumber != 1 ) 
        {                                                                               
                $week_ts = strtotime ("last Monday", $week_ts );
                $ttd->ttd($week_ts);
        }

        $week_ts = mktime(0,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);  
        $ttd->ttd($week_ts);

        // set Week view start and End time
        $start_ts       = $week_ts;
        $end_ts         = strtotime ("+6 days 23 hours 59 minutes 59 seconds", $week_ts );      
        $DATE           = getContent($start_ts, $end_ts, $DB);
        $Dates          = $DATE[0];
        $WholeDates     = $DATE[1];

        // take care that no date begin or end after time zone above
        // if it, enhance time zone
        if($Dates) 
        {
        for ($i=0;$i< count($Dates);$i++) 
        {
                $ttdend = new TimestampToDate;
                $ttdend->ttd($Dates[$i][2]);

                $end = $ttdend->hour_long.":".$ttdend->minutes.":".$ttdend->seconds;

                $ttd->ttd($Dates[$i][1]);
                $begin = $ttd->hour_long.":".$ttd->minutes.":".$ttd->seconds;

                if ($ttd->hour_short <= (int)$from_time )  
                {
                        $from_time = $ttd->hour_short;
                }
                if ($ttdend->hour_short >= (int)$to_time) 
                {
                        $to_time = $ttdend->hour_short+1;
                }
        }
        }

        // count rows for view
        $rows           = (($to_time - $from_time)*2)+1;
        // count rows height , best compatibility
        $row_height = 100/$rows;

        $week_navigation        = setNavigation($week_ts,$rows);
        $S_Datum                        = setDateInTblHead($week_ts) ;

        $monatstag_ts   = $week_ts;
    $style                      = $DP_CSS[tblrow2];

        // 1st - one day dates , cause more important 
        $c_rows = 0;
        for ($i=0;$i<=7;$i++) 
        {

                if ($i==0) 
                {
                        $week_float = $week_float."<tr >\n";
                        $week_float = $week_float."<td width=\"4%\" height=\"".$row_height."%\" style=\"border-style: solid;  border-width: 1\" $DP_CSS[tblrow2] ><center>".$DP_language[o_day_date]."<center></td>";
                }
                else 
                {
                        $week_float = $week_float.setDayDatesInWeek($monatstag_ts, $WholeDates, $row_height, $style);
                        $monatstag_ts = strtotime ("+1 day", $monatstag_ts );
                }
                        $ttd->ttd($monatstag_ts);
        }

        $week_float             = $week_float."</tr>\n";
        $c_rows++;
        $ttd->ttd($week_ts);
        $week_ts                = mktime($from_time,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
        $monatstag_ts   = $week_ts;
        $style                  = $DP_CSS[tblrow2];
        $day_ts                 = mktime(0,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
        
        // 2nd - normal dates  
        while($c_rows < $rows)
        { 
                for ($i=0;$i<=7;$i++) 
                {
                        if ($i==0) 
                        {
                        // set time in left row
                                $time = (($c_rows-1)/2)+$from_time;
                                if (floor($time)!=0) 
                                {
                                        if (($time/floor($time)) > 1) 
                                        {
                                                $time = floor ($time).":30";
                                        }
                                        else 
                                        {
                                                $time = $time.":00";
                                        }

                                }
                                else 
                                {
                                        if (round ($time)==1) 
                                        {
                                                $time = "0:30";
                                        }
                                        else 
                                        {
                                                $time = "0:00";
                                        }
                                }
                                $week_float = $week_float."<tr >\n";
                                $week_float = $week_float."<td width=\"4%\" height=\"".$row_height."%\" style=\"border-style: solid;  border-width: 1\" $DP_CSS[tblrow2] ><center>".$time."<center></td>";
                        }
                        else 
                        {
                                $week_float     = $week_float.setDatesInWeek($monatstag_ts, $Dates, $day_ts, $row_height, $style);
                                $monatstag_ts = strtotime ("+1 day", $monatstag_ts );

                        }
                        $ttd->ttd($monatstag_ts);
                        $day_ts                 = mktime(0,0,0,$ttd->monthnumber,$ttd->day_of_month,$ttd->year_long);
                }
                $week_ts                = strtotime ("+30 minutes", $week_ts);  
                $monatstag_ts   = $week_ts ;
                $week_float             = $week_float."</tr>\n";
                $c_rows++;
        }
        $week_float = $week_float."</tr>\n";

        $Return[0] = $week_navigation;
        $Return[1] = $week_float;
        $Return[2] = $S_Datum;

        Return $Return;
}//end func

Here is the call graph for this function: