Example #1
0
    if (!file_exists($question->questionDirSys)) {
        claro_mkdir($question->questionDirSys, CLARO_FILE_PERMISSIONS);
    }
    if ($fp = @fopen($question->questionDirSys . "/question_" . $quId . ".xml", 'w')) {
        fwrite($fp, $xml);
        fclose($fp);
    } else {
        // interrupt process
    }
    // list of dirs to add in archive
    $filePathList[] = $question->questionDirSys;
    /*
     * BUILD THE ZIP ARCHIVE
     */
    // build and send the zip
    if (sendZip($question->getTitle(), $filePathList, $question->questionDirSys)) {
        exit;
    } else {
        $dialogBox->error(get_lang("Unable to send zip file"));
    }
}
if ($cmd == 'recupMultipleQuestions' && !is_null($exId)) {
    // add multiple question selection
    $sql = "SELECT `id` FROM `" . $tbl_quiz_question . "` ORDER BY `id`";
    $list = claro_sql_query_fetch_all_rows($sql);
    $ok = true;
    foreach ($list as $questionInfo) {
        $quId = $questionInfo['id'];
        if (isset($_REQUEST[$quId])) {
            if (!$exercise->addQuestion($quId)) {
                $ok = false;
Example #2
0
             claro_mkdir($questionObj->questionDirSys, CLARO_FILE_PERMISSIONS);
         }
         if ($fp = @fopen($questionObj->questionDirSys . "/question_" . $quRank . ".xml", 'w')) {
             fwrite($fp, $xml);
             fclose($fp);
         } else {
             // interrupt process
         }
         // list of dirs to add in archive
         $filePathList[] = $questionObj->questionDirSys;
     }
     if (!empty($filePathList)) {
         require_once get_path('incRepositorySys') . '/lib/thirdparty/pclzip/pclzip.lib.php';
         // build and send the zip
         // TODO use $courseDir ?
         if (sendZip($exercise->title, $filePathList, get_conf('coursesRepositorySys') . claro_get_current_course_data('path') . '/exercise/')) {
             exit;
         } else {
             $dialogBox->error(get_lang("Unable to create zip file"));
         }
     }
 }
 //-- export pdf
 if ($cmd == 'printPreview' && $exId) {
     require_once './lib/question.class.php';
     $exercise = new Exercise();
     $exercise->load($exId);
     if ($exercise->getShuffle() && isset($_REQUEST['shuffle']) && $_REQUEST['shuffle'] == 1) {
         $questionList = $exercise->getRandomQuestionList();
     } else {
         $questionList = $exercise->getQuestionList();