static function create_question($parent, $so, $user = null) { isset($user) or $user = lms_steam::get_current_user(); self::$user = $user; if ($so instanceof steam_document) { $xml = simplexml_load_string($so->get_content()); if ($xml->type == "MultipleChoice" || $xml->type == "MultipleChoiceQuestion") { return new elearning_question_multiplechoice($parent, $so, $xml); } } else { return NULL; } }
private function create_question_objects($id, $user = null) { isset($user) or $user = lms_steam::get_current_user(); $steam_container = $this->cache->call("steam_factory::get_object_by_name", $GLOBALS["STEAM"]->get_id(), $this->steam_object_path . "/" . $id); $steam_objects = $this->cache->call(array($steam_container, "get_inventory")); $result = array(); foreach ($steam_objects as $so) { $result[] = elearning_question::create_question($this, $so, $user); } return $result; }