Ejemplo n.º 1
0
                     Display::display_confirmation_message(get_lang('ItemUpdated'));
                     break;
             }
         }
     }
     // destruction of Exercise
     unset($objExerciseTmp);
     Security::clear_token();
 }
 if (!empty($hpchoice)) {
     switch ($hpchoice) {
         case 'delete':
             // deletes an exercise
             $imgparams = array();
             $imgcount = 0;
             GetImgParams($file, $documentPath, $imgparams, $imgcount);
             $fld = GetFolderName($file);
             for ($i = 0; $i < $imgcount; $i++) {
                 FileManager::my_delete($documentPath . $uploadPath . "/" . $fld . "/" . $imgparams[$i]);
                 FileManager::update_db_info("delete", $uploadPath . "/" . $fld . "/" . $imgparams[$i]);
             }
             if (FileManager::my_delete($documentPath . $file)) {
                 FileManager::update_db_info("delete", $file);
             }
             // hotpotatoes folder may contains several tests so don't delete folder if not empty : #2165
             if (!(strstr($uploadPath, DIR_HOTPOTATOES) && !FileManager::folder_is_empty($documentPath . $uploadPath . "/" . $fld . "/"))) {
                 FileManager::my_delete($documentPath . $uploadPath . "/" . $fld . "/");
             }
             break;
         case 'enable':
             // enables an exercise
Ejemplo n.º 2
0
             $imgcount = $imgcount - 1;
         } else {
             $dialogBox .= $filename . ' ' . get_lang('NameNotEqual');
             FileManager::my_delete($document_sys_path . $uploadPath . '/' . $fld . '/' . $filename);
             FileManager::update_db_info('delete', $uploadPath . '/' . $fld . '/' . $filename);
         }
         if ($imgcount == 0) {
             // all image uploaded
             $finish = 1;
         }
     } else {
         // If we are (still) on the first step of the upload process.
         if ($finish == 0) {
             $finish = 2;
             // Get number and name of images from the files contents.
             GetImgParams('/' . $filename, $document_sys_path . $uploadPath . '/' . $fld, $imgparams, $imgcount);
             if ($imgcount == 0) {
                 $finish = 1;
             } else {
                 $dialogBox .= get_lang('DownloadEnd');
             }
         }
     }
     $title = @htmlspecialchars(GetQuizName($filename, $document_sys_path . $uploadPath . '/' . $fld . '/'), ENT_COMPAT, api_get_system_encoding());
     $query = "UPDATE {$dbTable} SET comment='" . Database::escape_string($title) . "' WHERE c_id = {$course_id} AND path=\"" . $uploadPath . "/" . $fld . "/" . $filename . "\"";
     Database::query($query);
     api_item_property_update($_course, TOOL_QUIZ, $id, 'QuizAdded', api_get_user_id());
 } else {
     if ($finish == 2) {
         // delete?
         //$dialogBox .= get_lang('NoImg');