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


PHP grade_category::set_properties方法代码示例

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


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

示例1: require_login

require_login($course);
$context = context_course::instance($course->id);
require_capability('moodle/grade:manage', $context);
// todo $PAGE->requires->js_module() should be used here instead
$PAGE->requires->js('/grade/edit/tree/functions.js');
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'edit', 'plugin' => 'tree', 'courseid' => $courseid));
$returnurl = $gpr->get_return_url(null);
// Change category aggregation if requested
if (!is_null($category) && !is_null($aggregationtype) && confirm_sesskey()) {
    if (!($grade_category = grade_category::fetch(array('id' => $category, 'courseid' => $courseid)))) {
        print_error('invalidcategoryid');
    }
    $data = new stdClass();
    $data->aggregation = $aggregationtype;
    grade_category::set_properties($grade_category, $data);
    $grade_category->update();
    grade_regrade_final_grades($courseid);
}
//first make sure we have proper final grades - we need it for locking changes
$normalisationmessage = null;
$originalweights = grade_helper::fetch_all_natural_weights_for_course($courseid);
grade_regrade_final_grades($courseid);
$alteredweights = grade_helper::fetch_all_natural_weights_for_course($courseid);
if (array_diff($originalweights, $alteredweights)) {
    $normalisationmessage = get_string('weightsadjusted', 'grades');
}
// get the grading tree object
// note: total must be first for moving to work correctly, if you want it last moving code must be rewritten!
$gtree = new grade_tree($courseid, false, false);
if (empty($eid)) {
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:31,代码来源:index.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;
     $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


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