Go to the source code of this file.
Namespaces | |
namespace | dateplaner |
Database Class. | |
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) |
convertToDateFormat | ( | $ | a | ) |
void function convertToDateFormat($a)
$a,a | required timestamp of sometime during the current day. int $DP_UId reads the User ID from the session |
Definition at line 96 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; }
getCSV | ( | $ | file | ) |
void function navigation($timestamp)
This function generates the timestamps for the day navigation and passes them to the template day_navigation
$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. |
Definition at line 49 of file inc.parse.php.
Referenced by parse().
{ $handle = fopen ($file,"r"); while ($data = fgetcsv ($handle, 1000, ",")) { // Daten werden aus der Datei if (is_array($data)) { foreach($data as $k => $v) { $data[$k] = strip_tags($data[$k]); } } $array[] = $data; // in ein Array $data gelesen } fclose ($handle); return $array; }
makeTimestamp | ( | $ | day, | |
$ | time | |||
) |
void function makeTimestamp($day, $time)
$day | ||
$time |
Definition at line 127 of file inc.parse.php.
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; }
parse | ( | $ | db, | |
$ | _FILES | |||
) |
void function parse($db, $_FILES)
$_FILES | ||
$DB,a | DB class object. $DP_language , used by the Gui to determine the language of "today" as set in the language file. |
Definition at line 142 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]; } }
showArray | ( | $ | array | ) |
void function showArray($array)
$array | $DP_language , used by the Gui to determine the language of "today" as set in the language file. |
Definition at line 74 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; }