Lines
100.00%
36 / 36
Functions and Methods
100.00%
3 / 3
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ExchangeSlotscope | 100.00% | 36 / 36 | 100.00% | 3 / 3 | 6 | 100.00% | 1 / 1 | |||
| readEntity | 100.00% | 21 / 21 | 100.00% | 1 / 1 | 3 | |||||
| readSubjectList | 100.00% | 10 / 10 | 100.00% | 1 / 1 | 2 | |||||
| readPeriodList | 100.00% | 5 / 5 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsbackend\Exchange\Service; | |
| 4 | ||
| 5 | use BO\Zmsentities\Exchange; | |
| 6 | ||
| 7 | class ExchangeSlotscope extends \BO\Zmsbackend\Base | |
| 8 | { | |
| 9 | public function readEntity( | |
| 10 | $subjectid | |
| 11 | ): Exchange { | |
| 12 | $scope = (new \BO\Zmsbackend\Scope\Service\Scope())->readEntity($subjectid); | |
| 13 | $entity = new Exchange(); | |
| 14 | $entity['title'] = "Slotbelegung " . $scope->contact->name . " " . $scope->shortName; | |
| 15 | //$entity->setPeriod($datestart, $dateend, $period); | |
| 16 | $entity->addDictionaryEntry('subjectid', 'string', 'ID of a scope', 'scope.id'); | |
| 17 | $entity->addDictionaryEntry('date', 'string', 'Date of day'); | |
| 18 | $entity->addDictionaryEntry('bookedcount', 'number', 'booked slots'); | |
| 19 | $entity->addDictionaryEntry('plannedcount', 'number', 'planned slots'); | |
| 20 | $subjectIdList = explode(',', $subjectid); | |
| 21 | ||
| 22 | $entity['visualization']['xlabel'] = ["date"]; | |
| 23 | $entity['visualization']['ylabel'] = ["bookedcount", "plannedcount"]; | |
| 24 | ||
| 25 | foreach ($subjectIdList as $subjectid) { | |
| 26 | $raw = $this | |
| 27 | ->fetchAll( | |
| 28 | constant("\BO\Zmsbackend\Exchange\Repository\ExchangeSlotscope::QUERY_READ_REPORT"), | |
| 29 | [ | |
| 30 | 'scopeid' => $subjectid, | |
| 31 | ] | |
| 32 | ); | |
| 33 | foreach ($raw as $entry) { | |
| 34 | $entity->addDataSet(array_values($entry)); | |
| 35 | } | |
| 36 | } | |
| 37 | return $entity; | |
| 38 | } | |
| 39 | ||
| 40 | public function readSubjectList(): Exchange | |
| 41 | { | |
| 42 | $raw = $this->getReader()->fetchAll(\BO\Zmsbackend\Exchange\Repository\ExchangeSlotscope::QUERY_SUBJECTS, []); | |
| 43 | $entity = new Exchange(); | |
| 44 | $entity['title'] = "Slotbelegung "; | |
| 45 | $entity->addDictionaryEntry('subject', 'string', 'Standort ID', 'scope.id'); | |
| 46 | $entity->addDictionaryEntry('periodstart', 'string', 'Datum von'); | |
| 47 | $entity->addDictionaryEntry('periodend', 'string', 'Datum bis'); | |
| 48 | $entity->addDictionaryEntry('description', 'string', 'Beschreibung des Standortes'); | |
| 49 | foreach ($raw as $entry) { | |
| 50 | $entity->addDataSet(array_values($entry)); | |
| 51 | } | |
| 52 | return $entity; | |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * @SuppressWarnings(Unused) | |
| 57 | */ | |
| 58 | public function readPeriodList($subjectid, $period = 'day'): Exchange | |
| 59 | { | |
| 60 | $entity = new Exchange(); | |
| 61 | $entity['title'] = "Slotbelegung "; | |
| 62 | $entity->addDictionaryEntry('id', 'string', 'Gesamter Zeitraum', 'useraccount.permissions.superuser'); | |
| 63 | $entity->addDataSet(["_"]); | |
| 64 | return $entity; | |
| 65 | } | |
| 66 | } |