Пример #1
0
if ($cmd == 'delQu' && !is_null($quId)) {
    $question = new Question();
    if ($question->load($quId)) {
        if (!$question->delete()) {
            // TODO show confirmation and list
        }
    }
}
// export question
if ($cmd == 'exExport' && get_conf('enableExerciseExportQTI')) {
    require_once '../export/qti2/qti2_export.php';
    require_once get_path('incRepositorySys') . '/lib/fileManage.lib.php';
    require_once get_path('incRepositorySys') . '/lib/file.lib.php';
    require_once get_path('incRepositorySys') . '/lib/thirdparty/pclzip/pclzip.lib.php';
    $question = new Qti2Question();
    $question->load($quId);
    // contruction of XML flow
    $xml = $question->export();
    // remove trailing slash
    if (substr($question->questionDirSys, -1) == '/') {
        $question->questionDirSys = substr($question->questionDirSys, 0, -1);
    }
    //save question xml file
    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
Пример #2
0
 require_once get_path('incRepositorySys') . '/lib/fileManage.lib.php';
 require_once get_path('incRepositorySys') . '/lib/file.lib.php';
 //find exercise informations
 $exercise = new Exercise();
 $exercise->load($exId);
 if ($exercise->getShuffle() && isset($_REQUEST['shuffle']) && $_REQUEST['shuffle'] == 1) {
     $questionList = $exercise->getRandomQuestionList();
 } else {
     $questionList = $exercise->getQuestionList();
 }
 $filePathList = array();
 //prepare xml file of each question
 foreach ($questionList as $question) {
     $quId = $question['id'];
     $questionObj = new Qti2Question();
     $questionObj->load($quId);
     // contruction of XML flow
     $xml = $questionObj->export();
     // remove trailing slash
     if (substr($questionObj->questionDirSys, -1) == '/') {
         $questionObj->questionDirSys = substr($questionObj->questionDirSys, 0, -1);
     }
     //save question xml file
     if (!file_exists($questionObj->questionDirSys)) {
         claro_mkdir($questionObj->questionDirSys, CLARO_FILE_PERMISSIONS);
     }
     if ($fp = @fopen($questionObj->questionDirSys . "/question_" . $quRank . ".xml", 'w')) {
         fwrite($fp, $xml);
         fclose($fp);
     } else {
         // interrupt process