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


PHP grade_item::get_record_data方法代码示例

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


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

示例1: redirect

    if (!empty($grade_item->outcomeid) && !empty($CFG->enableoutcomes)) {
        $url = $CFG->wwwroot . '/grade/edit/tree/outcomeitem.php?id=' . $id . '&courseid=' . $courseid;
        redirect($gpr->add_url_params($url));
    }
    if ($grade_item->is_course_item() or $grade_item->is_category_item()) {
        $grade_category = $grade_item->get_item_category();
        $url = $CFG->wwwroot . '/grade/edit/tree/category.php?id=' . $grade_category->id . '&courseid=' . $courseid;
        redirect($gpr->add_url_params($url));
    }
    $item = $grade_item->get_record_data();
    $parent_category = $grade_item->get_parent_category();
    $item->parentcategory = $parent_category->id;
} else {
    $heading = get_string('newitem', 'grades');
    $grade_item = new grade_item(array('courseid' => $courseid, 'itemtype' => 'manual'), false);
    $item = $grade_item->get_record_data();
    $parent_category = grade_category::fetch_course_category($courseid);
    $item->parentcategory = $parent_category->id;
}
$decimalpoints = $grade_item->get_decimals();
if ($item->hidden > 1) {
    $item->hiddenuntil = $item->hidden;
    $item->hidden = 0;
} else {
    $item->hiddenuntil = 0;
}
$item->locked = !empty($item->locked);
$item->grademax = format_float($item->grademax, $decimalpoints);
$item->grademin = format_float($item->grademin, $decimalpoints);
$item->gradepass = format_float($item->gradepass, $decimalpoints);
$item->multfactor = format_float($item->multfactor, 4);
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:item.php

示例2: foreach

            // 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)) {
            $data->aggregateonlygraded = 0;
        }
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:category.php

示例3: create_grade_item

 /**
  * Create a grade_item.
  *
  * @param array|stdClass $record
  * @return stdClass the grade item record
  */
 public function create_grade_item($record = null)
 {
     global $CFG;
     require_once "{$CFG->libdir}/gradelib.php";
     $this->gradeitemcounter++;
     if (!isset($record['itemtype'])) {
         $record['itemtype'] = 'manual';
     }
     if (!isset($record['itemname'])) {
         $record['itemname'] = 'Grade item ' . $this->gradeitemcounter;
     }
     if (isset($record['outcomeid'])) {
         $outcome = new grade_outcome(array('id' => $record['outcomeid']));
         $record['scaleid'] = $outcome->scaleid;
     }
     if (isset($record['scaleid'])) {
         $record['gradetype'] = GRADE_TYPE_SCALE;
     } else {
         if (!isset($record['gradetype'])) {
             $record['gradetype'] = GRADE_TYPE_VALUE;
         }
     }
     // Create new grade item in this course.
     $gradeitem = new grade_item($record, false);
     $gradeitem->insert();
     $gradeitem->update_from_db();
     return $gradeitem->get_record_data();
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:34,代码来源:data_generator.php


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