Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 15... Línea 15...
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea 17...
17
namespace core\output\local\dropdown;
17
namespace core\output\local\dropdown;
18
 
18
 
Línea 19... Línea 19...
19
use core\output\named_templatable;
19
use core\output\named_templatable;
20
use renderable;
20
use core\output\renderable;
21
 
21
 
22
/**
22
/**
Línea 31... Línea 31...
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 */
32
 */
33
class dialog implements named_templatable, renderable {
33
class dialog implements named_templatable, renderable {
34
    /** Dropdown dialog positions. */
34
    /** Dropdown dialog positions. */
35
    public const POSITION = [
35
    public const POSITION = [
36
        'start' => 'dropdown-menu-left',
36
        'start' => 'dropdown-menu-start',
37
        'end' => 'dropdown-menu-right',
37
        'end' => 'dropdown-menu-end',
38
    ];
38
    ];
Línea 39... Línea 39...
39
 
39
 
40
    /** Dropdown dialog positions. */
40
    /** Dropdown dialog positions. */
41
    public const WIDTH = [
41
    public const WIDTH = [
Línea 72... Línea 72...
72
    /**
72
    /**
73
     * @var string dropdown preferred width.
73
     * @var string dropdown preferred width.
74
     */
74
     */
75
    protected $dropdownwidth = self::WIDTH['default'];
75
    protected $dropdownwidth = self::WIDTH['default'];
Línea -... Línea 76...
-
 
76
 
-
 
77
    /**
-
 
78
     * @var string dropdown autoclose behaviour.
-
 
79
     */
Línea 76... Línea 80...
76
 
80
    protected $autoclose = 'true';
77
 
81
 
78
    /**
82
    /**
79
     * @var array extra HTML attributes (attribute => value).
83
     * @var array extra HTML attributes (attribute => value).
Línea 91... Línea 95...
91
     * The definition object could contain the following keys:
95
     * The definition object could contain the following keys:
92
     * - classes: component CSS classes.
96
     * - classes: component CSS classes.
93
     * - buttonclasses: the button CSS classes.
97
     * - buttonclasses: the button CSS classes.
94
     * - dialogwidth: the dropdown width.
98
     * - dialogwidth: the dropdown width.
95
     * - dropdownposition: the dropdown position.
99
     * - dropdownposition: the dropdown position.
-
 
100
     * - autoclose: dropdown autoclose behaviour ('true' (default), 'false', 'inside', 'outside')
96
     * - extras: extra HTML attributes (attribute => value).
101
     * - extras: extra HTML attributes (attribute => value).
97
     *
102
     *
98
     * @param string $buttoncontent the button content
103
     * @param string $buttoncontent the button content
99
     * @param string $dialogcontent the footer content
104
     * @param string $dialogcontent the footer content
100
     * @param array $definition an optional array of the element definition
105
     * @param array $definition an optional array of the element definition
Línea 115... Línea 120...
115
            $this->dropdownwidth = $definition['dialogwidth'];
120
            $this->dropdownwidth = $definition['dialogwidth'];
116
        }
121
        }
117
        if (isset($definition['dropdownposition'])) {
122
        if (isset($definition['dropdownposition'])) {
118
            $this->dropdownposition = $definition['dropdownposition'];
123
            $this->dropdownposition = $definition['dropdownposition'];
119
        }
124
        }
-
 
125
        if (isset($definition['autoclose'])) {
-
 
126
            $this->autoclose = $definition['autoclose'];
-
 
127
        }
120
    }
128
    }
Línea 121... Línea 129...
121
 
129
 
122
    /**
130
    /**
123
     * Set the dialog contents.
131
     * Set the dialog contents.
Línea 229... Línea 237...
229
            'buttoncontent' => (string) $this->buttoncontent,
237
            'buttoncontent' => (string) $this->buttoncontent,
230
            'dialogcontent' => (string) $this->dialogcontent,
238
            'dialogcontent' => (string) $this->dialogcontent,
231
            'classes' => $this->classes,
239
            'classes' => $this->classes,
232
            'buttonclasses' => $this->buttonclasses,
240
            'buttonclasses' => $this->buttonclasses,
233
            'dialogclasses' => $this->dropdownwidth,
241
            'dialogclasses' => $this->dropdownwidth,
-
 
242
            'autoclose' => $this->autoclose,
234
            'extras' => $extras,
243
            'extras' => $extras,
235
        ];
244
        ];
236
        if ($this->disabled) {
245
        if ($this->disabled) {
237
            $data['disabledbutton'] = true;
246
            $data['disabledbutton'] = true;
238
        }
247
        }