Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| DeliverySelectionService | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
42 | |
0.00% |
0 / 1 |
| breadcrumbs | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
| breadcrumbsIndex | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
12 | |||
| 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\taoProctoring\model\breadcrumbs; |
| 23 | |
| 24 | use oat\oatbox\service\ConfigurableService; |
| 25 | use oat\tao\model\mvc\Breadcrumbs; |
| 26 | |
| 27 | /** |
| 28 | * Provides breadcrumbs for the DeliverySelection controller. |
| 29 | * @author Jean-Sébastien Conan <jean-sebastien@taotesting.com> |
| 30 | */ |
| 31 | class DeliverySelectionService extends ConfigurableService implements Breadcrumbs |
| 32 | { |
| 33 | public const SERVICE_ID = 'taoProctoring/DeliverySelection/breadcrumbs'; |
| 34 | |
| 35 | /** |
| 36 | * Builds breadcrumbs for a particular route. |
| 37 | * @param string $route - The route URL |
| 38 | * @param array $parsedRoute - The parsed URL (@see parse_url), augmented with extension, controller and action |
| 39 | * @return array|null - The breadcrumb related to the route, or `null` if none. Must contains: |
| 40 | * - id: the route id |
| 41 | * - url: the route url |
| 42 | * - label: the label displayed for the breadcrumb |
| 43 | * - entries: a list of related links, using the same format as above |
| 44 | */ |
| 45 | public function breadcrumbs($route, $parsedRoute) |
| 46 | { |
| 47 | if (isset($parsedRoute['action'])) { |
| 48 | switch ($parsedRoute['action']) { |
| 49 | case 'index': |
| 50 | return $this->breadcrumbsIndex($route, $parsedRoute); |
| 51 | } |
| 52 | } |
| 53 | return null; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Gets the breadcrumbs for the index page |
| 58 | * @param string $route |
| 59 | * @param array $parsedRoute |
| 60 | * @return array |
| 61 | */ |
| 62 | protected function breadcrumbsIndex($route, $parsedRoute) |
| 63 | { |
| 64 | $urlContext = []; |
| 65 | if (isset($parsedRoute['params'])) { |
| 66 | if (isset($parsedRoute['params']['context'])) { |
| 67 | $urlContext['context'] = $parsedRoute['params']['context']; |
| 68 | } |
| 69 | } |
| 70 | return [ |
| 71 | 'id' => 'deliverySelection', |
| 72 | 'url' => _url('index', 'DeliverySelection', 'taoProctoring', $urlContext), |
| 73 | 'label' => __('Deliveries'), |
| 74 | ]; |
| 75 | } |
| 76 | } |