You are here

public function OpignoScorm::scormSave in Opigno SCORM 8

Same name and namespace in other branches
  1. 3.x src/OpignoScorm.php \Drupal\opigno_scorm\OpignoScorm::scormSave()

Save a SCORM package information.

Parameters

object $scorm: Scorm object.

Return value

bool Save flag.

Throws

\Exception

1 call to OpignoScorm::scormSave()
OpignoScorm::scormExtract in src/OpignoScorm.php
Extract and save Scorm data from Scorm package.

File

src/OpignoScorm.php, line 157

Class

OpignoScorm
Class OpignoScorm.

Namespace

Drupal\opigno_scorm

Code

public function scormSave($scorm) {
  $connection = $this->database;
  if (!empty($scorm->id)) {
    return $connection
      ->update('opigno_scorm_packages')
      ->fields((array) $scorm)
      ->condition('id', $scorm->id)
      ->execute();
  }
  else {
    $id = $connection
      ->insert('opigno_scorm_packages')
      ->fields((array) $scorm)
      ->execute();
    $scorm->id = $id;
    return !!$id;
  }
}