/** * this creates a pagebreak. * a pagebreak is a special kind of item * * @global object * @param int $feedbackid * @return mixed false if there already is a pagebreak on last position or the id of the pagebreak-item */ function feedback_create_pagebreak($feedbackid) { global $DB; //check if there already is a pagebreak on the last position $lastposition = $DB->count_records('feedback_item', array('feedback'=>$feedbackid)); if ($lastposition == feedback_get_last_break_position($feedbackid)) { return false; } $item = new stdClass(); $item->feedback = $feedbackid; $item->template=0; $item->name = ''; $item->presentation = ''; $item->hasvalue = 0; $item->typ = 'pagebreak'; $item->position = $lastposition + 1; $item->required=0; return $DB->insert_record('feedback_item', $item); }
/** * this creates a pagebreak. * a pagebreak is a special kind of item * @param int $feedbackid * @return mixed false if there already is a pagebreak on last position or the id of the pagebreak-item */ function feedback_create_pagebreak($feedbackid) { //check if there already is a pagebreak on the last position $lastposition = count_records('feedback_item', 'feedback', $feedbackid); if ($lastposition == feedback_get_last_break_position($feedbackid)) { return false; } $item = new object(); $item->id = ''; $item->feedback = $feedbackid; $item->template = 0; $item->name = ''; $item->presentation = ''; $item->hasvalue = 0; $item->typ = 'pagebreak'; $item->position = $lastposition + 1; $item->required = 0; return insert_record('feedback_item', $item); }