當前位置: 首頁>>代碼示例>>PHP>>正文


PHP grade_category::get_record_data方法代碼示例

本文整理匯總了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)) {
開發者ID:evltuma,項目名稱:moodle,代碼行數:31,代碼來源:category.php

示例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();
 }
開發者ID:abhilash1994,項目名稱:moodle,代碼行數:29,代碼來源:data_generator.php


注:本文中的grade_category::get_record_data方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。