You are here

private function OpignoScorm::scormLoadScormAttributes in Opigno SCORM 8

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

Helper function to load a SCO attributes.

Parameters

int $sco_id: Sco ID.

Return value

array SCO attributes.

1 call to OpignoScorm::scormLoadScormAttributes()
OpignoScorm::scormLoadSco in src/OpignoScorm.php
Load a SCO information.

File

src/OpignoScorm.php, line 358

Class

OpignoScorm
Class OpignoScorm.

Namespace

Drupal\opigno_scorm

Code

private function scormLoadScormAttributes($sco_id) {
  $connection = $this->database;
  $attributes = [];
  $result = $connection
    ->select('opigno_scorm_package_sco_attributes', 'o')
    ->fields('o', [
    'attribute',
    'value',
    'serialized',
  ])
    ->condition('sco_id', $sco_id)
    ->execute();
  while ($row = $result
    ->fetchObject()) {
    $attributes[$row->attribute] = !empty($row->serialized) ? unserialize($row->value) : $row->value;
  }
  return $attributes;
}