You are here

public function CourseObject::save in Course 7

Same name and namespace in other branches
  1. 6 includes/course_object.core.inc \CourseObject::save()
  2. 7.2 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/CourseObjectNode.inc
On object write, set privacy on this node.
1 method overrides CourseObject::save()
CourseObjectNode::save in includes/CourseObjectNode.inc
On object write, set privacy on this node.

File

includes/CourseObject.inc, line 977

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);
  }
  $this
    ->getCourse()
    ->resetCache();
  return parent::save();
}