/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $userid * @param object $gpr grade plugin return tracking object * @param string $context */ public function __construct($userid, $gpr, $context) { global $CFG, $COURSE, $DB; parent::__construct($COURSE->id, $gpr, $context); // Get the user (for full name). $this->user = $DB->get_record('user', array('id' => $userid)); // Load the user's courses. $this->courses = enrol_get_users_courses($this->user->id, false, 'id, shortname, showgrades'); $this->showrank = array(); $this->showrank['any'] = false; $this->showtotalsifcontainhidden = array(); if ($this->courses) { foreach ($this->courses as $course) { $this->showrank[$course->id] = grade_get_setting($course->id, 'report_overview_showrank', !empty($CFG->grade_report_overview_showrank)); if ($this->showrank[$course->id]) { $this->showrank['any'] = true; } $this->showtotalsifcontainhidden[$course->id] = grade_get_setting($course->id, 'report_overview_showtotalsifcontainhidden', $CFG->grade_report_overview_showtotalsifcontainhidden); } } // base url for sorting by first/last name $this->baseurl = $CFG->wwwroot . '/grade/overview/index.php?id=' . $userid; $this->pbarurl = $this->baseurl; $this->setup_table(); }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid * @param object $gpr grade plugin return tracking object * @param string $context * @param int $userid The id of the user */ public function __construct($courseid, $gpr, $context, $userid) { global $CFG, $DB; parent::__construct($courseid, $gpr, $context); $this->showrank = grade_get_setting($this->courseid, 'report_user_showrank', $CFG->grade_report_user_showrank); $this->showpercentage = grade_get_setting($this->courseid, 'report_user_showpercentage', $CFG->grade_report_user_showpercentage); $this->showhiddenitems = grade_get_setting($this->courseid, 'report_user_showhiddenitems', $CFG->grade_report_user_showhiddenitems); $this->showtotalsifcontainhidden = grade_get_setting($this->courseid, 'report_user_showtotalsifcontainhidden', $CFG->grade_report_user_showtotalsifcontainhidden); $this->switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition); // Grab the grade_tree for this course $this->gtree = new grade_tree($this->courseid, false, $this->switch, null, !$CFG->enableoutcomes); // Determine the number of rows and indentation $this->maxdepth = 1; $this->inject_rowspans($this->gtree->top_element); $this->maxdepth++; // Need to account for the lead column that spans all children for ($i = 1; $i <= $this->maxdepth; $i++) { $this->evenodd[$i] = 0; } $this->tabledata = array(); $this->canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->courseid)); // get the user (for full name) $this->user = $DB->get_record('user', array('id' => $userid)); // base url for sorting by first/last name $this->baseurl = $CFG->wwwroot . '/grade/report?id=' . $courseid . '&userid=' . $userid; $this->pbarurl = $this->baseurl; // no groups on this report - rank is from all course users $this->setup_table(); }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $userid * @param object $gpr grade plugin return tracking object * @param string $context */ public function __construct($userid, $gpr, $context) { global $CFG, $COURSE, $DB; parent::__construct($COURSE->id, $gpr, $context); $this->showrank = grade_get_setting($this->courseid, 'report_overview_showrank', !empty($CFG->grade_report_overview_showrank)); // get the user (for full name) $this->user = $DB->get_record('user', array('id' => $userid)); // base url for sorting by first/last name $this->baseurl = $CFG->wwwroot . '/grade/overview/index.php?id=' . $userid; $this->pbarurl = $this->baseurl; $this->setup_table(); }
/** * Constructor for this report. Creates the appropriate screen class based on itemtype. * * @param int $courseid The course id. * @param object $gpr grade plugin return tracking object * @param context_course $context * @param string $itemtype Should be user, select or grade * @param int $itemid The id of the user or grade item * @param int $groupid (optional) The current groupid. */ public function __construct($courseid, $gpr, $context, $itemtype, $itemid, $groupid = null) { parent::__construct($courseid, $gpr, $context); $screenclass = "\\gradereport_singleview\\local\\screen\\{$itemtype}"; $this->screen = new $screenclass($courseid, $itemid, $groupid); // Load custom or predifined js. $this->screen->js(); $base = '/grade/report/singleview/index.php'; $idparams = array('id' => $courseid); $this->baseurl = new moodle_url($base, $idparams); $this->pbarurl = new moodle_url($base, $idparams + array('item' => $itemtype, 'itemid' => $itemid)); $this->setup_groups(); }
/** * Constructor for this report. Creates the appropriate screen class based on itemtype. * * @param int $courseid The course id. * @param object $gpr grade plugin return tracking object * @param context_course $context * @param string $itemtype Should be user, select or grade * @param int $itemid The id of the user or grade item * @param string $unused Used to be group id but that was removed and this is now unused. */ public function __construct($courseid, $gpr, $context, $itemtype, $itemid, $unused = null) { parent::__construct($courseid, $gpr, $context); $base = '/grade/report/singleview/index.php'; $idparams = array('id' => $courseid); $this->baseurl = new moodle_url($base, $idparams); $this->pbarurl = new moodle_url($base, $idparams + array('item' => $itemtype, 'itemid' => $itemid)); // The setup_group method is used to validate group mode and permissions and define the currentgroup value. $this->setup_groups(); $screenclass = "\\gradereport_singleview\\local\\screen\\{$itemtype}"; $this->screen = new $screenclass($courseid, $itemid, $this->currentgroup); // Load custom or predifined js. $this->screen->js(); }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $userid * @param object $gpr grade plugin return tracking object * @param string $context */ public function __construct($userid, $gpr, $context) { global $CFG, $COURSE, $DB; parent::__construct($COURSE->id, $gpr, $context); // Get the user (for full name). $this->user = $DB->get_record('user', array('id' => $userid)); // Load the user's courses. $this->courses = enrol_get_users_courses($this->user->id, false, 'id, shortname, showgrades'); $this->showrank = array(); $this->showrank['any'] = false; $this->showtotalsifcontainhidden = array(); $this->studentcourseids = array(); $this->teachercourses = array(); $roleids = explode(',', get_config('moodle', 'gradebookroles')); if ($this->courses) { foreach ($this->courses as $course) { $this->showrank[$course->id] = grade_get_setting($course->id, 'report_overview_showrank', !empty($CFG->grade_report_overview_showrank)); if ($this->showrank[$course->id]) { $this->showrank['any'] = true; } $this->showtotalsifcontainhidden[$course->id] = grade_get_setting($course->id, 'report_overview_showtotalsifcontainhidden', $CFG->grade_report_overview_showtotalsifcontainhidden); $coursecontext = context_course::instance($course->id); foreach ($roleids as $roleid) { if (user_has_role_assignment($userid, $roleid, $coursecontext->id)) { $this->studentcourseids[$course->id] = $course->id; // We only need to check if one of the roleids has been assigned. break; } } if (has_capability('moodle/grade:viewall', $coursecontext, $userid)) { $this->teachercourses[$course->id] = $course; } } } // base url for sorting by first/last name $this->baseurl = $CFG->wwwroot . '/grade/overview/index.php?id=' . $userid; $this->pbarurl = $this->baseurl; $this->setup_table(); }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid * @param object $gpr grade plugin return tracking object * @param string $context * @param int $userid The id of the user * @param bool $viewasuser Set this to true when the current user is a mentor/parent of the targetted user. */ public function __construct($courseid, $gpr, $context, $userid, $viewasuser = null) { global $DB, $CFG; parent::__construct($courseid, $gpr, $context); $this->showrank = grade_get_setting($this->courseid, 'report_user_showrank', $CFG->grade_report_user_showrank); $this->showpercentage = grade_get_setting($this->courseid, 'report_user_showpercentage', $CFG->grade_report_user_showpercentage); $this->showhiddenitems = grade_get_setting($this->courseid, 'report_user_showhiddenitems', $CFG->grade_report_user_showhiddenitems); $this->showtotalsifcontainhidden = array($this->courseid => grade_get_setting($this->courseid, 'report_user_showtotalsifcontainhidden', $CFG->grade_report_user_showtotalsifcontainhidden)); $this->showgrade = grade_get_setting($this->courseid, 'report_user_showgrade', !empty($CFG->grade_report_user_showgrade)); $this->showrange = grade_get_setting($this->courseid, 'report_user_showrange', !empty($CFG->grade_report_user_showrange)); $this->showfeedback = grade_get_setting($this->courseid, 'report_user_showfeedback', !empty($CFG->grade_report_user_showfeedback)); $this->showweight = grade_get_setting($this->courseid, 'report_user_showweight', !empty($CFG->grade_report_user_showweight)); $this->showlettergrade = grade_get_setting($this->courseid, 'report_user_showlettergrade', !empty($CFG->grade_report_user_showlettergrade)); $this->showaverage = grade_get_setting($this->courseid, 'report_user_showaverage', !empty($CFG->grade_report_user_showaverage)); $this->viewasuser = $viewasuser; // The default grade decimals is 2 $defaultdecimals = 2; if (property_exists($CFG, 'grade_decimalpoints')) { $defaultdecimals = $CFG->grade_decimalpoints; } $this->decimals = grade_get_setting($this->courseid, 'decimalpoints', $defaultdecimals); // The default range decimals is 0 $defaultrangedecimals = 0; if (property_exists($CFG, 'grade_report_user_rangedecimals')) { $defaultrangedecimals = $CFG->grade_report_user_rangedecimals; } $this->rangedecimals = grade_get_setting($this->courseid, 'report_user_rangedecimals', $defaultrangedecimals); $this->switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition); // Grab the grade_tree for this course $this->gtree = new grade_tree($this->courseid, false, $this->switch, null, !$CFG->enableoutcomes); // Get the user (for full name). $this->user = $DB->get_record('user', array('id' => $userid)); // What user are we viewing this as? $coursecontext = context_course::instance($this->courseid); if ($viewasuser) { $this->modinfo = new course_modinfo($this->course, $this->user->id); $this->canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext, $this->user->id); } else { $this->modinfo = $this->gtree->modinfo; $this->canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext); } // Determine the number of rows and indentation. $this->maxdepth = 1; $this->inject_rowspans($this->gtree->top_element); $this->maxdepth++; // Need to account for the lead column that spans all children. for ($i = 1; $i <= $this->maxdepth; $i++) { $this->evenodd[$i] = 0; } $this->tabledata = array(); // base url for sorting by first/last name $this->baseurl = $CFG->wwwroot . '/grade/report?id=' . $courseid . '&userid=' . $userid; $this->pbarurl = $this->baseurl; // no groups on this report - rank is from all course users $this->setup_table(); //optionally calculate grade item averages $this->calculate_averages(); }
public function __construct($courseid, $gpr, $context, $user) { parent::__construct($courseid, $gpr, $context); $this->user = $user; }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid * @param object $gpr grade plugin return tracking object * @param string $context * @param int $page The current page being viewed (when report is paged) * @param int $sortitemid The id of the grade_item by which to sort the table */ public function __construct($courseid, $gpr, $context, $page = null, $sortitemid = null) { global $CFG; parent::__construct($courseid, $gpr, $context, $page); $this->canviewhidden = has_capability('moodle/grade:viewhidden', context_course::instance($this->course->id)); // load collapsed settings for this report $this->collapsed = static::get_collapsed_preferences($this->course->id); if (empty($CFG->enableoutcomes)) { $nooutcomes = false; } else { $nooutcomes = get_user_preferences('grade_report_shownooutcomes'); } // if user report preference set or site report setting set use it, otherwise use course or site setting $switch = $this->get_pref('aggregationposition'); if ($switch == '') { $switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition); } // Grab the grade_tree for this course $this->gtree = new grade_tree($this->courseid, true, $switch, $this->collapsed, $nooutcomes); $this->sortitemid = $sortitemid; // base url for sorting by first/last name $this->baseurl = new moodle_url('index.php', array('id' => $this->courseid)); $studentsperpage = $this->get_students_per_page(); if (!empty($this->page) && !empty($studentsperpage)) { $this->baseurl->params(array('perpage' => $studentsperpage, 'page' => $this->page)); } $this->pbarurl = new moodle_url('/grade/report/grader/index.php', array('id' => $this->courseid)); $this->setup_groups(); $this->setup_users(); $this->setup_sortitemid(); $this->overridecat = (bool) get_config('moodle', 'grade_overridecat'); }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid * @param object $gpr grade plugin return tracking object * @param string $context * @param int $page The current page being viewed (when report is paged) * @param int $sortitemid The id of the grade_item by which to sort the table */ public function __construct($courseid, $gpr, $context, $page = null, $sortitemid = null) { global $CFG; parent::__construct($courseid, $gpr, $context, $page); $this->canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->course->id)); // load collapsed settings for this report if ($collapsed = get_user_preferences('grade_report_grader_collapsed_categories')) { $this->collapsed = unserialize($collapsed); } else { $this->collapsed = array('aggregatesonly' => array(), 'gradesonly' => array()); } if (empty($CFG->enableoutcomes)) { $nooutcomes = false; } else { $nooutcomes = get_user_preferences('grade_report_shownooutcomes'); } // if user report preference set or site report setting set use it, otherwise use course or site setting $switch = $this->get_pref('aggregationposition'); if ($switch == '') { $switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition); } // Grab the grade_tree for this course $this->gtree = new grade_tree($this->courseid, true, $switch, $this->collapsed, $nooutcomes); $this->sortitemid = $sortitemid; // base url for sorting by first/last name $studentsperpage = $this->get_pref('studentsperpage'); $perpage = ''; $curpage = ''; if (!empty($studentsperpage)) { $perpage = '&perpage=' . $studentsperpage; $curpage = '&page=' . $this->page; } $this->baseurl = 'index.php?id=' . $this->courseid . $perpage . $curpage . '&'; $this->pbarurl = 'index.php?id=' . $this->courseid . $perpage . '&'; $this->setup_groups(); $this->setup_sortitemid(); }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid * @param object $gpr grade plugin return tracking object * @param string $context * @param int $userid The id of the user * @param boolean $hidereport Hide all report only show assessments */ public function __construct($courseid, $gpr, $context, $userid, $hidereport) { global $DB, $CFG; parent::__construct($courseid, $gpr, $context); if (isset($hidereport)) { $this->hidereport = $hidereport; } $this->showhiddenactivity = grade_get_setting($this->courseid, 'report_marksheet_showhiddenactivity', $CFG->grade_report_marksheet_showhiddenactivity); $this->showrank = grade_get_setting($this->courseid, 'report_marksheet_showrank', $CFG->grade_report_marksheet_showrank); $this->showpercentage = grade_get_setting($this->courseid, 'report_marksheet_showpercentage', $CFG->grade_report_marksheet_showpercentage); $this->showhiddenitems = grade_get_setting($this->courseid, 'report_marksheet_showhiddenitems', $CFG->grade_report_marksheet_showhiddenitems); $this->showtotalsifcontainhidden = array($this->courseid => grade_get_setting($this->courseid, 'report_marksheet_showtotalsifcontainhidden', $CFG->grade_report_marksheet_showtotalsifcontainhidden)); $this->showgrade = grade_get_setting($this->courseid, 'report_marksheet_showgrade', !empty($CFG->grade_report_marksheet_showgrade)); $this->showrange = grade_get_setting($this->courseid, 'report_marksheet_showrange', !empty($CFG->grade_report_marksheet_showrange)); $this->showfeedback = grade_get_setting($this->courseid, 'report_marksheet_showfeedback', !empty($CFG->grade_report_marksheet_showfeedback)); $this->showweight = grade_get_setting($this->courseid, 'report_marksheet_showweight', !empty($CFG->grade_report_marksheet_showweight)); $this->showlettergrade = grade_get_setting($this->courseid, 'report_marksheet_showlettergrade', !empty($CFG->grade_report_marksheet_showlettergrade)); $this->showaverage = grade_get_setting($this->courseid, 'report_marksheet_showaverage', !empty($CFG->grade_report_marksheet_showaverage)); $this->showtimeupdate = grade_get_setting($this->courseid, 'report_marksheet_showtimeupdate', !empty($CFG->grade_report_marksheet_showtimeupdate)); $this->showstartdate = grade_get_setting($this->courseid, 'report_marksheet_showstartdate', !empty($CFG->grade_report_marksheet_showstartdate)); $this->grade_category_modids = array(); $this->grade_category_start_dates = array(); // The default grade decimals is 2 $defaultdecimals = 2; date_default_timezone_set('Australia/Victoria'); if (property_exists($CFG, 'grade_decimalpoints')) { $defaultdecimals = $CFG->grade_decimalpoints; } $this->decimals = grade_get_setting($this->courseid, 'decimalpoints', $defaultdecimals); // The default range decimals is 0 $defaultrangedecimals = 0; if (property_exists($CFG, 'grade_report_marksheet_rangedecimals')) { $defaultrangedecimals = $CFG->grade_report_marksheet_rangedecimals; } $this->rangedecimals = grade_get_setting($this->courseid, 'report_marksheet_rangedecimals', $defaultrangedecimals); $this->switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition); // Grab the grade_tree for this course $this->gtree = new grade_tree($this->courseid, false, $this->switch, null, !$CFG->enableoutcomes); // Determine the number of rows and indentation $this->maxdepth = 1; $this->inject_rowspans($this->gtree->top_element); $this->maxdepth++; // Need to account for the lead column that spans all children for ($i = 1; $i <= $this->maxdepth; $i++) { $this->evenodd[$i] = 0; } $this->tabledata = array(); $this->canviewhidden = has_capability('moodle/grade:viewhidden', context_course::instance($this->courseid)); // get the user (for full name) $this->user = $DB->get_record('user', array('id' => $userid)); // base url for sorting by first/last name $this->baseurl = $CFG->wwwroot . '/grade/report?id=' . $courseid . '&userid=' . $userid; $this->pbarurl = $this->baseurl; // no groups on this report - rank is from all course users $this->setup_table(); //optionally calculate grade item averages $this->calculate_averages(); // //Set Marksheet Categoryid // $cat = grade_category::fetch(array('courseid'=>$this->courseid,'fullname'=>'Marksheet')); // if (isset($cat)) { // $this->marksheet_category_id = $cat->id; // }else // { // $this->marksheet_category_id = nil; // } }
/** * Constructor. Sets local copies of user preferences and initialises grade_tree. * @param int $courseid * @param object $gpr grade plugin return tracking object * @param string $context * @param int $page The current page being viewed (when report is paged) * @param int $sortitemid The id of the grade_item by which to sort the table */ public function __construct($courseid, $gpr, $context, $page = null, $sortitemid = null) { global $CFG; parent::__construct($courseid, $gpr, $context, $page); //Basado en el constructor de la clase grade_report_grader // Grab the grade_tree for this course $this->gtree = new grade_tree($this->courseid, false, false); $this->add_activities_to_gtree(); $this->grade_viewer = new grade_expert_db_block(); $this->calculator = new calculator_average(); $this->sortitemid = $sortitemid; // base url for sorting by first/last name $this->baseurl = new moodle_url('index.php', array('id' => $this->courseid)); $this->studentsperpage = $this->get_pref('studentsperpage'); $studentsperpage = $this->studentsperpage; if (!empty($studentsperpage)) { $this->baseurl->params(array('perpage' => $studentsperpage, 'page' => $this->page)); } $this->pbarurl = new moodle_url('/blocks/evalcomix/assessment/index.php', array('id' => $this->courseid, 'perpage' => $studentsperpage)); $this->setup_groups(); $this->setup_sortitemid(); $this->canviewhidden = has_capability('moodle/grade:viewhidden', context_course::instance($this->course->id)); }
function __construct($courseid, $gpr, $context, $page = null) { parent::__construct($courseid, $gpr, $context, $page); $this->course_grade_item = grade_item::fetch_course_item($this->courseid); }
/** * Constructor. Initialises grade_tree, sets up group, baseurl * and pbarurl. * @param int $courseid the coures id for the report * @param object $gpr grade plugin tracking object * @context string $context */ public function __construct($courseid, $gpr, $context, $visid = null) { global $CFG; parent::__construct($courseid, $gpr, $context, null); $this->canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->course->id)); /// Set up urls $this->baseurl = 'index.php?id=' . $this->courseid; $this->pbarurl = 'index.php?id=' . $this->courseid; /// Set the position of the aggregation categorie based on pref $switch = $this->get_pref('visual', 'aggregationposition'); if ($switch == '' && isset($CFG->grade_aggregationposition)) { $switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition); } /// Build grade tree $this->gtree = new grade_tree($this->courseid, false, $switch); $this->load_visualizations(); if (!is_null($visid) && !empty($visid) && array_key_exists($visid, grade_report_visual::$visualizations)) { $this->visid = $visid; } else { $keys = array_keys(grade_report_visual::$visualizations); $this->visid = $keys[0]; } $this->set_up_flashvars(); /// Set up Groups if ($this->visid && grade_report_visual::get_visualization($this->visid)->usegroups) { $this->setup_groups(); } }