當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。