. */ include("./include/include.php"); include("./include/g_workshop.php"); include("./include/AjaxResponse.php"); include("./include/Popup.php"); define("POPUP_HEIGHT", 360); define("POPUP_WIDTH", 500); if( !in_array("application_editworkshop", $_SESSION['sess_functions']) ) { $popup = new Popup("Edit workshop", "You are not authorized to see this page."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response = new AjaxResponse(false); $response->addRefresh("popup", $popup->createPopup()); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }else { admin_header(true, true); $id = get_int("id"); $slot = get_int("slot"); $ws = get_int("ws"); if( isset($_POST['noconfirm']) ) { $_SESSION['WSnoconfirm'] = true; $response = new AjaxResponse(true); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }else if( $slot!="1" AND $slot!="2" ) { // Unknown workshop slot selected $popup = new Popup("Edit workshop", "Unknown workshop slot selected."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response = new AjaxResponse(false); $response->addRefresh("popup", $popup->createPopup()); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }else if( !isset($Workshop[$ws]) ) { // Unknown workshop selected $popup = new Popup("Edit workshop", "Unknown workshop selected."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response = new AjaxResponse(false); $response->addRefresh("popup", $popup->createPopup()); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }else { $query="SELECT `persons`.`FirstName`, `persons`.`LastName`, `ab_bodies`.`BodyName` AS `BodyName`, `persons`.`WorkshopID1`, `persons`.`WorkshopID2`, `persons`.`WorkshopID3`, `persons`.`WorkshopID4`, `persons`.`WorkshopIDSlot1`, `persons`.`WorkshopIDSlot2` FROM `ab_bodies`, `persons` WHERE `ab_bodies`.`BodyCode`=`persons`.`BodyCode` AND `persons`.`PersonID`=".addslashes($id); if( $res=doquery($query) ) { if( $row=mysql_fetch_array($res) ) { // Check if there is a change if( $row["WorkshopIDSlot".$slot]==$ws ) { // No change $response = new AjaxResponse(false); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }elseif( $slot==1 && $ws>0 && $Workshopslot[$ws]=="both" && $row['WorkshopIDSlot2']>0 ) { $popup = new Popup("Edit workshop", "You cannot select a long workshop in the first slot as this person is already selected for a short workshop in the second slot."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response = new AjaxResponse(false); $response->addRefresh("popup", $popup->createPopup()); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }elseif( $slot==2 && $row['WorkshopIDSlot1']>0 && $Workshopslot[ $row['WorkshopIDSlot1'] ]=="both" ) { $popup = new Popup("Edit workshop", "You cannot select a workshop for the second timeslot as this person is already selected for a long workshop in the first slot."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response = new AjaxResponse(false); $response->addRefresh("popup", $popup->createPopup()); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }else { $query="UPDATE `persons` SET `WorkshopIDSlot".$slot."`='".$ws."', `Log`=CONCAT(`Log`,'\n".date("Y-m-d H:i:s").": selected for workshop ".addslashes($ws)." in slot ".addslashes($slot)." by ".addslashes($_SESSION['sess_name'])."') WHERE `PersonID`=$id"; if( doquery($query) ) { // Update WS choice successfull include("./include/Persons.php"); $response = new AjaxResponse(false); if( $slot==1 ) { include("./include/PersonsFields/200WorkshopSelectID1.php"); include("./include/PersonsFields/205WorkshopSelectID2.php"); $query = "SELECT "; $ws1 = new PersonsWorkshopSelectID1($id); $query .= $ws1->sql_columnname(); $ws2 = new PersonsWorkshopSelectID2($id); $query .= ", " . $ws2->sql_columnname(); $query .= " FROM `persons` WHERE `PersonID`=$id"; if( ($res2=doquery($query)) && $row2=mysql_fetch_assoc($res2) ) { $response->addRefresh("WorkshopSelectID1_".$id, $ws1->display($row2['WorkshopSelectID1'], $id)); $response->addRefresh("WorkshopSelectID2_".$id, $ws2->display($row2['WorkshopSelectID2'], $id)); } }else { include("./include/PersonsFields/210WorkshopSelectID3.php"); include("./include/PersonsFields/215WorkshopSelectID4.php"); $query = "SELECT "; $ws3 = new PersonsWorkshopSelectID3($id); $query .= $ws3->sql_columnname(); $ws4 = new PersonsWorkshopSelectID4($id); $query .= ", " . $ws4->sql_columnname(); $query .= " FROM `persons` WHERE `PersonID`=$id"; if( ($res2=doquery($query)) && $row2=mysql_fetch_assoc($res2) ) { $response->addRefresh("WorkshopSelectID3_".$id, $ws3->display($row2['WorkshopSelectID3'], $id)); $response->addRefresh("WorkshopSelectID4_".$id, $ws4->display($row2['WorkshopSelectID4'], $id)); } } if( !isset($_SESSION['WSnoconfirm']) || $_SESSION['WSnoconfirm']==false ) { $content = "Updated selection for workshop."; $content .= "

Don't show this popup after selecting workshop (this will be reset after logging out)."; $row["WorkshopIDSlot".$slot] = $ws; $content .= "

"; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= "
First name:".$row["FirstName"]."
Family name:".$row["LastName"]."
Body:".$row["BodyName"]."
 
1st workshop choice:".$Workshop[ $row["WorkshopID1"] ]."
2nd workshop choice:".$Workshop[ $row["WorkshopID2"] ]."
Time slot 2 1st workshop choice:".$Workshop[ $row["WorkshopID3"] ]."
Time slot 2 2nd workshop choice:".$Workshop[ $row["WorkshopID4"] ]."
Selected workshop slot 1:".$Workshop[ $row["WorkshopIDSlot1"] ]."
Selected workshop slot 2:".$Workshop[ $row["WorkshopIDSlot2"] ]."
"; $content .= "

"; $content .= ""; $content .= "\"Close\"/ Close"; $content .= ""; $content .= "

"; $popup = new Popup("Edit workshop", $content); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response->addRefresh("popup", $popup->createPopup()); } header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); }else { // Failed updating WS choice $popup = new Popup("Edit workshop", "Failed updating selection for workshop."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response = new AjaxResponse(false); $response->addRefresh("popup", $popup->createPopup()); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); } } }else { $popup = new Popup("Edit workshop", "Error: unable to load the data. The person was not found."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH); $response = new AjaxResponse(false); $response->addRefresh("popup", $popup->createPopup()); header("Content-type: text/xml; charset=utf-8"); echo $response->createResponse(); } } } admin_footer(true, true); } ?>