예제 #1
0
<?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 . '
		';
예제 #2
0
<?php

$member_id = $_PORTAL['action'];
$member_info = portal_get_member_info($member_id);
$is_editing_self = 'no';
$page_title = 'Member Delete';
$selected_member_is_members_student = 'no';
$return_page = '/admin/';
if ($_SESSION['portal']['member_type'] == 'teacher') {
    $return_page = '/';
    // check to see if the selected member is in the member's class
    $taught_classes = portal_get_teacher_classes($_SESSION['portal']['member_id']);
    if (array_intersect($taught_classes, $member_info['classes']['student'])) {
        $selected_member_is_members_student = 'yes';
    }
}
if ($_SESSION['portal']['member_type'] != 'superuser' && $_SESSION['portal']['member_type'] != 'admin' && $selected_member_is_members_student != 'yes') {
    mystery_redirect('/');
    exit;
}
if (isset($_PORTAL['params']['process'])) {
    if ($member_id == $_SESSION['portal']['member_id']) {
        $errors = array('Sorry you cannot delete your own account.');
        echo portal_generate_error_page($errors);
    } else {
        portal_delete_member($_PORTAL['action']);
        mystery_redirect($return_page);
        exit;
    }
} else {
    // FIXME - Maybe add in details on the class to be deleted here
예제 #3
0
<?php

$page_title = 'Switch';
if ($_SESSION['portal']['member_type'] != 'superuser') {
    mystery_redirect('/');
    exit;
}
if ($_PORTAL['activity'] == 'school' && $_PORTAL['action'] == 'process' && @$_REQUEST['school_id'] != $_SESSION['portal']['member_school']) {
    $_SESSION['portal']['member_school'] = @$_REQUEST['school_id'];
    $member_info = portal_get_member_info($_SESSION['portal']['member_id']);
}
if ($_PORTAL['activity'] == 'member' && $_PORTAL['action'] == 'process' && @$_REQUEST['school_id'] != $_SESSION['portal']['member_school']) {
    $member_info = portal_get_member_info($_REQUEST['member_id']);
    $_SESSION['portal']['member_id'] = $_REQUEST['member_id'];
    $_SESSION['user_first_name'] = $member_info['member_first_name'];
    $_SESSION['user_last_name'] = $member_info['member_last_name'];
    $_SESSION['user_username'] = $member_info['member_username'];
    $_SESSION['user_email'] = $member_info['member_email'];
    $_SESSION['portal']['member_id'] = $member_info['member_id'];
    $_SESSION['portal']['member_school'] = $member_info['member_school'];
    $_SESSION['portal']['member_interface'] = $member_info['member_interface'];
    $_SESSION['portal']['diy_member_id'] = $member_info['diy_member_id'];
    $_SESSION['portal']['sds_member_id'] = $member_info['sds_member_id'];
    $_SESSION['portal']['member_username'] = $member_info['member_username'];
    $_SESSION['portal']['member_password_ue'] = $member_info['member_password_ue'];
    $_SESSION['portal']['taking_course'] = $member_info['taking_course'];
}
$school_info = portal_get_school_info($_SESSION['portal']['member_school']);
echo '
<h1>Switch your school</h1>
예제 #4
0
<?php

$page_title = 'Student Report';
$student_id = $_PORTAL['action'];
if ($_SESSION['portal']['member_type'] == 'student' && $_SESSION['portal']['member_id'] != $student_id) {
    // let this individual student but no other see this work.
    mystery_redirect('/');
    exit;
}
$member_info = portal_get_member_info($student_id);
$class_id = @$member_info['classes']['student'][0];
$class_info = portal_get_class_info($class_id);
echo '
<h2>Report for ' . $member_info['member_first_name'] . ' ' . $member_info['member_last_name'] . ' in ' . @$class_info['class_name'] . '</h2>
';
$old_uuid_setting = $GLOBALS['portal_config']['diy_use_uuid'];
$GLOBALS['portal_config']['diy_use_uuid'] = 'no';
$class_activities = portal_get_class_diy_activities($class_id);
$GLOBALS['portal_config']['diy_use_uuid'] = $old_uuid_setting;
$usage = portal_get_diy_activity_usage_from_db($student_id);
echo '
<table class="roster-table">
<tr>
	<th>Activity</th>
	<th>Status</th>
</tr>
';
$student_diy_id = portal_get_diy_member_id_from_db($member_info['member_username']);
for ($i = 0; $i < count($class_activities); $i++) {
    $report_link = '&nbsp;';
    if (in_array($class_activities[$i]['activity_id'], $usage)) {
예제 #5
0
function portal_get_prepared_diy_activities($member_id)
{
    if ($GLOBALS['portal_config']['use_diy_activities'] == 'no') {
        return array();
    }
    $member_info = portal_get_member_info($member_id);
    // get my students
    $query = 'SELECT member_id FROM portal_class_students WHERE class_id IN ("' . implode('","', $member_info['classes']['teacher']) . '")';
    $params = array();
    $results = mystery_select_query($query, $params, 'portal_dbh');
    $my_students = mystery_convert_results_to_simple_array($results, 'member_id');
    $query = 'SELECT member_username, member_id, member_school,member_source,school_district AS member_district FROM portal_members AS pm LEFT JOIN portal_schools AS ps ON pm.member_school=ps.school_id LEFT JOIN portal_districts AS pd ON ps.school_district=pd.district_id';
    $params = array();
    $results = mystery_select_query($query, $params, 'portal_dbh');
    // prepare the member usernames to be an associative_array
    $total_members = count($results);
    $subject_keys = array();
    for ($i = 0; $i < $total_members; $i++) {
        $this_username = $results[$i]['member_username'];
        $this_member_id = $results[$i]['member_id'];
        $this_school = $results[$i]['member_school'];
        $this_district = $results[$i]['member_district'];
        $this_source = $results[$i]['member_source'];
        if ($this_username == $member_info['member_username']) {
            $subject_keys[$this_username] = 'My Activities';
        } elseif (in_array($this_member_id, $my_students)) {
            $subject_keys[$this_username] = 'My Student Activities';
        } elseif ($this_school == $_SESSION['portal']['member_school']) {
            $subject_keys[$this_username] = 'My School Activities';
        } elseif ($this_district == $_SESSION['portal']['member_district']) {
            $subject_keys[$this_username] = 'My District Activities';
        } elseif ($this_source == $_SESSION['portal']['member_source'] && trim($this_source) != '') {
            $subject_keys[$this_username] = 'My Event Activities';
        } else {
            $subject_keys[$this_username] = 'Other Activities';
        }
    }
    $new_activities = array();
    // don't show the pre-existing ids
    $conditions = array();
    $conditions[] = 'ida.id NOT IN ("' . implode('","', portal_get_diy_ids_to_exclude()) . '")';
    $activities = portal_get_diy_activities_from_db($conditions);
    //mystery_debug_query('rails_dbh');
    $total_activities = count($activities);
    for ($i = 0; $i < $total_activities; $i++) {
        if (!isset($subject_keys[$activities[$i]['author']])) {
            $subject_keys[$activities[$i]['author']] = 'Other Activities';
        }
        $activities[$i]['subject_name'] = $subject_keys[$activities[$i]['author']];
        if (!$activities[$i]['public']) {
            $activities[$i]['activity_name'] .= ' (private)';
        }
    }
    // now I need to re-sort the array
    $activities = portal_record_sort($activities, array('subject_name', 'unit_name', 'activity_name'));
    return $activities;
}