Skip to content
Permalink
Browse files

Added all the moodle docs to a new sub dir "Moodle Docs" in documents

  • Loading branch information...
jloguercio committed Sep 2, 2016
1 parent f31c119 commit fbbfb3d7a79be1d6a0e7e5a267fea6df06263c35
Showing with 21 additions and 6 deletions.
  1. +21 −6 main/inc/lib/MoodleImport.php
@@ -36,12 +36,27 @@ public function readMoodleFile($uploadedFile)
}
$folder = api_get_unique_id();
$destinationDir = api_get_path(SYS_ARCHIVE_PATH).$folder;
$destinationDir = api_get_path(SYS_ARCHIVE_PATH) . $folder;
$coursePath = api_get_course_path();
$sessionId = api_get_session_id();
$groupId = api_get_group_id();
$documentPath = api_get_path(SYS_COURSE_PATH) . $coursePath . '/document';
$courseInfo = api_get_course_info();
mkdir($destinationDir, api_get_permissions_for_new_directories(), true);
$newFolderData = create_unexisting_directory(
$courseInfo,
api_get_user_id(),
$sessionId,
$groupId,
null,
$documentPath,
'/moodle',
'Moodle Docs',
0
);
$package->extract(
PCLZIP_OPT_PATH,
$destinationDir
@@ -145,7 +160,7 @@ public function readMoodleFile($uploadedFile)
$questionInstance->updateTitle($moduleValues['question_instances'][$index]['name']);
// Replace the path from @@PLUGINFILE@@ to a correct chamilo path
$moduleValues['question_instances'][$index]['questiontext'] = str_replace('@@PLUGINFILE@@', '/courses/' . $coursePath . '/document', $moduleValues['question_instances'][$index]['questiontext']);
$moduleValues['question_instances'][$index]['questiontext'] = str_replace('@@PLUGINFILE@@', '/courses/' . $coursePath . '/document/moodle', $moduleValues['question_instances'][$index]['questiontext']);
$questionInstance->updateDescription($moduleValues['question_instances'][$index]['questiontext']);
$questionInstance->updateLevel(1);
$questionInstance->updateCategory(0);
@@ -192,7 +207,7 @@ public function readMoodleFile($uploadedFile)
DocumentManager::upload_document(
$files,
'/',
'/moodle',
$fileInfo['title'],
'',
null,
@@ -243,7 +258,7 @@ public function readMoodleFile($uploadedFile)
DocumentManager::upload_document(
$files,
'/',
'/moodle',
isset($fileInfo['title']) ? $fileInfo['title'] : pathinfo($fileInfo['filename'], PATHINFO_FILENAME),
'',
null,
@@ -605,7 +620,7 @@ public function processAnswers($questionList, $questionType, $questionInstance,
$coursePath = api_get_course_path();
$placeholder = str_replace('@@PLUGINFILE@@', '/courses/' . $coursePath . '/document', $currentQuestion['questiontext']);
$placeholder = str_replace('@@PLUGINFILE@@', '/courses/' . $coursePath . '/document/moodle', $currentQuestion['questiontext']);
$optionsValues = [];
@@ -850,7 +865,7 @@ public function processFillBlanks($objAnswer, $questionType, $answerValues, &$pl
$currentAnswers = $correctAnswer.$othersAnswers;
$currentAnswers = '['.substr($currentAnswers, 0, -1).'] ';
$answer['questiontext'] = str_replace('@@PLUGINFILE@@', '/courses/' . $coursePath . '/document', $answer['questiontext']);
$answer['questiontext'] = str_replace('@@PLUGINFILE@@', '/courses/' . $coursePath . '/document/moodle', $answer['questiontext']);
$placeholder .= '<p> ' . strip_tags($answer['questiontext']).' '.$currentAnswers . ' </p>';
}

0 comments on commit fbbfb3d

Please sign in to comment.
You can’t perform that action at this time.