mirrored from git://git.moodle.org/moodle.git
/
config.html
169 lines (160 loc) · 6 KB
/
config.html
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
//Get some strings
$yes = get_string("yes");
$no = get_string("no");
$withuserdata = get_string("withuserdata");
$withoutuserdata = get_string("withoutuserdata");
$course = get_string("course");
$all = get_string("all");
$include = get_string("include");
$modules = get_string("modules");
//Get backup_config pairs
$backup_config = backup_get_config();
//Checks backup_config pairs exist
if (!isset($backup_config->backup_sche_modules)) {
$backup_config->backup_sche_modules = 1;
}
if (!isset($backup_config->backup_sche_withuserdata)) {
$backup_config->backup_sche_withuserdata = 1;
}
if (!isset($backup_config->backup_sche_users)) {
$backup_config->backup_sche_users = 1;
}
if (!isset($backup_config->backup_sche_logs)) {
$backup_config->backup_sche_logs = 0;
}
if (!isset($backup_config->backup_sche_userfiles)) {
$backup_config->backup_sche_userfiles = 1;
}
if (!isset($backup_config->backup_sche_coursefiles)) {
$backup_config->backup_sche_coursefiles = 1;
}
if (!isset($backup_config->backup_sche_active)) {
$backup_config->backup_sche_active = 0;
}
if (!isset($backup_config->backup_sche_weekdays)) {
$backup_config->backup_sche_weekdays = "0000000";
}
if (!isset($backup_config->backup_sche_hour)) {
$backup_config->backup_sche_hour = 00;
}
if (!isset($backup_config->backup_sche_minute)) {
$backup_config->backup_sche_minute = 00;
}
//print_object($backup_config); //Debug
//Yes/no array for use in yes/no menu
$yesno_array[0] = $no;
$yesno_array[1] = $yes;
//With user data/without user data array for use in menu
$withwithout_array[0] = $withoutuserdata;
$withwithout_array[1] = $withuserdata;
//Course/alla array for use in course/all menu
$courseall_array[0] = $all;
$courseall_array[1] = $course;
?>
<form method="post" action="backup.php" name="form">
<table cellpadding=9 cellspacing=0 >
<tr valign=top>
<td colspan = 3 align=center><strong><?php print_string("settings") ?></strong></td>
</tr>
<tr valign=top>
<td align=right><p><?php print_string("includemodules") ?>:</td>
<td nowrap>
<?php choose_from_menu($yesno_array, "backup_sche_modules", $backup_config->backup_sche_modules, "") ?>
<?php choose_from_menu($withwithout_array, "backup_sche_withuserdata", $backup_config->backup_sche_withuserdata, "") ?>
</td>
<td>
<?php print_string("backupincludemoduleshelp") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p><?php print_string("users") ?>:</td>
<td>
<?php choose_from_menu($courseall_array, "backup_sche_users", $backup_config->backup_sche_users, "") ?>
</td>
<td>
<?php print_string("backupusershelp") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p><?php print_string("logs") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_logs", $backup_config->backup_sche_logs, "") ?>
</td>
<td>
<?php print_string("backuplogshelp") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p><?php print_string("userfiles") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_userfiles", $backup_config->backup_sche_userfiles, "") ?>
</td>
<td>
<?php print_string("backupuserfileshelp") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p><?php print_string("coursefiles") ?>:</td>
<td>
<?php choose_from_menu($yesno_array, "backup_sche_coursefiles", $backup_config->backup_sche_coursefiles, "") ?>
</td>
<td>
<?php print_string("backupcuoursefileshelp") ?>
</td>
</tr>
<tr valign=top>
<td colspan = 3 align=center><strong><?php print_string("schedule") ?></strong></td>
</tr>
<tr valign=top>
<td colspan = 3 align=center>
<?php print_string("active") ?>: <?php choose_from_menu($yesno_array, "backup_sche_active", $backup_config->backup_sche_active, "") ?>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<?php
//Get first day of week from languaje files
//after searching the web I haven't find a sytem to retrieve it in php from locale info
$firstdayofweek = get_string("firstdayofweek");
//If it is empty ot it is different of 1, default to 0
if (!isset($firstdayofweek) || $firstdayofweek != 1) {
$firstdayofweek = 0;
}
//Now create the timestamp of a well-know sunday (02/25/2001, my 31th birthday (stronk7) !!)
$onesunday = make_timestamp(2001,2,25);
$i = 0;
$day_names = "";
$check_names = "";
while ($i<7) {
$day_names[] = strftime("%A",$onesunday + (($firstdayofweek+$i)*86400));
//Calculate standard day of week (0=Sunday......6=Saturday)
//to store info in that exact order in DB
$stddayofweek = ($i+$firstdayofweek) % 7;
//Calculate the status of the checkbox
if (substr($backup_config->backup_sche_weekdays,$stddayofweek,1) == "1") {
$strchecked = " checked";
} else {
$strchecked = "";
}
$check_names[] = "<input type=\"checkbox\" name=\"dayofweek_$stddayofweek\" value=\"1\"$strchecked>";
$i++;
}
$table->align = array("center","center","center","center","center","center","center");
$table->head = $day_names;
$table->data[] = $check_names;
print_table($table);
?>
</td>
</tr>
<tr valign=top>
<td colspan = 3 align=center>
<?php print_string("executeat") ?>: <?php print_time_selector("backup_sche_hour","backup_sche_minute",make_timestamp(2000,1,1,$backup_config->backup_sche_hour,$backup_config->backup_sche_minute)) ?>
</td>
</tr>
<tr>
<td colspan=3 align=center>
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
</tr>
</table>
</form>