Example #1
0
    $context = get_context_instance(CONTEXT_COURSE, $params["enc_course_id"]);
    $adminUsers = get_users_by_capability($context, 'mod/voiceboard:presenter');
    $allUsers = get_users_by_capability($context, 'moodle/course:view');
    //$users also contain the users which have this capabilities at the system level
    $students = array_diff_assoc($allUsers, $adminUsers);
    //we get the student by getting the diff of the two arrays
    $users_key = array_keys($students);
    $vtAction = new vtAction($session->getEmail(), $params);
    $resource = $vtAction->getResource($resource_id);
    if ($resource === false) {
        //problem to get the grade
        redirection($redirectionUrl . '&error=problem_vt');
    }
    $options = $resource->getOptions();
    $isAverageMethodAvailable = true;
    $arrayAverageLength = $vtAction->getAverageMessageLengthPerUser($resource_id);
    if ($arrayAverageLength == "not_implemented") {
        $isAverageMethodAvailable = false;
    }
    $arrayNbMessage = $vtAction->getNbMessagePerUser($resource_id);
    $urlParams = 'resource_id=' . $resource_id . '&type=board&id=' . $params["enc_course_id"] . '&' . voiceboard_get_url_params($params["enc_course_id"]) . '&time=' . $session->timeOfLoad;
    $previousGrade = grade_get_grades($params["enc_course_id"], "mod", "voiceboard", $params["gradeId"], $users_key);
    if (!empty($previousGrade) && isset($previousGrade->items[0])) {
        //extract only the grade information from the object that we get
        //we take the items 0 because we ask only for one grade item
        $previousGrade = $previousGrade->items[0]->grades;
    }
    ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">