-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsettings.php
119 lines (102 loc) · 5.35 KB
/
settings.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* mod/taskchain/settings.php
*
* @package mod
* @subpackage taskchain
* @copyright 2010 Gordon Bateson ([email protected])
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
/** Prevent direct access to this script */
defined('MOODLE_INTERNAL') || die();
/** Include required files */
require_once($CFG->dirroot.'/mod/taskchain/locallib.php');
// admin_setting_xxx classes are defined in "lib/adminlib.php"
// new admin_setting_xxx($name, $visiblename, $description, $defaultsetting);
// show TaskChains on MyMoodle page (default=1)
$settings->add(
new admin_setting_configcheckbox('taskchain_enablemymoodle', get_string('enablemymoodle', 'mod_taskchain'), get_string('configenablemymoodle', 'mod_taskchain'), 1)
);
// enable caching of browser content for each task (default=1)
$str = get_string('clearcache', 'mod_taskchain');
$url = new moodle_url('/mod/taskchain/tools/clear_cache.php', array('sesskey' => sesskey()));
$link = html_writer::link($url, $str, array('class' => 'small', 'style'=> 'white-space: nowrap', 'onclick' => "this.target='_blank'"))."\n";
$settings->add(
new admin_setting_configcheckbox('taskchain_enablecache', get_string('enablecache', 'mod_taskchain'), get_string('configenablecache', 'mod_taskchain').' '.$link, 1)
);
// restrict cron job to certain hours of the day (default=never)
if (class_exists('core_date') && method_exists('core_date', 'get_user_timezone')) {
// Moodle >= 2.9
$timezone = core_date::get_user_timezone(99);
$datetime = new DateTime('now', new DateTimeZone($timezone));
$timezone = ($datetime->getOffset() - dst_offset_on(time(), $timezone)) / (3600.0);
} else {
// Moodle <= 2.8
$timezone = get_user_timezone_offset();
}
if (abs($timezone) > 13) {
$timezone = 0;
} else if ($timezone > 0) {
$timezone = $timezone - 24;
}
$options = array();
for ($i=0; $i<=23; $i++) {
$options[($i - $timezone) % 24] = gmdate('H:i', $i * HOURSECS);
}
$settings->add(
new admin_setting_configmultiselect('taskchain_enablecron', get_string('enablecron', 'mod_taskchain'), get_string('configenablecron', 'mod_taskchain'), array(), $options)
);
// enable embedding of swf media objects intaskchain tasks (default=1)
$settings->add(
new admin_setting_configcheckbox('taskchain_enableswf', get_string('enableswf', 'mod_taskchain'), get_string('configenableswf', 'mod_taskchain'), 1)
);
// enable obfuscation of javascript in html files (default=1)
$settings->add(
new admin_setting_configcheckbox('taskchain_enableobfuscate', get_string('enableobfuscate', 'mod_taskchain'), get_string('configenableobfuscate', 'mod_taskchain'), 1)
);
// bodystyles
$options = array(
mod_taskchain::BODYSTYLES_BACKGROUND => get_string('bodystylesbackground', 'mod_taskchain'),
mod_taskchain::BODYSTYLES_COLOR => get_string('bodystylescolor', 'mod_taskchain'),
mod_taskchain::BODYSTYLES_FONT => get_string('bodystylesfont', 'mod_taskchain'),
mod_taskchain::BODYSTYLES_MARGIN => get_string('bodystylesmargin', 'mod_taskchain')
);
$settings->add(
new admin_setting_configmultiselect('taskchain_bodystyles', get_string('bodystyles', 'mod_taskchain'), get_string('configbodystyles', 'mod_taskchain'), array(), $options)
);
// taskchain navigation frame height (default=85)
$settings->add(
new admin_setting_configtext('taskchain_frameheight', get_string('frameheight', 'mod_taskchain'), get_string('configframeheight', 'mod_taskchain'), 85, PARAM_INT, 4)
);
// lock taskchain navigation frame so it is not scrollable (default=0)
$settings->add(
new admin_setting_configcheckbox('taskchain_lockframe', get_string('lockframe', 'mod_taskchain'), get_string('configlockframe', 'mod_taskchain'), 0)
);
// store raw xml details of TaskChain task attempts (default=1)
$str = get_string('cleardetails', 'mod_taskchain');
$url = new moodle_url('/mod/taskchain/tools/clear_details.php', array('sesskey' => sesskey()));
$link = html_writer::link($url, $str, array('class' => 'small', 'style'=> 'white-space: nowrap', 'onclick' => "this.target='_blank'"))."\n";
$settings->add(
new admin_setting_configcheckbox('taskchain_storedetails', get_string('storedetails', 'mod_taskchain'), get_string('configstoredetails', 'mod_taskchain').' '.$link, 0)
);
// maximum duration of a single calendar event (default=5 mins)
$setting = new admin_setting_configtext('taskchain_maxeventlength', get_string('maxeventlength', 'mod_taskchain'), get_string('configmaxeventlength', 'mod_taskchain'), 5, PARAM_INT, 4);
$setting->set_updatedcallback('taskchain_refresh_events');
$settings->add($setting);
// dispose of temporary variables used above
unset($str, $url, $link, $timezone, $datetime, $options, $i);