See Release Notes
Long Term Support Release
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Step configuration detail class. 19 * 20 * @package tool_usertours 21 * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace tool_usertours; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 /** 30 * Step configuration detail class. 31 * 32 * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk> 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class configuration { 36 37 /** 38 * @var TOURDEFAULT 39 */ 40 const TOURDEFAULT = 'usetourdefault'; 41 42 /** 43 * Get the list of keys which can be defaulted in the tour. 44 * 45 * @return array 46 */ 47 public static function get_defaultable_keys() { 48 return [ 49 'placement', 50 'orphan', 51 'backdrop', 52 'reflex', 53 ]; 54 } 55 56 /** 57 * Get the default value for the specified key. 58 * 59 * @param string $key The key for the specified value 60 * @return mixed 61 */ 62 public static function get_default_value($key) { 63 switch($key) { 64 case 'placement': 65 return 'bottom'; 66 case 'orphan': 67 case 'backdrop': 68 case 'reflex': 69 return false; 70 } 71 } 72 73 /** 74 * Get the default value for the specified key for the step form. 75 * 76 * @param string $key The key for the specified value 77 * @return mixed 78 */ 79 public static function get_step_default_value($key) { 80 switch($key) { 81 case 'placement': 82 case 'orphan': 83 case 'backdrop': 84 case 'reflex': 85 return self::TOURDEFAULT; 86 } 87 } 88 89 /** 90 * Get the list of possible placement options. 91 * 92 * @param string $default The default option. 93 * @return array 94 */ 95 public static function get_placement_options($default = null) { 96 $values = [ 97 'top' => get_string('above', 'tool_usertours'), 98 'bottom' => get_string('below', 'tool_usertours'), 99 'left' => get_string('left', 'tool_usertours'), 100 'right' => get_string('right', 'tool_usertours'), 101 ]; 102 103 if ($default === null) { 104 return $values; 105 } 106 107 if (!isset($values[$default])) { 108 $default = self::get_default_value('placement'); 109 } 110 111 $values = array_reverse($values, true); 112 $values[self::TOURDEFAULT] = get_string('defaultvalue', 'tool_usertours', $values[$default]); 113 $values = array_reverse($values, true); 114 115 return $values; 116 } 117 118 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body