// NOTE: if you are using custompix in your theme, see /fixpix.php.
//
// special magic evil developer only wanting to edit the xmldb files manually
-// uncomment these if you're lazy like Penny
+// AND don't use the XMLDBEditor nor the prev/next stuff at all (Mahara and others)
+// Uncomment these if you're lazy like Penny
// $CFG->xmldbdisablecommentchecking = true;
// $CFG->xmldbdisablenextprevchecking = true;
//
+// special magig evil developer only wanting to edit xmldb files manually
+// AND allowing the XMLDBEditor to recostruct the prev/next elements every
+// time one file is loaded and saved (Moodle).
+// Uncomment this if you're lazy like Petr
+// $CFG->xmldbreconstructprevnext = true;
+//
// Set the priority of themes from highest to lowest. This is useful (for
// example) in sites where the user theme should override all other theme
// settings for accessibility reasons. You can also disable types of themes
return $result;
}
+ /**
+ * Reconstruct previous/next attributes.
+ */
+ function fixPrevNext(&$arr) {
+ global $CFG;
+
+ if (empty($CFG->xmldbreconstructprevnext)) {
+ return false;
+ }
+ $tweaked = false;
+
+ $prev = null;
+ foreach ($arr as $key=>$el) {
+ $prev_value = $arr[$key]->previous;
+ $next_value = $arr[$key]->next;
+
+ $arr[$key]->next = null;
+ $arr[$key]->previous = null;
+ if ($prev !== null) {
+ $arr[$prev]->next = $arr[$key]->name;
+ $arr[$key]->previous = $arr[$prev]->name;
+ }
+ $prev = $key;
+
+ if ($prev_value != $arr[$key]->previous or $next_value != $arr[$key]->next) {
+ $tweaked = true;
+ }
+ }
+
+ return $tweaked;
+ }
+
/**
* This function will check that all the elements in one array
* have a consistent info in their previous/next fields
$result = false;
}
/// Check previous & next are ok (duplicates and existing tables)
+ $this->fixPrevNext($this->tables);
if ($result && !$this->checkPreviousNextValues($this->tables)) {
$this->errormsg = 'Some TABLES previous/next values are incorrect';
$this->debug($this->errormsg);
$result = false;
}
/// Check previous & next are ok (duplicates and existing statements)
+ $this->fixPrevNext($this->statements);
if ($result && !$this->checkPreviousNextValues($this->statements)) {
$this->errormsg = 'Some STATEMENTS previous/next values are incorrect';
$this->debug($this->errormsg);
$result = false;
}
/// Check previous & next are ok (duplicates and existing fields)
+ $this->fixPrevNext($this->fields);
if ($result && !$this->checkPreviousNextValues($this->fields)) {
$this->errormsg = 'Some FIELDS previous/next values are incorrect';
$this->debug($this->errormsg);
$result = false;
}
/// Check previous & next are ok (duplicates and existing keys)
+ $this->fixPrevNext($this->keys);
if ($result && !$this->checkPreviousNextValues($this->keys)) {
$this->errormsg = 'Some KEYS previous/next values are incorrect';
$this->debug($this->errormsg);
$result = false;
}
/// Check previous & next are ok (duplicates and existing INDEXES)
+ $this->fixPrevNext($this->indexes);
if ($result && !$this->checkPreviousNextValues($this->indexes)) {
$this->errormsg = 'Some INDEXES previous/next values are incorrect';
$this->debug($this->errormsg);