<?php
/**
* SASHA :: inc/lib/lib.forms.php
*
* This contains the methods required to generate a form.
*
* @package SASHA
* @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id: lib.forms.php 84 2010-01-21 01:26:56Z gphemsley $
*/
/**
* Forms
*
* Form generator. Must be called from within an instance of Base or its descendant.
*
* @todo Consolidate Forms::_create_*_type_selector() methods
*
* @package Forms
*/
class Forms
{
/**
* Forms::_create_date_selector()
*
* Create date selector form controls.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|int $current_date UNIX timestamp to be selected by default
* @return void Prints form controls
*/
final private static function _create_date_selector( $selector_id, $current_date = FALSE )
{
$current_date = ( $current_date ) ? $current_date : time();
print "\t" . '<select id="' . $selector_id . ':month" name="' . $selector_id . '[month]">' . "\n";
for( $i = 1; $i <= 12; $i++ )
{
switch( $i )
{
case 1:
$month = 'January';
break;
case 2:
$month = 'February';
break;
case 3:
$month = 'March';
break;
case 4:
$month = 'April';
break;
case 5:
$month = 'May';
break;
case 6:
$month = 'June';
break;
case 7:
$month = 'July';
break;
case 8:
$month = 'August';
break;
case 9:
$month = 'September';
break;
case 10:
$month = 'October';
break;
case 11:
$month = 'November';
break;
case 12:
$month = 'December';
break;
}
$selected = ( $i == date( 'n', $current_date ) ) ? ' selected="selected"' : '';
print "\t\t" . '<option value="' . $i . '"' . $selected . '>' . $month . '</option>' . "\n";
}
print "\t" . '</select>' . "\n\n";
print "\t" . '<select id="' . $selector_id . ':day" name="' . $selector_id . '[day]">' . "\n";
for( $i = 1; $i <= 31; $i++ )
{
$selected = ( $i == date( 'j', $current_date ) ) ? ' selected="selected"' : '';
print "\t\t" . '<option value="' . $i . '"' . $selected . '>' . $i . '</option>' . "\n";
}
print "\t" . '</select>' . "\n\n";
print "\t" . '<select id="' . $selector_id . ':year" name="' . $selector_id . '[year]">' . "\n";
$year = date( 'Y', $current_date );
for( $i = $year - 2; $i <= $year + 2; $i++ )
{
$selected = ( $i == $year ) ? ' selected="selected"' : '';
print "\t\t" . '<option value="' . $i . '"' . $selected . '>' . $i . '</option>' . "\n";
}
print "\t" . '</select>' . "\n";
}
/**
* Forms::_create_time_selector()
*
* Create time selector form controls.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|int $current_date UNIX timestamp to be selected by default
* @return void Prints form controls
*/
final private static function _create_time_selector( $selector_id, $current_date = FALSE )
{
$current_date = ( $current_date ) ? $current_date : time();
if( strlen( $current_date ) == 4 )
{
list( $hour, $minute ) = str_split( $current_date, 2 );
$current_date = mktime( $hour, $minute, 0 );
}
print "\t\t" . '<select id="' . $selector_id . ':hour" name="' . $selector_id . '[hour]">' . "\n";
for( $i = 1; $i <= 12; $i++ )
{
$selected = ( $i == date( 'g', $current_date ) ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $i . '"' . $selected . '>' . str_pad( $i, 2, 0, STR_PAD_LEFT ) . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n\n";
print "\t\t" . '<select id="' . $selector_id . ':minute" name="' . $selector_id . '[minute]">' . "\n";
for( $i = 0; $i < 60; $i++ )
{
$selected = ( str_pad( $i, 2, 0, STR_PAD_LEFT ) == date( 'i', $current_date ) ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $i . '"' . $selected . '>' . str_pad( $i, 2, 0, STR_PAD_LEFT ) . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n\n";
print "\t\t" . '<select id="' . $selector_id . ':meridiem" name="' . $selector_id . '[meridiem]">' . "\n";
foreach( array( 'AM', 'PM' ) as $meridiem )
{
$selected = ( $meridiem == date( 'A', $current_date ) ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $meridiem . '"' . $selected . '>' . $meridiem . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_color_selector()
*
* Create color selector form control.
*
* @todo Update this to match other form control methods.
* @todo Get this working and implemented.
*
* @access private
* @param string $selector_id Form control id for selector
// * @param int $current_date UNIX timestamp to be selected by default
* @return void Prints form controls
*/
final private static function _create_color_selector( $selector_id, $current_colorset = 0 )
{
global $SASHA;
$colorsets = array(
array(
'name' => 'Black on White',
'text_color' => '#000000',
'bg_color' => '#FFFFFF'
),
array(
'name' => 'White on Black',
'text_color' => '#FFFFFF',
'bg_color' => '#000000'
),
array(
'name' => 'Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Gray (inverse)',
'text_color' => '#D4DEEF',
'bg_color' => '#455574'
),
array(
'name' => 'Light Blue',
'text_color' => '#004DFF',
'bg_color' => '#D5E7FF'
),
array(
'name' => 'Light Blue (inverse)',
'text_color' => '#D5E7FF',
'bg_color' => '#004DFF'
),
array(
'name' => 'Navy Blue',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Navy Blue (inverse)',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
array(
'name' => 'Dark Gray on Light Gray',
'text_color' => '#455574',
'bg_color' => '#D4DEEF'
),
);
print "\t\t" . '<select id="' . $selector_id . '" name="' . $selector_id . '" onchange="document.getElementById( \'colorbox\' ).style.backgroundColor = \'\'; )">' . "\n";
// print "\t\t\t" . '<option value="0"' . $selected . '>' . $row['subject'] . ' ' . $row['course'] . ' (' . $row['section'] . ') — ' . $SASHA->format_instructors( $row['instructors'], '; ' ) . ' (' . $row['type'] . ': ' . $SASHA->format_days( $row['days'] ) . ')</option>' . "\n";
foreach( $colors as $row )
{
// $selected = ( $row['schedule_id'] == $schedule_id ) ? ' selected="selected"' : '';
// print "\t\t\t" . '<option value="' . $row['schedule_id'] . '"' . $selected . '>' . $row['subject'] . ' ' . $row['course'] . ' (' . $row['section'] . ') — ' . $SASHA->format_instructors( $row['instructors'], '; ' ) . ' (' . $row['type'] . ': ' . $SASHA->format_days( $row['days'] ) . ')</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_days_selector()
*
* Create days selector form control.
*
* @todo Ensure that this matches other form controls.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|array $current_days Days to be selected by default
* @return void Prints form controls
*/
final private static function _create_days_selector( $selector_id, $current_days = FALSE )
{
global $SASHA;
$current_days = $SASHA->format_days( $current_days, NULL, 'array' );
print "\t\t" . '<select id="' . $selector_id . '" name="' . $selector_id . '[]" multiple="multiple" style="vertical-align: text-top;">' . "\n";
foreach( $SASHA->days as $day => $values )
{
$selected = ( $current_days[$day] ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $day . '"' . $selected . '>' . $day . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_instructor_selector()
*
* Create instructor selector form control.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|array $current_instructor_ids Instructor id to be selected by default
* @param bool|string $institution Limit selection to given institution
* @return void Prints form controls
*/
final private static function _create_instructor_selector( $selector_id, $current_instructor_ids = FALSE, $institution = FALSE )
{
global $SASHA;
global $Database;
if( !is_array( $current_instructor_ids ) )
{
$current_instructor_ids = explode( ',', $current_instructor_ids );
}
$institution = ( $institution ) ? (string) $institution : $SASHA->institution;
$sql = "SELECT r.*
FROM instructors r
WHERE r.institution = '$institution'
ORDER BY r.last_name ASC, r.first_name ASC, r.middle_name ASC, r.type ASC, r.type_description ASC";
$result = $Database->query( $sql );
print "\t\t\t" . '<ol>' . "\n";
for( $i = 0; $i < 6; $i++ )
{
print "\t\t\t\t" . '<li><select id="' . $selector_id . ':' . $i . '" name="' . $selector_id . '[' . $i . ']">' . "\n";
print "\t\t\t\t" . '<option value="">None</option>' . "\n";
while( $row = $Database->fetch_assoc( $result ) )
{
$selected = ( ( $row['instructor_id'] == @$current_instructor_ids[$i] ) || ( $row['instructor_key'] == @$current_instructor_ids[$i] ) ) ? ' selected="selected"' : '';
print "\t\t\t\t\t" . '<option value="' . $row['instructor_id'] . '"' . $selected . '>' . htmlentities( $row['last_name'] ) . ', ' . htmlentities( $row['first_name'] ) . ' ' . htmlentities( $row['middle_name'] ) . ' — ' . $SASHA->format_instructor_type( $row['type'], $row['type_description'] ) . '</option>' . "\n";
}
$Database->reset_result( $result );
print "\t\t\t\t" . '</select></li>' . "\n";
}
$Database->free_result( $result );
print "\t\t\t" . '</ol>' . "\n";
}
/**
* Forms::_create_schedule_type_selector()
*
* Create schedule type selector form control.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|int $current_schedule_type Schedule type to be selected by default
* @return void Prints form controls
*/
final private static function _create_schedule_type_selector( $selector_id, $current_schedule_type = FALSE )
{
global $SASHA;
print "\t\t" . '<select id="' . $selector_id . '" name="' . $selector_id . '">' . "\n";
print "\t\t\t" . '<option value=""> </option>' . "\n";
foreach( $SASHA->schedule_types as $option_value => $option_name )
{
$selected = ( $option_value === $current_schedule_type ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $option_value . '"' . $selected . '>' . $option_name . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_assignment_status_selector()
*
* Create assignment type selector form control.
*
* @access private
* @param string $selector_id Form control id for selector
* @param int $current_assignment_status Assignment type to be selected by default
* @return void Prints form controls
*/
final private static function _create_assignment_status_selector( $selector_id, $current_assignment_status = AT_TODO )
{
global $SASHA;
print "\t\t" . '<select id="' . $selector_id . '" name="' . $selector_id . '">' . "\n";
foreach( $SASHA->assignment_statuses as $option_value => $option_name )
{
$selected = ( $option_value == $current_assignment_status ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $option_value . '"' . $selected . '>' . $option_name . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_test_type_selector()
*
* Create test type selector form control.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|int $current_test_type Test type to be selected by default
* @return void Prints form controls
*/
final private static function _create_test_type_selector( $selector_id, $current_test_type = FALSE )
{
global $SASHA;
print "\t\t" . '<select id="' . $selector_id . '" name="' . $selector_id . '">' . "\n";
print "\t\t\t" . '<option value=""> </option>' . "\n";
foreach( $SASHA->test_types as $option_value => $option_name )
{
$selected = ( $option_value === $current_test_type ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $option_value . '"' . $selected . '>' . $option_name . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_institution_selector()
*
* Create institution selector form control.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|string $institution Institution to be selected by default
* @return void Prints form controls
*/
final private static function _create_institution_selector( $selector_id, $institution = FALSE )
{
global $SASHA;
global $Database;
$institution = ( $institution ) ? (string) $institution : $SASHA->institution;
$sql = "SELECT i.*
FROM institutions i
ORDER BY i.country ASC, i.subdivision ASC, i.name ASC";
$result = $Database->query( $sql );
print "\t\t" . '<select id="' . $selector_id . '" name="' . $selector_id . '">' . "\n";
print "\t\t\t" . '<option value=""> </option>' . "\n";
while( $row = $Database->fetch_assoc( $result ) )
{
$selected = ( $row['institution'] == $institution ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $row['institution'] . '"' . $selected . '>' . $row['country'] . ' — ' . $row['subdivision'] . ' — ' . $row['name'] . '</option>' . "\n";
}
$Database->free_result( $result );
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_semester_selector()
*
* Create semester selector form control.
*
* @access private
* @param string $selector_id Form control id for selector
* @param bool|int|string $semester Semester to be selected by default (format: YYYYMM)
* @return void Prints form controls
*/
final private static function _create_semester_selector( $selector_id, $semester = FALSE )
{
global $SASHA;
$semester = ( $semester ) ? (string) $semester : $SASHA->semester;
$data = preg_split( '/(\d{4})(\d{2})/', $semester, -1, PREG_SPLIT_DELIM_CAPTURE );
if( !$data || ( count( $data ) != 4 ) )
{
return FALSE;
}
$year = $data[1];
$seasons = array(
'01' => 'Spring',
'06' => 'Summer',
'09' => 'Fall'
);
print "\t\t" . '<select id="' . $selector_id . ':season" name="' . $selector_id . '[season]">' . "\n";
foreach( $seasons as $month => $season )
{
$selected = ( $month == $data[2] ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $month . '"' . $selected . '>' . $season . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
print "\t\t" . '<select id="' . $selector_id . ':year" name="' . $selector_id . '[year]">' . "\n";
for( $i = $year - 2; $i <= $year + 2; $i++ )
{
$selected = ( $i == $year ) ? ' selected="selected"' : '';
print "\t\t\t" . '<option value="' . $i . '"' . $selected . '>' . $i . '</option>' . "\n";
}
print "\t\t" . '</select>' . "\n";
}
/**
* Forms::_create_course_selector()
*
* Create course selector form control.
*
* @todo Do something with $institution.
* @todo Clean up SQL query.
*
* @access private
* @param string $selector_id Form control id for selector
* @param int|bool $current_schedule_id Schedule id to be selected by default
* @param int|string|bool $semester List courses from given semester (format: YYYYMM)
* @param string|bool $institution Limit selection to given institution
* @return void Prints form controls
*/
final private static function _create_course_selector( $selector_id, $current_schedule_id = FALSE, $semester = FALSE, $institution = FALSE )
{
global $SASHA;
global $Database, $User;
$semester = ( $semester ) ? (string) $semester : $SASHA->semester;
$institution_where = ( $institution ) ? "AND s.institution = '$institution'" : '';
$sql = "SELECT s.*
FROM schedules s
LEFT JOIN ( institutions i )
ON ( s.institution = i.institution )
WHERE s.user_id = {$User->user_info['id']}
AND s.semester = '$semester'
$institution_where
ORDER BY i.name ASC, s.subject ASC, s.course ASC, s.section ASC, s.instructors ASC, s.days DESC";
$result = $Database->query( $sql );
print "\t\t\t" . '<select id="' . $selector_id . '" name="' . $selector_id . '">' . "\n";
print "\t\t\t" . '<option value="">None</option>' . "\n";
while( $row = $Database->fetch_assoc( $result ) )
{
$selected = ( $row['schedule_id'] == $current_schedule_id ) ? ' selected="selected"' : '';
print "\t\t\t\t" . '<option value="' . $row['schedule_id'] . '"' . $selected . '>' . $SASHA->format_institution( $row['institution'] ) . ' — ' . $SASHA->format_course( $row['subject'], $row['course'], $row['institution'] ) . ' (' . $row['section'] . ') — ' . $SASHA->format_instructors( $row['instructors'], '; ' ) . ' (' . $SASHA->format_schedule_type( $row['schedule_type'] ) . ': ' . $SASHA->format_days( $row['days'], NULL, 'html' ) . ')</option>' . "\n";
}
$Database->free_result( $result );
print "\t\t\t" . '</select>' . "\n";
}
/**
* Forms::create_form()
*
* Create a complete HTML form using the given parameters.
*
* @access public
* @param string $form_name Form name
* @param string $form_action URL to send form data
* @param array $form_data Parameters used to propagate form
* @return void Prints a complete HTML form
*/
public static function create_form( $form_name, $form_action, $form_data )
{
global $SASHA;
if( !is_array( $form_data ) )
{
return FALSE;
}
print "\t" . '<form id="' . $form_name . '" action="' . $form_action . '" method="post" accept-charset="UTF-8" style="text-align: left;">' . "\n";
foreach( $form_data as $id => $id_data )
{
$form_data[$id]['name'] = $id_data['name'] = ( isset( $id_data['name'] ) ) ? $id_data['name'] : 'r_' . md5( rand() . microtime() );
$form_data[$id]['id'] = $id_data['id'] = ( isset( $id_data['id'] ) ) ? $id_data['id'] : $id_data['name']; //'r_' . md5( rand() . microtime() );
switch( $id_data['type'] )
{
case 'header':
print "\t\t<h";
print ( $id_data['data']['level'] && ( $id_data['data']['level'] < 6 ) ) ? $id_data['data']['level'] : 2;
print ' id="' . $id_data['id'] . '">' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . '</h';
print ( $id_data['data']['level'] && ( $id_data['data']['level'] < 6 ) ) ? $id_data['data']['level'] : 2;
print ">\n";
break;
case 'text':
case 'password':
print "\t\t<p>";
if( isset( $id_data['label'] ) )
{
print '<label>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ':<br />';
}
print '<input id="' . $id_data['id'] . '" name="' . $id_data['name'] . '" type="' . $id_data['type'] . '"';
if( isset( $id_data['data']['value'] ) )
{
print ' value="' . htmlentities( $id_data['data']['value'], ENT_QUOTES, 'UTF-8' ) . '"';
}
if( isset( $id_data['data']['size'] ) )
{
print ' size="' . (int) $id_data['data']['size'] . '"';
}
if( isset( $id_data['data']['maxlength'] ) )
{
print ' maxlength="' . (int) $id_data['data']['maxlength'] . '"';
}
print ' />';
if( isset( $id_data['label'] ) )
{
print '</label>';
}
print "</p>\n";
break;
case 'hidden':
print "\t\t<p>";
if( preg_match( '#(\[|\])#', $id_data['name'] ) && ( $id_data['name'] == $id_data['id'] ) )
{
$id_data['id'] = str_replace( '[', ':', $id_data['id'] );
$id_data['id'] = str_replace( ']', '', $id_data['id'] );
$form_data[$id]['id'] = $id_data['id'];
}
print '<input id="' . $id_data['id'] . '" name="' . $id_data['name'] . '" type="hidden"';
if( isset( $id_data['data']['value'] ) )
{
print ' value="' . htmlentities( $id_data['data']['value'], ENT_QUOTES, 'UTF-8' ) . '"';
}
print ' />';
print "</p>\n";
break;
case 'submit':
print "\t\t<p>";
print '<input id="' . $id_data['id'] . '" name="' . $id_data['name'] . '" type="submit"';
if( isset( $id_data['data']['value'] ) )
{
print ' value="' . htmlentities( $id_data['data']['value'], ENT_QUOTES, 'UTF-8' ) . '"';
}
print ' />';
print "</p>\n";
break;
case 'textarea':
print "\t\t<p>";
if( isset( $id_data['label'] ) )
{
print '<label>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ':<br />';
}
print '<textarea id="' . $id_data['id'] . '" name="' . $id_data['name'] . '"';
if( isset( $id_data['data']['rows'] ) )
{
print ' rows="' . (int) $id_data['data']['rows'] . '"';
}
if( isset( $id_data['data']['cols'] ) )
{
print ' cols="' . (int) $id_data['data']['cols'] . '"';
}
print '>';
if( isset( $id_data['data']['value'] ) )
{
print htmlentities( $id_data['data']['value'], ENT_QUOTES, 'UTF-8' );
}
print '</textarea>';
if( isset( $id_data['label'] ) )
{
print '</label>';
}
print "</p>\n";
break;
case 'date':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_date_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'time':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_time_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'date_time':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_date_selector( $id_data['name'], @$id_data['data'][0] );
Forms::_create_time_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'color':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_color_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'days':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_days_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'schedule_type':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_schedule_type_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'assignment_status':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_assignment_status_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'test_type':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_test_type_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'institution':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_institution_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'instructor':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_instructor_selector( $id_data['name'], @$id_data['data'][0], @$id_data['data'][1] );
print "\t\t" . '</p>' . "\n";
break;
case 'semester':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_semester_selector( $id_data['name'], @$id_data['data'][0] );
print "\t\t" . '</p>' . "\n";
break;
case 'course':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_course_selector( $id_data['name'], @$id_data['data'][0], @$id_data['data'][1], @$id_data['data'][2] );
print "\t\t" . '</p>' . "\n";
break;
}
}
print "\t</form>\n";
}
}
?>