Ejemplo n.º 1
0
    $data['school_zip'] = $_REQUEST['school_zip'];
    $data['school_country'] = $_REQUEST['school_country'];
    $status = mystery_update_query('portal_schools', $data, 'school_id', $_SESSION['portal']['member_school'], 'portal_dbh');
    if ($status == 0) {
        $errors = array('Could not update school information');
        echo portal_generate_error_page($errors);
    } else {
        // redirect back to the admin page
        mystery_redirect('/admin/');
        exit;
    }
} else {
    $school_info = portal_get_school_info($_SESSION['portal']['member_school']);
    $state_list = portal_generate_db_form_list('school_state', @$school_info['school_state'], 'mystery4.mystery_states', 'state_abbr', 'state_name', 'list', '', '', array(), array('<option value=""></option>'), 35);
    $country_list = portal_generate_db_form_list('school_country', $school_info['district_school'], 'mystery4.mystery_countries', 'country_name', 'country_name', 'list', '', '', array(), array('<option value=""></option>'), 50);
    $school_info = portal_web_output_filter($school_info);
    echo '
	<form action="/school/edit/process/" method="post">
	
	<h1>Edit School</h1>
	
	<p><label for="school-name">School Name</label> <input type="text" name="school_name" id="school-name" value="' . @$school_info['school_name'] . '" size="35"></p>

	<p><label for="school-address-1">Address 1</label> <input type="text" name="school_address_1" id="school-address-1" value="' . @$school_info['school_address_1'] . '" size="35"></p>

	<p><label for="school-address-2">Address 2</label> <input type="text" name="school_address_2" id="school-address-2" value="' . @$school_info['school_address_2'] . '" size="35"></p>

	<p><label for="school-city">City</label> <input type="text" name="school_city" id="school-city" value="' . @$school_info['school_city'] . '" size="35"></p>

	<p><label for="school-state">State</label> ' . $state_list . '</p>
Ejemplo n.º 2
0
        $diy_id = $activities[$i]['diy_identifier'];
        $info = '<a href="#" onclick="toggle_block_element(\'activity-description-' . $activities[$i]['activity_id'] . '\'); return false;" title="View activity description">' . portal_icon('info') . '</a>';
        $run = '<a href="/diy/run/' . $diy_id . '/" title="Run this activity">' . portal_icon('run') . '</a>';
        $activity_options = '
		' . $info . '
		' . $run . '
		';
        if (in_array($diy_id, $usage)) {
            $activity_used = portal_icon('work');
        }
    }
    $description = portal_web_output_filter($activities[$i]['activity_description']);
    $activity_box = '
	<div class="activity-box">
		<div class="activity-title">
		' . $activity_options . ' ' . portal_web_output_filter($activities[$i]['activity_name']) . ' ' . $activity_used . '
		</div>
		<!--div class="activity-info">
		(Sensor: ' . $activities[$i]['sensor_type'] . '; Model: ' . $activities[$i]['model_type'] . ')
		</div-->
		<div class="activity-description" id="activity-description-' . $activities[$i]['activity_id'] . '">
		' . $description . '
		</div>
	</div>
	';
    $list .= $activity_box;
}
if ($list != '') {
    echo '<h2 style="margin-top: 1.5em;">Additional Activities</h2>';
    echo $list;
}
Ejemplo n.º 3
0
		<li><a href="/class/copy/' . $class_id . '/">Make a copy of this class (and its activity selections)</a></li>

		<li><a href="/class/preview/' . $class_id . '/">Preview this class as your students will see it</a></li>

		</ul>
		
		';
        // mystery_redirect('/');
        // exit;
    } else {
        $errors = array('Another class is already using that <strong>Sign Up Word</strong>.  Please choose another.');
        echo portal_generate_error_page($errors);
    }
} else {
    $class_info = portal_web_output_filter($class_info);
    // generate accomations if applicable
    $accommodations = '<p><em>These settings apply for the whole class.  You can change settings for particular students on the class roster page.</em></p>' . portal_generate_class_accommodations($id_param);
    // generate the activity grid
    $activity_grid = portal_generate_activity_grid($class_info['activities'], $class_info['diy_activities'], 'setup');
    $total_activity_count = count($class_info['activities']) + count($class_info['diy_activities']);
    $section_counts = array();
    /*
    $all_activities = array_merge($class_info['activities'], $class_info['diy_activities']);
    foreach ($all_activities as $activity) {
    	$section_counts[] += 1;
    }
    */
    // generate the form
    echo '
	<form action="/class/' . $_PORTAL['activity'] . '/' . $id_param . '/process/" method="post">
Ejemplo n.º 4
0
<?php

$page_title = 'About';
echo '

<img src="' . @$_PORTAL['project_info']['project_logo'] . '" align="right" border="0">

<h2>' . @$_PORTAL['project_info']['project_title'] . '</h2>

<p>' . portal_web_output_filter(@$_PORTAL['project_info']['project_description']) . '</p>

<p>For more information, please <a href="' . @$_PORTAL['project_info']['project_url'] . '">visit the project website</a>.</p>

';
Ejemplo n.º 5
0
                $_SESSION['portal']['member_password_ue'] = $_REQUEST['password'];
            }
        }
        // update class information if provided
        if (isset($_REQUEST['class_id'])) {
            if (!in_array($_REQUEST['class_id'], $member_info['classes']['student'])) {
                portal_add_member_to_class($member_id, $_REQUEST['class_id']);
            }
        }
        // redirect back to the admin page
        mystery_redirect($return_page);
        exit;
    }
} else {
    // FIXME - show admin option for admin/superuser
    $member_info = portal_web_output_filter($member_info);
    $email_field = '';
    $class_field = '';
    $type_field = '';
    $grade_field = '';
    if ($member_info['member_type'] == 'student') {
        if ($_SESSION['portal']['member_type'] != 'student') {
            // don't let students change their own class
            $teacher_id = '';
            if ($_SESSION['portal']['member_type'] == 'teacher') {
                $teacher_id = $_SESSION['portal']['member_id'];
            }
            $current_class = @$member_info['classes']['student'][0];
            $class_field = portal_generate_class_select_list(@$member_info['member_school'], $teacher_id, $current_class);
        }
    } else {
Ejemplo n.º 6
0
    $data['district_zip'] = $_REQUEST['district_zip'];
    $data['district_country'] = $_REQUEST['district_country'];
    $status = mystery_update_query('portal_districts', $data, 'district_id', $district_id, 'portal_dbh');
    if ($status == 0) {
        $errors = array('Could not update district information');
        echo portal_generate_error_page($errors);
    } else {
        // redirect back to the admin page
        mystery_redirect('/admin/');
        exit;
    }
} else {
    $district_info = portal_get_district_info($district_id);
    $state_list = portal_generate_db_form_list('district_state', @$district_info['district_state'], 'mystery4.mystery_states', 'state_abbr', 'state_name', 'list', '', '', array(), array('<option value=""></option>'), 35);
    $country_list = portal_generate_db_form_list('district_country', @$district_info['district_country'], 'mystery4.mystery_countries', 'country_name', 'country_name', 'list', '', '', array(), array('<option value=""></option>'), 50);
    $district_info = portal_web_output_filter($district_info);
    echo '
	<form action="/district/edit/' . $district_id . '/process/" method="post">
	
	<h1>Edit district</h1>
	
	<p><label for="district-name">district Name</label> <input type="text" name="district_name" id="district-name" value="' . @$district_info['district_name'] . '" size="35"></p>

	<p><label for="district-address-1">Address 1</label> <input type="text" name="district_address_1" id="district-address-1" value="' . @$district_info['district_address_1'] . '" size="35"></p>

	<p><label for="district-address-2">Address 2</label> <input type="text" name="district_address_2" id="district-address-2" value="' . @$district_info['district_address_2'] . '" size="35"></p>

	<p><label for="district-city">City</label> <input type="text" name="district_city" id="district-city" value="' . @$district_info['district_city'] . '" size="35"></p>

	<p><label for="district-state">State</label> ' . $state_list . '</p>
Ejemplo n.º 7
0
function portal_generate_activity_grid($activity_ids = array(), $diy_activity_ids = array(), $mode = '')
{
    global $portal_config;
    $activity_grid = '';
    if ($mode == 'preview') {
        $activities = portal_get_activities(array(), array(), 'unit_order, activity_order');
    } else {
        $activities = portal_get_all_activities();
    }
    // First create the display activities array
    $display_activities = array();
    $level_classes = array();
    $level_counts = array();
    for ($i = 0; $i < count($activities); $i++) {
        $this_level = $activities[$i]['level_name'] . ': ' . $activities[$i]['subject_name'];
        $fixed_level = preg_replace('~[^a-z0-9]~', '', strtolower($this_level));
        $class = 'level' . $activities[$i]['level_id'];
        $level_classes[$this_level] = $class;
        if (!isset($level_counts[$this_level])) {
            $level_counts[$this_level] = 0;
        }
        $this_unit = $activities[$i]['unit_name'];
        // Setup Checkboxes
        $checked = '';
        if ($activities[$i]['level_id'] == '999') {
            if (in_array($activities[$i]['activity_id'], $diy_activity_ids)) {
                $checked = ' checked="checked"';
                $level_counts[$this_level]++;
            }
            $field_name = 'diy_activities[]';
        } else {
            if (in_array($activities[$i]['activity_id'], $activity_ids)) {
                $checked = ' checked="checked"';
                $level_counts[$this_level]++;
            }
            $field_name = 'activities[]';
        }
        $checkbox = '<input type="checkbox" name="' . $field_name . '" value="' . $activities[$i]['activity_id'] . '"' . $checked . ' onclick="updateTotalActivities(this); updateSectionActivities(\'' . $fixed_level . '\', this);">';
        // Setup DIY Items
        $diy_id = $activities[$i]['diy_identifier'];
        $id_prefix = '';
        if ($activities[$i]['level_id'] == '999') {
            $id_prefix = 'diy';
        }
        // initialize placeholders for links
        $copy = '';
        $edit = '';
        $info = '';
        $preview = '';
        $report = '';
        $run = '';
        $try = '';
        $guide = '';
        if ($diy_id != '') {
            $available_actions = portal_get_available_actions();
            if (in_array('copy', $available_actions)) {
                $copy_title = 'Make your own version of this activity';
                $copy = '<a href="/diy/copy/' . $diy_id . '/" target="_blank" title="' . $copy_title . '">' . portal_icon('copy', $copy_title) . '</a>';
            }
            if (in_array('edit', $available_actions)) {
                $edit_title = 'Edit this activity';
                $edit = '<a href="/diy/edit/' . $diy_id . '/" target="_blank" title="' . $edit_title . '">' . portal_icon('setup', $edit_title) . '</a>';
            }
            if (in_array('info', $available_actions)) {
                $info_title = 'View activity description';
                $info = '<a href="#" onclick="toggle_block_element(\'activity-description-' . $id_prefix . $activities[$i]['activity_id'] . '\'); return false;" title="' . $info_title . '">' . portal_icon('info', $info_title) . '</a>';
            }
            if (in_array('guide', $available_actions) && $activities[$i]['activity_teacher_guide'] != '') {
                $guide_title = 'View the teacher guide for this activity';
                $guide = '<a href="' . $activities[$i]['activity_teacher_guide'] . '" title="' . $guide_title . '" target="_blank">' . portal_icon('guide', $guide_title) . '</a>';
            }
            if (in_array('preview', $available_actions)) {
                $preview_title = 'View a quick preview version of this activity';
                $preview = '<a href="/diy/show/' . $diy_id . '/" target="_blank" title="' . $preview_title . '">' . portal_icon('preview', $preview_title) . '</a>';
            }
            if (in_array('report', $available_actions)) {
                $report_title = 'View the student data from this activity';
                $report = '<a href="/diy/usage/' . $diy_id . '/" target="_blank" title="' . $report_title . '">' . portal_icon('report', $report_title) . '</a>';
            }
            if (in_array('run', $available_actions)) {
                $run_title = 'Run this activity (and save data)';
                $run = '<a href="/diy/run/' . $diy_id . '/" title="' . $run_title . '">' . portal_icon('run', $run_title) . '</a>';
            }
            if (in_array('try', $available_actions)) {
                $try_title = 'Try this activity (as a teacher, do not save data)';
                $try = '<a href="/diy/view/' . $diy_id . '/" title="' . $try_title . '">' . portal_icon('try', $try_title) . '</a>';
            }
        }
        // don't show an edit link if hte user can't edit this activity
        if ($activities[$i]['subject_name'] != 'My Activities') {
            $edit = '';
        }
        // remove items based on the mode
        if ($mode == 'setup') {
            $copy = '';
            $edit = '';
            $run = '';
            $report = '';
            $try = '';
            $preview = '';
            $guide = '';
        } else {
            $checkbox = '';
        }
        if ($mode == 'preview') {
            $report = '';
            $run = '';
            $copy = '';
            $guide = '';
        }
        $activity_options = '
		' . $checkbox . '
		' . $edit . '
		' . $copy . '
		' . $info . '
		' . $guide . '
		' . $report . '
		' . $preview . '
		' . $try . '
		' . $run . '
		';
        $description = portal_web_output_filter($activities[$i]['activity_description']);
        $sensor_probe_string = '';
        if (@$portal_config['show_probe_model_info'] != 'no' && (@$activities[$i]['sensor_type'] != 'None' || @$activities[$i]['model_type'] != 'None')) {
            $sensor_probe_string_parts = array();
            if (@$activities[$i]['sensor_type'] != 'None') {
                $sensor_probe_string_parts[] = 'Sensor: ' . @$activities[$i]['sensor_type'];
            }
            if (@$activities[$i]['model_type'] != 'None') {
                $sensor_probe_string_parts[] = 'Model: ' . @$activities[$i]['model_type'];
            }
            $sensor_probe_string = '(' . implode('; ', $sensor_probe_string_parts) . ')';
        }
        $activity_box = '
		<div class="activity-box">
			<div class="activity-title">
			' . $activity_options . ' ' . portal_web_output_filter($activities[$i]['activity_name']) . ' 
			</div>
			<div class="activity-info">
			' . $sensor_probe_string . '
			</div>
			<div class="activity-description" id="activity-description-' . $id_prefix . $activities[$i]['activity_id'] . '">
			' . $description . '
			</div>
		</div>
		';
        $display_activities[$this_level][$this_unit][] = $activity_box;
    }
    // Now loop through the display activities array and generate the unit displays
    $navigation = array();
    $panels = array();
    $i = 0;
    $js_section = '';
    $js_section_control = '';
    while (list($level, $unit_set) = each($display_activities)) {
        $fixed_level = preg_replace('~[^a-z0-9]~', '', strtolower($level));
        $level_count = $level_counts[$level];
        $fixed_level_count = '';
        if ($level_count > 0) {
            $fixed_level_count = ' (' . $level_count . ')';
        }
        $navigation[] = '<li class="unit-navigation ' . $level_classes[$level] . '" id="' . $fixed_level . '-control" onclick="show_section(\'' . $fixed_level . '\', this);">' . $level . ' <span id="' . $fixed_level . '-count" class="navigation-count">' . $fixed_level_count . '</span></li>';
        if ($i == 0) {
            $js_section = $fixed_level;
            $js_section_control = $fixed_level . '-control';
        }
        $this_panel = '
		<div class="unit-activities ' . $level_classes[$level] . '" id="' . preg_replace('~[^a-z0-9]~', '', strtolower($level)) . '">
		<script type="text/javascript">
			if (window.sectionActivities === undefined) {
				sectionActivities = [];
			}
			sectionActivities["' . $fixed_level . '"] = ' . $level_count . ';
		</script>
		';
        reset($unit_set);
        while (list($unit_title, $activity_boxes) = each($unit_set)) {
            $unit_id = preg_replace('~[^a-z0-9]~', '', strtolower($level . $unit_title));
            $select_all = '';
            if ($mode == 'setup') {
                $select_all = '<span class="heading-info"><label><input type="checkbox" onclick="select_activity_checkboxes(\'' . $unit_id . '\', \'' . $fixed_level . '\', this);"> select all</label></span>';
            }
            $this_panel .= '
			<div id="' . $unit_id . '">
			<h2 class="unit-title">' . portal_web_output_filter($unit_title) . ' ' . $select_all . '</h2>
			
			' . implode("\n", $activity_boxes) . '
			</div>
			';
        }
        $this_panel .= '
		</div>
		';
        $panels[] = $this_panel;
        $i++;
    }
    // Now generate the interface
    $activity_grid = '
	' . portal_generate_icon_legend() . '
	<table id="activity-chart" border="0" cellspacing="0" cellpadding="0" width="100%">
		<tr>
			<td id="activity-chart-navigation">
				<ul>' . implode("\n", $navigation) . '</ul>
			</td>
			<td id="activity-chart-panels">
			' . implode("\n", $panels) . '
			</td>
		</tr>
	</table>
	
	<script type="text/javascript">
		show_section("' . $js_section . '", document.getElementById("' . $js_section_control . '"));
		
	</script>
	';
    return $activity_grid;
}