338 lines
10 KiB
PHP
Executable File
338 lines
10 KiB
PHP
Executable File
<?php
|
|
#################################################################################
|
|
# #
|
|
# written by benjamin ramey #
|
|
# bsr@rameydesign.net #
|
|
# #
|
|
# This file contains: #
|
|
# File that govern how to display the user control panel page #
|
|
# #
|
|
#################################################################################
|
|
|
|
include 'html/html_header.php';
|
|
include 'functions/flow_errors.php';
|
|
include 'functions/flow_messages.php';
|
|
|
|
global $_WORDS,$_LANG,$_MENU,$_DOC_ROOT,$_SEMINAR_FILES,$_NEXT_MONTHS;
|
|
|
|
# SCHEDULE variables for the editing/deleting/adding forms
|
|
$schedule_options = '';
|
|
$scheduled_seminars = xml_parse_file($_CONFIG['schedules_file']);
|
|
$scheduled_seminars = xml_force_array($scheduled_seminars['seminar_schedule']['seminar']);
|
|
|
|
# create the select options html for the schedule
|
|
# used twice, for the edit drop-down and the delete drop-down
|
|
foreach($scheduled_seminars as $seminar)
|
|
{
|
|
$schedule_options .= "<option value='{$seminar['id']}'>{$seminar['title']} ({$seminar['startdate']})</option>\n";
|
|
}
|
|
|
|
# EVENTS variables for the editing/deleting/adding forms
|
|
$events_options = '';
|
|
$events = xml_parse_file($_CONFIG['events_file']);
|
|
$events = xml_force_array($events['events']['event']);
|
|
|
|
# create the select options html for the events
|
|
# used twice, for the edit drop-down and the delete drop-down
|
|
foreach($events as $event)
|
|
{
|
|
$events_options .= "<option value='{$event['id']}'>{$event['title']}</option>\n";
|
|
}
|
|
|
|
$all_seminars = array();
|
|
|
|
# adds allcourse names with their internal link
|
|
# to a list to display for the administrator to pick from
|
|
# when selecting acourse to schedule on the schedule
|
|
sort($_SEMINAR_FILES);
|
|
foreach($_SEMINAR_FILES as $seminar)
|
|
{
|
|
$data = xml_parse_file($_DOC_ROOT.'/data/pages/'.$seminar);
|
|
$name = $data['page'][$_LANG]['name'];
|
|
if(empty($name))
|
|
{
|
|
if($_LANG == 'en')
|
|
{ $name = $data['page']['de']['name']; }
|
|
else if($_LANG == 'de')
|
|
{ $name = $data['page']['en']['name']; }
|
|
}
|
|
array_push($all_seminars, array('file'=>$seminar,
|
|
'name'=>$name));
|
|
}
|
|
|
|
# gets all the days options for day of month
|
|
$monthday_options = '';
|
|
for($c = 1; $c < 32; $c++)
|
|
{
|
|
$monthday_options .= "<option>$c</option>\n";
|
|
}
|
|
# gets all the month options
|
|
$month_options = '';
|
|
for($c = 1; $c < 13; $c++)
|
|
{
|
|
$value_mon = str_pad($c , 2, '0', STR_PAD_LEFT);
|
|
$month_options .= "<option value='$value_mon'>$c</option>\n";
|
|
}
|
|
# gets all the year options
|
|
$year_options = '';
|
|
$cur_year = date("Y");
|
|
$cur_shortyear = date("y");
|
|
for($c = 0; $c < 10; $c++)
|
|
{
|
|
$option_year = $cur_year + $c;
|
|
$value_year = str_pad($cur_shortyear + $c , 2, '0', STR_PAD_LEFT);
|
|
$year_options .= "<option value='$value_year'>$option_year</option>\n";
|
|
}
|
|
|
|
if($_SESSION['_usertype'] == 'admin')
|
|
{
|
|
?>
|
|
<div class='page_subtitle'><?php echo $_WORDS['administrator'].' '.$_WORDS['functions'] ?></div>
|
|
<div class='page_content'>
|
|
<div class='text_div'>
|
|
<!--SCHEDULE EDITING-->
|
|
<div class='text_header'><?php echo $_MENU['schedule'] ?></div>
|
|
<div class='text'>
|
|
<form action='/pae.php/<?php echo $_LANG ?>/user/editschedule' method='post'>
|
|
<strong><?php echo $_WORDS['edit'] ?>: </strong>
|
|
<br />
|
|
<select name='edit_id'>
|
|
<option value=''>Select acourse</option>
|
|
<option value=''>----------------</option>
|
|
<?php echo $schedule_options ?>
|
|
</select>
|
|
<input type='submit' value='<?php echo $_WORDS['edit'] ?>' />
|
|
</form>
|
|
<br />
|
|
<form action='/pae.php/<?php echo $_LANG ?>/user/deleteschedule' method='post'>
|
|
<strong><?php echo $_WORDS['delete'] ?>: </strong>
|
|
<br />
|
|
<select name='delete_id'>
|
|
<option value=''>Select acourse</option>
|
|
<option value=''>----------------</option>
|
|
<?php echo $schedule_options ?>
|
|
</select>
|
|
<input type='submit' value='<?php echo $_WORDS['delete'] ?>' />
|
|
</form>
|
|
<br />
|
|
<strong><?php echo $_WORDS['add'] ?>:</strong>
|
|
<form action='/pae.php/en/user/addschedule' method='post'>
|
|
<table cellpadding='2'>
|
|
<tr>
|
|
<td align='right' valign='top'>Course:</td>
|
|
<td>
|
|
<select name='seminar'>
|
|
<?php
|
|
|
|
foreach($all_seminars as $option)
|
|
{
|
|
print "<option value='{$option['file']}'>{$option['name']}</option>\n";
|
|
}
|
|
|
|
?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Start date:</td>
|
|
<td valign='top'>
|
|
<table cellpadding='0' cellspacing='0'>
|
|
<tr>
|
|
<td>
|
|
<select name='startday[]' multiple='multiple' size='2'>
|
|
<?php echo $monthday_options ?>
|
|
</select>
|
|
</td>
|
|
<td valign='top'>
|
|
<select name='startmonth'>
|
|
<?php echo $month_options ?>
|
|
</select>
|
|
</td>
|
|
<td valign='top'>
|
|
<select name='startyear'>
|
|
<?php echo $year_options ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>
|
|
Select multiple days by holding down the 'CTRL'
|
|
key while clicking.
|
|
<br />
|
|
If thecourse lasts several non-consecutive days or thecourse
|
|
is just one day long, make the end date exactly
|
|
the same as the start date.
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>End date:</td>
|
|
<td valign='top'>
|
|
<table cellpadding='0' cellspacing='0'>
|
|
<tr>
|
|
<td>
|
|
<select name='endday[]' multiple='multiple' size='2'>
|
|
<?php echo $monthday_options ?>
|
|
</select>
|
|
</td>
|
|
<td valign='top'>
|
|
<select name='endmonth'>
|
|
<?php echo $month_options ?>
|
|
</select>
|
|
</td>
|
|
<td valign='top'>
|
|
<select name='endyear'>
|
|
<?php echo $year_options ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>
|
|
Select multiple days by holding down the 'CTRL'
|
|
key while clicking.
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Level:</td>
|
|
<td><input type='text' name='level' /></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Date:</td>
|
|
<td><input type='text' name='date' /></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Duration:</td>
|
|
<td>
|
|
<input type='text' name='duration' />
|
|
<br />(the words 'day' and 'days' will automatically be translated)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Venue:</td>
|
|
<td>
|
|
<input type='text' name='venue' />
|
|
<br />(recognized venues will automatically be linked)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Participants:</td>
|
|
<td>
|
|
<input type='text' name='participants' />
|
|
<br />(the word 'people' will be stripped out)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Registration Deadline:</td>
|
|
<td>
|
|
<select name='regday'>
|
|
<?php echo $monthday_options ?>
|
|
</select>
|
|
<select name='regmonth'>
|
|
<?php echo $month_options ?>
|
|
</select>
|
|
<select name='regyear'>
|
|
<?php echo $year_options ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Price:</td>
|
|
<td><input type='text' name='price' /></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'></td>
|
|
<td><input type='submit' value='<?php echo $_WORDS['add'] ?>' /></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
<br />
|
|
</div>
|
|
</div>
|
|
<!--END SCHEDULE EDITING-->
|
|
<!--EVENT EDITING-->
|
|
<div class='text_div'>
|
|
<div class='text_header'><?php echo $_MENU['events'] ?></div>
|
|
<div class='text'>
|
|
<form action='/pae.php/<?php echo $_LANG ?>/user/editevent' method='post'>
|
|
<strong><?php echo $_WORDS['edit'] ?>: </strong>
|
|
<br />
|
|
<select name='edit_id'>
|
|
<option value=''>Select an event</option>
|
|
<option value=''>----------------</option>
|
|
<?php echo $events_options ?>
|
|
</select>
|
|
<input type='submit' value='<?php echo $_WORDS['edit'] ?>' />
|
|
</form>
|
|
<br />
|
|
<form action='/pae.php/<?php echo $_LANG ?>/user/deleteevent' method='post'>
|
|
<strong><?php echo $_WORDS['delete'] ?>: </strong>
|
|
<br />
|
|
<select name='delete_id'>
|
|
<option value=''>Select an event</option>
|
|
<option value=''>----------------</option>
|
|
<?php echo $events_options ?>
|
|
</select>
|
|
<input type='submit' value='<?php echo $_WORDS['delete'] ?>' />
|
|
</form>
|
|
<br />
|
|
<strong><?php echo $_WORDS['add'] ?>:</strong>
|
|
<br />
|
|
<form action='/pae.php/<?php echo $_LANG ?>/user/addevent' method='post' enctype="multipart/form-data">
|
|
<table cellpadding='4' cellspacing='0' border='0'>
|
|
<tr>
|
|
<td align='right'>Event Name:</td>
|
|
<td><input type='text' size='30' name='title' /></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Event <?php echo $_WORDS['location'] ?>:</td>
|
|
<td><textarea rows='3' cols='40' name='location'></textarea></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right'>Event <?php echo $_WORDS['date'] ?>:</td>
|
|
<td>
|
|
<input type='text' size='10' name='date' />
|
|
<?php echo $_WORDS['from'] ?>: <input type='text' size='10' name='starttime' />
|
|
<?php echo $_WORDS['until'] ?>: <input type='text' size='10' name='endtime' />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Event <?php echo $_WORDS['description'] ?>:</td>
|
|
<td><textarea rows='6' cols='40' name='description'></textarea></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'>Event Photo:</td>
|
|
<td><input type='file' size='40' name='picture' /></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right'> </td>
|
|
<td><input type='submit' value='<?php echo $_WORDS['add'] ?>' /></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!--END EVENT EDITING-->
|
|
</div>
|
|
<?php
|
|
}
|
|
# if this user logs in but is not an admin
|
|
else
|
|
{
|
|
?>
|
|
<div class='page_subtitle'><?php echo $_WORDS['welcome'] ?></div>
|
|
<div class='page_content'>
|
|
There is nothing for you to do here. Muahahah!
|
|
</div>
|
|
<?php
|
|
}
|
|
|
|
include 'html/html_footer.php';
|
|
|
|
?>
|