Files
pae.co.at/other/archive/version_01/html/html_schedule.php
2017-03-02 21:57:21 -06:00

127 lines
3.9 KiB
PHP
Executable File

<?php
###################################################################################################### set up this page
global $_MENU,$_WORDS,$_ERRORS,$_MONTHS,$_SCHEDULE; // globals we will need
$data = xml_parse_file($_DOC_ROOT.'/data/pages/seminars_schedule.xml');
?>
<div class='page_subtitle'><?php echo $_MENU['schedule'] ?></div>
<div class='page_content'>
<?php
if(empty($data)) {
print $_ERRORS['pagenotfound'];
}
else {
?>
<table cellpadding='1' cellspacing='2' border='0' class='sch_table'>
<tr class='schedule_header'>
<td align='center'><?php echo $_SCHEDULE['seminar'] ?></td>
<td align='center'><?php echo $_SCHEDULE['level'] ?></td>
<td align='center'><?php echo $_SCHEDULE['date'] ?></td>
<td align='center'><?php echo $_SCHEDULE['duration'] ?></td>
<td align='center'><?php echo $_SCHEDULE['venue'] ?></td>
<td align='center'><?php echo $_SCHEDULE['participants'] ?></td>
<td align='center'><?php echo $_SCHEDULE['registration_deadline'] ?></td>
<td align='center'><?php echo $_SCHEDULE['price'] ?></td>
</tr>
<?php
$seminars = $data['seminar_schedule']['seminar'];
# the user defined sort function here sorts according to
# the next 12 months and then according to start day
# of thecourse within that month (see func_main.php file)
usort($seminars,'main_sort_schedule');
$cur_month = '';
$cur_year = '';
# print a table row for eachcourse
foreach($seminars as $seminar)
{
# getcourse month
$sem_date = explode('.',$seminar['startdate']);
$sem_month = $sem_date[1];
$sem_year = $sem_date[2];
# thecourses are already ordered in the order of the next twelve months
# so, if the month for thiscourse is not the same as the month's heading
# that we've been printing under, print a new heading
if($sem_month != $cur_month || $sem_year != $cur_year)
{
$cur_month = $sem_date[1];
$cur_year = $sem_date[2];
print "<tr><td colspan='8' class='month_row'>{$_MONTHS[$sem_date[1]-1]} 20{$sem_date[2]}</td></tr>\n";
}
print "<tr>";
# print eachcourse data, it is ordered in the xml
# file just like it should be displayed here
foreach($seminar as $key => $value)
{
# these xml elements we don't print, but do use later
if($key == 'month' || $key == 'internal_link' || $key == 'id'
|| $key == 'enddate')
{ continue; }
# if the admin enters 'people' with the number of participants,
# take that word out, as it takes up unnecessary space
else if($key == 'participants')
{
$value = str_replace('people','',$value);
}
# number of days should be entered in english, so translate
# the word to the current language's word for 'days' or 'day'
else if($key == 'duration')
{
$value = str_ireplace('days',$_SCHEDULE['days'],$value);
$value = str_ireplace('day',$_SCHEDULE['day'],$value);
}
# make a link out of certain venues
else if($key == 'venue')
{
if($value == 'Intercity Hotel')
{
$value = "<a href='http://www.intercityhotel.at'>Intercity Hotel</a>";
}
}
# the title and price will be links to the detailed description
# of thecourse
else if($key == 'title' || $key == 'price')
{
$value = "<a href='{$_PATH_PREFIX}/{$_LANG}/display/{$seminar['internal_link']}'>$value</a>";
}
# same rationale as for the date field
else if($key == 'level')
{
$value = str_ireplace('all',$_WORDS['all'],$value);
}
# format the date correctly
else if($key == 'startdate')
{
# if the start and end date are the same
# we'll just keep the value the same (startdate)
# since the enddate is skipped (see above)
if($value != $seminar['enddate'])
{
$value = $value.'-'.$seminar['enddate'];
}
}
# we want the field data centered in the cell
# for each field except the title field
$style = "";
if($key != 'title') {
$style = "style='text-align:center;'";
}
print "<td $style>$value</td>";
}
print "</tr>";
}
?>
</table>
<?php
}
?>
</div>