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


PHP grade_item::load_scale方法代码示例

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


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

示例1: stdClass

 }
 // check if grade item is locked if so, abort
 if ($gradeitem->is_locked()) {
     $status = false;
     import_cleanup($importcode);
     echo $OUTPUT->notification(get_string('gradeitemlocked', 'grades'));
     break 3;
 }
 $newgrade = new stdClass();
 $newgrade->itemid = $gradeitem->id;
 if ($gradeitem->gradetype == GRADE_TYPE_SCALE and $verbosescales) {
     if ($value === '' or $value == '-') {
         $value = null;
         // no grade
     } else {
         $scale = $gradeitem->load_scale();
         $scales = explode(',', $scale->scale);
         $scales = array_map('trim', $scales);
         //hack - trim whitespace around scale options
         array_unshift($scales, '-');
         // scales start at key 1
         $key = array_search($value, $scales);
         if ($key === false) {
             echo "<br/>t0 is {$t0}";
             echo "<br/>grade is {$value}";
             $status = false;
             import_cleanup($importcode);
             echo $OUTPUT->notification(get_string('badgrade', 'grades'));
             break 3;
         }
         $value = $key;
开发者ID:covex-nn,项目名称:moodle,代码行数:31,代码来源:index.php

示例2: update_grade_item

 /**
  * This updates existing grade items.
  *
  * @param int $courseid The course ID.
  * @param array $map Mapping information provided by the user.
  * @param int $key The line that we are currently working on.
  * @param bool $verbosescales Form setting for grading with scales.
  * @param string $value The grade value.
  * @return array grades to be updated.
  */
 protected function update_grade_item($courseid, $map, $key, $verbosescales, $value)
 {
     // Case of an id, only maps id of a grade_item.
     // This was idnumber.
     if (!($gradeitem = new grade_item(array('id' => $map[$key], 'courseid' => $courseid)))) {
         // Supplied bad mapping, should not be possible since user
         // had to pick mapping.
         $this->cleanup_import(get_string('importfailed', 'grades'));
         return null;
     }
     // Check if grade item is locked if so, abort.
     if ($gradeitem->is_locked()) {
         $this->cleanup_import(get_string('gradeitemlocked', 'grades'));
         return null;
     }
     $newgrade = new stdClass();
     $newgrade->itemid = $gradeitem->id;
     if ($gradeitem->gradetype == GRADE_TYPE_SCALE and $verbosescales) {
         if ($value === '' or $value == '-') {
             $value = null;
             // No grade.
         } else {
             $scale = $gradeitem->load_scale();
             $scales = explode(',', $scale->scale);
             $scales = array_map('trim', $scales);
             // Hack - trim whitespace around scale options.
             array_unshift($scales, '-');
             // Scales start at key 1.
             $key = array_search($value, $scales);
             if ($key === false) {
                 $this->cleanup_import(get_string('badgrade', 'grades'));
                 return null;
             }
             $value = $key;
         }
         $newgrade->finalgrade = $value;
     } else {
         if ($value === '' or $value == '-') {
             $value = null;
             // No grade.
         } else {
             // If the value has a local decimal or can correctly be unformatted, do it.
             $validvalue = unformat_float($value, true);
             if ($validvalue !== false) {
                 $value = $validvalue;
             } else {
                 // Non numeric grade value supplied, possibly mapped wrong column.
                 $this->cleanup_import(get_string('badgrade', 'grades'));
                 return null;
             }
         }
         $newgrade->finalgrade = $value;
     }
     $this->newgrades[] = $newgrade;
     return $this->newgrades;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:66,代码来源:load_data.php


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