本文整理汇总了PHP中grade_report类的典型用法代码示例。如果您正苦于以下问题:PHP grade_report类的具体用法?PHP grade_report怎么用?PHP grade_report使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了grade_report类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: grade_report_grader
/**
* 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
*/
function grade_report_grader($courseid, $gpr, $context, $page = null, $sortitemid = null)
{
global $CFG;
parent::grade_report($courseid, $gpr, $context, $page);
// 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');
}
// Grab the grade_tree for this course
$this->gtree = new grade_tree($this->courseid, true, $this->get_pref('aggregationposition'), $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 . '&';
// Setup groups if requested
if ($this->get_pref('showgroups')) {
$this->setup_groups();
}
$this->setup_sortitemid();
}
示例3: __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();
}
示例4: grade_report_overview
/**
* 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
*/
function grade_report_overview($userid, $gpr, $context)
{
global $CFG, $COURSE;
parent::grade_report($COURSE->id, $gpr, $context);
// get the user (for full name)
$this->user = get_record('user', '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();
}
示例5: __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();
}
示例6: grade_report_overview
/**
* 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
*/
function grade_report_overview($userid, $gpr, $context)
{
global $CFG, $COURSE;
parent::grade_report($COURSE->id, $gpr, $context);
$this->showrank = grade_get_setting($this->courseid, 'report_overview_showrank', !empty($CFG->grade_report_overview_showrank));
$this->showtotalsifcontainhidden = grade_get_setting($this->courseid, 'report_overview_showtotalsifcontainhidden', $CFG->grade_report_overview_showtotalsifcontainhidden);
// get the user (for full name)
$this->user = get_record('user', '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();
}
示例7: grade_report_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 $userid The id of the user
*/
function grade_report_user($courseid, $gpr, $context, $userid)
{
global $CFG;
parent::grade_report($courseid, $gpr, $context);
$this->showrank = grade_get_setting($this->courseid, 'report_user_showrank', $CFG->grade_report_user_showrank);
$this->showhiddenitems = grade_get_setting($this->courseid, 'report_user_showhiddenitems', $CFG->grade_report_user_showhiddenitems);
$switch = grade_get_setting($this->courseid, 'aggregationposition', $CFG->grade_aggregationposition);
// Grab the grade_seq for this course
$this->gseq = new grade_seq($this->courseid, $switch);
// get the user (for full name)
$this->user = get_record('user', '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();
}
示例8: grade_report_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 $userid The id of the user
*/
function grade_report_user($courseid, $gpr, $context, $userid)
{
global $CFG;
parent::grade_report($courseid, $gpr, $context);
// Grab the grade_tree for this course
$this->gtree = new grade_tree($this->courseid, true, $this->get_pref('aggregationposition'));
// get the user (for full name)
$this->user = get_record('user', 'id', $userid);
// base url for sorting by first/last name
$this->baseurl = $CFG->wwwroot . '/grade/report?id=' . $courseid . '&userid=' . $userid;
$this->pbarurl = $this->baseurl;
// Setup groups if requested
if ($this->get_pref('showgroups')) {
$this->setup_groups();
}
$this->setup_table();
}
示例9: __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();
}
示例10: grade_report_grader
/**
* 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
*/
function grade_report_grader($courseid, $gpr, $context, $page = null, $sortitemid = null)
{
global $CFG;
parent::grade_report($courseid, $gpr, $context, $page);
$this->canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $this->course->id));
$this->canviewuserreport = has_capability('gradereport/' . $CFG->grade_profilereport . ':view', $this->context);
// 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 $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');
}
示例12: get_pref
/**
* Given the name of a user preference (without grade_report_ prefix), locally saves then returns
* the value of that preference. If the preference has already been fetched before,
* the saved value is returned. If the preference is not set at the User level, the $CFG equivalent
* is given (site default).
* @static (Can be called statically, but then doesn't benefit from caching)
* @param string $pref The name of the preference (do not include the grade_report_ prefix)
* @param int $objectid An optional itemid or categoryid to check for a more fine-grained preference
* @return mixed The value of the preference
*/
public function get_pref($pref, $objectid = null)
{
global $CFG;
$fullprefname = 'grade_report_' . $pref;
$shortprefname = 'grade_' . $pref;
$retval = null;
if (!isset($this) or get_class($this) != 'grade_report') {
if (!empty($objectid)) {
$retval = get_user_preferences($fullprefname . $objectid, grade_report::get_pref($pref));
} elseif (isset($CFG->{$fullprefname})) {
$retval = get_user_preferences($fullprefname, $CFG->{$fullprefname});
} elseif (isset($CFG->{$shortprefname})) {
$retval = get_user_preferences($fullprefname, $CFG->{$shortprefname});
} else {
$retval = null;
}
} else {
if (empty($this->prefs[$pref . $objectid])) {
if (!empty($objectid)) {
$retval = get_user_preferences($fullprefname . $objectid);
if (empty($retval)) {
// No item pref found, we are returning the global preference
$retval = $this->get_pref($pref);
$objectid = null;
}
} else {
$retval = get_user_preferences($fullprefname, $CFG->{$fullprefname});
}
$this->prefs[$pref . $objectid] = $retval;
} else {
$retval = $this->prefs[$pref . $objectid];
}
}
return $retval;
}
示例13: __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();
}
}
示例14: grade_regrade_final_grades
$returnurl = $gpr->get_return_url(null);
//first make sure we have proper final grades - we need it for locking changes
grade_regrade_final_grades($courseid);
// get the grading tree object
// note: total must be first for moving to work correctly, if you want it last moving code must be rewritten!
$gtree = new grade_tree($courseid, false, false);
if (empty($eid)) {
$element = null;
$object = null;
} else {
if (!($element = $gtree->locate_element($eid))) {
error('Incorrect element id!', $returnurl);
}
$object = $element['object'];
}
$switch = grade_report::get_pref('aggregationposition');
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$strcategoriesedit = get_string('categoriesedit', 'grades');
$strcategoriesanditems = get_string('categoriesanditems', 'grades');
$navigation = grade_build_nav(__FILE__, $strcategoriesanditems, array('courseid' => $courseid));
$moving = false;
switch ($action) {
case 'delete':
if ($eid) {
$confirm = optional_param('confirm', 0, PARAM_BOOL);
if ($confirm and confirm_sesskey()) {
$object->delete('grade/report/grader/category');
redirect($returnurl);
} else {
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcategoriesedit, $navigation, '', '', true, '', navmenu($course));
示例15: error
}
if (!isset($data->aggregateonlygraded)) {
$data->aggregateonlygraded = 0;
}
if (!isset($data->aggregateoutcomes)) {
$data->aggregateoutcomes = 0;
}
grade_category::set_properties($grade_category, $data);
if (empty($grade_category->id)) {
$grade_category->insert();
} else {
$grade_category->update();
}
// Handle user preferences
if (isset($data->pref_aggregationview)) {
if (!grade_report::set_pref('aggregationview', $data->pref_aggregationview, $grade_category->id)) {
error("Could not set preference aggregationview to {$value} for this grade category");
}
}
// set parent if needed
if (isset($data->parentcategory)) {
$grade_category->set_parent($data->parentcategory, 'gradebook');
}
// update agg coef if needed
if (isset($data->aggregationcoef)) {
$data->aggregationcoef = unformat_float($data->aggregationcoef);
$grade_item = $grade_category->load_grade_item();
$grade_item->aggregationcoef = $data->aggregationcoef;
$grade_item->update();
}
redirect($returnurl);