/** * Compute a list of LOs for this LMS * * @param array $attributes * name=>value filter array */ public function findLObyAttributes(array $attributes) { if (array_key_exists('loId', $attributes) && array_key_exists('getFullCourse', $attributes) && $attributes['getFullCourse'] == 'true') { // retrieve all objects in course $id = $attributes['loId']; $loId = $id instanceof LOId ? $id : new LOId($id); try { $adaptor = Intuitel::getAdaptorInstanceForCourseLOId($loId); $list = $adaptor->findLOAll(); return $list; } catch (UnknownLOException $ex) { return array(); } catch (UnknownIDException $ex) { return array(); } } else { if (array_key_exists('loId', $attributes)) { // return one object $id = $attributes['loId']; $loId = $id instanceof LOId ? $id : new LOId($id); try { $lo = IntuitelAdaptor::createLO($loId); return array($lo); } catch (UnknownLOException $ex) { return array(); } catch (UnknownIDException $ex) { return array(); } } else { // search every course by params $courses = Intuitel::getIntuitelEnabledCourses(); $total_list = array(); foreach ($courses as $course) { $filter = array('loId' => $course->loId, 'getFullCourse' => 'true'); $list = $this->findLObyAttributes($filter); $total_list = array_merge($total_list, $list); } // filter out unwanted items $final_list = $this->filterUnmatched($total_list, $attributes); return $final_list; } } }
/** * * @global \stdClass $DB * @param \stdClass $course */ function __construct(\stdClass $course = null) { global $DB; parent::__construct($course); }