Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Irregularity | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 1 |
| index | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
30 | |||
| 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) 2016 (original work) Open Assessment Technologies SA ; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\taoProctoring\controller; |
| 23 | |
| 24 | use oat\generis\model\OntologyAwareTrait; |
| 25 | use oat\tao\model\taskQueue\TaskLogActionTrait; |
| 26 | use oat\taoProctoring\controller\form\IrregularitiesExportForm; |
| 27 | use oat\taoProctoring\model\service\IrregularityReport; |
| 28 | use tao_helpers_form_FormContainer as FormContainer; |
| 29 | |
| 30 | /** |
| 31 | * Irregularity controller |
| 32 | * |
| 33 | * @author Open Assessment Technologies SA |
| 34 | * @package taoProctoring |
| 35 | * @license GPL-2.0 |
| 36 | * |
| 37 | */ |
| 38 | class Irregularity extends \tao_actions_CommonModule |
| 39 | { |
| 40 | use TaskLogActionTrait; |
| 41 | use OntologyAwareTrait; |
| 42 | |
| 43 | /** |
| 44 | * Displays the form to export irregularities and handles it after submit |
| 45 | */ |
| 46 | public function index() |
| 47 | { |
| 48 | $formContainer = new IrregularitiesExportForm( |
| 49 | $this->getRequestParameter('uri'), |
| 50 | [], |
| 51 | [FormContainer::CSRF_PROTECTION_OPTION => true] |
| 52 | ); |
| 53 | $myForm = $formContainer->getForm(); |
| 54 | |
| 55 | if ($myForm->isValid() && $myForm->isSubmited()) { |
| 56 | $delivery = $this->getResource(\tao_helpers_Uri::decode($this->getRequestParameter('uri'))); |
| 57 | |
| 58 | $from = $this->hasRequestParameter('from') |
| 59 | ? strtotime($this->getRequestParameter('from')) |
| 60 | : ''; |
| 61 | |
| 62 | $to = $this->hasRequestParameter('to') |
| 63 | ? strtotime($this->getRequestParameter('to')) |
| 64 | : ''; |
| 65 | |
| 66 | /** @var $IrregularityReport IrregularityReport */ |
| 67 | $IrregularityReport = $this->getServiceLocator()->get(IrregularityReport::SERVICE_ID); |
| 68 | |
| 69 | return $this->returnTaskJson($IrregularityReport->getIrregularities($delivery, $from, $to)); |
| 70 | } else { |
| 71 | $this->setData('myForm', $myForm->render()); |
| 72 | $this->setView('Irregularities/index.tpl'); |
| 73 | } |
| 74 | } |
| 75 | } |