Compare commits
112 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f6c3ff2f4 | |||
| 4d3c6ac7d3 | |||
| 05f38de60e | |||
| fdee5d95b7 | |||
| 10fbf4d8ca | |||
| ba4dfc998d | |||
| e41831dde4 | |||
| fb50bf6c32 | |||
| 8f9f666c90 | |||
| 9dce25dea5 | |||
| bd4f3fa5c4 | |||
| 6bbf934a3e | |||
| 5c66e926b6 | |||
| 61b865f72c | |||
| 215e7a00a2 | |||
| 715b7649bd | |||
| 4a817f0753 | |||
| b2d016f3da | |||
| 682e430ce0 | |||
| ffd3e38977 | |||
| 731e813ac8 | |||
| 85c123b5b1 | |||
| b2fd028829 | |||
| a424b206f6 | |||
| c74a93d017 | |||
| 96aec10056 | |||
| 6c56155188 | |||
| 5cea248b8b | |||
| 1b75cdd4c7 | |||
| ed64a00a57 | |||
| d395fa4024 | |||
| 54a70ffb8c | |||
| 4474ee420a | |||
| de5da04c5f | |||
| 6cc32cbb9e | |||
| 3b246aca22 | |||
| d98e3d6b60 | |||
| 7ef0866c93 | |||
| c58d4eef1e | |||
| 1de5024830 | |||
| c0e462c5d1 | |||
| d17b16b697 | |||
| 7bfc8766bc | |||
| ab0c861479 | |||
| 7a94695536 | |||
| 59d8944377 | |||
| 2ecbeaf815 | |||
| 226f0f6fdc | |||
| 8347921cfa | |||
| 4f336e2c97 | |||
| b66705e52c | |||
| d221a3839d | |||
| 0e4c5bfdbe | |||
| a1bc21b045 | |||
| e9cd73e2f3 | |||
| 9251e27e76 | |||
| 9330414966 | |||
| 71ec5d19df | |||
| 551a610ed1 | |||
| d14e8ea454 | |||
| d58181c60b | |||
| ef7383d32a | |||
| 3aeb4f03bd | |||
| ac9387b049 | |||
| 8be4ad990a | |||
| 032be8a19b | |||
| bd49223246 | |||
| 7e58c03d6c | |||
| 5a76642ddf | |||
| 697664c813 | |||
| fb8642bce5 | |||
| d2cabfdf9b | |||
| 0c3c77269d | |||
| 6c41ae0a0c | |||
| d6ed445589 | |||
| 5a3010310b | |||
| dedb3c5121 | |||
| 3215955fd0 | |||
| 19f65e6c6b | |||
| 5b2d591bcb | |||
| 6d276b3254 | |||
| 68d3425577 | |||
| 08bf2b2723 | |||
| 5dce59a4cf | |||
| 72250eed86 | |||
| 49e0d5d5e3 | |||
| fd602f4620 | |||
| fb7abd481b | |||
| 7e06e9ff4a | |||
| 416ea17252 | |||
| f8fb37424e | |||
| a6df2c2e5f | |||
| 04b4210605 | |||
| e1bde19170 | |||
| 5cf3a84aee | |||
| 1c712d947a | |||
| 1b607c2266 | |||
| cddf3e1679 | |||
| eb2dc3ab87 | |||
| f483e32922 | |||
| 83f22aae0e | |||
| 0e33a45653 | |||
| 18174ef082 | |||
| 6720f29ccf | |||
| 9044a8edb3 | |||
| 86a8740b67 | |||
| 49a1b113ad | |||
| f733078c91 | |||
| eeff6a0839 | |||
| 9170eb5aab | |||
| 49b2521492 | |||
| 8d5eaee1c9 |
@@ -328,4 +328,118 @@
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.1" requires="1.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mysql" version="5.0.25">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mysql416required" />
|
||||
</FEEDBACK>
|
||||
</VENDOR>
|
||||
<VENDOR name="postgres" version="8.3" />
|
||||
<VENDOR name="mssql" version="9.0" />
|
||||
<VENDOR name="odbc_mssql" version="9.0" />
|
||||
<VENDOR name="mssql_n" version="9.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
<VENDOR name="sqlite" version="2.0" />
|
||||
</DATABASE>
|
||||
<PHP version="5.3.2" level="required">
|
||||
</PHP>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="gdrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="40M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="safe_mode" value="0" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingsafemode" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -75,12 +75,12 @@
|
||||
.$param->extras
|
||||
." ORDER BY ".$param->orderby;
|
||||
}
|
||||
error_log($sql);
|
||||
|
||||
$courses = get_records_sql($sql, 0, $numcourses);
|
||||
|
||||
if (empty($courses)) {
|
||||
notify(get_string('statsnodata'));echo '</td></tr></table>';echo '<p>after notify</p>';
|
||||
notify(get_string('statsnodata'));
|
||||
echo '</td></tr></table>';
|
||||
|
||||
} else {
|
||||
if (empty($CFG->gdversion)) {
|
||||
|
||||
@@ -558,7 +558,7 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
continue;
|
||||
}
|
||||
// save custom profile fields data
|
||||
profile_save_data($user);
|
||||
profile_save_data(addslashes_recursive($user));
|
||||
|
||||
// make sure user context exists
|
||||
get_context_instance(CONTEXT_USER, $user->id);
|
||||
@@ -665,7 +665,7 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
$newgroupdata = new object();
|
||||
$newgroupdata->name = $addgroup;
|
||||
$newgroupdata->courseid = $ccache[$shortname]->id;
|
||||
if ($ccache[$shortname]->groups[$addgroup]->id = groups_create_group($newgroupdata)){
|
||||
if ($ccache[$shortname]->groups[$addgroup]->id = groups_create_group(addslashes_recursive($newgroupdata))){
|
||||
$ccache[$shortname]->groups[$addgroup]->name = $newgroupdata->name;
|
||||
} else {
|
||||
$upt->track('enrolments', get_string('unknowngroup', 'error', $addgroup), 'error');
|
||||
|
||||
+5
-2
@@ -57,7 +57,7 @@
|
||||
if ($resort and confirm_sesskey()) {
|
||||
if ($courses = get_courses($category->id, "fullname ASC", 'c.id,c.fullname,c.sortorder')) {
|
||||
// move it off the range
|
||||
|
||||
|
||||
$sortorderresult = get_record_sql('SELECT MIN(sortorder) AS min, 1
|
||||
FROM ' . $CFG->prefix . 'course WHERE category=' . $category->id);
|
||||
$sortordermin = $sortorderresult->min;
|
||||
@@ -131,7 +131,10 @@
|
||||
/// Print current category description
|
||||
if (!$editingon && $category->description) {
|
||||
print_box_start();
|
||||
echo format_text($category->description); // for multilang filter
|
||||
$options = new stdClass();
|
||||
$options->noclean = true;
|
||||
$options->para = false;
|
||||
echo format_text($category->description, FORMAT_MOODLE, $options); // for multilang filter
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -523,7 +523,7 @@ function print_log_csv($course, $user, $date, $order='l.time DESC', $modname,
|
||||
header("Pragma: public");
|
||||
|
||||
echo get_string('savedat').userdate(time(), $strftimedatetime)."\n";
|
||||
echo $text;
|
||||
echo $text."\n";
|
||||
|
||||
if (empty($logs['logs'])) {
|
||||
return true;
|
||||
|
||||
@@ -71,7 +71,7 @@ class enrolment_plugin_authorize
|
||||
$curcost = get_course_cost($course);
|
||||
echo '<div class="mdl-align">';
|
||||
echo '<p>'.get_string('paymentrequired').'</p>';
|
||||
echo '<p><b>'.get_string('cost').": $curcost[currency] $curcost[cost]".'</b></p>';
|
||||
echo '<p><b>'.get_string('cost').': '. $curcost['currency'] . $curcost['localizedcost'] .'</b></p>';
|
||||
echo '<p><a href="'.$CFG->httpswwwroot.'/login/">'.get_string('loginsite').'</a></p>';
|
||||
echo '</div>';
|
||||
}
|
||||
@@ -387,7 +387,7 @@ class enrolment_plugin_authorize
|
||||
}
|
||||
|
||||
$str .= '<div class="cost" title="'.$strrequirespayment.'">'.$strcost.': ';
|
||||
$str .= $currency . ' ' . $curcost['cost'].'</div>';
|
||||
$str .= $currency . ' ' . $curcost['localizedcost'].'</div>';
|
||||
}
|
||||
|
||||
return $str;
|
||||
|
||||
@@ -12,10 +12,11 @@ function get_course_cost($course)
|
||||
if (!empty($course->cost)) {
|
||||
$cost = (float)(((float)$course->cost) < 0) ? $CFG->enrol_cost : $course->cost;
|
||||
}
|
||||
|
||||
$cost = format_float($cost, 2);
|
||||
$costlocalizeddisplay = format_float($cost, 2);
|
||||
$cost = format_float($cost, 2, false);
|
||||
$ret = array(
|
||||
'cost' => $cost,
|
||||
'localizedcost' => $costlocalizeddisplay,
|
||||
'currency' => $currency
|
||||
);
|
||||
|
||||
|
||||
@@ -157,13 +157,13 @@ function get_access_icons($course) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $user = get_record("user", "idnumber", $fields[2]) ) {
|
||||
if (! $user = get_record("user", "idnumber", addslashes($fields[2])) ) {
|
||||
$this->log .= "Unknown user idnumber in field 3 - ignoring line\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (! $course = get_record("course", "idnumber", $fields[3]) ) {
|
||||
if (! $course = get_record("course", "idnumber", addslashes($fields[3])) ) {
|
||||
$this->log .= "Unknown course idnumber in field 4 - ignoring line\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -36,80 +36,80 @@ function mediaplugin_filter($courseid, $text) {
|
||||
$newtext = $text; // fullclone is slow and not needed here
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_mp3) {
|
||||
$search = '/<a.*?href="([^"]+\.mp3)"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.mp3)"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_mp3_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_ogg) {
|
||||
$search = '/<a[^>]*?href="([^"]+\.ogg)"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.ogg)"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'filter_mediaplugin_ogg_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_ogv) {
|
||||
$search = '/<a[^>]*?href="([^"]+\.ogv)"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.ogv)"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'filter_mediaplugin_ogv_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_swf) {
|
||||
$search = '/<a.*?href="([^"]+\.swf)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.swf)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_swf_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_flv) {
|
||||
$search = '/<a.*?href="([^"]+\.flv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.flv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_flv_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_mov) {
|
||||
$search = '/<a.*?href="([^"]+\.mov)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.mov)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
|
||||
|
||||
// MDL-18658
|
||||
$search = '/<a.*?href="([^"]+\.mp4)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.mp4)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
|
||||
|
||||
$search = '/<a.*?href="([^"]+\.m4v)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.m4v)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
|
||||
|
||||
$search = '/<a.*?href="([^<]+\.m4a)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^<]+\.m4a)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_wmv) {
|
||||
$search = '/<a.*?href="([^"]+\.wmv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.wmv)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_wmp_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_mpg) {
|
||||
$search = '/<a.*?href="([^"]+\.mpe?g)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.mpe?g)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_qt_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_avi) {
|
||||
$search = '/<a.*?href="([^"]+\.avi)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.avi)(\?d=([\d]{1,4}%?)x([\d]{1,4}%?))?"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_wmp_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_ram) {
|
||||
$search = '/<a.*?href="([^"]+\.ram)"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.ram)"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_rpm) {
|
||||
$search = '/<a.*?href="([^"]+\.rpm)"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.rpm)"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
|
||||
}
|
||||
|
||||
if ($CFG->filter_mediaplugin_enable_rm) {
|
||||
$search = '/<a.*?href="([^"]+\.rm)"[^>]*>.*?<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]+\.rm)"[^>]*>.*?<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_real_callback', $newtext);
|
||||
}
|
||||
|
||||
if (!empty($CFG->filter_mediaplugin_enable_youtube)) {
|
||||
$search = '/<a[^>]*?href="([^"]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]*)youtube.com\/watch\?v=([^"]*)"[^>]*>(.*?)<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_youtube_callback', $newtext);
|
||||
|
||||
$search = '/<a[^>]*?href="([^"]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
|
||||
$search = '/<a\s[^>]*href="([^"]*)youtube.com\/v\/([^"]*)"[^>]*>(.*?)<\/a>/is';
|
||||
$newtext = preg_replace_callback($search, 'mediaplugin_filter_youtube_callback', $newtext);
|
||||
}
|
||||
|
||||
|
||||
+17
-9
@@ -108,10 +108,14 @@ class graded_users_iterator {
|
||||
|
||||
$users_sql = "SELECT u.* $ofields
|
||||
FROM {$CFG->prefix}user u
|
||||
INNER JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
|
||||
$groupsql
|
||||
WHERE ra.roleid $gradebookroles
|
||||
AND ra.contextid $relatedcontexts
|
||||
JOIN (
|
||||
SELECT DISTINCT ra.userid
|
||||
FROM {$CFG->prefix}role_assignments ra
|
||||
WHERE ra.roleid $gradebookroles
|
||||
AND ra.contextid $relatedcontexts
|
||||
) rainner ON rainner.userid = u.id
|
||||
WHERE u.deleted = 0
|
||||
$groupwheresql
|
||||
ORDER BY $order";
|
||||
|
||||
@@ -123,13 +127,17 @@ class graded_users_iterator {
|
||||
|
||||
$grades_sql = "SELECT g.* $ofields
|
||||
FROM {$CFG->prefix}grade_grades g
|
||||
INNER JOIN {$CFG->prefix}user u ON g.userid = u.id
|
||||
INNER JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
|
||||
JOIN {$CFG->prefix}user u ON g.userid = u.id
|
||||
$groupsql
|
||||
WHERE ra.roleid $gradebookroles
|
||||
AND ra.contextid $relatedcontexts
|
||||
AND g.itemid IN ($itemids)
|
||||
$groupwheresql
|
||||
JOIN (
|
||||
SELECT DISTINCT ra.userid
|
||||
FROM {$CFG->prefix}role_assignments ra
|
||||
WHERE ra.roleid $gradebookroles
|
||||
AND ra.contextid $relatedcontexts
|
||||
) rainner ON rainner.userid = u.id
|
||||
WHERE u.deleted = 0
|
||||
AND g.itemid IN ($itemids)
|
||||
$groupwheresql
|
||||
ORDER BY $order, g.itemid ASC";
|
||||
$this->grades_rs = get_recordset_sql($grades_sql);
|
||||
} else {
|
||||
|
||||
+44
-42
@@ -327,41 +327,38 @@ class grade_report_grader extends grade_report {
|
||||
global $CFG;
|
||||
|
||||
if (is_numeric($this->sortitemid)) {
|
||||
// the MAX() magic is required in order to please PG
|
||||
$sort = "MAX(g.finalgrade) $this->sortorder";
|
||||
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
|
||||
FROM {$CFG->prefix}user u
|
||||
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
|
||||
$this->groupsql
|
||||
LEFT JOIN {$CFG->prefix}grade_grades g ON (g.userid = u.id AND g.itemid = $this->sortitemid)
|
||||
WHERE ra.roleid in ($this->gradebookroles) AND u.deleted = 0
|
||||
$this->groupwheresql
|
||||
AND ra.contextid ".get_related_contexts_string($this->context)."
|
||||
GROUP BY u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
|
||||
ORDER BY $sort";
|
||||
|
||||
$sortjoin = "LEFT JOIN {$CFG->prefix}grade_grades g ON " .
|
||||
"g.userid = u.id AND g.itemid = $this->sortitemid";
|
||||
$sort = "g.finalgrade $this->sortorder";
|
||||
} else {
|
||||
$sortjoin = '';
|
||||
switch($this->sortitemid) {
|
||||
case 'lastname':
|
||||
$sort = "u.lastname $this->sortorder, u.firstname $this->sortorder"; break;
|
||||
$sort = "u.lastname $this->sortorder, u.firstname $this->sortorder";
|
||||
break;
|
||||
case 'firstname':
|
||||
$sort = "u.firstname $this->sortorder, u.lastname $this->sortorder"; break;
|
||||
$sort = "u.firstname $this->sortorder, u.lastname $this->sortorder";
|
||||
break;
|
||||
case 'idnumber':
|
||||
default:
|
||||
$sort = "u.idnumber $this->sortorder"; break;
|
||||
$sort = "u.idnumber $this->sortorder";
|
||||
break;
|
||||
}
|
||||
|
||||
$sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
|
||||
FROM {$CFG->prefix}user u
|
||||
JOIN {$CFG->prefix}role_assignments ra ON u.id = ra.userid
|
||||
$this->groupsql
|
||||
WHERE ra.roleid in ($this->gradebookroles)
|
||||
$this->groupwheresql
|
||||
AND ra.contextid ".get_related_contexts_string($this->context)."
|
||||
ORDER BY $sort";
|
||||
}
|
||||
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname, u.imagealt, u.picture, u.idnumber
|
||||
FROM {$CFG->prefix}user u
|
||||
$this->groupsql
|
||||
$sortjoin
|
||||
JOIN (
|
||||
SELECT DISTINCT ra.userid
|
||||
FROM {$CFG->prefix}role_assignments ra
|
||||
WHERE ra.roleid IN ($this->gradebookroles)
|
||||
AND ra.contextid " . get_related_contexts_string($this->context) . "
|
||||
) rainner ON rainner.userid = u.id
|
||||
WHERE u.deleted = 0
|
||||
$this->groupwheresql
|
||||
ORDER BY $sort";
|
||||
|
||||
$this->users = get_records_sql($sql, $this->get_pref('studentsperpage') * $this->page,
|
||||
$this->get_pref('studentsperpage'));
|
||||
@@ -1152,20 +1149,24 @@ class grade_report_grader extends grade_report {
|
||||
if ($showaverages) {
|
||||
|
||||
// find sums of all grade items in course
|
||||
$SQL = "SELECT g.itemid, SUM(g.finalgrade) AS sum
|
||||
$sql = "SELECT g.itemid, SUM(g.finalgrade) AS sum
|
||||
FROM {$CFG->prefix}grade_items gi
|
||||
JOIN {$CFG->prefix}grade_grades g ON g.itemid = gi.id
|
||||
JOIN {$CFG->prefix}user u ON u.id = g.userid
|
||||
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
|
||||
JOIN {$CFG->prefix}grade_grades g ON g.itemid = gi.id
|
||||
JOIN {$CFG->prefix}user u ON u.id = g.userid
|
||||
$groupsql
|
||||
WHERE gi.courseid = $this->courseid
|
||||
AND ra.roleid in ($this->gradebookroles)
|
||||
AND ra.contextid ".get_related_contexts_string($this->context)."
|
||||
AND g.finalgrade IS NOT NULL
|
||||
$groupwheresql
|
||||
JOIN (
|
||||
SELECT DISTINCT ra.userid
|
||||
FROM {$CFG->prefix}role_assignments ra
|
||||
WHERE ra.roleid IN ($this->gradebookroles)
|
||||
AND ra.contextid " . get_related_contexts_string($this->context) . "
|
||||
) rainner ON rainner.userid = u.id
|
||||
WHERE gi.courseid = $this->courseid
|
||||
AND u.deleted = 0
|
||||
AND g.finalgrade IS NOT NULL
|
||||
$groupwheresql
|
||||
GROUP BY g.itemid";
|
||||
$sum_array = array();
|
||||
if ($sums = get_records_sql($SQL)) {
|
||||
if ($sums = get_records_sql($sql)) {
|
||||
foreach ($sums as $itemid => $csum) {
|
||||
$sum_array[$itemid] = $csum->sum;
|
||||
}
|
||||
@@ -1177,20 +1178,21 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
// MDL-10875 Empty grades must be evaluated as grademin, NOT always 0
|
||||
// This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
|
||||
$SQL = "SELECT gi.id, COUNT(u.id) AS count
|
||||
$sql = "SELECT gi.id, COUNT(DISTINCT u.id) AS count
|
||||
FROM {$CFG->prefix}grade_items gi
|
||||
CROSS JOIN {$CFG->prefix}user u
|
||||
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
|
||||
LEFT OUTER JOIN {$CFG->prefix}grade_grades g ON (g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL)
|
||||
JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id
|
||||
LEFT OUTER JOIN {$CFG->prefix}grade_grades g ON g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL
|
||||
$groupsql
|
||||
WHERE gi.courseid = $this->courseid
|
||||
AND ra.roleid in ($this->gradebookroles)
|
||||
AND ra.contextid ".get_related_contexts_string($this->context)."
|
||||
AND ra.roleid IN ($this->gradebookroles)
|
||||
AND u.deleted = 0
|
||||
AND ra.contextid " . get_related_contexts_string($this->context) . "
|
||||
AND g.id IS NULL
|
||||
$groupwheresql
|
||||
GROUP BY gi.id";
|
||||
|
||||
$ungraded_counts = get_records_sql($SQL);
|
||||
$ungraded_counts = get_records_sql($sql);
|
||||
|
||||
$fixedstudents = $this->is_fixed_students();
|
||||
if (!$fixedstudents) {
|
||||
|
||||
@@ -114,7 +114,7 @@ $string['configdisablecourseajax'] = 'Do not use AJAX when editing main course p
|
||||
$string['configenablecalendarexport'] = 'Enable exporting or subscribing to calendars.';
|
||||
$string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
|
||||
$string['configenableglobalsearch'] = 'This setting enables global text searching in resources and activities, it is not compatible with PHP 4.';
|
||||
$string['configenablegroupings'] = 'This setting enables groupings of groups.';
|
||||
$string['configenablegroupings'] = 'This setting enables the creation of groupings and the \'Available for group members only\' option. Groupings are a standard feature in Moodle 2.0 onwards whereas \'Available for group members only\' remains an experimental feature.';
|
||||
$string['configenablehtmlpurifier'] = 'Use HTML Purifier instead of KSES for cleaning of untrusted text. HTML Purifier is actively developed and is believed to be more secure, but it is more resource intensive. Expect minor visual differences in the resulting html code. Please note that embed and object tags can not be enabled, MathML tags and old lang tags are not supported. ';
|
||||
$string['configenablerssfeeds'] = 'This switch will enable RSS feeds from across the site. To actually see any change you will need to enable RSS feeds in the individual modules too - go to the Modules settings under Admin Configuration.';
|
||||
$string['configenablerssfeedsdisabled'] = 'It is not available because RSS feeds are disabled in all the Site. To enable them, go to the Variables settings under Admin Configuration.';
|
||||
@@ -209,8 +209,8 @@ $string['configcronremotepassword'] = 'This means that the cron.php script canno
|
||||
</pre>If this is left empty, no password is required.';
|
||||
$string['configrcache'] = 'Use the cache to store database records. Remember to set \'cachetype\' as well!';
|
||||
$string['configrcachettl'] = 'Time-to-live for cached records, in seconds. Use a short (<15) value here.';
|
||||
$string['configrecaptchaprivatekey'] = 'String of characters used to communicate between your Moodle server and the recaptcha.net server. Obtain one for this site by visiting http://recaptcha.net';
|
||||
$string['configrecaptchapublickey'] = 'String of characters used to display the reCAPTCHA element in the signup form. Generated by http://recaptcha.net';
|
||||
$string['configrecaptchaprivatekey'] = 'String of characters used to communicate between your Moodle server and the recaptcha server. Obtain one for this site by visiting http://www.google.com/recaptcha';
|
||||
$string['configrecaptchapublickey'] = 'String of characters used to display the reCAPTCHA element in the signup form. Generated by http://www.google.com/recaptcha';
|
||||
$string['configregenloginsession'] = 'Regeneration of the session id during each login request is highly recommended for security reasons. This setting might not be compatible with some authentication plugins.';
|
||||
$string['configrequestedstudentname'] = 'Word for student used in requested courses';
|
||||
$string['configrequestedstudentsname'] = 'Word for students used in requested courses';
|
||||
@@ -358,7 +358,7 @@ $string['enableajax'] = 'Enable AJAX';
|
||||
$string['enablecalendarexport'] = 'Enable calendar export';
|
||||
$string['enablecourserequests'] = 'Enable course requests';
|
||||
$string['enableglobalsearch'] = 'Enable global search';
|
||||
$string['enablegroupings'] = 'Enable groupings';
|
||||
$string['enablegroupings'] = 'Enable groupings and \'Available for group members only\'';
|
||||
$string['enablehtmlpurifier'] = 'Enable HTML Purifier';
|
||||
$string['enablerecordcache'] = 'Enable Record Cache';
|
||||
$string['enablerssfeeds'] = 'Enable RSS feeds';
|
||||
|
||||
@@ -125,7 +125,7 @@ $string['auth_emailnowexists'] = 'The email address you tried to assign to your
|
||||
$string['auth_emailtitle'] = 'Email-based self-registration';
|
||||
$string['auth_emailnoinsert'] = 'Could not add your record to the database!';
|
||||
$string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://recaptcha.net/learnmore.html for more details. <br /><em>PHP cURL extension is required.</em>';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha/learnmore for more details. <br /><em>PHP cURL extension is required.</em>';
|
||||
$string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
|
||||
$string['auth_emailsettings'] = 'Settings';
|
||||
$string['auth_emailupdatemessage'] = 'Dear $a->fullname,
|
||||
@@ -260,7 +260,7 @@ $string['auth_ntlmsso_enabled'] = 'Set to yes to attempt Single Sign On with the
|
||||
$string['auth_ntlmsso_ie_fastpath'] = 'Set to yes to enable the NTLM SSO fast path (bypasses certain steps and only works if the client\'s browser is MS Internet Explorer).';
|
||||
$string['auth_ntlmsso_ie_fastpath_key'] = 'MS IE fast path?';
|
||||
$string['auth_ntlmsso_subnet_key'] = 'Subnet';
|
||||
$string['auth_ntlmsso_subnet'] = 'If set, it will only attempt SSO with clients in this subnet. Format: xxx.xxx.xxx.xxx/bitmask';
|
||||
$string['auth_ntlmsso_subnet'] = 'If set, it will only attempt SSO with clients in this subnet. Format: xxx.xxx.xxx.xxx/bitmask. Separate multiple subnets with \',\' (comma).';
|
||||
$string['ntlmsso_attempting'] = 'Attempting Single Sign On via NTLM...';
|
||||
$string['ntlmsso_failed'] = 'Auto-login failed, try the normal login page...';
|
||||
$string['ntlmsso_isdisabled'] = 'NTLM SSO is disabled.';
|
||||
|
||||
@@ -94,7 +94,7 @@ $string['forum'] = 'Forum';
|
||||
$string['forum:addnews'] = 'Add news';
|
||||
$string['forumauthorhidden'] = 'Author (hidden)';
|
||||
$string['forumblockingalmosttoomanyposts'] = 'You are approaching the posting threshold. You have posted $a->numposts times in the last $a->blockperiod and the limit is $a->blockafter posts.';
|
||||
$string['forumbodyhidden'] = 'This post cannot be viewed by you, probably because you have not posted in the discussion yet.';
|
||||
$string['forumbodyhidden'] = 'This post cannot be viewed by you, probably because you have not posted in the discussion or the maximum editing time hasn\'t passed yet.';
|
||||
$string['forum:createattachment'] = 'Create attachments';
|
||||
$string['forum:deleteanypost'] = 'Delete any posts (anytime)';
|
||||
$string['forum:deleteownpost'] = 'Delete own posts (within deadline)';
|
||||
|
||||
@@ -1677,6 +1677,12 @@ function error ($message, $link='') {
|
||||
}
|
||||
}
|
||||
|
||||
// when printing an error the continue button should never link offsite
|
||||
if (stripos($link, $CFG->wwwroot) === false &&
|
||||
stripos($link, $CFG->httpswwwroot) === false) {
|
||||
$link = $CFG->wwwroot.'/';
|
||||
}
|
||||
|
||||
if (!empty($link)) {
|
||||
print_continue($link);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
require("../../../../config.php");
|
||||
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
$httpsrequired = optional_param('httpsrequired', 0, PARAM_BOOL);
|
||||
|
||||
require_login($id);
|
||||
require_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id));
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
require("../../../../config.php");
|
||||
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
$httpsrequired = optional_param('httpsrequired', 0, PARAM_BOOL);
|
||||
|
||||
require_course_login($id);
|
||||
|
||||
@header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
if ($httpsrequired or (!empty($_SERVER['HTTPS']) and $_SERVER['HTTPS'] != 'off')) {
|
||||
|
||||
+10
-1
@@ -122,7 +122,16 @@ class MoodleExcelWorksheet {
|
||||
*/
|
||||
function MoodleExcelWorksheet($name, &$workbook, $latin_output=false) {
|
||||
|
||||
/// Internally, add one sheet to the workbook
|
||||
if (strlen($name) > 31) {
|
||||
// Excel does not seem able to cope with sheet names > 31 chars.
|
||||
// With $latin_output = false, it does not cope at all.
|
||||
// With $latin_output = true it is supposed to work, but in our experience,
|
||||
// it doesn't. Therefore, truncate in all circumstances.
|
||||
$textlib = textlib_get_instance();
|
||||
$name = $textlib->substr($name, 0, 31);
|
||||
}
|
||||
|
||||
/// Internally, add one sheet to the workbook
|
||||
$this->pear_excel_worksheet =& $workbook->addWorksheet($name);
|
||||
$this->latin_output = $latin_output;
|
||||
/// Set encoding to UTF-16LE
|
||||
|
||||
+4
-2
@@ -656,12 +656,14 @@ class moodleform {
|
||||
/**
|
||||
* Adds a link/button that controls the checked state of a group of checkboxes.
|
||||
* @param int $groupid The id of the group of advcheckboxes this element controls
|
||||
* @param string $text The text of the link. Defaults to "select all/none"
|
||||
* @param string $text The text of the link. Defaults to selectallornone ("select all/none")
|
||||
* @param array $attributes associative array of HTML attributes
|
||||
* @param int $originalValue The original general state of the checkboxes before the user first clicks this element
|
||||
*/
|
||||
function add_checkbox_controller($groupid, $buttontext, $attributes, $originalValue = 0) {
|
||||
function add_checkbox_controller($groupid, $text = null, $attributes = null, $originalValue = 0) {
|
||||
global $CFG;
|
||||
|
||||
// Set the default text if none was specified
|
||||
if (empty($text)) {
|
||||
$text = get_string('selectallornone', 'form');
|
||||
}
|
||||
|
||||
+30
-26
@@ -1115,27 +1115,28 @@ function get_user_preferences($name=NULL, $default=NULL, $otheruserid=NULL) {
|
||||
* @param int $hour The hour part to create timestamp of
|
||||
* @param int $minute The minute part to create timestamp of
|
||||
* @param int $second The second part to create timestamp of
|
||||
* @param float $timezone ?
|
||||
* @param bool $applydst ?
|
||||
* @param mixed $timezone Timezone modifier, if 99 then use default user's timezone
|
||||
* @param bool $applydst Toggle Daylight Saving Time, default true, will be
|
||||
* applied only if timezone is 99 or string.
|
||||
* @return int timestamp
|
||||
* @todo Finish documenting this function
|
||||
*/
|
||||
function make_timestamp($year, $month=1, $day=1, $hour=0, $minute=0, $second=0, $timezone=99, $applydst=true) {
|
||||
|
||||
$strtimezone = NULL;
|
||||
if (!is_numeric($timezone)) {
|
||||
$strtimezone = $timezone;
|
||||
}
|
||||
//save input timezone, required for dst offset check.
|
||||
$passedtimezone = $timezone;
|
||||
|
||||
$timezone = get_user_timezone_offset($timezone);
|
||||
|
||||
if (abs($timezone) > 13) {
|
||||
if (abs($timezone) > 13) { //server time
|
||||
$time = mktime((int)$hour, (int)$minute, (int)$second, (int)$month, (int)$day, (int)$year);
|
||||
} else {
|
||||
$time = gmmktime((int)$hour, (int)$minute, (int)$second, (int)$month, (int)$day, (int)$year);
|
||||
$time = usertime($time, $timezone);
|
||||
if($applydst) {
|
||||
$time -= dst_offset_on($time, $strtimezone);
|
||||
|
||||
//Apply dst for string timezones or if 99 then try dst offset with user's default timezone
|
||||
if ($applydst && ((99 == $passedtimezone) || !is_numeric($passedtimezone))) {
|
||||
$time -= dst_offset_on($time, $passedtimezone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1222,7 +1223,8 @@ function make_timestamp($year, $month=1, $day=1, $hour=0, $minute=0, $second=0,
|
||||
* @uses HOURSECS
|
||||
* @param int $date timestamp in GMT
|
||||
* @param string $format strftime format
|
||||
* @param float $timezone
|
||||
* @param mixed $timezone by default, uses the user's time zone. if numeric and
|
||||
* not 99 then daylight saving will not be added.
|
||||
* @param bool $fixday If true (default) then the leading
|
||||
* zero from %d is removed. If false then the leading zero is mantained.
|
||||
* @return string
|
||||
@@ -1231,11 +1233,6 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$strtimezone = NULL;
|
||||
if (!is_numeric($timezone)) {
|
||||
$strtimezone = $timezone;
|
||||
}
|
||||
|
||||
if (empty($format)) {
|
||||
$format = get_string('strftimedaydatetime');
|
||||
}
|
||||
@@ -1247,7 +1244,11 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
|
||||
$fixday = ($formatnoday != $format);
|
||||
}
|
||||
|
||||
$date += dst_offset_on($date, $strtimezone);
|
||||
//add daylight saving offset for string timezones only, as we can't get dst for
|
||||
//float values. if timezone is 99 (user default timezone), then try update dst.
|
||||
if ((99 == $timezone) || !is_numeric($timezone)) {
|
||||
$date += dst_offset_on($date, $timezone);
|
||||
}
|
||||
|
||||
$timezone = get_user_timezone_offset($timezone);
|
||||
|
||||
@@ -1289,16 +1290,15 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
|
||||
*
|
||||
* @uses HOURSECS
|
||||
* @param int $time Timestamp in GMT
|
||||
* @param float $timezone ?
|
||||
* @param mixed $timezone offset time with timezone, if float and not 99, then no
|
||||
* dst offset is applyed
|
||||
* @return array An array that represents the date in user time
|
||||
* @todo Finish documenting this function
|
||||
*/
|
||||
function usergetdate($time, $timezone=99) {
|
||||
|
||||
$strtimezone = NULL;
|
||||
if (!is_numeric($timezone)) {
|
||||
$strtimezone = $timezone;
|
||||
}
|
||||
//save input timezone, required for dst offset check.
|
||||
$passedtimezone = $timezone;
|
||||
|
||||
$timezone = get_user_timezone_offset($timezone);
|
||||
|
||||
@@ -1306,8 +1306,12 @@ function usergetdate($time, $timezone=99) {
|
||||
return getdate($time);
|
||||
}
|
||||
|
||||
// There is no gmgetdate so we use gmdate instead
|
||||
$time += dst_offset_on($time, $strtimezone);
|
||||
//add daylight saving offset for string timezones only, as we can't get dst for
|
||||
//float values. if timezone is 99 (user default timezone), then try update dst.
|
||||
if ($passedtimezone == 99 || !is_numeric($passedtimezone)) {
|
||||
$time += dst_offset_on($time, $passedtimezone);
|
||||
}
|
||||
|
||||
$time += intval((float)$timezone * HOURSECS);
|
||||
|
||||
$datestring = gmstrftime('%B_%A_%j_%Y_%m_%w_%d_%H_%M_%S', $time);
|
||||
@@ -1456,7 +1460,7 @@ function get_timezone_offset($tz) {
|
||||
*
|
||||
* @uses $USER
|
||||
* @uses $CFG
|
||||
* @param float $tz If this value is provided and not equal to 99, it will be returned as is and no other settings will be checked
|
||||
* @param mixed $tz If this value is provided and not equal to 99, it will be returned as is and no other settings will be checked
|
||||
* @return mixed
|
||||
*/
|
||||
function get_user_timezone($tz = 99) {
|
||||
@@ -6431,12 +6435,12 @@ function check_php_version($version='4.1.0') {
|
||||
break;
|
||||
|
||||
case 'Safari': /// Safari
|
||||
// Look for AppleWebKit, excluding strings with OmniWeb, Shiira and SimbianOS
|
||||
// Look for AppleWebKit, excluding strings with OmniWeb, Shiira and SymbianOS
|
||||
if (strpos($agent, 'OmniWeb')) { // Reject OmniWeb
|
||||
return false;
|
||||
} elseif (strpos($agent, 'Shiira')) { // Reject Shiira
|
||||
return false;
|
||||
} elseif (strpos($agent, 'SimbianOS')) { // Reject SimbianOS
|
||||
} elseif (strpos($agent, 'SymbianOS')) { // Reject SymbianOS
|
||||
return false;
|
||||
}
|
||||
if (strpos($agent, 'iPhone') or strpos($agent, 'iPad') or strpos($agent, 'iPod')) {
|
||||
|
||||
@@ -664,6 +664,7 @@ function olson_parse_at ($at, $set = 'set', $gmtoffset) {
|
||||
$at = substr($at, 0, strlen($at)-1); // chop
|
||||
}
|
||||
|
||||
$at = (strpos($at, ':') === false) ? $at . ':0' : $at;
|
||||
list($hours, $mins) = explode(':', $at);
|
||||
|
||||
// GMT -- return as is!
|
||||
|
||||
+41
-35
@@ -2,13 +2,13 @@
|
||||
/*
|
||||
* This is a PHP library that handles calling reCAPTCHA.
|
||||
* - Documentation and latest version
|
||||
* http://recaptcha.net/plugins/php/
|
||||
* {@link http://code.google.com/apis/recaptcha/docs/php.html}
|
||||
* - Get a reCAPTCHA API Key
|
||||
* http://recaptcha.net/api/getkey
|
||||
* {@link https://www.google.com/recaptcha/admin/create}
|
||||
* - Discussion group
|
||||
* http://groups.google.com/group/recaptcha
|
||||
*
|
||||
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
|
||||
* Copyright (c) 2007 reCAPTCHA -- {@link http://www.google.com/recaptcha}
|
||||
* AUTHORS:
|
||||
* Mike Crawford
|
||||
* Ben Maurer
|
||||
@@ -30,14 +30,17 @@
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @copyright (c) 2007 reCAPTCHA -- {@link http://www.google.com/recaptcha}
|
||||
*/
|
||||
|
||||
/**
|
||||
* The reCAPTCHA server URL's
|
||||
*/
|
||||
define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net");
|
||||
define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net");
|
||||
define("RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net");
|
||||
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
|
||||
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
|
||||
|
||||
/**
|
||||
* Encodes the given data into a query string format
|
||||
@@ -107,15 +110,15 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) {
|
||||
|
||||
$recaptchatype = optional_param('recaptcha', 'image', PARAM_TEXT);
|
||||
|
||||
if ($pubkey == null || $pubkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
|
||||
}
|
||||
|
||||
if ($use_ssl) {
|
||||
$server = RECAPTCHA_API_SECURE_SERVER;
|
||||
} else {
|
||||
$server = RECAPTCHA_API_SERVER;
|
||||
}
|
||||
if ($pubkey == null || $pubkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($use_ssl) {
|
||||
$server = RECAPTCHA_API_SECURE_SERVER;
|
||||
} else {
|
||||
$server = RECAPTCHA_API_SERVER;
|
||||
}
|
||||
|
||||
$errorpart = "";
|
||||
if ($error) {
|
||||
@@ -175,6 +178,9 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) {
|
||||
|
||||
/**
|
||||
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
||||
*
|
||||
* @package moodlecore
|
||||
* @copyright (c) 2007 reCAPTCHA -- {@link http://www.google.com/recaptcha}
|
||||
*/
|
||||
class ReCaptchaResponse {
|
||||
var $is_valid;
|
||||
@@ -192,9 +198,9 @@ class ReCaptchaResponse {
|
||||
*/
|
||||
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $https=false)
|
||||
{
|
||||
if ($privkey == null || $privkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>");
|
||||
}
|
||||
if ($privkey == null || $privkey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($remoteip == null || $remoteip == '') {
|
||||
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
|
||||
@@ -210,12 +216,12 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ht
|
||||
return $recaptcha_response;
|
||||
}
|
||||
|
||||
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/verify",
|
||||
array (
|
||||
'privatekey' => $privkey,
|
||||
'remoteip' => $remoteip,
|
||||
'challenge' => $challenge,
|
||||
'response' => $response
|
||||
$response = _recaptcha_http_post(RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
|
||||
array (
|
||||
'privatekey' => $privkey,
|
||||
'remoteip' => $remoteip,
|
||||
'challenge' => $challenge,
|
||||
'response' => $response
|
||||
),
|
||||
$https
|
||||
);
|
||||
@@ -242,7 +248,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ht
|
||||
* @param string $appname The name of your application
|
||||
*/
|
||||
function recaptcha_get_signup_url ($domain = null, $appname = null) {
|
||||
return "http://recaptcha.net/api/getkey?" . _recaptcha_qsencode (array ('domain' => $domain, 'app' => $appname));
|
||||
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
|
||||
}
|
||||
|
||||
function _recaptcha_aes_pad($val) {
|
||||
@@ -270,16 +276,16 @@ function _recaptcha_mailhide_urlbase64 ($x) {
|
||||
|
||||
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
||||
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
||||
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
||||
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
||||
"you can do so at <a href='http://mailhide.recaptcha.net/apikey'>http://mailhide.recaptcha.net/apikey</a>");
|
||||
}
|
||||
|
||||
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
||||
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
||||
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
|
||||
}
|
||||
|
||||
$ky = pack('H*', $privkey);
|
||||
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
|
||||
|
||||
return "http://mailhide.recaptcha.net/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
|
||||
|
||||
$ky = pack('H*', $privkey);
|
||||
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
|
||||
|
||||
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,7 +310,7 @@ function _recaptcha_mailhide_email_parts ($email) {
|
||||
* Gets html to display an email address given a public an private key.
|
||||
* to get a key, go to:
|
||||
*
|
||||
* http://mailhide.recaptcha.net/apikey
|
||||
* http://www.google.com/recaptcha/mailhide/apikey
|
||||
*/
|
||||
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
||||
$emailparts = _recaptcha_mailhide_email_parts ($email);
|
||||
|
||||
@@ -255,7 +255,14 @@ class moodlelib_test extends UnitTestCase {
|
||||
}
|
||||
|
||||
function test_usergetdate() {
|
||||
global $USER;
|
||||
global $USER, $CFG;
|
||||
|
||||
//Check if forcetimezone is set then save it and set it to use user timezone
|
||||
$cfgforcetimezone = null;
|
||||
if (isset($CFG->forcetimezone)) {
|
||||
$cfgforcetimezone = $CFG->forcetimezone;
|
||||
$CFG->forcetimezone = 99; //get user default timezone.
|
||||
}
|
||||
|
||||
$userstimezone = $USER->timezone;
|
||||
$USER->timezone = 2;//set the timezone to a known state
|
||||
@@ -292,9 +299,274 @@ class moodlelib_test extends UnitTestCase {
|
||||
$this->assertEqual($weekday,'Wednesday');
|
||||
$this->assertEqual($month,'December');
|
||||
|
||||
//restore forcetimezone if changed.
|
||||
if (!is_null($cfgforcetimezone)) {
|
||||
$CFG->forcetimezone = $cfgforcetimezone;
|
||||
}
|
||||
|
||||
//set the timezone back to what it was
|
||||
$USER->timezone = $userstimezone;
|
||||
}
|
||||
|
||||
public function test_userdate() {
|
||||
global $USER, $CFG;
|
||||
|
||||
$testvalues = array(
|
||||
array(
|
||||
'time' => '1309514400',
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'timezone' => '0.0', //no dst offset
|
||||
'expectedoutput' => 'Friday, 1 July 2011, 10:00 AM'
|
||||
),
|
||||
array(
|
||||
'time' => '1309514400',
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'timezone' => '99', //dst offset and timezone offset.
|
||||
'expectedoutput' => 'Friday, 1 July 2011, 07:00 AM'
|
||||
),
|
||||
array(
|
||||
'time' => '1309514400',
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'timezone' => 'America/Moncton', //dst offset and timezone offset.
|
||||
'expectedoutput' => 'Friday, 1 July 2011, 07:00 AM'
|
||||
),
|
||||
array(
|
||||
'time' => '1293876000 ',
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'timezone' => '0.0', //no dst offset
|
||||
'expectedoutput' => 'Saturday, 1 January 2011, 10:00 AM'
|
||||
),
|
||||
array(
|
||||
'time' => '1293876000 ',
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'timezone' => '99', //no dst offset in jan, so just timezone offset.
|
||||
'expectedoutput' => 'Saturday, 1 January 2011, 06:00 AM'
|
||||
),
|
||||
array(
|
||||
'time' => '1293876000 ',
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'timezone' => 'America/Moncton', //no dst offset in jan
|
||||
'expectedoutput' => 'Saturday, 1 January 2011, 06:00 AM'
|
||||
),
|
||||
array(
|
||||
'time' => '1293876000 ',
|
||||
'usertimezone' => '2',
|
||||
'timezone' => '99', //take user timezone
|
||||
'expectedoutput' => 'Saturday, 1 January 2011, 12:00 PM'
|
||||
),
|
||||
array(
|
||||
'time' => '1293876000 ',
|
||||
'usertimezone' => '-2',
|
||||
'timezone' => '99', //take user timezone
|
||||
'expectedoutput' => 'Saturday, 1 January 2011, 08:00 AM'
|
||||
),
|
||||
array(
|
||||
'time' => '1293876000 ',
|
||||
'usertimezone' => '-10',
|
||||
'timezone' => '2', //take this timezone
|
||||
'expectedoutput' => 'Saturday, 1 January 2011, 12:00 PM'
|
||||
),
|
||||
array(
|
||||
'time' => '1293876000 ',
|
||||
'usertimezone' => '-10',
|
||||
'timezone' => '-2', //take this timezone
|
||||
'expectedoutput' => 'Saturday, 1 January 2011, 08:00 AM'
|
||||
)
|
||||
);
|
||||
|
||||
//Check if forcetimezone is set then save it and set it to use user timezone
|
||||
$cfgforcetimezone = null;
|
||||
if (isset($CFG->forcetimezone)) {
|
||||
$cfgforcetimezone = $CFG->forcetimezone;
|
||||
$CFG->forcetimezone = 99; //get user default timezone.
|
||||
}
|
||||
//store user default timezone to restore later
|
||||
$userstimezone = $USER->timezone;
|
||||
|
||||
// The string version of date comes from server locale setting and does
|
||||
// not respect user language, so it is necessary to reset that.
|
||||
$oldlocale = setlocale(LC_TIME, '0');
|
||||
setlocale(LC_TIME, 'en_AU.UTF-8');
|
||||
|
||||
//get instance of textlib for strtolower
|
||||
$textlib = textlib_get_instance();
|
||||
foreach ($testvalues as $vals) {
|
||||
$USER->timezone = $vals['usertimezone'];
|
||||
$actualoutput = userdate($vals['time'], '%A, %d %B %Y, %I:%M %p', $vals['timezone']);
|
||||
|
||||
//On different systems case of AM PM changes so compare case insenitive
|
||||
$vals['expectedoutput'] = $textlib->strtolower($vals['expectedoutput']);
|
||||
$actualoutput = $textlib->strtolower($actualoutput);
|
||||
|
||||
$this->assertEqual($vals['expectedoutput'], $actualoutput,
|
||||
"Expected: {$vals['expectedoutput']} => Actual: {$actualoutput},
|
||||
Please check if timezones are updated (Site adminstration -> location -> update timezone)");
|
||||
}
|
||||
|
||||
//restore user timezone back to what it was
|
||||
$USER->timezone = $userstimezone;
|
||||
|
||||
//restore forcetimezone
|
||||
if (!is_null($cfgforcetimezone)) {
|
||||
$CFG->forcetimezone = $cfgforcetimezone;
|
||||
}
|
||||
|
||||
//restore system default values.
|
||||
setlocale(LC_TIME, $oldlocale);
|
||||
}
|
||||
|
||||
public function test_make_timestamp() {
|
||||
global $USER, $CFG;
|
||||
|
||||
$testvalues = array(
|
||||
array(
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => '0.0', //no dst offset
|
||||
'applydst' => false,
|
||||
'expectedoutput' => '1309528800'
|
||||
),
|
||||
array(
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => '99', //user default timezone
|
||||
'applydst' => false, //don't apply dst
|
||||
'expectedoutput' => '1309528800'
|
||||
),
|
||||
array(
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => '99', //user default timezone
|
||||
'applydst' => true, //apply dst
|
||||
'expectedoutput' => '1309525200'
|
||||
),
|
||||
array(
|
||||
'usertimezone' => 'America/Moncton',
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => 'America/Moncton', //string timezone
|
||||
'applydst' => true, //apply dst
|
||||
'expectedoutput' => '1309525200'
|
||||
),
|
||||
array(
|
||||
'usertimezone' => '2',//no dst applyed
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => '99', //take user timezone
|
||||
'applydst' => true, //apply dst
|
||||
'expectedoutput' => '1309507200'
|
||||
),
|
||||
array(
|
||||
'usertimezone' => '-2',//no dst applyed
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => '99', //take usertimezone
|
||||
'applydst' => true, //apply dst
|
||||
'expectedoutput' => '1309521600'
|
||||
),
|
||||
array(
|
||||
'usertimezone' => '-10',//no dst applyed
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => '2', //take this timezone
|
||||
'applydst' => true, //apply dst
|
||||
'expectedoutput' => '1309507200'
|
||||
),
|
||||
array(
|
||||
'usertimezone' => '-10',//no dst applyed
|
||||
'year' => '2011',
|
||||
'month' => '7',
|
||||
'day' => '1',
|
||||
'hour' => '10',
|
||||
'minutes' => '00',
|
||||
'seconds' => '00',
|
||||
'timezone' => '-2', //take this timezone
|
||||
'applydst' => true, //apply dst,
|
||||
'expectedoutput' => '1309521600'
|
||||
)
|
||||
);
|
||||
|
||||
//Check if forcetimezone is set then save it and set it to use user timezone
|
||||
$cfgforcetimezone = null;
|
||||
if (isset($CFG->forcetimezone)) {
|
||||
$cfgforcetimezone = $CFG->forcetimezone;
|
||||
$CFG->forcetimezone = 99; //get user default timezone.
|
||||
}
|
||||
|
||||
//store user default timezone to restore later
|
||||
$userstimezone = $USER->timezone;
|
||||
|
||||
// The string version of date comes from server locale setting and does
|
||||
// not respect user language, so it is necessary to reset that.
|
||||
$oldlocale = setlocale(LC_TIME, '0');
|
||||
setlocale(LC_TIME, 'en_AU.UTF-8');
|
||||
|
||||
//get instance of textlib for strtolower
|
||||
$textlib = textlib_get_instance();
|
||||
//Test make_timestamp with all testvals and assert if anything wrong.
|
||||
foreach ($testvalues as $vals) {
|
||||
$USER->timezone = $vals['usertimezone'];
|
||||
$actualoutput = make_timestamp(
|
||||
$vals['year'],
|
||||
$vals['month'],
|
||||
$vals['day'],
|
||||
$vals['hour'],
|
||||
$vals['minutes'],
|
||||
$vals['seconds'],
|
||||
$vals['timezone'],
|
||||
$vals['applydst']
|
||||
);
|
||||
|
||||
//On different systems case of AM PM changes so compare case insenitive
|
||||
$vals['expectedoutput'] = $textlib->strtolower($vals['expectedoutput']);
|
||||
$actualoutput = $textlib->strtolower($actualoutput);
|
||||
|
||||
$this->assertEqual($vals['expectedoutput'], $actualoutput,
|
||||
"Expected: {$vals['expectedoutput']} => Actual: {$actualoutput},
|
||||
Please check if timezones are updated (Site adminstration -> location -> update timezone)");
|
||||
}
|
||||
|
||||
//restore user timezone back to what it was
|
||||
$USER->timezone = $userstimezone;
|
||||
|
||||
//restore forcetimezone
|
||||
if (!is_null($cfgforcetimezone)) {
|
||||
$CFG->forcetimezone = $cfgforcetimezone;
|
||||
}
|
||||
|
||||
//restore system default values.
|
||||
setlocale(LC_TIME, $oldlocale);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
+2149
-2112
File diff suppressed because it is too large
Load Diff
+63
-23
@@ -216,33 +216,41 @@ function get_referer($stripquery=true) {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function me() {
|
||||
|
||||
function me() {
|
||||
if (!empty($_SERVER['REQUEST_URI'])) {
|
||||
return $_SERVER['REQUEST_URI'];
|
||||
$return = $_SERVER['REQUEST_URI'];
|
||||
|
||||
} else if (!empty($_SERVER['PHP_SELF'])) {
|
||||
if (!empty($_SERVER['QUERY_STRING'])) {
|
||||
return $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
|
||||
$return = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
|
||||
} else {
|
||||
$return = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
return $_SERVER['PHP_SELF'];
|
||||
|
||||
} else if (!empty($_SERVER['SCRIPT_NAME'])) {
|
||||
if (!empty($_SERVER['QUERY_STRING'])) {
|
||||
return $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];
|
||||
$return = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];
|
||||
} else {
|
||||
$return = $_SERVER['SCRIPT_NAME'];
|
||||
}
|
||||
return $_SERVER['SCRIPT_NAME'];
|
||||
|
||||
} else if (!empty($_SERVER['URL'])) { // May help IIS (not well tested)
|
||||
if (!empty($_SERVER['QUERY_STRING'])) {
|
||||
return $_SERVER['URL'] .'?'. $_SERVER['QUERY_STRING'];
|
||||
$return = $_SERVER['URL'] .'?'. $_SERVER['QUERY_STRING'];
|
||||
} else {
|
||||
$return = $_SERVER['URL'];
|
||||
}
|
||||
return $_SERVER['URL'];
|
||||
|
||||
} else {
|
||||
notify('Warning: Could not find any of these web server variables: $REQUEST_URI, $PHP_SELF, $SCRIPT_NAME or $URL');
|
||||
return false;
|
||||
}
|
||||
|
||||
// sanitize the url a bit more, the encoding style may be different in vars above
|
||||
$return = str_replace('"', '%22', $return);
|
||||
$return = str_replace('\'', '%27', $return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1502,7 +1510,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
|
||||
|
||||
static $croncache = array();
|
||||
|
||||
if ($text === '') {
|
||||
if ($text === '' || is_null($text)) {
|
||||
return ''; // no need to do any filters and cleaning
|
||||
}
|
||||
|
||||
@@ -2757,9 +2765,9 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
|
||||
|
||||
$pageclass .= ' dir-'.get_string('thisdirection');
|
||||
|
||||
$pageclass .= ' lang-'.$currentlanguage;
|
||||
$pageclass .= ' lang-'.s($currentlanguage);
|
||||
|
||||
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
|
||||
$bodytags .= ' class="'.s($pageclass).'" id="'.s($pageid).'"';
|
||||
|
||||
ob_start();
|
||||
include($CFG->header);
|
||||
@@ -5833,12 +5841,20 @@ function print_error($errorcode, $module='error', $link='', $a=NULL, $extralocat
|
||||
}
|
||||
}
|
||||
|
||||
// when printing an error the continue button should never link offsite
|
||||
if (stripos($link, $CFG->wwwroot) === false &&
|
||||
stripos($link, $CFG->httpswwwroot) === false) {
|
||||
$link = $CFG->wwwroot.'/';
|
||||
}
|
||||
|
||||
if (!empty($CFG->errordocroot)) {
|
||||
$errordocroot = $CFG->errordocroot;
|
||||
} else if (!empty($CFG->docroot)) {
|
||||
$errordocroot = $CFG->docroot;
|
||||
$errordoclink = $CFG->errordocroot.'/en';
|
||||
} else {
|
||||
$errordocroot = 'http://docs.moodle.org';
|
||||
$errordoclink = get_doc_root();
|
||||
if (is_null($errordoclink)) {
|
||||
$lang = current_language();
|
||||
$errordoclink = 'http://docs.moodle.org/19/'.$lang; //no doc links set. point to default.
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('FULLME') && FULLME == 'cron') {
|
||||
@@ -5855,7 +5871,7 @@ function print_error($errorcode, $module='error', $link='', $a=NULL, $extralocat
|
||||
|
||||
$message = clean_text('<p class="errormessage">'.$message.'</p>'.
|
||||
'<p class="errorcode">'.
|
||||
'<a href="'.$errordocroot.'/en/error/'.$modulelink.'/'.$errorcode.'">'.
|
||||
'<a href="'.$errordoclink.'/error/'.$modulelink.'/'.$errorcode.'">'.
|
||||
get_string('moreinformation').'</a></p>');
|
||||
|
||||
if (! defined('HEADER_PRINTED')) {
|
||||
@@ -6949,18 +6965,16 @@ function page_doc_link($text='', $iconpath='') {
|
||||
function doc_link($path='', $text='', $iconpath='') {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->docroot)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$target = '';
|
||||
if (!empty($CFG->doctonewwindow)) {
|
||||
$target = ' target="_blank"';
|
||||
}
|
||||
|
||||
$lang = str_replace('_utf8', '', current_language());
|
||||
if (is_null($docroot = get_doc_root())) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$str = '<a href="' .$CFG->docroot. '/' .$lang. '/' .$path. '"' .$target. '>';
|
||||
$str = '<a href="' .$docroot. '/' .$path. '"' .$target. '>';
|
||||
|
||||
if (empty($iconpath)) {
|
||||
$iconpath = $CFG->httpswwwroot . '/pix/docs.gif';
|
||||
@@ -6972,6 +6986,32 @@ function doc_link($path='', $text='', $iconpath='') {
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that checks if docroot is set, builds and returns the docs root url according to version release.
|
||||
* @return string documentation url, null if doc root isn't set (ie:during installation perhaps).
|
||||
*/
|
||||
function get_doc_root() {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->docroot)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$lang = str_replace('_utf8', '', current_language());
|
||||
if (!empty($CFG->release)) {
|
||||
$release = $CFG->release;
|
||||
} else {
|
||||
//derive branch from the first three letters of version.php's $release with the period taken out.($CFG->release isn't populated yet during upgrade)
|
||||
include($CFG->dirroot.'/version.php');
|
||||
}
|
||||
if (preg_match('/^(.)\.(.)/', $release, $matches)) {
|
||||
$branch = $matches[1].$matches[2];
|
||||
} else {
|
||||
$branch = '.';
|
||||
}
|
||||
|
||||
return $CFG->docroot. '/' .$branch. '/' .$lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current site debugging settings are equal or above specified level.
|
||||
|
||||
@@ -838,8 +838,7 @@ class assignment_base {
|
||||
if ($users) {
|
||||
$select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
|
||||
s.id AS submissionid, s.grade, s.submissioncomment,
|
||||
s.timemodified, s.timemarked,
|
||||
COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
|
||||
s.timemodified, s.timemarked ';
|
||||
$sql = 'FROM '.$CFG->prefix.'user u '.
|
||||
'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid
|
||||
AND s.assignment = '.$this->assignment->id.' '.
|
||||
@@ -1167,8 +1166,7 @@ class assignment_base {
|
||||
|
||||
$select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
|
||||
s.id AS submissionid, s.grade, s.submissioncomment,
|
||||
s.timemodified, s.timemarked,
|
||||
COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
|
||||
s.timemodified, s.timemarked ';
|
||||
$sql = 'FROM '.$CFG->prefix.'user u '.
|
||||
'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid
|
||||
AND s.assignment = '.$this->assignment->id.' '.
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<option value="-2"<?php if($this->field->param2==-2) echo ' selected="selected"' ?>><?php echo get_string('latitude', 'data').'/'.get_string('longitude', 'data') ?></option>
|
||||
<?php
|
||||
// Fetch all "suitable" other fields that exist for this database
|
||||
$textfields = get_records_select('data_fields', 'dataid='.$this->data->id.' AND type="text"');
|
||||
$textfields = get_records_select('data_fields', 'dataid='.$this->data->id." AND type='text'");
|
||||
echo '<optgroup label="'.get_string('latlongotherfields', 'data').':">';
|
||||
if(sizeof($textfields)>0) {
|
||||
foreach($textfields as $textfield) {
|
||||
|
||||
+9
-1
@@ -729,7 +729,15 @@ function data_user_outline($course, $user, $mod, $data) {
|
||||
} else if ($grade) {
|
||||
$result = new object();
|
||||
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
|
||||
$result->time = $grade->dategraded;
|
||||
|
||||
//datesubmitted == time created. dategraded == time modified or time overridden
|
||||
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
|
||||
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
|
||||
$result->time = $grade->dategraded;
|
||||
} else {
|
||||
$result->time = $grade->datesubmitted;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
+36
-4
@@ -380,6 +380,12 @@ function forum_cron() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't send email if the forum is Q&A and the user has not posted
|
||||
if ($forum->type == 'qanda' && !forum_get_user_posted_time($discussion->id, $userto->id)) {
|
||||
mtrace('Did not email '.$userto->id.' because user has not posted in discussion');
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get info about the sending user
|
||||
if (array_key_exists($post->userid, $users)) { // we might know him/her already
|
||||
$userfrom = $users[$post->userid];
|
||||
@@ -970,7 +976,15 @@ function forum_user_outline($course, $user, $mod, $forum) {
|
||||
} else if ($grade) {
|
||||
$result = new object();
|
||||
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
|
||||
$result->time = $grade->dategraded;
|
||||
|
||||
//datesubmitted == time created. dategraded == time modified or time overridden
|
||||
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
|
||||
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
|
||||
$result->time = $grade->dategraded;
|
||||
} else {
|
||||
$result->time = $grade->datesubmitted;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
return NULL;
|
||||
@@ -4636,7 +4650,7 @@ function forum_user_can_see_discussion($forum, $discussion, $context, $user=NULL
|
||||
*
|
||||
*/
|
||||
function forum_user_can_see_post($forum, $discussion, $post, $user=NULL, $cm=NULL) {
|
||||
global $USER;
|
||||
global $CFG, $USER;
|
||||
|
||||
// retrieve objects (yuk)
|
||||
if (is_numeric($forum)) {
|
||||
@@ -4697,9 +4711,10 @@ function forum_user_can_see_post($forum, $discussion, $post, $user=NULL, $cm=NUL
|
||||
if ($forum->type == 'qanda') {
|
||||
$firstpost = forum_get_firstpost_from_discussion($discussion->id);
|
||||
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$userfirstpost = forum_get_user_posted_time($discussion->id, $user->id);
|
||||
|
||||
return (forum_user_has_posted($forum->id,$discussion->id,$user->id) ||
|
||||
$firstpost->id == $post->id ||
|
||||
return (($userfirstpost !== false && (time() - $userfirstpost >= $CFG->maxeditingtime)) ||
|
||||
$firstpost->id == $post->id || $post->userid == $user->id || $firstpost->userid == $user->id ||
|
||||
has_capability('mod/forum:viewqandawithoutposting', $modcontext, $user->id, false));
|
||||
}
|
||||
return true;
|
||||
@@ -6937,4 +6952,21 @@ function forum_get_extra_capabilities() {
|
||||
return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames', 'moodle/site:trustcontent');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns creation time of the first user's post in given discussion
|
||||
* @global object $DB
|
||||
* @param int $did Discussion id
|
||||
* @param int $userid User id
|
||||
* @return int|bool post creation time stamp or return false
|
||||
*/
|
||||
function forum_get_user_posted_time($did, $userid) {
|
||||
global $CFG;
|
||||
|
||||
$posttime = get_field('forum_posts', 'MIN(created)', 'userid', $userid, 'discussion', $did);
|
||||
if (empty($posttime)) {
|
||||
return false;
|
||||
}
|
||||
return $posttime;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -385,15 +385,12 @@
|
||||
$read->firstread = backup_todb($rea_info['#']['FIRSTREAD']['0']['#']);
|
||||
$read->lastread = backup_todb($rea_info['#']['LASTREAD']['0']['#']);
|
||||
|
||||
//Some recoding and check are performed now
|
||||
$toinsert = true;
|
||||
|
||||
//We have to recode the userid field
|
||||
$user = backup_getid($restore->backup_unique_code,"user",$read->userid);
|
||||
if ($user) {
|
||||
$read->userid = $user->new_id;
|
||||
} else {
|
||||
$toinsert = false;
|
||||
continue; // Skip this forum_read record
|
||||
}
|
||||
|
||||
//We have to recode the discussionid field
|
||||
@@ -401,7 +398,7 @@
|
||||
if ($discussion) {
|
||||
$read->discussionid = $discussion->new_id;
|
||||
} else {
|
||||
$toinsert = false;
|
||||
continue; // Skip this forum_read record
|
||||
}
|
||||
|
||||
//We have to recode the postid field
|
||||
@@ -409,14 +406,12 @@
|
||||
if ($post) {
|
||||
$read->postid = $post->new_id;
|
||||
} else {
|
||||
$toinsert = false;
|
||||
continue; // Skip this forum_read record
|
||||
}
|
||||
|
||||
//The structure is equal to the db, so insert the forum_read
|
||||
// Arrived here, the structure is equal to the db, so insert the forum_read
|
||||
$newid = 0;
|
||||
if ($toinsert) {
|
||||
$newid = insert_record ("forum_read",$read);
|
||||
}
|
||||
$newid = insert_record ("forum_read",$read);
|
||||
|
||||
//Do some output
|
||||
if (($i+1) % 50 == 0) {
|
||||
|
||||
+11
-4
@@ -189,7 +189,15 @@ function glossary_user_outline($course, $user, $mod, $glossary) {
|
||||
} else if ($grade) {
|
||||
$result = new object();
|
||||
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
|
||||
$result->time = $grade->dategraded;
|
||||
|
||||
//datesubmitted == time created. dategraded == time modified or time overridden
|
||||
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
|
||||
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
|
||||
$result->time = $grade->dategraded;
|
||||
} else {
|
||||
$result->time = $grade->datesubmitted;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -301,12 +309,11 @@ function glossary_print_recent_activity($course, $viewfullnames, $timestart) {
|
||||
if ($entrycount < GLOSSARY_RECENT_ACTIVITY_LIMIT) {
|
||||
if ($entry->approved) {
|
||||
$dimmed = '';
|
||||
$urlparams = array('g' => $entry->glossaryid, 'mode' => 'entry', 'hook' => $entry->id);
|
||||
$link = $CFG->wwwroot.'/mod/glossary/view.php?g='.$entry->glossaryid.'&mode=entry&hook='.$entry->id;
|
||||
} else {
|
||||
$dimmed = ' dimmed_text';
|
||||
$urlparams = array('id' => $ids[$entry->glossaryid], 'mode' => 'approval', 'hook' => format_text($entry->concept, true));
|
||||
$link = $CFG->wwwroot.'/mod/glossary/view.php?id='.$ids[$entry->glossaryid].'&mode=approval&hook='.format_text($entry->concept, true);
|
||||
}
|
||||
$link = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php' , $urlparams);
|
||||
echo '<div class="head'.$dimmed.'">';
|
||||
echo '<div class="date">'.userdate($entry->timemodified, $strftimerecent).'</div>';
|
||||
echo '<div class="name">'.fullname($entry, $viewfullnames).'</div>';
|
||||
|
||||
@@ -329,12 +329,12 @@
|
||||
|
||||
/// Search box
|
||||
if ($showcommonelements ) {
|
||||
echo '<form method="post" action="view.php">';
|
||||
echo '<form method="get" action="view.php">';
|
||||
|
||||
echo '<table class="boxaligncenter" width="70%" border="0">';
|
||||
echo '<tr><td align="center" class="glossarysearchbox">';
|
||||
|
||||
echo '<input type="submit" value="'.$strsearch.'" name="searchbutton" /> ';
|
||||
echo '<input type="submit" value="'.$strsearch.'" /> ';
|
||||
if ($mode == 'search') {
|
||||
echo '<input type="text" name="hook" size="20" value="'.s($hook).'" alt="'.$strsearch.'" /> ';
|
||||
} else {
|
||||
|
||||
@@ -1089,13 +1089,13 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
||||
// JCross quiztype
|
||||
|
||||
function v6_expand_CluesAcrossLabel() {
|
||||
$this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-across');
|
||||
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-across');
|
||||
}
|
||||
function v6_expand_CluesDownLabel() {
|
||||
$this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-down');
|
||||
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',clues-down');
|
||||
}
|
||||
function v6_expand_EnterCaption() {
|
||||
$this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',enter-caption');
|
||||
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',enter-caption');
|
||||
}
|
||||
function v6_expand_ShowHideClueList() {
|
||||
$value = $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-clue-list');
|
||||
|
||||
+8
-1
@@ -155,7 +155,14 @@ function lesson_user_outline($course, $user, $mod, $lesson) {
|
||||
} else {
|
||||
$grade = reset($grades->items[0]->grades);
|
||||
$return->info = get_string("grade") . ': ' . $grade->str_long_grade;
|
||||
$return->time = $grade->dategraded;
|
||||
|
||||
//datesubmitted == time created. dategraded == time modified or time overridden
|
||||
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
|
||||
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
|
||||
$result->time = $grade->dategraded;
|
||||
} else {
|
||||
$result->time = $grade->datesubmitted;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@
|
||||
$feedback = '';
|
||||
if ($quiz->grade && !is_null($bestgrade)) {
|
||||
if ($alloptions->scores) {
|
||||
$grade = "$bestgrade / $quiz->grade";
|
||||
$grade = round($bestgrade, $quiz->decimalpoints) . ' / ' . $quiz->grade;
|
||||
}
|
||||
if ($alloptions->overallfeedback) {
|
||||
$feedback = quiz_feedback_for_grade($bestgrade, $quiz->id);
|
||||
|
||||
+10
-2
@@ -186,7 +186,7 @@ function quiz_get_best_grade($quiz, $userid) {
|
||||
|
||||
// Need to detect errors/no result, without catching 0 scores.
|
||||
if (is_numeric($grade)) {
|
||||
return round($grade, $quiz->decimalpoints);
|
||||
return $grade + 0;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@@ -209,7 +209,15 @@ function quiz_user_outline($course, $user, $mod, $quiz) {
|
||||
|
||||
$result = new stdClass;
|
||||
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
|
||||
$result->time = $grade->dategraded;
|
||||
|
||||
//datesubmitted == time created. dategraded == time modified or time overridden
|
||||
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
|
||||
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
|
||||
$result->time = $grade->dategraded;
|
||||
} else {
|
||||
$result->time = $grade->datesubmitted;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ function quiz_save_best_grade($quiz, $userid = null) {
|
||||
|
||||
// Calculate the best grade
|
||||
$bestgrade = quiz_calculate_best_grade($quiz, $attempts);
|
||||
$bestgrade = quiz_rescale_grade($bestgrade, $quiz);
|
||||
$bestgrade = quiz_rescale_grade($bestgrade, $quiz, false);
|
||||
|
||||
// Save the best grade in the database
|
||||
if ($grade = get_record('quiz_grades', 'quiz', $quiz->id, 'userid', $userid)) {
|
||||
|
||||
@@ -282,6 +282,14 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
$key = 0;
|
||||
foreach ($this->_feedbacks as $feedback){
|
||||
$default_values['feedbacktext['.$key.']'] = $feedback->feedbacktext;
|
||||
if ($default_values['grade'] == 0) {
|
||||
// When a quiz is un-graded, there can only be one lot of
|
||||
// feedback. If the quiz previously had a maximum grade and
|
||||
// several lots of feedback, we must now avoid putting text
|
||||
// into input boxes that are disabled, but which the
|
||||
// validation will insist are blank.
|
||||
break;
|
||||
}
|
||||
if ($feedback->mingrade > 0) {
|
||||
$default_values['feedbackboundaries['.$key.']'] = (100.0 * $feedback->mingrade / $default_values['grade']) . '%';
|
||||
}
|
||||
|
||||
@@ -348,9 +348,22 @@ class quiz_report extends quiz_default_report {
|
||||
"END) AS gradedattempt, ";
|
||||
}
|
||||
|
||||
$select .= 'qa.uniqueid AS attemptuniqueid, qa.id AS attempt, ' .
|
||||
'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, ' .
|
||||
'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration ';
|
||||
$select .= '
|
||||
qa.uniqueid AS attemptuniqueid,
|
||||
qa.id AS attempt,
|
||||
u.id AS userid,
|
||||
u.idnumber,
|
||||
u.firstname,
|
||||
u.lastname,
|
||||
u.picture,
|
||||
u.imagealt,
|
||||
u.email,
|
||||
qa.sumgrades,
|
||||
qa.timefinish,
|
||||
qa.timestart,
|
||||
CASE WHEN qa.timefinish = 0 THEN null
|
||||
WHEN qa.timefinish > qa.timestart THEN qa.timefinish - qa.timestart
|
||||
ELSE 0 END AS duration ';
|
||||
|
||||
// This part is the same for all cases - join users and quiz_attempts tables
|
||||
$from = 'FROM '.$CFG->prefix.'user u ';
|
||||
|
||||
@@ -78,6 +78,16 @@
|
||||
redirect('view.php?q=' . $quiz->id, $message);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
|
||||
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
|
||||
// Check the users have at least one group in common.
|
||||
$teachersgroups = groups_get_activity_allowed_groups($cm);
|
||||
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
|
||||
if (!($teachersgroups && $studentsgroups &&
|
||||
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
|
||||
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
|
||||
}
|
||||
}
|
||||
|
||||
/// Bits needed to print a good URL for this page.
|
||||
|
||||
@@ -80,6 +80,16 @@
|
||||
if ($attempt->userid != $USER->id) {
|
||||
error('This is not your attempt!');
|
||||
}
|
||||
|
||||
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
|
||||
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
|
||||
// Check the users have at least one group in common.
|
||||
$teachersgroups = groups_get_activity_allowed_groups($cm);
|
||||
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
|
||||
if (!($teachersgroups && $studentsgroups &&
|
||||
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
|
||||
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
|
||||
}
|
||||
}
|
||||
|
||||
//add_to_log($course->id, 'quiz', 'review', "review.php?id=$cm->id&attempt=$attempt->id", "$quiz->id", "$cm->id");
|
||||
|
||||
+3
-3
@@ -267,11 +267,11 @@
|
||||
}
|
||||
|
||||
// Ouside the if because we may be showing feedback but not grades.
|
||||
$attemptgrade = quiz_rescale_grade($attempt->sumgrades, $quiz);
|
||||
$attemptgrade = quiz_rescale_grade($attempt->sumgrades, $quiz, false);
|
||||
|
||||
if ($gradecolumn) {
|
||||
if ($attemptoptions->scores && $attempt->timefinish > 0) {
|
||||
$formattedgrade = $attemptgrade;
|
||||
$formattedgrade = round($attemptgrade, $quiz->decimalpoints);
|
||||
// highlight the highest grade if appropriate
|
||||
if ($overallstats && $numattempts > 1 && !is_null($mygrade) && $attemptgrade == $mygrade && $quiz->grademethod == QUIZ_GRADEHIGHEST) {
|
||||
$table->rowclass[$attempt->attempt] = 'bestrow';
|
||||
@@ -313,7 +313,7 @@
|
||||
if ($available && $moreattempts) {
|
||||
$a = new stdClass;
|
||||
$a->method = quiz_get_grading_option_name($quiz->grademethod);
|
||||
$a->mygrade = $mygrade;
|
||||
$a->mygrade = round($mygrade, $quiz->decimalpoints);
|
||||
$a->quizgrade = $quiz->grade;
|
||||
$resultinfo .= print_heading(get_string('gradesofar', 'quiz', $a), '', 2, 'main', true);
|
||||
} else {
|
||||
|
||||
@@ -22,7 +22,7 @@ class mod_resource_mod_form extends moodleform_mod {
|
||||
$mform->setType('type', PARAM_ALPHA);
|
||||
$mform->setDefault('type', $type);
|
||||
|
||||
require($CFG->dirroot.'/mod/resource/type/'.$type.'/resource.class.php');
|
||||
require_once($CFG->dirroot.'/mod/resource/type/'.$type.'/resource.class.php');
|
||||
$resclass = 'resource_'.$type;
|
||||
$this->_resinstance = new $resclass();
|
||||
|
||||
|
||||
+6
-7
@@ -77,7 +77,7 @@
|
||||
if ($sco = scorm_get_sco($scoid)) {
|
||||
$userdata->course_id = $sco->identifier;
|
||||
$userdata->datafromlms = isset($sco->datafromlms)?$sco->datafromlms:'';
|
||||
$userdata->mastery_score = isset($sco->mastery_score)?$sco->mastery_score:'';
|
||||
$userdata->mastery_score = isset($sco->mastery_score) && is_numeric($sco->mastery_score)?trim($sco->mastery_score):'';
|
||||
$userdata->max_time_allowed = isset($sco->max_time_allowed)?$sco->max_time_allowed:'';
|
||||
$userdata->time_limit_action = isset($sco->time_limit_action)?$sco->time_limit_action:'';
|
||||
echo "error=0\r\nerror_text=Successful\r\naicc_data=";
|
||||
@@ -135,7 +135,7 @@
|
||||
echo "[Core_Vendor]\r\n".$userdata->datafromlms."\r\n";
|
||||
echo "[Evaluation]\r\nCourse_ID = {".$userdata->course_id."}\r\n";
|
||||
echo "[Student_Data]\r\n";
|
||||
echo 'Mastery_Score='.$userdata->mastery_score."\r\n";
|
||||
echo 'Mastery_Score='.$userdata->mastery_score."\r\n";
|
||||
echo 'Max_Time_Allowed='.$userdata->max_time_allowed."\r\n";
|
||||
echo 'Time_Limit_Action='.$userdata->time_limit_action."\r\n";
|
||||
} else {
|
||||
@@ -250,7 +250,7 @@
|
||||
$value .= $datarow."\r\n";
|
||||
next($datarows);
|
||||
}
|
||||
$value = rawurlencode(stripslashes($value));
|
||||
$value = rawurlencode(stripslashes($value));
|
||||
$id = scorm_insert_track($USER->id, $scorm->id, $sco->id, $attempt, $element, $value);
|
||||
}
|
||||
}
|
||||
@@ -260,11 +260,10 @@
|
||||
$id = scorm_insert_track($USER->id, $scorm->id, $sco->id, $attempt, 'cmi.core.lesson_status', 'browsed');
|
||||
}
|
||||
if ($mode == 'normal') {
|
||||
|
||||
if ($sco = scorm_get_sco($scoid)) {
|
||||
if (!empty($sco->mastery_score)) {
|
||||
if (!empty($score)) {
|
||||
if ($score >= $sco->mastery_score) {
|
||||
if (isset($sco->mastery_score) && is_numeric($sco->mastery_score)) {
|
||||
if ($score != '') { // $score is correctly initialized w/ an empty string, see above
|
||||
if ($score >= trim($sco->mastery_score)) {
|
||||
$lessonstatus = 'passed';
|
||||
} else {
|
||||
$lessonstatus = 'failed';
|
||||
|
||||
+4
-2
@@ -10,8 +10,10 @@
|
||||
$attempt = required_param('attempt', PARAM_INT); // new attempt
|
||||
|
||||
//IE 6 Bug workaround
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false && ini_get('zlib.output_compression') == 'On') {
|
||||
ini_set('zlib.output_compression', 'Off');
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
|
||||
@ini_set('zlib.output_compression', 'Off');
|
||||
@apache_setenv('no-gzip', 1);
|
||||
header( 'Content-Type: application/javascript' );
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
// Log every datamodel update requested
|
||||
if (substr($element,0,15) == 'adl.nav.request' || substr($element,0,3) == 'cmi') {
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
add_to_log($course->id, 'scorm', 'trk: '.trim($scorm->name).' at: '.$attempt, 'view.php?id='.$cm->id, "$element => $value", $cm->id);
|
||||
add_to_log($course->id, 'scorm', 'trk: scoid/'.$scoid.' at: '.$attempt, 'view.php?id='.$cm->id, "$element => $value", $cm->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -225,7 +225,15 @@ function scorm_user_outline($course, $user, $mod, $scorm) {
|
||||
$grade = reset($grades->items[0]->grades);
|
||||
$result = new object();
|
||||
$result->info = get_string('grade') . ': '. $grade->str_long_grade;
|
||||
$result->time = $grade->dategraded;
|
||||
|
||||
//datesubmitted == time created. dategraded == time modified or time overridden
|
||||
//if grade was last modified by the user themselves use date graded. Otherwise use date submitted
|
||||
if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) {
|
||||
$result->time = $grade->dategraded;
|
||||
} else {
|
||||
$result->time = $grade->datesubmitted;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
return null;
|
||||
@@ -664,4 +672,4 @@ function scorm_is_moddata_trusted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -730,6 +730,11 @@ function scorm_simple_play($scorm,$user, $context) {
|
||||
$result = false;
|
||||
|
||||
if ($scorm->updatefreq == UPDATE_EVERYTIME) {
|
||||
if (strpos($scorm->version, 'AICC') !== false) {
|
||||
$scorm->pkgtype = 'AICC';
|
||||
} else {
|
||||
$scorm->pkgtype = 'SCORM';
|
||||
}
|
||||
scorm_parse($scorm);
|
||||
}
|
||||
if (has_capability('mod/scorm:viewreport', $context)) { //if this user can view reports, don't skipview so they can see links to reports.
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
$newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt
|
||||
|
||||
//IE 6 Bug workaround
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false && ini_get('zlib.output_compression') == 'On') {
|
||||
ini_set('zlib.output_compression', 'Off');
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) {
|
||||
@ini_set('zlib.output_compression', 'Off');
|
||||
@apache_setenv('no-gzip', 1);
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
|
||||
@@ -292,6 +292,7 @@ class embedded_cloze_qtype extends default_questiontype {
|
||||
$feedback = '' ;
|
||||
$correctanswer = '';
|
||||
$strfeedbackwrapped = $strfeedback;
|
||||
$strclosewindow = get_string('close', 'editor');
|
||||
$testedstate = clone($state);
|
||||
if ($correctanswers = $QTYPES[$wrapped->qtype]->get_correct_responses($wrapped, $testedstate)) {
|
||||
if ($options->readonly && $options->correct_responses) {
|
||||
@@ -357,7 +358,7 @@ class embedded_cloze_qtype extends default_questiontype {
|
||||
}else {
|
||||
$strfeedbackwrapped = get_string('feedback', 'quiz');
|
||||
}
|
||||
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF');\" ".
|
||||
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF', CLOSETEXT, '$strclosewindow');\" ".
|
||||
" onmouseout=\"return nd();\" ";
|
||||
}
|
||||
|
||||
@@ -373,7 +374,7 @@ class embedded_cloze_qtype extends default_questiontype {
|
||||
if ($feedback !='' && $popup == ''){
|
||||
$strfeedbackwrapped = get_string('correctanswer', 'qtype_multianswer');
|
||||
$feedback = s(str_replace(array("\\", "'"), array("\\\\", "\\'"), $feedback));
|
||||
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF');\" ".
|
||||
$popup = " onmouseover=\"return overlib('$feedback', STICKY, MOUSEOFF, CAPTION, '$strfeedbackwrapped', FGCOLOR, '#FFFFFF', CLOSETEXT, '$strclosewindow');\" ".
|
||||
" onmouseout=\"return nd();\" ";
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ class random_qtype extends default_questiontype {
|
||||
echo 'Could not get qtype while recoding question random-'.$answerregs[1].'<br />';
|
||||
return($answer_field);
|
||||
}
|
||||
$newstate = $state;
|
||||
$newstate = clone($state);
|
||||
$newstate->question = $wrapped->new_id;
|
||||
$newstate->answer = $answerregs[2];
|
||||
$answer_field = 'random'.$wrapped->new_id.'-';
|
||||
|
||||
+102
-49
@@ -495,14 +495,14 @@ function tag_delete($tagids) {
|
||||
}
|
||||
|
||||
$success = true;
|
||||
foreach( $tagids as $tagid ) {
|
||||
foreach ($tagids as $tagid) {
|
||||
if (is_null($tagid)) { // can happen if tag doesn't exists
|
||||
continue;
|
||||
}
|
||||
// only delete the main entry if there were no problems deleting all the
|
||||
// instances - that (and the fact we won't often delete lots of tags)
|
||||
// is the reason for not using delete_records_select()
|
||||
if ( delete_records('tag_instance', 'tagid', $tagid) ) {
|
||||
if (delete_records('tag_instance', 'tagid', $tagid) && delete_records('tag_correlation', 'tagid', $tagid)) {
|
||||
$success &= (bool) delete_records('tag', 'id', $tagid);
|
||||
}
|
||||
}
|
||||
@@ -758,59 +758,109 @@ function tag_cleanup() {
|
||||
* It works as a cache for a potentially heavy load query done at the 'tag_instance' table.
|
||||
* So, the 'tag_correlation' table stores redundant information derived from the 'tag_instance' table.
|
||||
*
|
||||
* @param number $min_correlation cutoff percentage (optional, default is 2)
|
||||
* @param number $mincorrelation cutoff percentage (optional, default is 2)
|
||||
*/
|
||||
function tag_compute_correlations($min_correlation=2) {
|
||||
|
||||
function tag_compute_correlations($mincorrelation = 2) {
|
||||
global $CFG;
|
||||
|
||||
if (!$all_tags = get_records_list('tag')) {
|
||||
return;
|
||||
}
|
||||
$mincorrelation = (int)$mincorrelation;
|
||||
// This mighty one line query fetches a row from the database for every
|
||||
// individual tag correlation. We then need to process the rows collecting
|
||||
// the correlations for each tag id.
|
||||
// The fields used by this query are as follows:
|
||||
// tagid : This is the tag id, there should be at least $mincorrelation
|
||||
// rows for each tag id.
|
||||
// correlation : This is the tag id that correlates to the above tagid field.
|
||||
// correlationid : This is the id of the row in the tag_correlation table that
|
||||
// relates to the tagid field and will be NULL if there are no
|
||||
// existing correlations
|
||||
$sql = "SELECT pairs.tagid, pairs.correlation, pairs.ocurrences, co.id AS correlationid
|
||||
FROM (
|
||||
SELECT ta.tagid, tb.tagid AS correlation, COUNT(*) AS ocurrences
|
||||
FROM {$CFG->prefix}tag_instance ta
|
||||
JOIN {$CFG->prefix}tag_instance tb ON (ta.itemtype = tb.itemtype AND ta.itemid = tb.itemid AND ta.tagid <> tb.tagid)
|
||||
GROUP BY ta.tagid, tb.tagid
|
||||
HAVING COUNT(*) > $mincorrelation
|
||||
) pairs
|
||||
LEFT JOIN {$CFG->prefix}tag_correlation co ON co.tagid = pairs.tagid
|
||||
ORDER BY pairs.tagid ASC, pairs.ocurrences DESC, pairs.correlation ASC";
|
||||
$rs = get_recordset_sql($sql);
|
||||
|
||||
$tag_correlation_obj = new object();
|
||||
foreach($all_tags as $tag) {
|
||||
// Set up an empty tag correlation object
|
||||
$tagcorrelation = new stdClass;
|
||||
$tagcorrelation->id = null;
|
||||
$tagcorrelation->tagid = null;
|
||||
$tagcorrelation->correlatedtags = array();
|
||||
|
||||
// query that counts how many times any tag appears together in items
|
||||
// with the tag passed as argument ($tag_id)
|
||||
$query = "SELECT tb.tagid ".
|
||||
"FROM {$CFG->prefix}tag_instance ta INNER JOIN {$CFG->prefix}tag_instance tb ON ta.itemid = tb.itemid ".
|
||||
"WHERE ta.tagid = {$tag->id} AND tb.tagid != {$tag->id} ".
|
||||
"GROUP BY tb.tagid ".
|
||||
"HAVING COUNT(*) > $min_correlation ".
|
||||
"ORDER BY COUNT(*) DESC";
|
||||
// We store each correction id in this array so we can remove any correlations
|
||||
// that no longer exist.
|
||||
$correlations = array();
|
||||
|
||||
$correlated = array();
|
||||
|
||||
// Correlated tags happen when they appear together in more occasions
|
||||
// than $min_correlation.
|
||||
if ($tag_correlations = get_records_sql($query)) {
|
||||
foreach($tag_correlations as $correlation) {
|
||||
// commented out - now done in query. kept here in case it breaks on some db
|
||||
// if($correlation->nr >= $min_correlation){
|
||||
$correlated[] = $correlation->tagid;
|
||||
// }
|
||||
// Iterate each row of the result set and build them into tag correlations.
|
||||
while ($row = rs_fetch_next_record($rs)) {
|
||||
if ($row->tagid != $tagcorrelation->tagid) {
|
||||
// The tag id has changed so its now time to process the tag
|
||||
// correlation information we have.
|
||||
$tagcorrelationid = tag_process_computed_correlation($tagcorrelation);
|
||||
if ($tagcorrelationid) {
|
||||
$correlations[] = $tagcorrelationid;
|
||||
}
|
||||
// Now we reset the tag correlation object so we can reuse it and set it
|
||||
// up for the current record.
|
||||
$tagcorrelation = new stdClass;
|
||||
$tagcorrelation->id = $row->correlationid;
|
||||
$tagcorrelation->tagid = $row->tagid;
|
||||
$tagcorrelation->correlatedtags = array();
|
||||
}
|
||||
|
||||
if (empty($correlated)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$correlated = implode(',', $correlated);
|
||||
//var_dump($correlated);
|
||||
|
||||
//saves correlation info in the caching table
|
||||
if ($tag_correlation_obj = get_record('tag_correlation', 'tagid', $tag->id, '', '', '', '', 'id')) {
|
||||
$tag_correlation_obj->correlatedtags = $correlated;
|
||||
update_record('tag_correlation', $tag_correlation_obj);
|
||||
} else {
|
||||
$tag_correlation_obj = new stdClass();
|
||||
$tag_correlation_obj->tagid = $tag->id;
|
||||
$tag_correlation_obj->correlatedtags = $correlated;
|
||||
insert_record('tag_correlation', $tag_correlation_obj);
|
||||
}
|
||||
$tagcorrelation->correlatedtags[] = $row->correlation;
|
||||
}
|
||||
// Update the current correlation after the last record.
|
||||
$tagcorrelationid = tag_process_computed_correlation($tagcorrelation);
|
||||
if ($tagcorrelationid) {
|
||||
$correlations[] = $tagcorrelationid;
|
||||
}
|
||||
|
||||
// Close the recordset
|
||||
rs_close($rs);
|
||||
|
||||
// Remove any correlations that weren't just identified
|
||||
if (empty($correlations)) {
|
||||
//there are no correlations so delete any in the database
|
||||
delete_records('tag_correlation');
|
||||
} else {
|
||||
delete_records_select('tag_correlation', 'id NOT IN ('.join(',', $correlations).')');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function processes a tag correlation and makes changes in the database
|
||||
* as required.
|
||||
*
|
||||
* The tag correlation object needs have both a tagid property and a correlatedtags
|
||||
* property that is an array.
|
||||
*
|
||||
* @param stdClass $tagcorrelation
|
||||
* @return int The id of the tag correlation that was just processed.
|
||||
*/
|
||||
function tag_process_computed_correlation(stdClass $tagcorrelation) {
|
||||
|
||||
// You must provide a tagid and correlatedtags must be set and be an array
|
||||
if (empty($tagcorrelation->tagid) || !isset($tagcorrelation->correlatedtags) || !is_array($tagcorrelation->correlatedtags)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The row tagid doesn't match the current tag id which means we are onto
|
||||
// the next tag. Before we switch over we need to either insert or update
|
||||
// the correlation.
|
||||
$tagcorrelation->correlatedtags = join(',', $tagcorrelation->correlatedtags);
|
||||
if (!empty($tagcorrelation->id)) {
|
||||
// The tag correlation already exists so update it
|
||||
update_record('tag_correlation', $tagcorrelation);
|
||||
} else {
|
||||
// This is a new correlation to insert
|
||||
$tagcorrelation->id = insert_record('tag_correlation', $tagcorrelation, true);
|
||||
}
|
||||
return $tagcorrelation->id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -894,9 +944,12 @@ function tag_get_correlated($tag_id, $limitnum=null) {
|
||||
}
|
||||
|
||||
// this is (and has to) return the same fields as the query in tag_get_tags
|
||||
if ( !$result = get_records_sql("SELECT tg.id, tg.tagtype, tg.name, tg.rawname, tg.flag, ti.ordering ".
|
||||
"FROM {$CFG->prefix}tag tg INNER JOIN {$CFG->prefix}tag_instance ti ON tg.id = ti.tagid ".
|
||||
"WHERE tg.id IN ({$tag_correlation->correlatedtags})") ) {
|
||||
$sql = "SELECT tg.id, tg.tagtype, tg.name, tg.rawname, tg.flag, ti.ordering
|
||||
FROM {$CFG->prefix}tag tg
|
||||
INNER JOIN {$CFG->prefix}tag_instance ti ON tg.id = ti.tagid
|
||||
WHERE tg.id IN ({$tag_correlation->correlatedtags})";
|
||||
$result = get_records_sql($sql);
|
||||
if (!$result) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ form.mform div.textarea textarea {
|
||||
width:30px
|
||||
}
|
||||
#course-view .section .left a {
|
||||
display:none
|
||||
/* display:none */
|
||||
}
|
||||
#course-view .section .spacer {
|
||||
height:2em
|
||||
|
||||
@@ -27,7 +27,6 @@ class user_edit_form extends moodleform {
|
||||
useredit_shared_definition($mform);
|
||||
|
||||
/// extra settigs
|
||||
$mform->addRule('description', $strrequired, 'required', null, 'client');
|
||||
if (!empty($CFG->gdversion) and !empty($CFG->disableuserimages)) {
|
||||
$mform->removeElement('deletepicture');
|
||||
$mform->removeElement('imagefile');
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2007101591.02; // YYYYMMDD = date of the 1.9 branch (don't change)
|
||||
$version = 2007101591.04; // YYYYMMDD = date of the 1.9 branch (don't change)
|
||||
// X = release number 1.9.[0,1,2,3,4,5...]
|
||||
// Y.YY = micro-increments between releases
|
||||
|
||||
$release = '1.9.11 (Build: 20110221)'; // Human-friendly version name
|
||||
$release = '1.9.13 (Build: 20110801)'; // Human-friendly version name
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user