echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
echo '<td class="left side"> </td>';
- if (!empty($USER->ajax) && $editing) {
+
+ if (ajaxenabled() && $editing) {
// Temporarily hide the dates for the weeks. We do it this way
// for now. Eventually, we'll have to modify the javascript code
// to handle re-calculation of dates when sections are moved
$weekperiod = $weekday.' '.$endweekday;
}
+
echo '<td class="content">';
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
echo '<div class="weekdates">'.$weekperiod.' ('.get_string('notavailable').')</div>';
global $CFG;
$output = '';
- if (!check_browser_version('MSIE', 6.0)
- && !check_browser_version('Firefox', 1.5)
- && !check_browser_version('Camino', '1.0.2')) {
- // We still have issues with AJAX in other browsers.
+ if (!ajaxenabled()) {
return;
}
}
+/**
+ * Returns whether ajax is enabled/allowed or not.
+ */
+function ajaxenabled() {
+
+ global $CFG, $USER;
+
+ if (!check_browser_version('MSIE', 6.0)
+ && !check_browser_version('Firefox', 1.5)
+ && !check_browser_version('Camino', '1.0.2')) {
+ // We still have issues with AJAX in other browsers.
+ return false;
+ }
+
+ if (!empty($CFG->enableajax) && !empty($USER->ajax)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
/**
* Used to create view of document to be passed to JavaScript on pageload.
* We use this class to pass data from PHP to JavaScript.
main.connect('POST', 'class=course&field=marker', null, 'value=0');
this.toggle_highlight();
}
-}
+}
section_class.prototype.changeId = function(newId) {
this.sectionId = newId;
- this.numberDisplay.firstChild.data = newId;
+ this.numberDisplay.firstChild.data = newId;
//main.connectQueue_add('POST','class=section&field=all',null,'id='+newId+"&summary="+main.mk_safe_for_transport(this.summary)+"&sequence="+this.write_sequence_list(true)+'&visible='+(this.hidden?0:1))
if (main.marker == this) {
- main.update_marker(this);
+ main.update_marker(this);
}
}
} else {
if (el.hiddenStored != null) {
el.toggle_hide(null, null, true, el.hiddenStored);
- el.hiddenStored = null;
+ el.hiddenStored = null;
}
}
//update model