Asociace studentů

Kalendář akcí



"", "\\n" => "
", "\\" => "" ))); //print_r($soubor); $udalosti = Array(); $i = 0; $chytej = Array("DTSTART", "DTEND", "DESCRIPTION", "LOCATION", "SUMMARY"); foreach($soubor as $line) { if ($line == "BEGIN:VEVENT\r") $i++; foreach($chytej as $c) { if (substr($line, 0, strlen($c)+1) == "$c:") { $udalosti[$i][$c] = substr($line, strlen($c)+1); } if (substr($line, 0, strlen($c)+1) == "$c;") { // "TZID=Europe/Prague", "VALUE=DATE" $udalosti[$i][$c] = substr($line, strpos($line,":")+1); } } } foreach($udalosti as $key => $udalost) { if (isset($udalost["DTEND"])) { $udalosti[$key]["delka"] = strtotime($udalost["DTEND"]) - strtotime($udalost["DTSTART"]); } else { $udalosti[$key]["delka"] = 86400; } if ((isset($udalost["DTEND"]) && strtotime($udalost["DTEND"]) < time()) || strtotime($udalost["DTSTART"]) < time() || strtotime($udalost["DTSTART"]) > time() + 86400*31) unset($udalosti[$key]); //if (strpos($udalosti[$key]["SUMMARY"],"Schůzka") !== false) unset($udalosti[$key]); } uasort( $udalosti, function ( $a, $b ) { return $a["DTSTART"] > $b["DTSTART"]; } ); function delka($t) { // if ($t > 3600) { return floor($t / 3600)."h ".substr("0".($t - (floor($t / 3600)*3600))/60,-2)."m"; // } } foreach($udalosti as $key => $udalost) { /* echo date("Y-m-d H:i:s", strtotime($udalost["DTSTART"]))."
"; echo date("Y-m-d H:i:s", strtotime($udalost["DTEND"]))."
"; echo $udalost["delka"]."
\n"; echo $udalost["SUMMARY"]."
\n"; */ $nadpis = isset($udalost["SUMMARY"]) ? $udalost["SUMMARY"] : ""; //"http://www.google.com/search?q=".rawurlencode($udalost["SUMMARY"])."&btnI"; {$udalost["SUMMARY"]} $obsah = isset($udalost["DESCRIPTION"]) ? $udalost["DESCRIPTION"] : ""; if ($udalost["delka"] > 86400) { $datum = "".date("j.n.", strtotime($udalost["DTSTART"]))."-".date("j.n.Y", strtotime($udalost["DTEND"])).""; } if ($udalost["delka"] == 86400) { $datum = "".date("j.n.Y", strtotime($udalost["DTSTART"])).""; } if ($udalost["delka"] < 86400) { $datum = "".date("j.n.Y H:i", strtotime($udalost["DTSTART"])).", délka ".delka($udalost["delka"]).""; } echo "
$nadpis
\n$datum\n
$obsah
\n"; } //print_r($udalosti);