Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| taoTests_actions_SaSTests | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| getClassService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| selectItems | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
12 | |||
| 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) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg |
| 19 | * (under the project TAO & TAO2); |
| 20 | * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung |
| 21 | * (under the project TAO-TRANSFER); |
| 22 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 23 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 24 | */ |
| 25 | |
| 26 | /** |
| 27 | * SaSTests Controller provide process services on tests |
| 28 | * |
| 29 | * @author Bertrand Chevrier, <taosupport@tudor.lu> |
| 30 | * @package taoTests |
| 31 | |
| 32 | * @license GPLv2 http://www.opensource.org/licenses/gpl-2.0.php |
| 33 | */ |
| 34 | class taoTests_actions_SaSTests extends taoTests_actions_Tests |
| 35 | { |
| 36 | protected function getClassService() |
| 37 | { |
| 38 | return taoTests_models_classes_TestsService::singleton(); |
| 39 | } |
| 40 | /** |
| 41 | * Render the tree and the list to select and order the test related items |
| 42 | * @return void |
| 43 | */ |
| 44 | public function selectItems() |
| 45 | { |
| 46 | |
| 47 | $this->setData('uri', $this->getRequestParameter('uri')); |
| 48 | $this->setData('classUri', $this->getRequestParameter('classUri')); |
| 49 | |
| 50 | $test = $this->getCurrentInstance(); |
| 51 | |
| 52 | $allItems = []; |
| 53 | foreach ($this->service->getAllItems() as $itemUri => $itemLabel) { |
| 54 | $allItems['item_' . tao_helpers_Uri::encode($itemUri)] = $itemLabel; |
| 55 | } |
| 56 | $this->setData('allItems', json_encode($allItems)); |
| 57 | |
| 58 | $relatedItems = tao_helpers_Uri::encodeArray( |
| 59 | $this->service->getTestItems($test, true), |
| 60 | tao_helpers_Uri::ENCODE_ARRAY_VALUES |
| 61 | ); |
| 62 | $this->setData('relatedItems', json_encode($relatedItems)); |
| 63 | |
| 64 | $itemSequence = []; |
| 65 | foreach ($relatedItems as $index => $itemUri) { |
| 66 | $item = new core_kernel_classes_Resource($itemUri); |
| 67 | $itemSequence[$index] = [ |
| 68 | 'uri' => tao_helpers_Uri::encode($itemUri), |
| 69 | 'label' => $item->getLabel() |
| 70 | ]; |
| 71 | } |
| 72 | $this->setData('itemSequence', $itemSequence); |
| 73 | $this->setView('items.tpl'); |
| 74 | } |
| 75 | } |