本文整理汇总了PHP中grade_object::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_object::insert方法的具体用法?PHP grade_object::insert怎么用?PHP grade_object::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_object
的用法示例。
在下文中一共展示了grade_object::insert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
/**
* Records this object in the Database, sets its id to the returned value, and returns that value.
* If successful this function also fetches the new object data from database and stores it
* in object properties.
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return int PK ID if successful, false otherwise
*/
function insert($source = null)
{
$this->timecreated = time();
$this->timemodified = time();
return parent::insert($source);
}
示例2: insert_course_category
/**
* Internal function - used only from fetch_course_category()
* Normal insert() can not be used for course category
*
* @param int $courseid The course ID
* @return int The ID of the new course category
*/
public function insert_course_category($courseid)
{
$this->courseid = $courseid;
$this->fullname = '?';
$this->path = null;
$this->parent = null;
$this->aggregation = GRADE_AGGREGATE_WEIGHTED_MEAN2;
$this->apply_default_settings();
$this->apply_forced_settings();
$this->timecreated = $this->timemodified = time();
if (!parent::insert('system')) {
debugging("Could not insert this category: " . print_r($this, true));
return false;
}
// build path and depth
$this->update('system');
return $this->id;
}
示例3: insert
/**
* Records this object in the Database, sets its id to the returned value, and returns that value.
* If successful this function also fetches the new object data from database and stores it
* in object properties.
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return int PK ID if successful, false otherwise
*/
function insert($source = null)
{
$this->timecreated = $this->timemodified = time();
if ($result = parent::insert($source)) {
if (!empty($this->courseid)) {
$goc = new object();
$goc->courseid = $this->courseid;
$goc->outcomeid = $this->id;
insert_record('grade_outcomes_courses', $goc);
}
}
return $result;
}
示例4: insert
/**
* In addition to perform parent::insert(), calls force_regrading() method too.
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return int PK ID if successful, false otherwise
*/
function insert($source = null)
{
global $CFG;
if (empty($this->courseid)) {
error('Can not insert grade item without course id!');
}
// load scale if needed
$this->load_scale();
// add parent category if needed
if (empty($this->categoryid) and !$this->is_course_item() and !$this->is_category_item()) {
$course_category = grade_category::fetch_course_category($this->courseid);
$this->categoryid = $course_category->id;
}
// always place the new items at the end, move them after insert if needed
$last_sortorder = get_field_select('grade_items', 'MAX(sortorder)', "courseid = {$this->courseid}");
if (!empty($last_sortorder)) {
$this->sortorder = $last_sortorder + 1;
} else {
$this->sortorder = 1;
}
// add proper item numbers to manual items
if ($this->itemtype == 'manual') {
if (empty($this->itemnumber)) {
$this->itemnumber = 0;
}
}
// make sure there is not 0 in outcomeid
if (empty($this->outcomeid)) {
$this->outcomeid = null;
}
$this->timecreated = $this->timemodified = time();
if (parent::insert($source)) {
// force regrading of items if needed
$this->force_regrading();
return $this->id;
} else {
debugging("Could not insert this grade_item in the database!");
return false;
}
}
示例5: insert
/**
* Insert the grade_grade instance into the database.
*
* @param string $source From where was the object inserted (mod/forum, manual, etc.)
* @return int The new grade_grade ID if successful, false otherwise
*/
public function insert($source = null)
{
// TODO: dategraded hack - do not update times, they are used for submission and grading (MDL-31379)
//$this->timecreated = $this->timemodified = time();
return parent::insert($source);
}
示例6: insert
/**
* Records this object in the Database, sets its id to the returned value, and returns that value.
* If successful this function also fetches the new object data from database and stores it
* in object properties.
*
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return int PK ID if successful, false otherwise
*/
public function insert($source = null)
{
global $DB;
$this->timecreated = $this->timemodified = time();
if ($result = parent::insert($source)) {
if (!empty($this->courseid)) {
$goc = new stdClass();
$goc->courseid = $this->courseid;
$goc->outcomeid = $this->id;
$DB->insert_record('grade_outcomes_courses', $goc);
}
}
return $result;
}
示例7: debugging
/**
* Internal function - used only from fetch_course_category()
* Normal insert() can not be used for course category
* @param int $courseid
* @return bool success
*/
function insert_course_category($courseid)
{
$this->courseid = $courseid;
$this->fullname = get_string('coursegradecategory', 'grades');
$this->path = null;
$this->parent = null;
$this->aggregate = GRADE_AGGREGATE_MEAN;
if (!parent::insert('system')) {
debugging("Could not insert this category: " . print_r($this, true));
return false;
}
// build path and depth
$this->update('system');
return $this->id;
}