You are here

public function CourseObject::getReadOnlyOptions in Course 7.2

Get read-only options. These options have been processed by plugins and may have changed from their definitions.

Only use this to get options when evaluating access or completion.

File

includes/CourseObject.inc, line 571

Class

CourseObject
Parent abstract base class of all course objects.

Code

public function getReadOnlyOptions() {
  global $user;
  $account = $user;
  if (!isset($this->readOnlyOptionsCache[$account->uid])) {
    $options = $this
      ->getOptions();

    // Allow plugins to alter options on the fly if we are not editing the
    // course.
    ctools_include('plugins');
    foreach (ctools_get_plugins('course', 'course_object_access') as $key => $plugin) {
      $class = ctools_plugin_get_class($plugin, 'handler');
      $accessPlugin = new $class();
      $accessPlugin
        ->setCourseObject($this);
      $accessPlugin
        ->setType($key);
      $accessPlugin
        ->alterOptions($options, $account);
    }
    $this->readOnlyOptionsCache[$account->uid] = $options;
  }
  return $this->readOnlyOptionsCache[$account->uid];
}