コード例 #1
0
 /**
  * Imports the auxiliary files (file elements contained in the resource test element to be imported) into
  * the TAO Test Content directory.
  *
  * If some file cannot be copied, warnings will be committed.
  *
  * @param core_kernel_file_File $testContent The pointer to the TAO Test Content directory where auxilliary files will be stored.
  * @param oat\taoQtiItem\model\qti\Resource $qtiResource The manifest resource describing the test to be imported.
  * @param string $extractionFolder The absolute path to the temporary folder containing the content of the imported IMS QTI Package Archive.
  * @param common_report_Report A report about how the importation behaved.
  */
 protected function importTestAuxiliaryFiles(core_kernel_file_File $testContent, Resource $qtiResource, $extractionFolder, common_report_Report $report)
 {
     foreach ($qtiResource->getAuxiliaryFiles() as $aux) {
         try {
             taoQtiTest_helpers_Utils::storeQtiResource($testContent, $aux, $extractionFolder);
         } catch (common_Exception $e) {
             $report->add(new common_report_Report(common_report_Report::TYPE_WARNING, __('Auxiliary file not found at location "%s".', $aux)));
         }
     }
 }
コード例 #2
0
 /**
  * Copy the test resources (e.g. images) that will be availabe at delivery time
  * in the public compilation directory.
  * 
  */
 protected function copyPublicResources()
 {
     $compiledDocDir = $this->getPrivateDirectory()->getPath();
     $publicCompiledDocDir = $this->getPublicDirectory()->getPath();
     foreach (tao_helpers_File::scandir($compiledDocDir, array('recursive' => true, 'only' => tao_helpers_File::$FILE, 'absolute' => true)) as $file) {
         $mime = tao_helpers_File::getMimeType($file, true);
         $pathinfo = pathinfo($file);
         // Exclude CSS files because already copied when dealing with rubric blocks.
         if (in_array($mime, self::getPublicMimeTypes()) === true && $pathinfo['extension'] !== 'php') {
             $file = str_replace($compiledDocDir, '', $file);
             common_Logger::t("Copying public resource '{$file}'...");
             taoQtiTest_helpers_Utils::storeQtiResource($publicCompiledDocDir, $file, $compiledDocDir);
         }
     }
 }