本文整理汇总了PHP中grade_object::update方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_object::update方法的具体用法?PHP grade_object::update怎么用?PHP grade_object::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_object
的用法示例。
在下文中一共展示了grade_object::update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* In addition to update() it also updates grade_outcomes_courses if needed
* @param string $source from where was the object inserted
* @return boolean success
*/
function update($source = null)
{
$this->timemodified = time();
return parent::update($source);
}
示例2: update
/**
* In addition to update() as defined in grade_object, call force_regrading of parent categories, if applicable.
*
* @param string $source from where was the object updated (mod/forum, manual, etc.)
* @return bool success
*/
public function update($source = null)
{
// load the grade item or create a new one
$this->load_grade_item();
// force recalculation of path;
if (empty($this->path)) {
$this->path = grade_category::build_path($this);
$this->depth = substr_count($this->path, '/') - 1;
$updatechildren = true;
} else {
$updatechildren = false;
}
$this->apply_forced_settings();
// these are exclusive
if ($this->droplow > 0) {
$this->keephigh = 0;
} else {
if ($this->keephigh > 0) {
$this->droplow = 0;
}
}
// Recalculate grades if needed
if ($this->qualifies_for_regrading()) {
$this->force_regrading();
}
$this->timemodified = time();
$result = parent::update($source);
// now update paths in all child categories
if ($result and $updatechildren) {
if ($children = grade_category::fetch_all(array('parent' => $this->id))) {
foreach ($children as $child) {
$child->path = null;
$child->depth = 0;
$child->update($source);
}
}
}
return $result;
}
示例3: update
/**
* In addition to update() as defined in grade_object, handle the grade_outcome and grade_scale objects.
* Force regrading if necessary, rounds the float numbers using php function,
* the reason is we need to compare the db value with computed number to skip regrading if possible.
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return boolean success
*/
function update($source = null)
{
// reset caches
$this->dependson_cache = null;
// Retrieve scale and infer grademax/min from it if needed
$this->load_scale();
// make sure there is not 0 in outcomeid
if (empty($this->outcomeid)) {
$this->outcomeid = null;
}
if ($this->qualifies_for_regrading()) {
$this->force_regrading();
}
$this->timemodified = time();
$this->grademin = grade_floatval($this->grademin);
$this->grademax = grade_floatval($this->grademax);
$this->multfactor = grade_floatval($this->multfactor);
$this->plusfactor = grade_floatval($this->plusfactor);
$this->aggregationcoef = grade_floatval($this->aggregationcoef);
return parent::update($source);
}
示例4: update
/**
* In addition to update() it also updates grade_outcomes_courses if needed
* @param string $source from where was the object inserted
* @return boolean success
*/
function update($source = null)
{
$this->timemodified = time();
if ($result = parent::update($source)) {
if (!empty($this->courseid)) {
$this->use_in($this->courseid);
}
}
return $result;
}
示例5: update
/**
* In addition to update() as defined in grade_object rounds the float numbers using php function,
* the reason is we need to compare the db value with computed number to skip updates if possible.
*
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return bool success
*/
public function update($source = null)
{
$this->rawgrade = grade_floatval($this->rawgrade);
$this->finalgrade = grade_floatval($this->finalgrade);
$this->rawgrademin = grade_floatval($this->rawgrademin);
$this->rawgrademax = grade_floatval($this->rawgrademax);
return parent::update($source);
}
示例6: update
/**
* In addition to update() it also updates grade_outcomes_courses if needed
* @param string $source from where was the object inserted
* @return boolean success
*/
function update($source = null)
{
if ($result = parent::update($source)) {
if (!empty($this->courseid)) {
if (!get_records('grade_outcomes_courses', 'courseid', $this->courseid, 'outcomeid', $this->id)) {
$goc = new object();
$goc->courseid = $this->courseid;
$goc->outcomeid = $this->id;
insert_record('grade_outcomes_courses', $goc);
}
}
}
return $result;
}
示例7: update
/**
* In addition to update() as defined in grade_object, handle the grade_outcome and grade_scale objects.
* Force regrading if necessary
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return boolean success
*/
function update($source = null)
{
// Retrieve scale and infer grademax/min from it if needed
$this->load_scale();
// make sure there is not 0 in outcomeid
if (empty($this->outcomeid)) {
$this->outcomeid = null;
}
if ($this->qualifies_for_regrading()) {
$this->force_regrading();
}
return parent::update($source);
}
示例8: update
/**
* In addition to update() as defined in grade_object, call force_regrading of parent categories, if applicable.
* @param string $source from where was the object updated (mod/forum, manual, etc.)
* @return boolean success
*/
function update($source = null)
{
// load the grade item or create a new one
$this->load_grade_item();
// force recalculation of path;
if (empty($this->path)) {
$this->path = grade_category::build_path($this);
$this->depth = substr_count($this->path, '/') - 1;
}
// Recalculate grades if needed
if ($this->qualifies_for_regrading()) {
$this->force_regrading();
}
return parent::update($source);
}