Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| Assignment | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| getDeliveryId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLabel | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| getDescriptionStrings | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| isStartable | |
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) 2015 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoDelivery\model; |
| 24 | |
| 25 | use oat\generis\model\OntologyAwareTrait; |
| 26 | use oat\taoDelivery\model\fields\DeliveryFieldsService; |
| 27 | use oat\oatbox\service\ServiceManager; |
| 28 | |
| 29 | /** |
| 30 | * Basic Assignment object that represents the assignment |
| 31 | * of a test-taker to a delivery. It is used by the assignment service |
| 32 | * to determine which deliveries have been assigned to a test-taker. |
| 33 | * |
| 34 | * @author Open Assessment Technologies SA |
| 35 | * @license GPL-2.0 |
| 36 | * |
| 37 | */ |
| 38 | class Assignment |
| 39 | { |
| 40 | use OntologyAwareTrait; |
| 41 | |
| 42 | private $deliveryId; |
| 43 | |
| 44 | private $label; |
| 45 | |
| 46 | private $desc; |
| 47 | |
| 48 | private $startable; |
| 49 | |
| 50 | /** |
| 51 | * Simple constructor to create a new assigment object |
| 52 | * |
| 53 | * @param string $deliveryId |
| 54 | * @param string $userId |
| 55 | * @param string $label |
| 56 | * @param string[] $desc |
| 57 | * @param boolean $startable |
| 58 | * @param array $launchParams |
| 59 | */ |
| 60 | public function __construct($deliveryId, $userId, $label, $desc, $startable) |
| 61 | { |
| 62 | $this->deliveryId = $deliveryId; |
| 63 | $this->label = $label; |
| 64 | $this->desc = $desc; |
| 65 | $this->startable = $startable; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Returns the id of the delivery to run |
| 70 | * @return string |
| 71 | */ |
| 72 | public function getDeliveryId() |
| 73 | { |
| 74 | return $this->deliveryId; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the label of the asignment, which will often correspond |
| 79 | * to the label of the delivery |
| 80 | * |
| 81 | * @return string |
| 82 | */ |
| 83 | public function getLabel() |
| 84 | { |
| 85 | /** @var DeliveryFieldsService $deliveryFieldsService */ |
| 86 | $deliveryFieldsService = ServiceManager::getServiceManager()->get(DeliveryFieldsService::SERVICE_ID); |
| 87 | $delivery = $this->getResource($this->getDeliveryId()); |
| 88 | $label = $deliveryFieldsService->getLabel( |
| 89 | $delivery, |
| 90 | $this->label |
| 91 | ); |
| 92 | return $label; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * An array of description strings to give |
| 97 | * enhanced informations about the assignment |
| 98 | * and its restrictions |
| 99 | * |
| 100 | * @return string[] |
| 101 | */ |
| 102 | public function getDescriptionStrings() |
| 103 | { |
| 104 | return $this->desc; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Whenever or not the assigment is statable |
| 109 | * |
| 110 | * @return boolean |
| 111 | */ |
| 112 | public function isStartable() |
| 113 | { |
| 114 | return $this->startable; |
| 115 | } |
| 116 | } |