You are here

public function CourseObjectScorm::create in Course 6

Creates a course object.

For example, this would create the new node and return the node ID if this was a CourseObjectNode.

Do not confuse this with save(), which saves the course outline record for tracking.

Course objects should call setInstanceId() if this is a course object that creates external resources.

Overrides CourseObjectNode::create

File

modules/course_scorm/course_scorm.classes.inc, line 5

Class

CourseObjectScorm

Code

public function create() {
  if ($this
    ->getInstanceId()) {
    $scorm_node = node_load($this
      ->getInstanceId());
  }
  else {
    $scorm_node = new stdClass();
  }
  $scorm_node->type = $this
    ->getComponent();
  $scorm_node->title = $this
    ->getTitle();
  $scorm_node->uid = $this->user->uid;
  node_save($scorm_node);
  $this
    ->setNode($scorm_node);
}