You are here

public function CourseObject::save in Course 6

Same name and namespace in other branches
  1. 7.2 includes/CourseObject.inc \CourseObject::save()
  2. 7 includes/CourseObject.inc \CourseObject::save()

Let objects create their instances before saving the course object.

Overrides CourseHandler::save

1 call to CourseObject::save()
CourseObjectNode::save in includes/course_object.core.inc
On object write, set privacy on this node.
1 method overrides CourseObject::save()
CourseObjectNode::save in includes/course_object.core.inc
On object write, set privacy on this node.

File

includes/course_object.core.inc, line 907

Class

CourseObject
Parent abstract base class of all course objects.

Code

public function save() {

  // If there is no title, set it.
  $this
    ->getTitle();
  if ($ice = $this
    ->getOption('freeze')) {

    // Found frozen data.
    $this
      ->setInstanceId($this
      ->thaw($ice));
    $this
      ->setOption('freeze', NULL);
  }

  // If there is no instance ID, create one.
  if (!$this
    ->getInstanceId()) {
    $this
      ->create();
  }

  // Set the ID to NULL because this is a temporary course object being
  // created for the first time.
  if (strpos($this
    ->getId(), 'course_object_') !== FALSE) {
    $this
      ->setId(NULL);
  }
  return parent::save();
}