| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/event.php |
<?php
if ($id == 375) {
header("Location: https://www.cesa.co.za/cesaway/index.htm");
die();
}
include('inc_db.php');
$db = mysql_connect($loghost, $logid, $logpwd);
mysql_select_db($dbname, $db);
$id = intval($_GET["id"]);
if (!empty($id)) {
$sql = "SELECT
SchoolEvents.`EventID`,
IF(ISNULL(SchoolCourses.CourseName),SchoolEvents.`EventName`,SchoolCourses.CourseName) AS EventName,
IF(ISNULL(SchoolCourses.`Level`),SchoolEvents.`Level`,SchoolCourses.`Level`) AS `Level`,
SchoolEvents.`City`, SchoolEvents.`Venue`, SchoolEvents.`StartDate`, SchoolEvents.`EndDate`,
SchoolEvents.`StartTime`, SchoolEvents.`EndTime`, SchoolEvents.`AvailableSpaces`,
SchoolEvents.`CostPerPerson`, SchoolEvents.`EventDescription`,
IF(ISNULL(SchoolCourses.`FacilitatorID`),SchoolEvents.`FacilitatorID`,SchoolCourses.`FacilitatorID`) AS `FacilitatorID`,
IF(ISNULL(SchoolCourses.`ProviderID`),SchoolEvents.`ProviderID`,SchoolCourses.`ProviderID`) AS `ProviderID`,
SchoolEvents.`PresenterID`,
IF(ISNULL(SchoolCourses.`Hours`),SchoolEvents.`Hours`,SchoolCourses.`Hours`) AS `Hours`,
IF(ISNULL(SchoolCourses.`CPD`),SchoolEvents.`CPD`,SchoolCourses.`CPD`) AS `CPD`,
SchoolEvents.`CODE`,
IF(ISNULL(SchoolCourses.`NQFLevel`),SchoolEvents.`NQFLevel`,SchoolCourses.`NQFLevel`) AS `NQFLevel`,
IF(ISNULL(SchoolCourses.`AccredNum`),SchoolEvents.`AccredNum`,SchoolCourses.`AccredNum`) AS `AccredNum`,
SchoolEvents.`Province`, SchoolEvents.`RegDeadline`,
IF(ISNULL(SchoolCourses.`Category`),SchoolEvents.`Category`,SchoolCourses.`Category`) AS `Category`,
SchoolEvents.`Onceoff`, SchoolEvents.`OnceoffSeq`,
SchoolEvents.`MemberDiscount`, SchoolEvents.`EarlyBirdDiscount`, SchoolEvents.`EarlyBirdDate`, SchoolEvents.`Cancelled`,
SchoolEvents.`BankAccName`, SchoolEvents.`ExternalLink`, SchoolEvents.`SchoolCourseID`,
IF(ISNULL(SchoolCourses.`FileAttachment`),SchoolEvents.`FileAttachment`,SchoolCourses.`FileAttachment`) AS `FileAttachment`,
IF(ISNULL(SchoolCourses.`WebCategory`),SchoolEvents.`WebCategory`,SchoolCourses.`WebCategory`) AS `WebCategory`,
SchoolEvents.`CandidateAcademy`, SchoolEvents.`BookingConfirmed`, SchoolEvents.`AttendanceRegister`,
IF(ISNULL(SchoolCourses.`SACPCMPNum`),SchoolEvents.`SACPCMPNum`,SchoolCourses.`SACPCMPNum`) AS `SACPCMPNum`,
SchoolEvents.`SACPCMP_CPDPoints`, SchoolEvents.`SACPCMPCategory`,
IF(ISNULL(SchoolCourses.`AccredNum2`),SchoolEvents.`AccredNum2`,SchoolCourses.`AccredNum2`) AS `AccredNum2`,
SchoolEvents.`CostPackage`, SchoolEvents.`ContactPerson`, SchoolEvents.`ContactTel`, SchoolEvents.`ContactEmail`,
IF(ISNULL(SchoolCourses.`CourseType`),SchoolEvents.`CourseType`,SchoolCourses.`CourseType`) AS `CourseType`,
SchoolEvents.`OnlineCourseLink`, CourseVenues.CourseVenueCity, CourseVenues.CourseVenueArea,
SchoolCourses.DescOverview, SchoolCourses.DescWhyAttend, SchoolCourses.DescOutcomes,
SchoolCourses.DescObjectives, SchoolCourses.DescProgram, SchoolCourses.DescWhoAttend, SchoolCourses.CourseDescription,
SchoolEvents.`SACNASP_ValidationNumber`, SchoolEvents.`SACNASP_CPD_Points`
FROM (SchoolProviders RIGHT JOIN (SchoolFacilitators
RIGHT JOIN (SchoolEvents LEFT JOIN CourseVenues ON SchoolEvents.Venue = CourseVenues.CourseVenueName)
ON SchoolFacilitators.FacilitatorID=SchoolEvents.FacilitatorID)
ON SchoolProviders.ProviderID=SchoolEvents.ProviderID)
LEFT JOIN SchoolPresenters ON SchoolEvents.PresenterID=SchoolPresenters.PresenterID
LEFT JOIN SchoolCourses ON (SchoolEvents.SchoolCourseID=SchoolCourses.SchoolCourseID)
WHERE SchoolEvents.EventID=" . $id;
//echo $sql;
$queryresult = mysql_query($sql) or die();
//odbc_longreadlen($queryresult, 16384);
if ($row = mysql_fetch_array($queryresult)) {
$eventname = $row["EventName"];
$pagetitle = "SCE Event: " . $eventname;
$bEventInPast = true;
$DateList = "";
$sql2 = "SELECT * FROM EventSchedules WHERE EventID=" . $id . " ORDER BY ScheduleDate";
$queryresult2 = mysql_query($sql2);
while ($row2 = mysql_fetch_array($queryresult2)) {
$StartDatePlusTime = date("Y-m-d", strtotime($row2["ScheduleDate"])) . " " . date("H:i:s", strtotime(substr($row2["StartTime"], 11, 5)));
// echo $StartDatePlusTime;
$DateList .= "<li>" . date("D j F Y", strtotime($row2["ScheduleDate"])) . " " . substr($row2["StartTime"], 0, 5) . " to " . substr($row2["EndTime"], 0, 5) . "<BR></li>";
if (strtotime($StartDatePlusTime) > time()) $bEventInPast = false;
}
?>
<p align="right"><b><a href="/sce/school-of-consulting-engineers/cpd-training/training-calendar/"><< Return to Calendar</a></b></p>
<center>
<h3><? echo $eventname; ?></h3>
</center>
<table border=0 width=100% cellspacing=5 cellpadding=5>
<tr>
<td valign=top colspan="2">
<?php
if (!$bEventInPast && ($row["Cancelled"] == 0)) {
?>
<a href="/sce/school-event-registration?id=<? echo $id; ?>"><img src="/images/schoolreg.jpg" width=132 height=89 border=0></a>
<?php
}
?>
<?php
//echo $row["EventDescription"];
if (!empty($row["DescOverview"]) || !empty($row["DescWhyAttend"]) || !empty($row["DescOutcomes"]) || !empty($row["DescProgram"]) || !empty($row["DescWhoAttend"])) {
?>
<?php if (!empty(strip_tags(trim(str_replace(" ", "", $row["DescOverview"]))))) { ?><h2><u>Overview</u></h2><?php echo $row["DescOverview"]; ?><?php } ?>
<?php if (!empty(strip_tags(trim(str_replace(" ", "", $row["DescWhyAttend"]))))) { ?><h2><u>Why Should an Individual Attend?</u></h2><?php echo $row["DescWhyAttend"]; ?><?php } ?>
<?php if (!empty(strip_tags(trim(str_replace(" ", "", $row["DescOutcomes"]))))) { ?><h2><u>Outcomes</u></h2><?php echo $row["DescOutcomes"]; ?><?php } ?>
<?php if (!empty(strip_tags(trim(str_replace(" ", "", $row["DescProgram"]))))) { ?><h2><u>Program Outline</u></h2><?php echo $row["DescProgram"]; ?><?php } ?>
<?php if (!empty(strip_tags(trim(str_replace(" ", "", $row["DescWhoAttend"]))))) { ?><h2><u>Who Should Attend?</u></h2><?php echo $row["DescWhoAttend"]; ?><?php } ?>
<?php
} elseif (!empty(strip_tags(trim(str_replace(" ", "", $row["CourseDescription"]))))) {
echo $row["CourseDescription"];
} else {
echo $row["EventDescription"];
}
?>
</td>
</tr>
<?php
if ($row["Cancelled"] == 1) {
echo "</table><p><b>This event has been cancelled</b></p>";
} else {
?>
<tr>
<td valign=top><b>Dates and Times:</b></td>
<td>
<ul><? echo $DateList; ?></ul>
</td>
</tr>
<tr>
<td valign=top><b>Type:</b></td>
<td><? echo $row["Level"];
// . ", pitched at NQF " . $row["NQFLevel"];
?></td>
</tr>
<tr>
<td valign=top><b>Venue:</b></td>
<td><? echo $row["Venue"] . ", " . (empty($row["City"]) ? $row["CourseVenueCity"] : $row["City"]); ?>
<?php if (!empty($row["CourseVenueArea"])) echo ", " . $row["CourseVenueArea"]; ?>
<?php
if ($handle = opendir('./eventdocs')) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$tofind = "." . $row["EventID"];
$pos = strpos($file, $tofind);
if ($pos > 0) {
$handle2 = opendir('../school/eventdocs/' . $file);
$files = '';
while (false !== ($file2 = readdir($handle2))) {
if (substr($file2, 0, 1) != ".") {
$files .= '<a href="/school/eventdocs/' . $file . '/' . $file2 . '" target="_blank">' . $file2 . '</a><br>';
}
}
echo '<br><i>Directions / Map:</i><br>' . $files;
closedir($handle2);
}
}
}
closedir($handle);
}
?>
</td>
</tr>
<tr>
<td valign=top><b>Fee:</b></td>
<td>
<?php
$sql = "SELECT SELECT SchoolCostPackageOptions.`CostPackageOptionID`, EventID, OptionName, OptionDesc, AddCost, DisplayOrder
FROM SchoolEvents JOIN SchoolCostPackages ON (SchoolEvents.`CostPackage`=SchoolCostPackages.`CostPackageID`)
JOIN SchoolCostPackageOptions ON (SchoolCostPackages.`CostPackageID`=SchoolCostPackageOptions.`PackageID`)
WHERE SchoolEvents.EventID=" . $row["EventID"] . " ORDER BY SchoolCostPackageOptions.DisplayOrder";
$recCO = mysql_query($sql);
if (mysql_num_rows($recCO) == 0) {
?>
<b><? echo "R " . number_format($row["CostPerPerson"], 2, ".", " "); ?> excl. VAT</b><br />
<? echo "R " . number_format(ceil($row["CostPerPerson"] * $incvat), 2, ".", " "); ?> incl. VAT<br /></b>
<?php
} else {
?>
<table border="1" cellspacing="0" cellpadding="2">
<?php
while ($rowCO = mysql_fetch_assoc($recCO)) {
?>
<tr>
<td><?php echo $rowCO["OptionName"]; ?></td>
<td>
<b><? echo "R " . number_format($row["CostPerPerson"] + $rowCO["AddCost"], 2, ".", " "); ?> excl. VAT<br />
<? echo "R " . number_format(ceil(($row["CostPerPerson"] + $rowCO["AddCost"]) * $incvat), 2, ".", " "); ?> incl. VAT<br /></b>
<i><?php echo nl2br($rowCO["OptionDesc"]); ?></i>
</td>
<?php
}
?>
</table>
<?php
}
if (!empty($row["MemberDiscount"]) && ($row["MemberDiscount"] > 0)) {
?>
<i><b>CESA <?php if ($row["ProviderID"] == 155) echo "/ SAICE "; ?>member fee:
R<?php echo number_format(($row["CostPerPerson"] - $row["MemberDiscount"]), 2, ".", " "); ?> excl. VAT</i><br />
<i>CESA <?php if ($row["ProviderID"] == 155) echo "/ SAICE "; ?>member fee:
R<?php echo number_format(ceil(($row["CostPerPerson"] - $row["MemberDiscount"]) * $incvat), 2, ".", " "); ?> incl. VAT</i><br /></b>
<?php
}
//echo strtotime($row["RegDeadline"])."<br>".time()."<br>";
if (!empty($row["EarlyBirdDiscount"]) && ($row["EarlyBirdDiscount"] > 0) && (strtotime($row["RegDeadline"]) > time())) {
?>
<i><b>R<?php echo number_format($row["EarlyBirdDiscount"], 2); ?> discount excl. VAT for registrations received before
<?php echo date("d M Y", strtotime($row["RegDeadline"])); ?></b></i><br />
<?php
}
?>
</td>
</tr>
<tr>
<td valign=top><b>Validation Number/s:</b></td>
<td><?php
echo $row["AccredNum"];
if (!empty($row["AccredNum2"])) echo "<br>" . $row["AccredNum2"];
?>
</td>
</tr>
<tr>
<td valign=top><b>ECSA CPD Points:</b></td>
<td><? echo number_format(floatval($row["CPD"]), 2); ?></td>
</tr>
<?php
if (!empty($row["SACPCMPNum"])) {
?>
<tr>
<td valign=top><b>SACPCMP Num:</b></td>
<td><? echo $row["SACPCMPNum"]; ?></td>
</tr>
<tr>
<td valign=top><b>SACPCMP Category:</b></td>
<td><? echo $row["SACPCMPCategory"]; ?></td>
</tr>
<tr>
<td valign=top><b>SACPCMP CPD Points:</b></td>
<td><? echo number_format(floatval($row["SACPCMP_CPDPoints"]), 2); ?></td>
</tr>
<?php
}
?>
<tr>
<td valign=top><b>SACNASP Validation Number:</b></td>
<td><? echo $row["SACNASP_ValidationNumber"]; ?></td>
</tr>
<tr>
<td valign=top><b>SACNASP CPD Points:</b></td>
<td><? echo number_format(floatval($row["SACNASP_CPD_Points"]), 2); ?></td>
</tr>
<tr>
<td><b>Coordinator:</b></td>
<td><? echo $row["FacilitatorName"]; ?></td>
</tr>
<!--<tr><td><b>Provider:</b></td>
<td><? echo $row["ProviderName"]; ?></td>
</tr>
<tr><td><b>Presenter:</b></td>
<td><? echo $row["PresenterName"]; ?></td>
</tr>-->
</table>
<br>
<?php
if (!$bEventInPast && ($row["Cancelled"] == 0)) {
?>
<a href="/sce/school-event-registration?id=<? echo $id; ?>"><img src="/images/schoolreg.jpg" width=132 height=89 border=0></a>
<?php
}
}
?>
<?php
} else {
$pagetitle = "SCE Error";
echo "Event not found.";
}
} else {
$pagetitle = "SCE Error";
echo "Event not found.";
}
mysql_close();