You are here

public function CourseHandler::save in Course 6

Same name and namespace in other branches
  1. 7.2 includes/CourseHandler.inc \CourseHandler::save()
  2. 7 includes/CourseHandler.inc \CourseHandler::save()
3 calls to CourseHandler::save()
CourseObject::save in includes/course_object.core.inc
Let objects create their instances before saving the course object.
CourseObjectFulfillment::save in includes/course_object.core.inc
Track course after saving fulfillment.
CourseReport::track in includes/course.core.inc
Track the course (scan required objects, update progress, completion, etc).
2 methods override CourseHandler::save()
CourseObject::save in includes/course_object.core.inc
Let objects create their instances before saving the course object.
CourseObjectFulfillment::save in includes/course_object.core.inc
Track course after saving fulfillment.

File

includes/course.core.inc, line 238
course.core.inc File for main Course class.

Class

CourseHandler
@file course.core.inc File for main Course class.

Code

public function save() {
  $options = $this
    ->getOptions();
  if (!isset($options['uuid'])) {
    $options['uuid'] = uuid_uuid();
  }

  // Set up serialized field for non-schema fields.
  $options[$this->serializedField] = array();
  $dbfields = $this
    ->getDatabaseFields();
  foreach ($options as $key => $value) {
    if (array_search($key, $dbfields) === FALSE) {
      $options[$this->serializedField][$key] = $value;
    }
  }
  $keys = $this
    ->getId() ? array(
    $this->primaryKey,
  ) : array();
  drupal_write_record($this->table, $options, $keys);
  $this
    ->setOptions($options);
  return $this;
}