72 lines
2.7 KiB
PHP
72 lines
2.7 KiB
PHP
|
<?php
|
||
|
/*
|
||
|
* This program is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU General Public License
|
||
|
* as published by the Free Software Foundation; under version 2
|
||
|
* of the License (non-upgradable).
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
*
|
||
|
* Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2);
|
||
|
* 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER);
|
||
|
* 2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV);
|
||
|
*
|
||
|
*/
|
||
|
?>
|
||
|
<?php
|
||
|
/**
|
||
|
* SaSTests Controller provide process services on tests
|
||
|
*
|
||
|
* @author Bertrand Chevrier, <taosupport@tudor.lu>
|
||
|
* @package taoTests
|
||
|
|
||
|
* @license GPLv2 http://www.opensource.org/licenses/gpl-2.0.php
|
||
|
*/
|
||
|
class taoTests_actions_SaSTests extends taoTests_actions_Tests
|
||
|
{
|
||
|
|
||
|
protected function getClassService()
|
||
|
{
|
||
|
return taoTests_models_classes_TestsService::singleton();
|
||
|
}
|
||
|
/**
|
||
|
* Render the tree and the list to select and order the test related items
|
||
|
* @return void
|
||
|
*/
|
||
|
public function selectItems()
|
||
|
{
|
||
|
|
||
|
$this->setData('uri', $this->getRequestParameter('uri'));
|
||
|
$this->setData('classUri', $this->getRequestParameter('classUri'));
|
||
|
|
||
|
$test = $this->getCurrentInstance();
|
||
|
|
||
|
$allItems = [];
|
||
|
foreach ($this->service->getAllItems() as $itemUri => $itemLabel) {
|
||
|
$allItems['item_' . tao_helpers_Uri::encode($itemUri)] = $itemLabel;
|
||
|
}
|
||
|
$this->setData('allItems', json_encode($allItems));
|
||
|
|
||
|
$relatedItems = tao_helpers_Uri::encodeArray($this->service->getTestItems($test, true), tao_helpers_Uri::ENCODE_ARRAY_VALUES);
|
||
|
$this->setData('relatedItems', json_encode($relatedItems));
|
||
|
|
||
|
$itemSequence = [];
|
||
|
foreach ($relatedItems as $index => $itemUri) {
|
||
|
$item = new core_kernel_classes_Resource($itemUri);
|
||
|
$itemSequence[$index] = [
|
||
|
'uri' => tao_helpers_Uri::encode($itemUri),
|
||
|
'label' => $item->getLabel()
|
||
|
];
|
||
|
}
|
||
|
$this->setData('itemSequence', $itemSequence);
|
||
|
$this->setView('items.tpl');
|
||
|
}
|
||
|
}
|