/** * Creates a new LearningObject representing an existing object in the LMS * @param string $type * @param string $loId * @return intuitelLO new instance * @throws intuitel\UnknownLOException */ public static function createLO(LOId $loId) { $idfactory = Intuitel::getIDFactory(); $type = $idfactory->getType($loId); try { $factory = Intuitel::getLOFactory($type); } catch (UnknownLOTypeException $ex) { $factory = new GenericLOFactory(); } return $factory->createLO($loId); }
/** * * @param array $rawDatas * @param string $type * null means unknown. Tries to guess type. * @return array of intuitelLO */ private function fillArrayWithLOs(array $rawDatas, $type) { $list = array(); $factory = null; foreach ($rawDatas as $data) { try { $newLO = $this->createLOFromNative($data, $type); if ($newLO != null) { // if section, empty ones are not added $list[] = $newLO; } } catch (UnknownLOTypeException $e) { // unknown type: Wrap it with a GenericLO // TODO: use logging output //print ('unknown LOtype:' . $e->getMessage () . '\l\n') ; $factory = new GenericLOFactory(); $newLO = $factory->createLOFromNative($data); if ($newLO != null) { // empty ones are not added $list[] = $newLO; } } } return $list; }