Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| CompatibilityTheme | |
0.00% |
0 / 16 |
|
0.00% |
0 / 3 |
42 | |
0.00% |
0 / 1 |
| getLabel | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getTemplate | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 | |||
| getStylesheet | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| 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 (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\tao\model\theme; |
| 23 | |
| 24 | use oat\tao\helpers\Template; |
| 25 | use oat\oatbox\Configurable; |
| 26 | |
| 27 | /** |
| 28 | * Backwards compatibilit Theme build |
| 29 | * based on original array |
| 30 | * |
| 31 | * @author bout |
| 32 | */ |
| 33 | class CompatibilityTheme extends DefaultTheme implements Theme |
| 34 | { |
| 35 | public function getLabel() |
| 36 | { |
| 37 | $all = $this->getOptions(); |
| 38 | $first = reset($all); |
| 39 | return $first['name']; |
| 40 | } |
| 41 | |
| 42 | public function getTemplate($id, $context = Theme::CONTEXT_BACKOFFICE) |
| 43 | { |
| 44 | if ($this->hasOption($context)) { |
| 45 | $arr = $this->getOption($context); |
| 46 | $templates = $arr['templates']; |
| 47 | if (isset($templates[$id])) { |
| 48 | return ROOT_PATH . $templates[$id]; |
| 49 | } else { |
| 50 | return parent::getTemplate($id, $context); |
| 51 | } |
| 52 | } else { |
| 53 | return parent::getTemplate($id, $context); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | public function getStylesheet($context = Theme::CONTEXT_BACKOFFICE) |
| 58 | { |
| 59 | if ($this->hasOption($context)) { |
| 60 | $arr = $this->getOption($context); |
| 61 | return ROOT_URL . $arr['path']; |
| 62 | } else { |
| 63 | return parent::getStylesheet($context); |
| 64 | } |
| 65 | } |
| 66 | } |