Ejemplo n.º 1
0
 /**
  * @param array $params
  * @return moodle_url
  */
 public function url($params = array())
 {
     $params = array_merge($this->pageparams->get_significant_params(), $params);
     return $this->att->url_individualreport($params);
 }
Ejemplo n.º 2
0
//Defines whether the student view or the teacher view is displayed
$nostudent = $pageparams->student == null;
$pageparams->init($cm);
$att = new attcontrol($att, $cm, $course, $PAGE->context, $pageparams);
//Prepare the student or teacher view.
if (!$att->perm->can_view_reports() && $nostudent) {
    $att->pageparams->student = $USER->id;
}
if ($USER->id == $att->pageparams->student) {
    $att->perm->require_view_capability();
    $own = true;
} else {
    $att->perm->require_view_reports_capability();
    $own = false;
}
$PAGE->set_url($att->url_individualreport());
$PAGE->set_pagelayout('report');
$PAGE->set_title($course->shortname . ": " . $att->name . ' - ' . get_string('individualreport', 'attcontrol'));
$PAGE->set_heading($course->fullname);
$PAGE->set_cacheable(true);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'attcontrol'));
$PAGE->navbar->add(get_string('report', 'attcontrol'));
switch ($pageparams->action) {
    case att_individualreport_page_params::ACTION_CHANGE_PERPAGE:
        $att->set_attcontrol_perpage(optional_param('perpage', 10, PARAM_INT));
        break;
        //Removed the save action from this view, as it could be used by the students.
}
$output = $PAGE->get_renderer('mod_attcontrol');
//Changed the tabs showed depending on the privileges
if ($own) {
Ejemplo n.º 3
0
 * @package    mod_attcontrol
 * @copyright  2013 José Luis Antúnez<*****@*****.**>
 * @copyright  2011 Artem Andreev <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../../config.php';
require_once dirname(__FILE__) . '/locallib.php';
$pageparams = new att_view_page_params();
$id = required_param('id', PARAM_INT);
$pageparams->studentid = optional_param('studentid', null, PARAM_INT);
$pageparams->view = optional_param('view', null, PARAM_INT);
$pageparams->curdate = optional_param('curdate', null, PARAM_INT);
$cm = get_coursemodule_from_id('attcontrol', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$attcontrol = $DB->get_record('attcontrol', array('id' => $cm->instance), '*', MUST_EXIST);
require_login($course, true, $cm);
$pageparams->init($cm);
$att = new attcontrol($attcontrol, $cm, $course, $PAGE->context, $pageparams);
// Redirect to appropriate page if can.
if (!$pageparams->studentid) {
    if ($att->perm->can_manage() || $att->perm->can_take() || $att->perm->can_change()) {
        redirect($att->url_manage());
    } else {
        if ($att->perm->can_view_reports()) {
            redirect($att->url_report());
        }
    }
}
$att->perm->require_view_capability();
redirect($att->url_individualreport());