Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       0.00%  | 
       0 / 10  | 
               | 
       0.00%  | 
       0 / 2  | 
       CRAP |         | 
       0.00%  | 
       0 / 1  | 
      
| ExtensionModel |         | 
       0.00%  | 
       0 / 10  | 
               | 
       0.00%  | 
       0 / 2  | 
       12 |         | 
       0.00%  | 
       0 / 1  | 
      
| __construct |         | 
       0.00%  | 
       0 / 2  | 
               | 
       0.00%  | 
       0 / 1  | 
       2 | |||
| addLanguages |         | 
       0.00%  | 
       0 / 8  | 
               | 
       0.00%  | 
       0 / 1  | 
       6 | |||
| 1 | <?php | 
| 2 | |
| 3 | /** | 
| 4 | * This program is free software; you can redistribute it and/or | 
| 5 | * modify it under the terms of the GNU General Public License | 
| 6 | * as published by the Free Software Foundation; under version 2 | 
| 7 | * of the License (non-upgradable). | 
| 8 | * | 
| 9 | * This program is distributed in the hope that it will be useful, | 
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 12 | * GNU General Public License for more details. | 
| 13 | * | 
| 14 | * You should have received a copy of the GNU General Public License | 
| 15 | * along with this program; if not, write to the Free Software | 
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
| 17 | * | 
| 18 | * Copyright (c) 2015 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | 
| 19 | * | 
| 20 | */ | 
| 21 | |
| 22 | namespace oat\tao\model\extension; | 
| 23 | |
| 24 | use oat\tao\model\TaoOntology; | 
| 25 | use tao_models_classes_LanguageService; | 
| 26 | use common_ext_Extension; | 
| 27 | use core_kernel_classes_Resource; | 
| 28 | use oat\generis\model\data\ModelManager; | 
| 29 | use oat\tao\helpers\translation\rdf\RdfPack; | 
| 30 | |
| 31 | class ExtensionModel extends \common_ext_ExtensionModel | 
| 32 | { | 
| 33 | public function __construct(common_ext_Extension $extension) | 
| 34 | { | 
| 35 | parent::__construct($extension); | 
| 36 | $this->addLanguages($extension); | 
| 37 | } | 
| 38 | |
| 39 | protected function addLanguages($extension) | 
| 40 | { | 
| 41 | $langService = tao_models_classes_LanguageService::singleton(); | 
| 42 | $dataUsage = new core_kernel_classes_Resource(tao_models_classes_LanguageService::INSTANCE_LANGUAGE_USAGE_DATA); | 
| 43 | $dataOptions = []; | 
| 44 | |
| 45 | $model = ModelManager::getModel(); | 
| 46 | foreach ($langService->getAvailableLanguagesByUsage($dataUsage) as $lang) { | 
| 47 | $langCode = $langService->getCode($lang); | 
| 48 | $pack = new RdfPack($langCode, $extension); | 
| 49 | $this->append($pack->getIterator()); | 
| 50 | } | 
| 51 | } | 
| 52 | } |