You are here

public function Course::getObjects in Course 7

Same name and namespace in other branches
  1. 6 includes/course.core.inc \Course::getObjects()
  2. 7.2 includes/Course.inc \Course::getObjects()

Get the course objects in this course.

Return value

CourseObject[] An array of course objects.

2 calls to Course::getObjects()
Course::setActive in includes/Course.inc
Set the active CourseObject in this Course.
Course::unEnroll in includes/Course.inc
Un-enroll the user from all course objects and revoke access.

File

includes/Course.inc, line 183

Class

Course
An object that holds CourseObjects and tracker functions?

Code

public function getObjects() {
  if (empty($this->courseObjects)) {
    $efq = new EntityFieldQuery();
    $result = $efq
      ->entityCondition('entity_type', 'course_object')
      ->propertyCondition('nid', $this
      ->getNode()->nid)
      ->propertyOrderBy('weight')
      ->execute();
    if (!empty($result['course_object'])) {
      if ($this->courseObjects = entity_load('course_object', array_keys($result['course_object']))) {
        foreach ($this->courseObjects as $courseObject) {

          /** @deprecated do not use set|getUser() */
          $courseObject
            ->setUser($this
            ->getUser());
        }
      }
    }
  }
  return $this->courseObjects;
}