You are here

abstract class CourseObjectAccess in Course 7

Same name and namespace in other branches
  1. 6 includes/course.core.inc \CourseObjectAccess
  2. 7.2 includes/CourseObjectAccess.inc \CourseObjectAccess

Access handler for CourseObjects.

Subtypes must define take(), see(), and view().

Hierarchy

Expanded class hierarchy of CourseObjectAccess

File

includes/CourseObjectAccess.inc, line 8

View source
abstract class CourseObjectAccess {
  private $courseObject;
  private $type;
  public function setType($type) {
    $this->type = $type;
  }

  /**
   * Helper method to get possible objects.
   */
  public function getObjectOptions() {
    $options = array(
      '',
    );
    foreach ($this
      ->getCourseObject()
      ->getCourse()
      ->getObjects() as $courseObject) {
      if ($courseObject
        ->getId() != $this
        ->getCourseObject()
        ->getId()) {
        $options[$courseObject
          ->getId()] = $courseObject
          ->getTitle();
      }
    }
    return $options;
  }
  public function setCourseObject($courseObject) {
    $this->courseObject = $courseObject;
  }
  public function getCourseObject() {
    return $this->courseObject;
  }
  public abstract function take();
  public abstract function see();
  public abstract function view();
  public function getOptions() {
    $plugins = $this
      ->getCourseObject()
      ->getOption('plugins');
    if (isset($plugins['access'][$this->type])) {
      return $plugins['access'][$this->type];
    }
    else {
      return $this
        ->optionsDefinition();
    }
  }
  public function getOption($option) {
    $options = $this
      ->getOptions();
    if (isset($options[$option])) {
      return $options[$option];
    }
    else {
      return NULL;
    }
  }
  public function optionsValidate($form, &$form_state) {
  }
  public function optionsDefinition() {
    return array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CourseObjectAccess::$courseObject private property
CourseObjectAccess::$type private property
CourseObjectAccess::getCourseObject public function
CourseObjectAccess::getObjectOptions public function Helper method to get possible objects. 1
CourseObjectAccess::getOption public function
CourseObjectAccess::getOptions public function
CourseObjectAccess::optionsDefinition public function 3
CourseObjectAccess::optionsValidate public function 1
CourseObjectAccess::see abstract public function 3
CourseObjectAccess::setCourseObject public function
CourseObjectAccess::setType public function
CourseObjectAccess::take abstract public function 3
CourseObjectAccess::view abstract public function 3