public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null) { $newArr = new KalturaQuizArray(); if ($arr == null) { return $newArr; } foreach ($arr as $obj) { $kQuiz = QuizPlugin::getQuizData($obj); if (!is_null($kQuiz)) { $quiz = new KalturaQuiz(); $quiz->fromObject($kQuiz, $responseProfile); $newArr[] = $quiz; } } return $newArr; }
/** * Allows to get a quiz * * @action get * @param string $entryId * @return KalturaQuiz * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @throws KalturaQuizErrors::PROVIDED_ENTRY_IS_NOT_A_QUIZ */ public function getAction($entryId) { $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $kQuiz = QuizPlugin::getQuizData($dbEntry); if (is_null($kQuiz)) { throw new KalturaAPIException(KalturaQuizErrors::PROVIDED_ENTRY_IS_NOT_A_QUIZ, $entryId); } $quiz = new KalturaQuiz(); $quiz->fromObject($kQuiz); return $quiz; }
/** * Allows to update a quiz * * @param string $entryId * @param KalturaQuiz $quiz * @return KalturaQuiz */ function update($entryId, KalturaQuiz $quiz) { $kparams = array(); $this->client->addParam($kparams, "entryId", $entryId); $this->client->addParam($kparams, "quiz", $quiz->toParams()); $this->client->queueServiceActionCall("quiz_quiz", "update", $kparams); if ($this->client->isMultiRequest()) { return $this->client->getMultiRequestResult(); } $resultObject = $this->client->doQueue(); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaQuiz"); return $resultObject; }