Namespaces | Functions

modules/dateplaner/includes/inc.parse.php File Reference

Go to the source code of this file.

Namespaces

namespace  dateplaner
 

dateplaner includes personal an group specific date management developt for ilias3 and adapted also to ilias2


Functions

 getCSV ($file)
 void function navigation($timestamp)
 showArray ($array)
 void function showArray($array)
 convertToDateFormat ($a)
 void function convertToDateFormat($a)
 makeTimestamp ($day, $time)
 void function makeTimestamp($day, $time)
 parse ($db, $_FILES)
 void function parse($db, $_FILES)

Function Documentation

convertToDateFormat ( a  ) 

void function convertToDateFormat($a)

Parameters:
$a,a required timestamp of sometime during the current day. int $DP_UId reads the User ID from the session
Returns:
array $dates

Definition at line 87 of file inc.parse.php.

References $DP_UId, and makeTimestamp().

Referenced by parse().

                                {
        global $DP_UId;
        for($i=1; $i<count($a); $i++){
                $j = $i-1;
                if($a[$i][5]=="Aus"){//ganztagestermin?
                        $dates[$j][begin]       = makeTimestamp($a[$i][1], $a[$i][2]);
                        $dates[$j][end]         = makeTimestamp($a[$i][3], $a[$i][4]);
                        $dates[$j][user_ID]     = $DP_UId;
                        $dates[$j][short]       = $a[$i][0];
                        if($a[$i][16]!="") {$dates[$j][short].= " (".$a[$i][16].")";}//Ort?
                        $dates[$j][text]        = $a[$i][14];
                }else{
                        $dates[$j][begin]       = makeTimestamp($a[$i][1], "00:00:00");
                        $dates[$j][end]         = makeTimestamp($a[$i][3], "23:59:59");
                        $dates[$j][user_ID]     = $DP_UId;
                        $dates[$j][short]       = $a[$i][0];
                        if($a[$i][16]!="") {$dates[$j][short].= " (".$a[$i][16].")";}//Ort?
                        $dates[$j][text]        = $a[$i][14];
                }
                
        }
        return $dates;          
}

Here is the call graph for this function:

Here is the caller graph for this function:

getCSV ( file  ) 

void function navigation($timestamp)

This function generates the timestamps for the day navigation and passes them to the template day_navigation

Parameters:
$timestamp,a required timestamp of sometime during the current day. $DP_language , used by the Gui to determine the language of "today" as set in the language file.
Returns:
$day_navigation , the output variable of the Gui,

Definition at line 49 of file inc.parse.php.

References $data, and $file.

Referenced by parse().

                      {
        $handle = fopen ($file,"r"); 
        while ($data = fgetcsv ($handle, 1000, ",")) { // Daten werden aus der Datei
            $array[] = $data;                           // in ein Array $data gelesen
        }
        fclose ($handle);
        return $array;
}

Here is the caller graph for this function:

makeTimestamp ( day,
time 
)

void function makeTimestamp($day, $time)

Parameters:
$day 
$time 
Returns:
$timestamp

Definition at line 118 of file inc.parse.php.

References $d, and $t.

Referenced by convertToDateFormat().

                                   {
        $d = explode(".", $day );
        $t = explode(":", $time);
        $timestamp = mktime($t[0],$t[1],$t[2],$d[1],$d[0],$d[2]);
        return  $timestamp;
}

Here is the caller graph for this function:

parse ( db,
_FILES 
)

void function parse($db, $_FILES)

Parameters:
$_FILES 
$DB,a DB class object. $DP_language , used by the Gui to determine the language of "today" as set in the language file.
Returns:

Definition at line 133 of file inc.parse.php.

References $DP_language, $file, convertToDateFormat(), getCSV(), and showArray().

                            {
        global $DP_language;
        $file = $_FILES['Datei'];
        if($file[tmp_name]){            
                $array = getCSV($file[tmp_name]);
                $dates = convertToDateFormat($array);
                for($j=0; $j<count($dates);$j++){
                        $return = $db->addDate (        $dates[$j][begin],
                                                                                $dates[$j][end], 
                                                                                0, 
                                                                                $dates[$j][user_ID], 
                                                                                mktime(),
                                                                                0, 
                                                                                0, 
                                                                                $dates[$j][short], 
                                                                                $dates[$j][text], 
                                                                                0, 
                                                                                $dates[$j][user_ID]);
                }
                return showArray($dates);
        }
        else{
                return $DP_language[ERROR_FILE_CSV_MSG];
        }

}

Here is the call graph for this function:

showArray ( array  ) 

void function showArray($array)

Parameters:
$array $DP_language , used by the Gui to determine the language of "today" as set in the language file.
Returns:
$parsedata , the output variable of the Gui,

Definition at line 65 of file inc.parse.php.

References $DP_language.

Referenced by parse().

                          {
        global $DP_language;
        $format = $DP_language[date_format];
        $parsedata.= "<b>$DP_language[insertImportDates]</b> <br><hr>";
        foreach($array as $date){
                $parsedata.= "<table><tr><td><b>$DP_language[timeslice]</b></td><td>".date($format, $date[begin])." - ".date($format, $date[end])."</td></tr>";
                $parsedata.= "<tr><td valign='top'><b>$DP_language[shorttext]:</b></td><td>".$date[short]."</td></tr>";
                $parsedata.= "<tr><td valign='top'><b>$DP_language[Text]:</b></td><td>".$date[text]."</td></tr></table>";
                
                $parsedata.= "<hr>";
        }
        return $parsedata;
}

Here is the caller graph for this function: