This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
choose_background_form.php
83 lines (66 loc) · 3.82 KB
/
choose_background_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Choose Background Form
*
* Form for selecting topic background and layout
* @author Jeremy FitzPatrick
* @copyright (C) 2011 Jeremy FitzPatrick
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package slides
* @category course
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once($CFG->libdir.'/formslib.php');
class choosebg_form extends moodleform {
function definition() {
global $CFG, $DB;
$mform = $this->_form;
// $course = $this->_customdata['course'];
$mform->addElement('header', 'bgimage', get_string('bg', 'format_slides'));
$mform->addElement('checkbox', 'usebgimage', get_string('usebgimage', 'format_slides'));
$mform->setDefault('usebgimage', true);
$icon_options = array('maxfiles' => 1, 'accepted_types' => array('image'), 'maxbytes' => 204800);
$mform->addElement('filepicker', 'summaryimage', get_string('bgimage', 'format_slides'), null, $icon_options);
$mform->addHelpButton('summaryimage', 'bg', 'format_slides');
$mform->disabledIf('summaryimage','usebgimage','notchecked');
$bgtop=array();
$bgcenter=array();
$bgbottom=array();
$bgtop[] =& $mform->createElement('radio', 'bg_position', 'tl', '', "top left");
$bgtop[] =& $mform->createElement('radio', 'bg_position', 'tc', '', "top center");
$bgtop[] =& $mform->createElement('radio', 'bg_position', 'tr', '', "top right");
$bgcenter[] =& $mform->createElement('radio', 'bg_position', 'cl', '', "center left");
$bgcenter[] =& $mform->createElement('radio', 'bg_position', 'cc', '', "center center");
$bgcenter[] =& $mform->createElement('radio', 'bg_position', 'cr', '', "center right");
$bgbottom[] =& $mform->createElement('radio', 'bg_position', 'cl', '', "bottom left");
$bgbottom[] =& $mform->createElement('radio', 'bg_position', 'cc', '', "bottom center");
$bgbottom[] =& $mform->createElement('radio', 'bg_position', 'cr', '', "bottom right");
$mform->addElement('html', '<div class="pos-gp">');
$mform->addGroup($bgtop, 'bgtop', get_string('pos', 'format_slides'), array(' '), false);
$mform->addGroup($bgcenter, 'bgcenter', '', array(' '), false);
$mform->addGroup($bgbottom, 'bgbottom', '', array(' '), false);
$mform->addHelpButton('bgtop', 'pos', 'format_slides');
$mform->setDefault('bg_position', "top left");
$mform->disabledIf('bg_position','usebgimage','notchecked');
$mform->addElement('html', '</div">');
$mform->addElement('header', 'layout', get_string('layout', 'format_slides'));
$mform->addElement('radio', 'layout_columns', get_string('columns', 'format_slides'), get_string('one', 'format_slides'), 1);
$mform->addElement('radio', 'layout_columns', '', get_string('two', 'format_slides'), 2);
$mform->addElement('text', 'height', get_string('height', 'format_slides'), array('size'=>'20'));
$mform->addRule('height', get_string('height_error', 'format_slides'), 'numeric', null, 'server', false, false);
$mform->addHelpButton('height', 'height', 'format_slides');
$mform->setDefault('columns', 1);
$mform->addElement('hidden', 'topic');
$mform->setType('topic', PARAM_INT);
//--------------------------------------------------------------------------------
$this->add_action_buttons();
}
function data_preprocessing(&$default_values){ }
function set_data($default_values) {
$default_values = (array)$default_values;
$this->data_preprocessing($default_values);
parent::set_data($default_values);
}
}