include("../Php/pag_session.php");
loadSession();
if (!SHOW_ERRORS) error_reporting(0);
include("../Php/pag_lib.php");
include("../Php/pag_globals.php");
include("../Php/pag_testxml.php");
include("../Php/dat_Photos.php");
include("../Php/pag_form.php");
setPage(PAGE_FOTOS);
$path = "../";
loadHTMLHeader(PAGE_FOTOS, $path);
loadHTMLBodyTopArea(PAGE_FOTOS, $path);
loadHTMLBodyBlueArea($path);
loadHTMLBodyMainAreaBegin();
//---- The specific page start -------
//------------------------------------
//---- The specific page content -------
$collectionId = $_GET["collectionId"];
$photoId = $_GET["photoId"];
$year = $_GET["year"];
$subnavi = 0;
$collectionName = "";
$showYears = false;
$ar_navi;
$ar_navi[0][0] = "Laatste fotocollectie";
$ar_navi[0][1] = "http://www.centrumbredevoort.nl/Fotos";
$ar_navi[1][0] = "Alle fotocollecties";
$ar_navi[1][1] = "http://www.centrumbredevoort.nl/Fotos/index.php?collectionId=all";
$ar_crumbs;
$ar_crumbs[0][0] = "Foto's";
$ar_crumbs[0][1] = "http://www.centrumbredevoort.nl/Fotos";
$xsl = "";
$xml = "";
define($lastYearIdentified, false);
$scanIcons = false;
$correctSubmitted = $_SESSION["CorrectSubmitted"];
if ($correctSubmitted) clearFormSessionVariables();
else {
$name = $_SESSION["Name"];
$content = $_SESSION["Content"] ;
$submitted = $_SESSION["Submitted"];
}
if (($collectionId == "") && ($year == "") ) {
/*
echo "
";
echo "Deze sectie krijgt op dit moment een technische wijziging. Enkele minuten geduld aub....";
echo "
";
echo "
";
*/
$collectionId = getIdLastPhotoCollection();
$title = GetTitleCollection($collectionId);
$year = GetYearCollection($collectionId);
$ar_crumbs[1][0] = "Alle fotocollecties (".$year.")";
$ar_crumbs[1][1] = "http://www.centrumbredevoort.nl/Fotos/index.php?year=".$year."&collectionId=all";
$ar_crumbs[2][0] = $title;
loadBreadCrumbs($ar_crumbs);
loadSubNavigation($ar_navi, 0);
$xml = GetPhotoCollection($collectionId);
$xsl = 'FotoCollection.xsl';
}
else {
$ar_crumbs[1][0] = "Alle fotocollecties";
$ar_crumbs[1][1] = "http://www.centrumbredevoort.nl/Fotos/index.php?collectionId=all";
if ($year == "") {
if ($collectionId == "all") {
loadBreadCrumbs($ar_crumbs);
loadSubNavigation($ar_navi, 1);
//first page of alle collecties --> laad alle collecties 2005
// show yearsline with 2005 active
$xml = GetAllPhotoYears();
echo "
";
echo " | ";
loadXML($xml);
echo " |
";
// show all collections of last year
$xml = GetAllPhotoCollections(YEAR);
$xsl = 'Collections.xsl';
}
else
echo "wrong page";
}
else {
$ar_crumbs[1][0] = "Alle fotocollecties (".$year.")";
$ar_crumbs[1][1] = "http://www.centrumbredevoort.nl/Fotos/index.php?year=".$year."&collectionId=all";
if ($collectionId == "all") {
define(YEAR, $year);
loadBreadCrumbs($ar_crumbs);
loadSubNavigation($ar_navi, 1);
// show yearsline with selected year active
$xml = GetAllPhotoYears();
echo " ";
echo " | ";
loadXML($xml);
echo " |
";
// show all collections of selected year
$xml = GetAllPhotoCollections(YEAR);
$xsl = 'Collections.xsl';
}
else {
$ar_crumbs[2][0] = getTitleCollection($collectionId);
$ar_crumbs[2][1] = "http://www.centrumbredevoort.nl/Fotos/index.php?year=".$year."&collectionId=".$collectionId;
if ($photoId != "") {
$ar_crumbs[3][0] = "Foto";
loadBreadCrumbs($ar_crumbs);
loadSubNavigation($ar_navi, 1);
//show picture
$xml = GetDetailedPicture($collectionId, $photoId);
$xsl = 'Foto.xsl';
echo "";
print XMLtoHTML($xml, $xsl);
echo "
";
loadFormPicture($year, $collectionId, $photoId, $name, $content, $correctSubmitted, $submitted);
echo "
";
$xml = GetPictureResponses($collectionId, $photoId);
$xsl = 'FotoReactions.xsl';
$scanIcons = true;
}
else {
//show title of collection
loadBreadCrumbs($ar_crumbs);
loadSubNavigation($ar_navi, 1);
//show thumbs
$xml = GetPhotoCollection($collectionId);
$xsl = 'FotoCollection.xsl';
}
}
}
}
//deal with Laatste collectie (collection name)
function startElement($parser, $name, $attrs) {
//echo $name;
}
function endElement($parser, $name) {
//echo $name;
}
function printYearMenu($parser, $data) {
//make menu with links to year pages
if ($lastYearIdentified == false) {
define(YEAR, $data);
define($lastYearIdentified, true);
}
echo "".$data." | ";
}
function loadXML($x) {
$xml_parser = xml_parser_create();
// use case-folding so we are sure to find the tag in $map_array
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "printYearMenu");
if (!xml_parse($xml_parser, $x)) {
die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
}
xml_parser_free($xml_parser);
}
if ($xml == "") echo "no valid xml file";
else if ($xsl == "") echo "no valid xsl file";
else {
//echo $xml;
if ($scanIcons) {
$html = XMLtoHTML($xml, $xsl);
print textToSmilie($html);
$scanIcons = false;
}
else {
print XMLtoHTML($xml, $xsl);
}
print "
";
}
//--------------------------------------
loadHTMLBodyMainAreaEnd();
loadHTMLBodyEnd(PAGE_FOTOS, "../");
?>