Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| RubricBlock | |
0.00% |
0 / 18 |
|
0.00% |
0 / 5 |
42 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getBody | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUsedAttributes | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |||
| toFilteredArray | |
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) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoQtiItem\model\qti; |
| 24 | |
| 25 | use oat\taoQtiItem\model\qti\RubricBlock; |
| 26 | use oat\taoQtiItem\model\qti\Element; |
| 27 | use oat\taoQtiItem\model\qti\container\FlowContainer; |
| 28 | use oat\taoQtiItem\model\qti\ContentVariable; |
| 29 | use oat\taoQtiItem\model\qti\Item; |
| 30 | use oat\taoQtiItem\model\qti\container\ContainerStatic; |
| 31 | |
| 32 | /** |
| 33 | * The QTI RubricBlock |
| 34 | * |
| 35 | * @access public |
| 36 | * @author Sam Sipasseuth, <sam.sipasseuth@taotesting.com> |
| 37 | * @package taoQTI |
| 38 | * @see http://www.imsglobal.org/question/qtiv2p1/imsqti_infov2p1.html#element10252 |
| 39 | |
| 40 | */ |
| 41 | class RubricBlock extends Element implements FlowContainer, ContentVariable |
| 42 | { |
| 43 | /** |
| 44 | * the QTI tag name as defined in QTI standard |
| 45 | * |
| 46 | * @access protected |
| 47 | * @var string |
| 48 | */ |
| 49 | protected static $qtiTagName = 'rubricBlock'; |
| 50 | |
| 51 | /** |
| 52 | * The content body of the rubric block |
| 53 | * |
| 54 | * @var oat\taoQtiItem\model\qti\container\ContainerStatic |
| 55 | */ |
| 56 | protected $body = null; |
| 57 | |
| 58 | public function __construct($attributes = [], Item $relatedItem = null, $serial = '') |
| 59 | { |
| 60 | parent::__construct($attributes, $relatedItem, $serial); |
| 61 | $this->body = new ContainerStatic(); |
| 62 | } |
| 63 | |
| 64 | public function getBody() |
| 65 | { |
| 66 | return $this->body; |
| 67 | } |
| 68 | |
| 69 | protected function getUsedAttributes() |
| 70 | { |
| 71 | return [ |
| 72 | //@todo: the cardinality actually is [0..*], make it this way! |
| 73 | 'oat\\taoQtiItem\\model\\qti\\attribute\\View', |
| 74 | 'oat\\taoQtiItem\\model\\qti\\attribute\\UseAttribute' |
| 75 | ]; |
| 76 | } |
| 77 | |
| 78 | public function toArray($filterVariableContent = false, &$filtered = []) |
| 79 | { |
| 80 | |
| 81 | $data = parent::toArray($filterVariableContent, $filtered); |
| 82 | |
| 83 | if ($filterVariableContent) { |
| 84 | $filtered[$this->getSerial()] = $data; |
| 85 | $data = [ |
| 86 | 'serial' => $data['serial'], |
| 87 | 'qtiClass' => $data['qtiClass'] |
| 88 | ]; |
| 89 | } |
| 90 | |
| 91 | return $data; |
| 92 | } |
| 93 | |
| 94 | public function toFilteredArray() |
| 95 | { |
| 96 | return $this->toArray(true); |
| 97 | } |
| 98 | } |