Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
| SelectAdaptiveNextItemEvent | |
0.00% |
0 / 12 |
|
0.00% |
0 / 8 |
90 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getTestSession | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getCurrentItemId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getNextItem | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| getCatItemIds | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPreCatItemIds | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| isShadowItem | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 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) 2017 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\taoQtiTest\models\event; |
| 23 | |
| 24 | use oat\oatbox\event\Event; |
| 25 | use qtism\runtime\tests\AssessmentTestSession; |
| 26 | |
| 27 | /** |
| 28 | * Class SelectAdaptiveNextItemEvent |
| 29 | * @package oat\taoQtiTest\models\event |
| 30 | * @author Aleh Hutnikau <hutnikau@1pt.com> |
| 31 | */ |
| 32 | class SelectAdaptiveNextItemEvent implements Event |
| 33 | { |
| 34 | /** @var string Current item id */ |
| 35 | protected $currentItemId; |
| 36 | |
| 37 | /** @var array Item ids of the next items. */ |
| 38 | protected $catItemIds; |
| 39 | |
| 40 | /** @var array Item ids which were used to give current item identifier. */ |
| 41 | protected $preCatItemIds; |
| 42 | |
| 43 | /** @var AssessmentTestSession */ |
| 44 | protected $testSession; |
| 45 | |
| 46 | /** @var bool A parameter to store if item is adaptive or retrieve from shadow */ |
| 47 | protected $isShadowItem = false; |
| 48 | |
| 49 | /** |
| 50 | * SelectAdaptiveNextItemEvent constructor. |
| 51 | * |
| 52 | * @param AssessmentTestSession $testSession |
| 53 | * @param $currentItemId |
| 54 | * @param array|null $preCatItemIds |
| 55 | * @param array|null $catItemIds |
| 56 | * @param bool $isShadowItem |
| 57 | */ |
| 58 | public function __construct( |
| 59 | AssessmentTestSession $testSession, |
| 60 | $currentItemId, |
| 61 | array $preCatItemIds = null, |
| 62 | array $catItemIds = null, |
| 63 | $isShadowItem = false |
| 64 | ) { |
| 65 | $this->currentItemId = $currentItemId; |
| 66 | $this->preCatItemIds = $preCatItemIds; |
| 67 | $this->catItemIds = $catItemIds; |
| 68 | $this->testSession = $testSession; |
| 69 | $this->isShadowItem = $isShadowItem; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * @return string |
| 74 | */ |
| 75 | public function getName() |
| 76 | { |
| 77 | return __CLASS__; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @return AssessmentTestSession |
| 82 | */ |
| 83 | public function getTestSession() |
| 84 | { |
| 85 | return $this->testSession; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Returns current item identifier. |
| 90 | * |
| 91 | * @return string |
| 92 | */ |
| 93 | public function getCurrentItemId() |
| 94 | { |
| 95 | return $this->currentItemId; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Returns next item identifier. |
| 100 | * |
| 101 | * @return string|null |
| 102 | */ |
| 103 | public function getNextItem() |
| 104 | { |
| 105 | return $this->catItemIds === null ? null : $this->catItemIds[0]; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Returns the item ids of the next items. |
| 110 | * |
| 111 | * @return array|null |
| 112 | */ |
| 113 | public function getCatItemIds() |
| 114 | { |
| 115 | return $this->catItemIds; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Returns the item ids given from cat engine to select current item (from previous call). |
| 120 | * |
| 121 | * @return array|null |
| 122 | */ |
| 123 | public function getPreCatItemIds() |
| 124 | { |
| 125 | return $this->preCatItemIds; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * @return bool |
| 130 | */ |
| 131 | public function isShadowItem() |
| 132 | { |
| 133 | return (bool) $this->isShadowItem; |
| 134 | } |
| 135 | } |