本文整理汇总了PHP中grade_category::get_record_data方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_category::get_record_data方法的具体用法?PHP grade_category::get_record_data怎么用?PHP grade_category::get_record_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_category
的用法示例。
在下文中一共展示了grade_category::get_record_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
// Input fields for grademin and grademax are disabled for the "Natural" category,
// this means they will be ignored if user does not change aggregation method.
// But if user does change aggregation method the default values should be used.
// This does not apply to calculated category totals.
$category->grademax = 100;
$category->grade_item_grademax = 100;
$category->grademin = 0;
$category->grade_item_grademin = 0;
}
}
} else {
$heading = get_string('newcategory', 'grades');
$grade_category = new grade_category(array('courseid' => $courseid), false);
$grade_category->apply_default_settings();
$grade_category->apply_forced_settings();
$category = $grade_category->get_record_data();
$grade_item = new grade_item(array('courseid' => $courseid, 'itemtype' => 'manual'), false);
foreach ($grade_item->get_record_data() as $key => $value) {
$category->{"grade_item_{$key}"} = $value;
}
}
$mform = new edit_category_form(null, array('current' => $category, 'gpr' => $gpr));
if ($mform->is_cancelled()) {
redirect($returnurl);
} else {
if ($data = $mform->get_data(false)) {
// If no fullname is entered for a course category, put ? in the DB
if (!isset($data->fullname) || $data->fullname == '') {
$data->fullname = '?';
}
if (!isset($data->aggregateonlygraded)) {
示例2: create_grade_category
/**
* Create a grade_category.
*
* @param array|stdClass $record
* @return stdClass the grade category record
*/
public function create_grade_category($record = null)
{
global $CFG;
$this->gradecategorycounter++;
$i = $this->gradecategorycounter;
if (!isset($record['fullname'])) {
$record['fullname'] = 'Grade category ' . $i;
}
// For gradelib classes.
require_once $CFG->libdir . '/gradelib.php';
// Create new grading category in this course.
$gradecategory = new grade_category($record, false);
$gradecategory->apply_default_settings();
$gradecategory->apply_forced_settings();
$gradecategory->insert();
// This creates a default grade item for the category
$gradeitem = $gradecategory->load_grade_item();
if (isset($record->parentcategory)) {
$gradecategory->set_parent($data->parentcategory);
}
$gradecategory->update_from_db();
return $gradecategory->get_record_data();
}