/** * creates a pdf from quiz object * * @action servePdf * @param string $entryId * @return file * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @throws KalturaQuizErrors::PROVIDED_ENTRY_IS_NOT_A_QUIZ */ public function servePdfAction($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); } $kp = new kQuizPdf($entryId); $kp->createQuestionPdf(); return $kp->submitDocument(); }
/** * creates a pdf from quiz object * * @action servePdf * @param string $entryId * @return file * @throws KalturaErrors::ENTRY_ID_NOT_FOUND */ public function servePdfAction($entryId) { KalturaLog::debug("PDF::: Create a PDF Document for entry id [ " . $entryId . " ]"); $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $kp = new kQuizPdf($entryId); $kp->createQuestionPdf(); return $kp->submitDocument(); }
/** * creates a pdf from quiz object * The Output type defines the file format in which the quiz will be generated * Currently only PDF files are supported * @action serve * @param string $entryId * @param KalturaQuizOutputType $quizOutputType * @return file * @throws KalturaErrors::ENTRY_ID_NOT_FOUND * @throws KalturaQuizErrors::PROVIDED_ENTRY_IS_NOT_A_QUIZ */ public function serveAction($entryId, $quizOutputType) { KalturaLog::debug("Create a PDF Document for entry id [ " . $entryId . " ]"); $dbEntry = entryPeer::retrieveByPK($entryId); //validity check if (!$dbEntry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } //validity check $kQuiz = QuizPlugin::getQuizData($dbEntry); if (is_null($kQuiz)) { throw new KalturaAPIException(KalturaQuizErrors::PROVIDED_ENTRY_IS_NOT_A_QUIZ, $entryId); } //validity check if (!$kQuiz->getAllowDownload()) { throw new KalturaAPIException(KalturaQuizErrors::QUIZ_CANNOT_BE_DOWNLOAD); } //create a pdf $kp = new kQuizPdf($entryId); $kp->createQuestionPdf(); return $kp->submitDocument(); }