Пример #1
0
        break;
    default:
        $page_title = 'ITSI Online Course';
        echo '
		<p>You will use this page in conjunction with the ITSI online course being offered
		by the Concord Consortium.</p>
		
		<p><a href="http://moodle.concord.org/">Go to the Online Course</a></p>
		
		<h2>Course Participants and Activities</h2>
		
		<p>Below is a table containing all of the ITSI Course participants and their activities.  
		Click on the info link to find out more about an activity, or to rate it and comment on it. </p>
		
		';
        $activities = portal_get_all_activities('activity_author, activity_name');
        $activities = portal_prepare_activity_list($activities);
        $activity_count = count($activities);
        if ($activity_count > 0) {
            echo '
			<form>
			<p><strong>Filter </strong><input type="text" size="40" id="filter" onkeyup="filterTable(this, \'activity-table-body\');"> viewing <strong id="filtered-count">' . $activity_count . '</strong> of <strong>' . $activity_count . '</strong></p>
			
			<table id="activity-table" class="tablesorter">
			<thead>
			<tr>
				<th>School</th>
				<th>Author</th>
				<th>Activity Name</th>
				<!--th width="120">Rating</th-->
				<th width="120">Comments</th>
Пример #2
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;
}