Ejemplo n.º 1
0
 /**
  * Trigger the grading_table_viewed event.
  *
  * @param int $seplid the sepl instance id
  * @return array of warnings and status result
  * @since Moodle 3.0
  * @throws moodle_exception
  */
 public static function view_grading_table($seplid)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . "/mod/sepl/locallib.php";
     $params = self::validate_parameters(self::view_grading_table_parameters(), array('seplid' => $seplid));
     $warnings = array();
     // Request and permission validation.
     $sepl = $DB->get_record('sepl', array('id' => $params['seplid']), 'id', MUST_EXIST);
     list($course, $cm) = get_course_and_cm_from_instance($sepl, 'sepl');
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     require_capability('mod/sepl:view', $context);
     $sepl = new sepl($context, null, null);
     $sepl->require_view_grades();
     \mod_sepl\event\grading_table_viewed::create_from_sepl($sepl)->trigger();
     $result = array();
     $result['status'] = true;
     $result['warnings'] = $warnings;
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * View entire grading page.
  *
  * @return string
  */
 protected function view_grading_page()
 {
     global $CFG;
     $o = '';
     // Need submit permission to submit an seplment.
     $this->require_view_grades();
     require_once $CFG->dirroot . '/mod/sepl/gradeform.php';
     // Only load this if it is.
     $o .= $this->view_grading_table();
     $o .= $this->view_footer();
     \mod_sepl\event\grading_table_viewed::create_from_sepl($this)->trigger();
     return $o;
 }