コード例 #1
0
    $students[] = $u->id;
}
$notstatus_ids = false;
if (!empty($status_id)) {
    $defaultstatusid = get_config('block_ilp', 'defaultstatusitem');
    if ($defaultstatusid == $status_id) {
        $notstatus_ids = true;
    }
}
//we only want to get the student matrix if students have been provided
$studentslist = !empty($students) ? $dbc->get_students_matrix($flextable, $students, $status_id, $notstatus_ids) : false;
//get the default status item which will be used as the status for students who
//have not entered their ilp and have not had a status assigned
$defaultstatusitem_id = get_config('block_ilp', 'defaultstatusitem');
//get the status item record
$defaultstatusitem = $dbc->get_status_item_by_id($defaultstatusitem_id);
$status_item = !empty($defaultstatusitem) ? $defaultstatusitem->name : get_string('unknown', 'block_ilp');
//this is needed if the current user has capabilities in the course context, it allows view_main page to view the user
//in the course context
$course_param = !empty($course_id) ? "&course_id={$course_id}" : '';
$coursearg = $course_id ? "&course={$course_id}" : '';
if (!empty($studentslist)) {
    foreach ($studentslist as $student) {
        $data = array();
        $userprofile = stripos($CFG->release, "2.") === false ? 'view.php' : 'profile.php';
        $data['picture'] = $OUTPUT->user_picture($student, array('return' => true, 'size' => 50));
        $data['fullname'] = "<a href='{$CFG->wwwroot}/user/{$userprofile}?id={$student->id}{$coursearg}' class=\"userlink\">" . fullname($student) . "</a>";
        //if the student status has been set then show it else they have not had there ilp setup
        //thus there status is the default
        $data['u_status'] = !empty($student->u_status) ? $student->u_status : $status_item;
        $data['view'] = "<a href='{$CFG->wwwroot}/blocks/ilp/actions/view_main.php?user_id={$student->id}{$course_param}' >" . get_string('viewplp', 'block_ilp') . "</a>";
コード例 #2
0
$selecttedtab = $PARSER->optional_param('selectedtab', NULL, PARAM_RAW);
//get the selectedtab param if it exists
$tabitem = $PARSER->optional_param('tabitem', NULL, PARAM_RAW);
//get the changed status
$ajax = $PARSER->required_param('ajax', PARAM_RAW);
//get the changed status
$status_id = $PARSER->required_param('select_userstatus', PARAM_RAW);
// instantiate the db
$dbc = new ilp_db();
//retreive the user record from the database
$student = $dbc->get_user_by_id($student_id);
if (empty($student)) {
    //trigger error
}
//
$stausitem = $dbc->get_status_item_by_id($status_id);
$userstatus = $dbc->get_user_status($student_id);
$userstatus->user_modified_id = $USER->id;
$userstatus->parent_id = $status_id;
if ($dbc->update_userstatus($userstatus)) {
    if ($ajax == 'false') {
        $return_url = $CFG->wwwroot . '/blocks/ilp/actions/view_main.php?user_id=' . $student_id . '&course_id=' . $course_id . '&tabitem=' . $tabitem . '&selectedtab=' . $selecttedtab;
        redirect($return_url, get_string("stausupdated", 'block_ilp'), ILP_REDIRECT_DELAY);
    } else {
        $userstatuscolor = get_config('block_ilp', 'passcolour');
        if (!empty($statusitem)) {
            if ($statusitem->passfail == 1) {
                $userstatuscolor = get_config('block_ilp', 'failcolour');
            }
        }
        //echo "['{$stausitem->name}','{$userstatuscolor}']";