当前位置: 首页>>代码示例>>PHP>>正文


PHP grade_get_setting函数代码示例

本文整理汇总了PHP中grade_get_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP grade_get_setting函数的具体用法?PHP grade_get_setting怎么用?PHP grade_get_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了grade_get_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Set up for every test
  */
 public function setUp()
 {
     global $DB;
     $this->resetAfterTest(true);
     $s1grade1 = 80;
     $s1grade2 = 40;
     $s2grade = 60;
     $this->course1 = $this->getDataGenerator()->create_course();
     $this->course2 = $this->getDataGenerator()->create_course();
     $studentrole = $DB->get_record('role', array('shortname' => 'student'));
     $teacherrole = $DB->get_record('role', array('shortname' => 'editingteacher'));
     $this->student1 = $this->getDataGenerator()->create_user();
     $this->teacher = $this->getDataGenerator()->create_user();
     $this->getDataGenerator()->enrol_user($this->teacher->id, $this->course1->id, $teacherrole->id);
     $this->getDataGenerator()->enrol_user($this->student1->id, $this->course1->id, $studentrole->id);
     $this->getDataGenerator()->enrol_user($this->student1->id, $this->course2->id, $studentrole->id);
     $this->student2 = $this->getDataGenerator()->create_user();
     $this->getDataGenerator()->enrol_user($this->student2->id, $this->course1->id, $studentrole->id);
     $this->getDataGenerator()->enrol_user($this->student2->id, $this->course2->id, $studentrole->id);
     $assignment1 = $this->getDataGenerator()->create_module('assign', array('name' => "Test assign", 'course' => $this->course1->id));
     $assignment2 = $this->getDataGenerator()->create_module('assign', array('name' => "Test assign", 'course' => $this->course2->id));
     $modcontext1 = get_coursemodule_from_instance('assign', $assignment1->id, $this->course1->id);
     $modcontext2 = get_coursemodule_from_instance('assign', $assignment2->id, $this->course2->id);
     $assignment1->cmidnumber = $modcontext1->id;
     $assignment2->cmidnumber = $modcontext2->id;
     $this->student1grade1 = array('userid' => $this->student1->id, 'rawgrade' => $s1grade1);
     $this->student1grade2 = array('userid' => $this->student1->id, 'rawgrade' => $s1grade2);
     $this->student2grade = array('userid' => $this->student2->id, 'rawgrade' => $s2grade);
     $studentgrades = array($this->student1->id => $this->student1grade1, $this->student2->id => $this->student2grade);
     assign_grade_item_update($assignment1, $studentgrades);
     $studentgrades = array($this->student1->id => $this->student1grade2);
     assign_grade_item_update($assignment2, $studentgrades);
     grade_get_setting($this->course1->id, 'report_overview_showrank', 1);
 }
开发者ID:dg711,项目名称:moodle,代码行数:37,代码来源:externallib_test.php

示例2: 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->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->showrange = true;
     $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, false, !$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 = get_record('user', 'id', $userid);
     // base url for sorting by first/last name
     $this->baseurl = $CFG->wwwroot . '/grade/report?id=' . $courseid . '&amp;userid=' . $userid;
     $this->pbarurl = $this->baseurl;
     // no groups on this report - rank is from all course users
     $this->setup_table();
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:36,代码来源:lib.php

示例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);
     // 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();
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:lib.php

示例4: __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();
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:18,代码来源:lib.php

示例5: 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();
 }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:19,代码来源:lib.php

示例6: 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 . '&amp;userid=' . $userid;
     $this->pbarurl = $this->baseurl;
     // no groups on this report - rank is from all course users
     $this->setup_table();
 }
开发者ID:r007,项目名称:PMoodle,代码行数:24,代码来源:lib.php

示例7: get_grade_min_and_max

 /**
  * Returns the minimum and maximum number of points this grade is graded with respect to.
  *
  * @since  Moodle 2.8.7, 2.9.1
  * @return array A list containing, in order, the minimum and maximum number of points.
  */
 protected function get_grade_min_and_max()
 {
     global $CFG;
     $this->load_grade_item();
     // When the following setting is turned on we use the grade_grade raw min and max values.
     $minmaxtouse = grade_get_setting($this->grade_item->courseid, 'minmaxtouse', $CFG->grade_minmaxtouse);
     // Only aggregate items use separate min grades.
     if ($minmaxtouse == GRADE_MIN_MAX_FROM_GRADE_GRADE || $this->grade_item->is_aggregate_item()) {
         return array($this->rawgrademin, $this->rawgrademax);
     } else {
         return array($this->grade_item->grademin, $this->grade_item->grademax);
     }
 }
开发者ID:Keneth1212,项目名称:moodle,代码行数:19,代码来源:grade_grade.php

示例8: 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));
     // 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 = '&amp;perpage=' . $studentsperpage;
         $curpage = '&amp;page=' . $this->page;
     }
     $this->baseurl = 'index.php?id=' . $this->courseid . $perpage . $curpage . '&amp;';
     $this->pbarurl = 'index.php?id=' . $this->courseid . $perpage . '&amp;';
     $this->setup_groups();
     $this->setup_sortitemid();
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:45,代码来源:lib.php

示例9: test_upgrade_minmaxgrade

 /**
  * Test upgrade minmaxgrade step.
  */
 public function test_upgrade_minmaxgrade()
 {
     global $CFG, $DB;
     require_once $CFG->libdir . '/gradelib.php';
     $initialminmax = $CFG->grade_minmaxtouse;
     $this->resetAfterTest();
     $c1 = $this->getDataGenerator()->create_course();
     $c2 = $this->getDataGenerator()->create_course();
     $c3 = $this->getDataGenerator()->create_course();
     $u1 = $this->getDataGenerator()->create_user();
     $a1 = $this->getDataGenerator()->create_module('assign', array('course' => $c1, 'grade' => 100));
     $a2 = $this->getDataGenerator()->create_module('assign', array('course' => $c2, 'grade' => 100));
     $a3 = $this->getDataGenerator()->create_module('assign', array('course' => $c3, 'grade' => 100));
     $cm1 = get_coursemodule_from_instance('assign', $a1->id);
     $ctx1 = context_module::instance($cm1->id);
     $assign1 = new assign($ctx1, $cm1, $c1);
     $cm2 = get_coursemodule_from_instance('assign', $a2->id);
     $ctx2 = context_module::instance($cm2->id);
     $assign2 = new assign($ctx2, $cm2, $c2);
     $cm3 = get_coursemodule_from_instance('assign', $a3->id);
     $ctx3 = context_module::instance($cm3->id);
     $assign3 = new assign($ctx3, $cm3, $c3);
     // Give a grade to the student.
     $ug = $assign1->get_user_grade($u1->id, true);
     $ug->grade = 10;
     $assign1->update_grade($ug);
     $ug = $assign2->get_user_grade($u1->id, true);
     $ug->grade = 20;
     $assign2->update_grade($ug);
     $ug = $assign3->get_user_grade($u1->id, true);
     $ug->grade = 30;
     $assign3->update_grade($ug);
     // Run the upgrade.
     upgrade_minmaxgrade();
     // Nothing has happened.
     $this->assertFalse($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c1->id)));
     $this->assertSame(false, grade_get_setting($c1->id, 'minmaxtouse', false, true));
     $this->assertFalse($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c1->id)));
     $this->assertFalse($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c2->id)));
     $this->assertSame(false, grade_get_setting($c2->id, 'minmaxtouse', false, true));
     $this->assertFalse($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c2->id)));
     $this->assertFalse($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c3->id)));
     $this->assertSame(false, grade_get_setting($c3->id, 'minmaxtouse', false, true));
     $this->assertFalse($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c3->id)));
     // Create inconsistency in c1 and c2.
     $giparams = array('itemtype' => 'mod', 'itemmodule' => 'assign', 'iteminstance' => $a1->id, 'courseid' => $c1->id, 'itemnumber' => 0);
     $gi = grade_item::fetch($giparams);
     $gi->grademin = 5;
     $gi->update();
     $giparams = array('itemtype' => 'mod', 'itemmodule' => 'assign', 'iteminstance' => $a2->id, 'courseid' => $c2->id, 'itemnumber' => 0);
     $gi = grade_item::fetch($giparams);
     $gi->grademax = 50;
     $gi->update();
     // C1 and C2 should be updated, but the course setting should not be set.
     $CFG->grade_minmaxtouse = GRADE_MIN_MAX_FROM_GRADE_GRADE;
     // Run the upgrade.
     upgrade_minmaxgrade();
     // C1 and C2 were partially updated.
     $this->assertTrue($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c1->id)));
     $this->assertSame(false, grade_get_setting($c1->id, 'minmaxtouse', false, true));
     $this->assertTrue($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c1->id)));
     $this->assertTrue($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c2->id)));
     $this->assertSame(false, grade_get_setting($c2->id, 'minmaxtouse', false, true));
     $this->assertTrue($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c2->id)));
     // Nothing has happened for C3.
     $this->assertFalse($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c3->id)));
     $this->assertSame(false, grade_get_setting($c3->id, 'minmaxtouse', false, true));
     $this->assertFalse($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c3->id)));
     // Course setting should not be set on a course that has the setting already.
     $CFG->grade_minmaxtouse = GRADE_MIN_MAX_FROM_GRADE_ITEM;
     grade_set_setting($c1->id, 'minmaxtouse', -1);
     // Sets different value than constant to check that it remained the same.
     // Run the upgrade.
     upgrade_minmaxgrade();
     // C2 was updated.
     $this->assertSame((string) GRADE_MIN_MAX_FROM_GRADE_GRADE, grade_get_setting($c2->id, 'minmaxtouse', false, true));
     // Nothing has happened for C1.
     $this->assertSame('-1', grade_get_setting($c1->id, 'minmaxtouse', false, true));
     // Nothing has happened for C3.
     $this->assertFalse($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c3->id)));
     $this->assertSame(false, grade_get_setting($c3->id, 'minmaxtouse', false, true));
     $this->assertFalse($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c3->id)));
     // Final check, this time we'll unset the default config.
     unset($CFG->grade_minmaxtouse);
     grade_set_setting($c1->id, 'minmaxtouse', null);
     // Run the upgrade.
     upgrade_minmaxgrade();
     // C1 was updated.
     $this->assertSame((string) GRADE_MIN_MAX_FROM_GRADE_GRADE, grade_get_setting($c1->id, 'minmaxtouse', false, true));
     // Nothing has happened for C3.
     $this->assertFalse($DB->record_exists('config', array('name' => 'show_min_max_grades_changed_' . $c3->id)));
     $this->assertSame(false, grade_get_setting($c3->id, 'minmaxtouse', false, true));
     $this->assertFalse($DB->record_exists('grade_items', array('needsupdate' => 1, 'courseid' => $c3->id)));
     // Restore value.
     $CFG->grade_minmaxtouse = $initialminmax;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:99,代码来源:upgradelib_test.php

示例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', 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');
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:40,代码来源:lib.php

示例11: __construct

 public function __construct(attendance $att)
 {
     global $CFG;
     $this->perm = $att->perm;
     $currenttime = time();
     if ($att->pageparams->view == ATT_VIEW_NOTPRESENT) {
         $att->pageparams->enddate = $currenttime;
     }
     $this->pageparams = $att->pageparams;
     $this->users = $att->get_users($att->pageparams->group, $att->pageparams->page);
     if (isset($att->pageparams->userids)) {
         foreach ($this->users as $key => $user) {
             if (!in_array($user->id, $att->pageparams->userids)) {
                 unset($this->users[$key]);
             }
         }
     }
     $this->groups = groups_get_all_groups($att->course->id);
     $this->sessions = $att->get_filtered_sessions();
     $this->statuses = $att->get_statuses(true, true);
     $this->allstatuses = $att->get_statuses(false, true);
     $this->gradable = $att->grade > 0;
     if (!($this->decimalpoints = grade_get_setting($att->course->id, 'decimalpoints'))) {
         $this->decimalpoints = $CFG->grade_decimalpoints;
     }
     $maxgrade = att_get_user_max_grade(count($this->sessions), $this->statuses);
     foreach ($this->users as $key => $user) {
         $grade = 0;
         if ($this->gradable) {
             $grade = $att->get_user_grade($user->id, array('enddate' => $currenttime));
             $totalgrade = $att->get_user_grade($user->id);
         }
         if ($att->pageparams->view != ATT_VIEW_NOTPRESENT || $grade < $maxgrade) {
             $this->usersgroups[$user->id] = groups_get_all_groups($att->course->id, $user->id);
             $this->sessionslog[$user->id] = $att->get_user_filtered_sessions_log($user->id);
             $this->usersstats[$user->id] = $att->get_user_statuses_stat($user->id);
             if ($this->gradable) {
                 $this->grades[$user->id] = $totalgrade;
                 $this->maxgrades[$user->id] = $att->get_user_max_grade($user->id);
             }
         } else {
             unset($this->users[$key]);
         }
     }
     $this->att = $att;
 }
开发者ID:amitkawasthi,项目名称:moodle-mod_attendance,代码行数:46,代码来源:renderables.php

示例12: grade_set_setting

/**
 * Add, update or delete a course gradebook setting
 *
 * @param int $courseid The course ID
 * @param string $name Name of the setting
 * @param string $value Value of the setting. NULL means delete the setting.
 */
function grade_set_setting($courseid, $name, $value)
{
    global $DB;
    if (is_null($value)) {
        $DB->delete_records('grade_settings', array('courseid' => $courseid, 'name' => $name));
    } else {
        if (!($existing = $DB->get_record('grade_settings', array('courseid' => $courseid, 'name' => $name)))) {
            $data = new stdClass();
            $data->courseid = $courseid;
            $data->name = $name;
            $data->value = $value;
            $DB->insert_record('grade_settings', $data);
        } else {
            $data = new stdClass();
            $data->id = $existing->id;
            $data->value = $value;
            $DB->update_record('grade_settings', $data);
        }
    }
    grade_get_setting($courseid, null, null, true);
    // reset the cache
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:29,代码来源:gradelib.php

示例13: get_decimals

 /**
  * Returns the value of the decimals field. It can be set at 3 levels: grade_item, course setting and site. The lowest level overrides the higher ones.
  * @return int Decimals (0 - 5)
  */
 function get_decimals()
 {
     global $CFG;
     if (is_null($this->decimals)) {
         return grade_get_setting($this->courseid, 'decimalpoints', $CFG->grade_decimalpoints);
     } else {
         return $this->decimals;
     }
 }
开发者ID:r007,项目名称:PMoodle,代码行数:13,代码来源:grade_item.php

示例14: __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 . '&amp;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;
     // }
 }
开发者ID:abhiahirwar,项目名称:moodle_plugin,代码行数:74,代码来源:lib.php

示例15: grade_set_setting

/**
 * Add/update course gradebook setting
 * @param int $courseid
 * @param string $name of setting
 * @param string value, NULL means no setting==remove
 * @return void
 */
function grade_set_setting($courseid, $name, $value)
{
    if (is_null($value)) {
        delete_records('grade_settings', 'courseid', $courseid, 'name', addslashes($name));
    } else {
        if (!($existing = get_record('grade_settings', 'courseid', $courseid, 'name', addslashes($name)))) {
            $data = new object();
            $data->courseid = $courseid;
            $data->name = addslashes($name);
            $data->value = addslashes($value);
            insert_record('grade_settings', $data);
        } else {
            $data = new object();
            $data->id = $existing->id;
            $data->value = addslashes($value);
            update_record('grade_settings', $data);
        }
    }
    grade_get_setting($courseid, null, null, true);
    // reset the cache
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:28,代码来源:gradelib.php


注:本文中的grade_get_setting函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。