| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/inc_scecalendarnew.php |
<?php
/*
$sql="SELECT * FROM SchoolWebCategories WHERE DisplayOrder>0";
if (isset($_REQUEST["cat"]) && !empty($_REQUEST["cat"])) $sql.=" AND WebCategoryID=".intval($_REQUEST["cat"]);
$sql.=" ORDER BY DisplayOrder";
$catrs=mysql_query($sql);
while ($catrow=mysql_fetch_assoc($catrs)) {
*/
include_once($_SERVER['DOCUMENT_ROOT'] . '/cesanet/inc_shared.php');
$schoolEventObj = new SchoolEvents($sqlf);
$calendarCourses = $schoolEventObj->getCalendarCoursesByMonth(
$NumMonths,
(isset($_REQUEST["cat"]) && !empty($_REQUEST["cat"])) ? intval($_REQUEST["cat"]) : null
);
// Always include CSS for both web and PDF display
?>
<style>
/* PDF-friendly CSS - simplified for wkhtmltopdf compatibility */
.table-container {
width: 100%;
overflow: visible;
position: relative;
max-height: 80vh;
overflow-y: auto;
}
#tbl {
width: 100%;
border-collapse: collapse;
table-layout: auto;
}
#tbl thead th {
background-color: #325eab !important;
color: white;
padding: 8px;
border: 1px solid #CCCCCC;
}
#tbl tbody td {
padding: 4px;
margin: 2px;
border: 1px solid #CCCCCC;
vertical-align: top;
}
.smallfonts {
font-family: Tahoma, Arial, sans-serif;
font-size: 10px;
}
.eventname {
font-family: Verdana, Arial, sans-serif;
font-size: 11px;
font-weight: bold;
}
.bluelink {
color: #ffffff;
text-decoration: underline;
}
/* Remove problematic CSS for PDF generation */
@media print {
.table-container {
height: auto !important;
overflow: visible !important;
}
#tbl {
page-break-inside: auto;
}
tr {
page-break-inside: avoid;
}
}
</style>
<?php
?>
<div class="table-container">
<table width=100% cellspacing=0 cellpadding=2 class="smallfonts" id="tbl">
<thead>
<tr>
<th colspan=<?php echo $NumMonths + 2; ?> align=center class='locked' bgcolor="#325eab"><B style="color:white">Training Schedule, <?php echo date("M Y"); ?> - <?php echo date("M Y", strtotime("+ " . ($NumMonths - 1) . " months", strtotime(date("Y-m") . "-01"))); ?></b></th>
</tr>
<tr>
<th class='locked' bgcolor="#325eab" align=center><b style="color:white">Course</b></th>
<?php
$lastmonthShown = 0;
for ($z = date("n"); $z <= (date("n") + ($NumMonths - 1)); $z++) {
$usez = $z;
if ($usez > 12)
$usez = $usez - 12;
echo "<th align=center class='locked' bgcolor='#325eab'><b style='color:white'>" . date("M", strtotime(date("Y") . "-" . $usez . "-01")) . "</b></th>";
$lastmonthShown = $usez;
}
?>
</tr>
</thead>
<tbody id="tbl-container">
<?php
if (count($calendarCourses) > 0) {
$bShowCatHeading = (isset($_REQUEST["cat"]) && !empty($_REQUEST["cat"]));
foreach ($calendarCourses as $course) {
if ($bShowCatHeading) {
echo '<tr><td colspan="' . ($NumMonths + 2) . '" align="left" bgcolor="#6ba9d5" style="color:#325eab; text-align:center; font-size:12px" align=center><b>' . $course["web_category_name"] . '</b></td></tr>';
$bShowCatHeading = false;
}
$sEventInfo = $course['name'];
$arrAccredNums = array();
if (!empty($course['accred_num'])) {
$arrAccredNums[] = $course['accred_num'];
}
if (!empty($course['sacpcmp_num'])) {
$arrAccredNums[] = $course['sacpcmp_num'];
}
if (count($arrAccredNums) > 0) {
$sEventInfo .= " (" . implode(", ", $arrAccredNums) . ")";
}
echo "<tr><td width=280>";
echo "<a href='/sce/school-course?id=" . intval($course['course_link_event_id']) . "'><span class='eventname'>" . $sEventInfo . "</span>";
echo '<p>ECSA CPD Points: ' . number_format(floatval($course['cpd']), 2) . '<br />';
if (!empty($course['sacpcmp_num'])) {
echo 'SACPCMP CPD Points: ' . number_format(floatval($course['sacpcmp_cpd_points']), 2);
}
if (!empty($course['sacnasp_validation_number'])) {
echo 'SACNASP CPD Points: ' . number_format(floatval($course['sacnasp_cpd_points']), 2);
}
echo '</p>';
echo '<p align="center" class="printhide"><span class="bluelink">More Info</span></p>';
echo "</a></td>";
foreach ($course['months'] as $monthData) {
if (empty($monthData['events'])) {
echo "<td> </td>";
continue;
}
echo "<td nowrap align='center' style='text-align:center !important'>";
$eventCount = count($monthData['events']);
$eventIdx = 0;
foreach ($monthData['events'] as $event) {
$eventIdx++;
$startTs = strtotime($event['start_date']);
$endTs = strtotime($event['end_date']);
echo "<p><a href='/sce/school-event?id=" . intval($event['event_id']) . "'>" . date("d", $startTs);
if ($endTs > $startTs) {
echo "-" . date("d", $endTs);
}
echo " " . date("M", $startTs) . "</a></p>";
echo "<p><a href='/sce/school-event?id=" . intval($event['event_id']) . "'><small>" . $event['city'] . "</small></a></p>";
foreach ($event['cost_options'] as $cppRow) {
if (isset($cppRow['CostPerPerson']) && $cppRow['CostPerPerson'] > 0) {
if (count($event['cost_options']) > 1 && !empty($cppRow['StartDate'])) {
$fromDate = new DateTime($cppRow['StartDate']);
echo '<p><b>From ' . $fromDate->format('F Y') . '</b></p>';
}
echo "<p align='center'>R " . number_format(ceil($cppRow["CostPerPerson"] * $incvat), 2) . "<br /><small>per person (incl. VAT)</small></p>";
}
}
if (!$event['cancelled']) {
echo "<p align='center' class='printhide'><a href='/sce/school-event-registration?id=" . intval($event['event_id']) . "'><u><i><span class='bluelink'>Register Now</span></i></u></a></p>";
} else {
echo "<p align='center'>Cancelled</p>";
}
if ($eventIdx < $eventCount) {
echo "<hr>";
}
}
echo "</td>";
}
echo "</tr>";
}
} else {
?>
<tr>
<td>No upcoming courses to display.</td>
</tr>
<?php
}
// if (isset($conni)) {
// mysql_close($conni);
// }
?>
</tbody>
</table></div>