Project

General

Profile

Bug #6362 » repository_422_dc1e9fb09fd9.patch

Laurent Opprecht, 21/02/2011 11:59

View differences:

php/autoloader.class.php
7 7
use common\libraries\Filesystem;
8 8

  
9 9
/**
10
 *
11
 * @todo: create autoloader_base class and move utility functions there - such as check_directory ?
12
 *
10 13
 * $Id: repository_autoloader.class.php 236 2009-11-16 12:56:59Z scaramanga $
11 14
 * @author vanpouckesven
12 15
 * @package repository
......
163 166
            'learning_path_scorm_export' => 'export/scorm/learning_path/learning_path_scorm_export',
164 167
            'ims_metadata_reader' => 'import/cp/metadata/ims_metadata_reader',
165 168
            'imscp_manifest_cp_import' => 'import/cp/object_import/import/dir/imscp_manifest_cp_import',
166
            'qti_question_builder' => 'import/qti/object_import/qti_question_builder',
167
            'qti_builder_base' => 'import/qti/object_import/qti_builder_base',
168
            'qti_renderer_base' => 'import/qti/object_import/qti_builder_base',
169 169
            'cp_object_import_base' => 'import/cp/object_import/cp_object_import_base',
170 170
            'cp_object_export' => 'export/cp/object_export/cp_object_export',
171 171
            'cpe_object_export_base' => 'export/cp/object_export/cpe_object_export_base',
......
184 184
        return false;
185 185
    }
186 186

  
187
    /**
188
     *
189
     * @param <type> $directory
190
     * @param <type> $recursive
191
     * @return <type>
192
     */
187 193
    static function check_directory($directory, $recursive = true) {
188 194
        $files = scandir($directory);
189 195
        $files = array_diff($files, array('.', '..'));
......
204 210
    }
205 211

  
206 212
    static function check_for_qti_files() {
207
        return self::check_directory(dirname(__FILE__) . '/export/qti');
208
        return self::check_directory(dirname(__FILE__) . '/import/qti');
213
        return self::check_directory(dirname(__FILE__) . '/lib/import/qti');
214
        return self::check_directory(dirname(__FILE__) . '/lib/export/qti');
209 215
    }
210 216

  
211 217
}
php/lib/export/qti/main.php
1
<?php
2

  
3
//TODO remove these lines and replace by autoloading !
4
use common\libraries\Path;
5

  
6
require_once  Path::get_common_libraries_path() .'php/ims/main.php';
7

  
8
require_once_all(dirname(__FILE__) .'/*.class.php');
9

  
10
require_once dirname(__FILE__) . '/object_export/qti_serializer_base.class.php';
11

  
12
require_once_all(dirname(__FILE__) .'/object_export/*.class.php');
13
require_once_all(dirname(__FILE__) .'/object_export/serializer/*.class.php');
php/lib/export/qti/qti_export.class.php
11 11
use common\libraries\Filecompression;
12 12

  
13 13
/**
14
 * $Id: qti_export.class.php 200 2009-11-13 12:30:04Z kariboe $
15
 * @package repository.lib.export.qti
16
 */
17
//FIXME Do not require main as it causses a cyclic dependency
18
//require_once dirname(__FILE__) . '/main.php';
19

  
20

  
21
/**
22 14
 * Exports learning object to QTI format (xml)
23 15
 */
24 16
class QtiExport extends ContentObjectExport
......
99 91
            {
100 92
                $result = $exporter->export_content_object();
101 93
            }
102
            /*
103
            $questions = $item->get_questions();
104
            while ($complex_question = $questions->next_result()) {
105
                $directory = $this->get_temp_directory();
106
                $manifest = $this->get_manifest();
107
                $toc = $this->toc;
108
                if ($exporter = self :: factory_qti($complex_question->get_ref_object(), $directory, $manifest, $toc)) {
109
                    $result = $exporter->export_content_object();
110
                } else {
111

  
112
                }
113
            }
114
             */
115

  
116 94
        }
117 95

  
118 96
        $xml = $this->get_manifest()->saveXML();
php/lib/import/qti/main.php
1
<?php
2
//FIXME do not use such a script because it requires unneeded files and
3
// creates cyclic dependencies
4
use common\libraries\Path;
5

  
6
require_once Path :: get_repository_content_object_path() . 'assessment_multiple_choice_question/php/assessment_multiple_choice_question_option.class.php';
7
require_once Path :: get_repository_content_object_path() . 'assessment_matching_question/php/assessment_matching_question_option.class.php';
8
require_once  Path::get_common_libraries_path() .'php/ims/main.php';
9
require_once dirname(__FILE__) . '/qti_import.class.php';
10

  
11
require_once_all(dirname(__FILE__) .'/*.class.php');
12
require_once_all(dirname(__FILE__) . '/object_import/*.class.php');
(2-2/2)