本文整理汇总了PHP中grade_report::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_report::__construct方法的具体用法?PHP grade_report::__construct怎么用?PHP grade_report::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_report
的用法示例。
在下文中一共展示了grade_report::__construct方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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();
}
示例2: __construct
/**
* 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();
}
示例3: __construct
/**
* 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();
}
示例4: __construct
/**
* 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();
}
示例5: __construct
/**
* 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();
}
示例6: __construct
/**
* 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();
}
示例7: __construct
/**
* 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();
}
示例8: __construct
public function __construct($courseid, $gpr, $context, $user)
{
parent::__construct($courseid, $gpr, $context);
$this->user = $user;
}
示例9: __construct
/**
* 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');
}
示例10: __construct
/**
* 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();
}
示例11: __construct
/**
* 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;
// }
}
示例12: __construct
/**
* 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));
}
示例13:
function __construct($courseid, $gpr, $context, $page = null)
{
parent::__construct($courseid, $gpr, $context, $page);
$this->course_grade_item = grade_item::fetch_course_item($this->courseid);
}
示例14: __construct
/**
* 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();
}
}