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


PHP grade_category::apply_default_settings方法代码示例

本文整理汇总了PHP中grade_category::apply_default_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_category::apply_default_settings方法的具体用法?PHP grade_category::apply_default_settings怎么用?PHP grade_category::apply_default_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grade_category的用法示例。


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

示例1: foreach

    } else {
        if ($category->aggregation == GRADE_AGGREGATE_SUM && !$grade_item->is_calculated()) {
            // 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 = '?';
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:category.php

示例2: create_grade_category

 private function create_grade_category($course)
 {
     static $cnt = 0;
     $cnt++;
     $grade_category = new grade_category(array('courseid' => $course->id, 'fullname' => 'Cat ' . $cnt), false);
     $grade_category->apply_default_settings();
     $grade_category->apply_forced_settings();
     $grade_category->insert();
     return $grade_category;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:10,代码来源:report_graderlib_test.php

示例3: 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;
     $record = (array) $record;
     if (empty($record['courseid'])) {
         throw new coding_exception('courseid must be present in testing::create_grade_category() $record');
     }
     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(array('courseid' => $record['courseid']), false);
     $gradecategory->apply_default_settings();
     grade_category::set_properties($gradecategory, $record);
     $gradecategory->apply_forced_settings();
     $gradecategory->insert();
     // This creates a default grade item for the category
     $gradeitem = $gradecategory->load_grade_item();
     $gradecategory->update_from_db();
     return $gradecategory->get_record_data();
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:data_generator.php

示例4: 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();
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:29,代码来源:data_generator.php


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