<?php switch ($_PORTAL['activity']) { case 'edit': $id_param = $_PORTAL['action']; $page_title = 'Edit a class'; $class_info = portal_get_class_info($id_param); break; case 'copy': $id_param = $_PORTAL['action']; $page_title = 'Copy a class'; $class_info = portal_get_class_info($id_param); $class_info['class_name'] = $class_info['class_name'] . ' Copy'; @($class_info['class_word'] = ''); break; case 'add': $id_param = 'new'; $page_title = 'Add a class'; $class_info = array(); $class_info['activities'] = array(); $class_info['diy_activities'] = array(); break; } if ($_SESSION['portal']['member_type'] != 'superuser' && $_SESSION['portal']['member_type'] != 'admin' && $_SESSION['portal']['member_type'] != 'teacher') { mystery_redirect('/'); exit; } // FIXME - Add a check here to see if this is the class teacher if the role is a teacher if (isset($_PORTAL['params']['process'])) { $data = array(); $data['class_name'] = $_REQUEST['class_name'];
<?php $page_title = 'Home'; $school_id = $_SESSION['portal']['member_school']; $classes = portal_get_student_classes($_SESSION['portal']['member_id']); $class_id = $classes[0]; $class_info = portal_get_class_info($class_id); $page_title = $class_info['class_name']; $student_id = $_SESSION['portal']['member_id']; $usage = portal_get_diy_activity_usage_from_db($student_id); echo portal_generate_student_activity_list($student_id, $class_id, $usage); $teacher_info = portal_get_member_info($class_info['class_teacher']); $conditions = array(); $params = array(); //$conditions[] = 'login = ?'; //$params[] = $teacher_info['member_username']; $conditions[] = 'ida.id IN ("' . implode('","', $class_info['diy_activities']) . '")'; $options = array('no restrict'); $activities = portal_get_diy_activities_from_db($conditions, $params, $options); $list = ''; for ($i = 0; $i < count($activities); $i++) { $activity_options = ''; $activity_used = ''; if ($activities[$i]['diy_identifier'] != '') { $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 . ' ';
function portal_generate_class_aggregate_report_link($activity, $class_id) { $diy_id = $activity['activity_id']; $report_link = ''; $reports = portal_get_diy_reports_for_activity($diy_id); if (count($reports) > 0) { $class_info = portal_get_class_info($class_id); $teacher_info = portal_get_member_info($class_info['class_teacher']); $class_members = portal_get_class_students_diy_ids($class_id); $class_name = $class_info['class_name']; $class_uuid = $class_info['class_uuid']; $class_teacher_name = $teacher_info['member_first_name'] . ' ' . $teacher_info['member_last_name']; $report_links = array(); for ($i = 0; $i < count($reports); $i++) { $reports[$i]['name'] = ucwords(str_replace('_', ' ', $reports[$i]['name'])); $report_links[] = '<a title="View class report: ' . $reports[$i]['name'] . '" href="/diy/report/' . $reports[$i]['id'] . '/class/' . rawurlencode(base64_encode($class_name)) . '/teacher/' . rawurlencode(base64_encode($class_teacher_name)) . '/members/' . rawurlencode(base64_encode(implode(',', $class_members))) . '/uuid/' . rawurlencode(base64_encode($class_uuid)) . '/activity/' . rawurlencode(base64_encode($activity['activity_name'])) . '/">' . portal_icon('report') . '</a>'; } $report_link = '<br>' . implode(' ', $report_links); } return $report_link; }