MDL-32003 fix xmldb editor code indentations, phpdocs and PHP4-isms

This commit is contained in:
Petr Skoda 2012-06-06 10:10:38 +02:00
parent a6d9d4efc2
commit 85d6dd382e
60 changed files with 446 additions and 546 deletions

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -27,35 +26,35 @@
* Main xmldb action class. It implements all the basic
* functionalities to be shared by each action.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class XMLDBAction {
var $does_generate; //Type of value returned by the invoke method
//ACTION_GENERATE_HTML have contents to show
//set by each specialized invoke
/** @var bool Type of value returned by the invoke method, ACTION_GENERATE_HTML have contents to show, set by each specialized invoke*/
protected $does_generate;
var $title; //Title of the Action (class name, by default)
//set by parent init automatically
/** @var string Title of the Action (class name, by default), set by parent init automatically*/
protected $title;
var $str; //Strings used by the action
//set by each specialized init, calling loadStrings
/** @var string Strings used by the action set by each specialized init, calling loadStrings*/
protected $str;
var $output; //Output of the action
//set by each specialized invoke, get with getOutput
/** @var string Output of the action, set by each specialized invoke, get with getOutput*/
protected $output;
var $errormsg; //Last Error produced. Check when any invoke returns false
//get with getError
/** @var string Last Error produced. Check when any invoke returns false, get with getError*/
protected $errormsg;
var $postaction; //Action to execute at the end of the invoke script
/** @var string Action to execute at the end of the invoke script*/
protected $postaction;
var $sesskey_protected; // Actions must be protected by sesskey mechanism
/** @var bool Actions must be protected by sesskey mechanism*/
protected $sesskey_protected;
/**
* Constructor to keep PHP5 happy
* Constructor
*/
function __construct() {
$this->init();
@ -76,7 +75,8 @@ class XMLDBAction {
}
/**
* returns the type of output of the file
* Returns the type of output of the file
* @return bool
*/
function getDoesGenerate() {
return $this->does_generate;
@ -85,6 +85,7 @@ class XMLDBAction {
/**
* getError method, returns the last error string.
* Used if the invoke() methods returns false
* @return string
*/
function getError() {
return $this->errormsg;
@ -93,6 +94,7 @@ class XMLDBAction {
/**
* getOutput method, returns the output generated by the action.
* Used after execution of the invoke() methods if they return true
* @return string
*/
function getOutput() {
return $this->output;
@ -101,6 +103,7 @@ class XMLDBAction {
/**
* getPostAction method, returns the action to launch after executing
* another one
* @return string
*/
function getPostAction() {
return $this->postaction;
@ -109,6 +112,7 @@ class XMLDBAction {
/**
* getTitle method returns the title of the action (that is part
* of the $str array attribute
* @return string
*/
function getTitle() {
return $this->str['title'];
@ -117,6 +121,7 @@ class XMLDBAction {
/**
* loadStrings method, loads the required strings specified in the
* array parameter
* @params array $strings
*/
function loadStrings($strings) {
// Load some commonly used strings
@ -162,6 +167,8 @@ class XMLDBAction {
/**
* launch method, used to easily call invoke methods between actions
* @param string $action
* @return mixed
*/
function launch($action) {

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2008 onwards Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This is a base class for the various actions that interate over all the
* tables and check some aspect of their definition.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2008 onwards Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -117,7 +115,7 @@ abstract class XMLDBCheckAction extends XMLDBAction {
// Iterate over $XMLDB->dbdirs, loading their XML data to memory
if ($XMLDB->dbdirs) {
$dbdirs =& $XMLDB->dbdirs;
$dbdirs = $XMLDB->dbdirs;
$o='<ul>';
foreach ($dbdirs as $dbdir) {
// Only if the directory exists

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* reporting about the ones not physically implemented as BIGINTs
* and providing one SQL script to fix all them. MDL-11038
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -26,8 +25,7 @@
* match those specified in the xml specs
* and providing one SQL script to fix all them.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -30,8 +29,7 @@
* Each 0 in that column will violate the foreign key, but we ignore them.
* If you want a strict check performed, then add &strict=1 to the URL.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -26,8 +25,7 @@
* with the physical DB implementation, reporting about all the missing
* indexes to be created to be 100% ok.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package xmldb-editor
* @package tool_xmldb
* @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -28,7 +28,7 @@
* them by changing to cross-db (CHAR) length semantics.
* See MDL-29322 for more details.
*
* @package xmldb-editor
* @package tool_xmldb
* @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,15 +15,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will delete completely one field
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -96,21 +94,21 @@ class delete_field extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Move adjacent fields prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$fields =& $table->getFields();
$field =& $table->getField($fieldparam);
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$fields = $table->getFields();
$field = $table->getField($fieldparam);
if ($field->getPrevious()) {
$prev =& $table->getField($field->getPrevious());
$prev = $table->getField($field->getPrevious());
$prev->setNext($field->getNext());
}
if ($field->getNext()) {
$next =& $table->getField($field->getNext());
$next = $table->getField($field->getNext());
$next->setPrevious($field->getPrevious());
}
// Remove the field
@ -121,7 +119,7 @@ class delete_field extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will delete completely one index
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -96,21 +94,21 @@ class delete_index extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Move adjacent indexes prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$indexes =& $table->getIndexes();
$index =& $table->getIndex($indexparam);
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$indexes = $table->getIndexes();
$index = $table->getIndex($indexparam);
if ($index->getPrevious()) {
$prev =& $table->getIndex($index->getPrevious());
$prev = $table->getIndex($index->getPrevious());
$prev->setNext($index->getNext());
}
if ($index->getNext()) {
$next =& $table->getIndex($index->getNext());
$next = $table->getIndex($index->getNext());
$next->setPrevious($index->getPrevious());
}
// Remove the index
@ -121,7 +119,7 @@ class delete_index extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will delete completely one key
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -96,21 +94,21 @@ class delete_key extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Move adjacent keys prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$keys =& $table->getKeys();
$key =& $table->getKey($keyparam);
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$keys = $table->getKeys();
$key = $table->getKey($keyparam);
if ($key->getPrevious()) {
$prev =& $table->getKey($key->getPrevious());
$prev = $table->getKey($key->getPrevious());
$prev->setNext($key->getNext());
}
if ($key->getNext()) {
$next =& $table->getKey($key->getNext());
$next = $table->getKey($key->getNext());
$next->setPrevious($key->getPrevious());
}
// Remove the key
@ -121,7 +119,7 @@ class delete_key extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will delete completely one table
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -95,10 +93,10 @@ class delete_table extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Remove the table
$structure->deleteTable($tableparam);
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will delete completely one XML file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -94,7 +92,7 @@ class delete_xml_file extends XMLDBAction {
// Get the original dir and delete the xml file
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
@unlink($dirpath . '/install.xml');
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will provide the interface for all the edit field actions
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -75,30 +73,30 @@ class edit_field extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$fieldparam = required_param('field', PARAM_CLEAN);
if (!$field =& $table->getField($fieldparam)) {
if (!$field = $table->getField($fieldparam)) {
// Arriving here from a name change, looking for the new field name
$fieldparam = required_param('name', PARAM_CLEAN);
$field =& $table->getField($fieldparam);
$field = $table->getField($fieldparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
$o = ''; // Output starts
@ -136,9 +134,9 @@ class edit_field extends XMLDBAction {
XMLDB_TYPE_CHAR => $field->getXMLDBTypeName(XMLDB_TYPE_CHAR),
XMLDB_TYPE_TEXT => $field->getXMLDBTypeName(XMLDB_TYPE_TEXT),
XMLDB_TYPE_BINARY => $field->getXMLDBTypeName(XMLDB_TYPE_BINARY));
// If current field isnt float, delete such column type to avoid its creation from the interface
// If current field isn't float, delete such column type to avoid its creation from the interface
// Note that float fields are supported completely but it's possible than in a next future
// we delete them completely from Moodle DB, using, exlusively, number(x,y) types
// we delete them completely from Moodle DB, using, exclusively, number(x,y) types
if ($field->getType() != XMLDB_TYPE_FLOAT) {
unset ($typeoptions[XMLDB_TYPE_FLOAT]);
}

View File

@ -14,8 +14,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class verifies all the data introduced when editing a field for correctness,
* performing changes / displaying errors depending of the results.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -99,10 +97,10 @@ class edit_field_save extends XMLDBAction {
$default = optional_param('default', NULL, PARAM_PATH);
$default = trim($default);
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$field =& $table->getField($fieldparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$field = $table->getField($fieldparam);
$oldhash = $field->getHash();
$errors = array(); // To store all the errors found
@ -225,12 +223,12 @@ class edit_field_save extends XMLDBAction {
if ($fieldparam != $name) {
$field->setName($name);
if ($field->getPrevious()) {
$prev =& $table->getField($field->getPrevious());
$prev = $table->getField($field->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($field->getNext()) {
$next =& $table->getField($field->getNext());
$next = $table->getField($field->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,7 +23,7 @@
/**
* This class will provide the interface for all the edit index actions
*
* @package xmldb-editor
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -73,30 +72,30 @@ class edit_index extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$indexparam = required_param('index', PARAM_CLEAN);
if (!$index =& $table->getIndex($indexparam)) {
if (!$index = $table->getIndex($indexparam)) {
// Arriving here from a name change, looking for the new key name
$indexparam = required_param('name', PARAM_CLEAN);
$index =& $table->getIndex($indexparam);
$index = $table->getIndex($indexparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class verifies all the data introduced when editing an index for correctness,
* performing changes / displaying errors depending of the results.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -93,10 +91,10 @@ class edit_index_save extends XMLDBAction {
$fields = required_param('fields', PARAM_CLEAN);
$fields = str_replace(' ', '', trim(strtolower($fields)));
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$index =& $table->getIndex($indexparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$index = $table->getIndex($indexparam);
$oldhash = $index->getHash();
$errors = array(); // To store all the errors found
@ -182,12 +180,12 @@ class edit_index_save extends XMLDBAction {
if ($indexparam != $name) {
$index->setName($name);
if ($index->getPrevious()) {
$prev =& $table->getIndex($index->getPrevious());
$prev = $table->getIndex($index->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($index->getNext()) {
$next =& $table->getIndex($index->getNext());
$next = $table->getIndex($index->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will provide the interface for all the edit key actions
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -74,30 +72,30 @@ class edit_key extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$keyparam = required_param('key', PARAM_CLEAN);
if (!$key =& $table->getKey($keyparam)) {
if (!$key = $table->getKey($keyparam)) {
// Arriving here from a name change, looking for the new key name
$keyparam = required_param('name', PARAM_CLEAN);
$key =& $table->getKey($keyparam);
$key = $table->getKey($keyparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';

View File

@ -14,8 +14,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class verifies all the data introduced when editing a key for correctness,
* performing changes / displaying errors depending of the results.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -106,10 +104,10 @@ class edit_key_save extends XMLDBAction {
$reffields = str_replace(' ', '', trim(strtolower($reffields)));
}
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$key =& $table->getKey($keyparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$key = $table->getKey($keyparam);
$oldhash = $key->getHash();
$errors = array(); // To store all the errors found
@ -254,16 +252,16 @@ class edit_key_save extends XMLDBAction {
// Continue if we aren't under errors
if (empty($errors)) {
// If there is one name change, do it, changing the prev and next
// atributes of the adjacent fields
// attributes of the adjacent fields
if ($keyparam != $name) {
$key->setName($name);
if ($key->getPrevious()) {
$prev =& $table->getKey($key->getPrevious());
$prev = $table->getKey($key->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($key->getNext()) {
$next =& $table->getKey($key->getNext());
$next = $table->getKey($key->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -28,8 +27,7 @@
* can be invoked, plus links to PHP code generator, view SQL, rearrange
* elements and so on.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -93,7 +91,7 @@ class edit_table extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
@ -104,19 +102,19 @@ class edit_table extends XMLDBAction {
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
// Arriving here from a name change, looking for the new table name
$tableparam = required_param('name', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
@ -193,7 +191,7 @@ class edit_table extends XMLDBAction {
$table->deleteIndex('changeme');
// Add the fields list
$fields =& $table->getFields();
$fields = $table->getFields();
if (!empty($fields)) {
$o .= '<h3 class="main">' . $this->str['fields'] . '</h3>';
$o .= '<table id="listfields" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
@ -251,7 +249,7 @@ class edit_table extends XMLDBAction {
$o .= '</table>';
}
// Add the keys list
$keys =& $table->getKeys();
$keys = $table->getKeys();
if (!empty($keys)) {
$o .= '<h3 class="main">' . $this->str['keys'] . '</h3>';
$o .= '<table id="listkeys" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
@ -304,7 +302,7 @@ class edit_table extends XMLDBAction {
$o .= '</table>';
}
// Add the indexes list
$indexes =& $table->getIndexes();
$indexes = $table->getIndexes();
if (!empty($indexes)) {
$o .= '<h3 class="main">' . $this->str['indexes'] . '</h3>';
$o .= '<table id="listindexes" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will save changes in table name and/or comments
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -81,11 +79,11 @@ class edit_table_save extends XMLDBAction {
$comment = required_param('comment', PARAM_CLEAN);
$comment = $comment;
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$errors = array(); // To store all the errors found
@ -120,12 +118,12 @@ class edit_table_save extends XMLDBAction {
if ($tableparam != $name) {
$table->setName($name);
if ($table->getPrevious()) {
$prev =& $structure->getTable($table->getPrevious());
$prev = $structure->getTable($table->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($table->getNext()) {
$next =& $structure->getTable($table->getNext());
$next = $structure->getTable($table->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
@ -145,7 +143,7 @@ class edit_table_save extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -27,8 +26,7 @@
* Main page to start editing one XML file. From here it's possible to access
* to tables edition plus PHP code generation and other utilities
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -90,7 +88,7 @@ class edit_xml_file extends XMLDBAction {
// Get the correct dir
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
// Only if the directory exists and it has been loaded
if (!$dbdir->path_exists || !$dbdir->xml_loaded) {
@ -105,8 +103,8 @@ class edit_xml_file extends XMLDBAction {
$XMLDB->editeddirs[$dirpath] = unserialize(serialize($dbdir));
}
// Get it
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will save the changes performed to the comment of one file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -76,16 +74,16 @@ class edit_xml_file_save extends XMLDBAction {
$comment = $comment;
// Set comment and recalculate hash
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$structure->setComment($comment);
$structure->calculateHash(true);
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $origdir->xml_file->getStructure();
$origdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $origdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class will produce the documentation for all the XMLDB files in the server,
* via XSL, performing the output in HTML format.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will produce XSL documentation for the loaded XML file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class will will check all the db directories existing under the
* current Moodle installation, sending them to the SESSION->dbdirs array
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will load one XML file to memory if necessary
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -74,7 +72,7 @@ class load_xml_file extends XMLDBAction {
// Get the correct dir
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
// Set some defaults
$dbdir->xml_exists = false;

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will load every XML file to memory if necessary
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,7 +67,7 @@ class load_xml_files extends XMLDBAction {
// Iterate over $XMLDB->dbdirs, loading their XML data to memory
if ($XMLDB->dbdirs) {
$dbdirs =& $XMLDB->dbdirs;
$dbdirs = $XMLDB->dbdirs;
foreach ($dbdirs as $dbdir) {
// Set some defaults
$dbdir->xml_exists = false;

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -27,8 +26,7 @@
* From here, files can be created, edited, saved and deleted, plus some
* extra utilities like displaying docs, xml info and performing various consistency tests
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -134,9 +132,9 @@ class main_view extends XMLDBAction {
if (!isset($dbdir->has_changed) && isset($dbdir->xml_loaded)) {
$dbdir->xml_changed = false;
if (isset($XMLDB->editeddirs[$key])) {
$editeddir =& $XMLDB->editeddirs[$key];
$editeddir = $XMLDB->editeddirs[$key];
if (isset($editeddir->xml_file)) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
if ($structure->hasChanged()) {
$dbdir->xml_changed = true;
$editeddir->xml_changed = true;
@ -197,7 +195,7 @@ class main_view extends XMLDBAction {
// Check if the file has been manually edited while being modified in the editor
if ($dbdir->filemtime != filemtime($key . '/install.xml')) {
// File manually modified. Add to errors.
if ($structure =& $dbdir->xml_file->getStructure()) {
if ($structure = $dbdir->xml_file->getStructure()) {
$structure->errormsg = 'Warning: File locally modified while using the XMLDB Editor. Saving will overwrite local changes';
}
}
@ -267,7 +265,7 @@ class main_view extends XMLDBAction {
$row = ($row + 1) % 2;
// show errors if they exist
if (isset($dbdir->xml_file)) {
if ($structure =& $dbdir->xml_file->getStructure()) {
if ($structure = $dbdir->xml_file->getStructure()) {
if ($errors = $structure->getAllErrors()) {
if ($hithis) {
$o .= '<tr class="highlight"><td class="error cell" colspan="10">' . implode (', ', $errors) . '</td></tr>';

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will will move one field up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,13 +67,13 @@ class move_updown_field extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
@ -83,20 +81,20 @@ class move_updown_field extends XMLDBAction {
$tableparam = required_param('table', PARAM_CLEAN);
$fieldparam = required_param('field', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$fields =& $table->getFields();
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$fields = $table->getFields();
if ($direction == 'down') {
$field =& $table->getField($fieldparam);
$swap =& $table->getField($field->getNext());
$field = $table->getField($fieldparam);
$swap = $table->getField($field->getNext());
} else {
$swap =& $table->getField($fieldparam);
$field =& $table->getField($swap->getPrevious());
$swap = $table->getField($fieldparam);
$field = $table->getField($swap->getPrevious());
}
// Change the field before the pair
if ($field->getPrevious()) {
$prev =& $table->getField($field->getPrevious());
$prev = $table->getField($field->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@ -105,7 +103,7 @@ class move_updown_field extends XMLDBAction {
}
// Change the field after the pair
if ($swap->getNext()) {
$next =& $table->getField($swap->getNext());
$next = $table->getField($swap->getNext());
$next->setPrevious($field->getName());
$field->setNext($next->getName());
$next->setChanged(true);
@ -131,7 +129,7 @@ class move_updown_field extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will will move one index up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,13 +67,13 @@ class move_updown_index extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
@ -83,20 +81,20 @@ class move_updown_index extends XMLDBAction {
$tableparam = required_param('table', PARAM_CLEAN);
$indexparam = required_param('index', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$indexes =& $table->getIndexes();
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$indexes = $table->getIndexes();
if ($direction == 'down') {
$index =& $table->getIndex($indexparam);
$swap =& $table->getIndex($index->getNext());
$index = $table->getIndex($indexparam);
$swap = $table->getIndex($index->getNext());
} else {
$swap =& $table->getIndex($indexparam);
$index =& $table->getIndex($swap->getPrevious());
$swap = $table->getIndex($indexparam);
$index = $table->getIndex($swap->getPrevious());
}
// Change the index before the pair
if ($index->getPrevious()) {
$prev =& $table->getIndex($index->getPrevious());
$prev = $table->getIndex($index->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@ -105,7 +103,7 @@ class move_updown_index extends XMLDBAction {
}
// Change the field after the pair
if ($swap->getNext()) {
$next =& $table->getIndex($swap->getNext());
$next = $table->getIndex($swap->getNext());
$next->setPrevious($index->getName());
$index->setNext($next->getName());
$next->setChanged(true);
@ -131,7 +129,7 @@ class move_updown_index extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will will move one key up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,13 +67,13 @@ class move_updown_key extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
@ -83,20 +81,20 @@ class move_updown_key extends XMLDBAction {
$tableparam = required_param('table', PARAM_CLEAN);
$keyparam = required_param('key', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$keys =& $table->getKeys();
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$keys = $table->getKeys();
if ($direction == 'down') {
$key =& $table->getKey($keyparam);
$swap =& $table->getKey($key->getNext());
$key = $table->getKey($keyparam);
$swap = $table->getKey($key->getNext());
} else {
$swap =& $table->getKey($keyparam);
$key =& $table->getKey($swap->getPrevious());
$swap = $table->getKey($keyparam);
$key = $table->getKey($swap->getPrevious());
}
// Change the key before the pair
if ($key->getPrevious()) {
$prev =& $table->getKey($key->getPrevious());
$prev = $table->getKey($key->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@ -105,7 +103,7 @@ class move_updown_key extends XMLDBAction {
}
// Change the key after the pair
if ($swap->getNext()) {
$next =& $table->getKey($swap->getNext());
$next = $table->getKey($swap->getNext());
$next->setPrevious($key->getName());
$key->setNext($next->getName());
$next->setChanged(true);
@ -131,7 +129,7 @@ class move_updown_key extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will will move table up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,31 +67,31 @@ class move_updown_table extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
$next = NULL;
$tableparam = required_param('table', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$tables = $structure->getTables();
if ($direction == 'down') {
$table =& $structure->getTable($tableparam);
$swap =& $structure->getTable($table->getNext());
$table = $structure->getTable($tableparam);
$swap = $structure->getTable($table->getNext());
} else {
$swap =& $structure->getTable($tableparam);
$table =& $structure->getTable($swap->getPrevious());
$swap = $structure->getTable($tableparam);
$table = $structure->getTable($swap->getPrevious());
}
// Change the table before the pair
if ($table->getPrevious()) {
$prev =& $structure->getTable($table->getPrevious());
$prev = $structure->getTable($table->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@ -102,7 +100,7 @@ class move_updown_table extends XMLDBAction {
}
// Change the table after the pair
if ($swap->getNext()) {
$next =& $structure->getTable($swap->getNext());
$next = $structure->getTable($swap->getNext());
$next->setPrevious($table->getName());
$table->setNext($next->getName());
$next->setChanged(true);
@ -125,7 +123,7 @@ class move_updown_table extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will create a new default field to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,23 +67,23 @@ class new_field extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
// If the changeme field exists, just get it and continue
$changeme_exists = false;
if ($fields =& $table->getFields()) {
if ($field =& $table->getField('changeme')) {
if ($fields = $table->getFields()) {
if ($field = $table->getField('changeme')) {
$changeme_exists = true;
}
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will create a new default index to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,23 +67,23 @@ class new_index extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
// If the changeme index exists, just get it and continue
$changeme_exists = false;
if ($indexes =& $table->getIndexes()) {
if ($index =& $table->getIndex('changeme')) {
if ($indexes = $table->getIndexes()) {
if ($index = $table->getIndex('changeme')) {
$changeme_exists = true;
}
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will create a new default key to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,23 +67,23 @@ class new_key extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
// If the changeme key exists, just get it and continue
$changeme_exists = false;
if ($keys =& $table->getKeys()) {
if ($key =& $table->getKey('changeme')) {
if ($keys = $table->getKeys()) {
if ($key = $table->getKey('changeme')) {
$changeme_exists = true;
}
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will create a new default table to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -69,19 +67,19 @@ class new_table extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// If the changeme table exists, just get it and continue
$changeme_exists = false;
if ($tables =& $structure->getTables()) {
if ($table =& $structure->getTable('changeme')) {
if ($tables = $structure->getTables()) {
if ($table = $structure->getTable('changeme')) {
$changeme_exists = true;
}
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class will ask and retrofit all the information from one
* mysql table present in the Moodle DB to one xmldb_table structure
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -72,13 +70,13 @@ class new_table_from_mysql extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = optional_param('table', NULL, PARAM_CLEAN);
@ -98,7 +96,7 @@ class new_table_from_mysql extends XMLDBAction {
}
// Get list of after tables
$aftertables = array();
if ($tables =& $structure->getTables()) {
if ($tables = $structure->getTables()) {
foreach ($tables as $aftertable) {
$aftertables[$aftertable->getName()] = $aftertable->getName();
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will revert changes (delete the editeddb)
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -94,7 +92,7 @@ class revert_changes extends XMLDBAction {
// Get the original dir and delete some elements
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
unset($dbdir->xml_changed);
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -29,8 +28,7 @@
* is going to continue (unload=false). Else (default) the
* file is unloaded once saved.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -76,18 +74,18 @@ class save_xml_file extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
}
}
// Copy the edited dir over the original one
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$XMLDB->dbdirs[$dirpath] = unserialize(serialize($editeddir));
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
}
}
// Chech for perms
// Check for perms
if (!is_writeable($dirpath . '/install.xml')) {
$this->errormsg = $this->str['filenotwriteable'] . '(' . $dirpath . '/install.xml)';
return false;

View File

@ -15,15 +15,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -68,13 +66,13 @@ class template extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// ADD YOUR CODE HERE

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will unload one loaded file completely
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -71,7 +69,7 @@ class unload_xml_file extends XMLDBAction {
// Get the original dir and delete some elements
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
unset($dbdir->xml_file);
unset($dbdir->xml_loaded);

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will display the XML for one field being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -75,11 +73,11 @@ class view_field_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@ -98,14 +96,14 @@ class view_field_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
@ -117,7 +115,7 @@ class view_field_xml extends XMLDBAction {
}
// Get the fields
if ($result) {
if (!$fields =& $t->getFields()) {
if (!$fields = $t->getFields()) {
$this->errormsg = 'Error retrieving ' . $select . ' fields';
$result = false;
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will display the XML for one index being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -75,11 +73,11 @@ class view_index_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@ -98,26 +96,26 @@ class view_index_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
}
// Get the table
if ($result && !$t =& $structure->getTable($table)) {
if ($result && !$t = $structure->getTable($table)) {
$this->errormsg = 'Error retrieving ' . $table . ' table';
$result = false;
}
// Get the indexes
if ($result) {
if (!$indexes =& $t->getIndexes()) {
if (!$indexes = $t->getIndexes()) {
$this->errormsg = 'Error retrieving ' . $select . ' indexes';
$result = false;
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will display the XML for one key being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -75,11 +73,11 @@ class view_key_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@ -98,26 +96,26 @@ class view_key_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
}
// Get the table
if ($result && !$t =& $structure->getTable($table)) {
if ($result && !$t = $structure->getTable($table)) {
$this->errormsg = 'Error retrieving ' . $table . ' table';
$result = false;
}
// Get the keys
if ($result) {
if (!$keys =& $t->getKeys()) {
if (!$keys = $t->getKeys()) {
$this->errormsg = 'Error retrieving ' . $select . ' keys';
$result = false;
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -27,8 +26,7 @@
* http://docs.moodle.org/en/Database_reserved_words
* Also, it introspects te DB looking for such words and informing about
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class will show the PHP needed (upgrade block) to perform
* the desired DDL action with the specified table
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -73,16 +71,16 @@ class view_structure_php extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tables =& $structure->getTables();
$tables = $structure->getTables();
$table = reset($tables);
$defaulttable = null;
if ($table) {

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class will show the SQL generated for the selected RDBMS for
* the entire XMLDB file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -72,13 +70,13 @@ class view_structure_sql extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// The back to edit table button

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will display the XML for one structure
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -73,11 +71,11 @@ class view_structure_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@ -96,7 +94,7 @@ class view_structure_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class will show the PHP needed (upgrade block) to perform
* the desired DDL action with the specified field/key/index
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -79,18 +77,18 @@ class view_table_php extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_PATH);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
$fields = $table->getFields();
$field = reset($fields);
$defaultfieldkeyindex = null;

View File

@ -14,8 +14,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -25,8 +24,7 @@
* This class will show the SQL generated for the selected RDBMS for
* one table
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -72,13 +70,13 @@ class view_table_sql extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Get parameters

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will display the XML for one table being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -74,11 +72,11 @@ class view_table_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@ -97,20 +95,20 @@ class view_table_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
}
// Get the table
if ($result && !$t =& $structure->getTable($table)) {
if ($result && !$t = $structure->getTable($table)) {
$this->errormsg = 'Error retrieving ' . $table . ' table';
$result = false;
}

View File

@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -24,8 +23,7 @@
/**
* This class will display one XML file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -53,6 +51,7 @@ class view_xml extends XMLDBAction {
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
* @return mixed
*/
function invoke() {
parent::invoke();

View File

@ -18,109 +18,108 @@
* This is the main script for the complete XMLDB interface. From here
* all the actions supported will be launched.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com,
* (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/ddllib.php');
// Add required XMLDB action classes
require_once('actions/XMLDBAction.class.php');
require_once('actions/XMLDBCheckAction.class.php');
require('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/ddllib.php');
// Add required XMLDB action classes
require_once('actions/XMLDBAction.class.php');
require_once('actions/XMLDBCheckAction.class.php');
admin_externalpage_setup('toolxmld');
admin_externalpage_setup('toolxmld');
// Add other used libraries
require_once($CFG->libdir . '/xmlize.php');
// Add other used libraries
require_once($CFG->libdir . '/xmlize.php');
// Handle session data
global $XMLDB;
// Handle session data
global $XMLDB;
// State is stored in session - we have to serialise it because the classes are not loaded when creating session
if (!isset($SESSION->xmldb)) {
$XMLDB = new stdClass;
} else {
$XMLDB = unserialize($SESSION->xmldb);
}
// State is stored in session - we have to serialise it because the classes are not loaded when creating session
if (!isset($SESSION->xmldb)) {
$XMLDB = new stdClass;
} else {
$XMLDB = unserialize($SESSION->xmldb);
}
// Some previous checks
$site = get_site();
// Some previous checks
$site = get_site();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
// Body of the script, based on action, we delegate the work
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
// Body of the script, based on action, we delegate the work
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
// Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
// Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
// Load and invoke the proper action
if (file_exists($actionpath) && is_readable($actionpath)) {
require_once($actionpath);
if ($xmldb_action = new $action) {
// Invoke it
$result = $xmldb_action->invoke();
// store the result in session
$SESSION->xmldb = serialize($XMLDB);
// Load and invoke the proper action
if (file_exists($actionpath) && is_readable($actionpath)) {
require_once($actionpath);
if ($xmldb_action = new $action) {
// Invoke it
$result = $xmldb_action->invoke();
// store the result in session
$SESSION->xmldb = serialize($XMLDB);
if ($result) {
// Based on getDoesGenerate()
switch ($xmldb_action->getDoesGenerate()) {
case ACTION_GENERATE_HTML:
if ($result) {
// Based on getDoesGenerate()
switch ($xmldb_action->getDoesGenerate()) {
case ACTION_GENERATE_HTML:
$action = optional_param('action', '', PARAM_ALPHAEXT);
$postaction = optional_param('postaction', '', PARAM_ALPHAEXT);
// If the js exists, load it
if ($action) {
$script = $CFG->admin . '/tool/xmldb/actions/' . $action . '/' . $action . '.js';
$action = optional_param('action', '', PARAM_ALPHAEXT);
$postaction = optional_param('postaction', '', PARAM_ALPHAEXT);
// If the js exists, load it
if ($action) {
$script = $CFG->admin . '/tool/xmldb/actions/' . $action . '/' . $action . '.js';
$file = $CFG->dirroot . '/' . $script;
if (file_exists($file) && is_readable($file)) {
$PAGE->requires->js('/'.$script);
} else if ($postaction) {
// Try to load the postaction javascript if exists
$script = $CFG->admin . '/tool/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
$file = $CFG->dirroot . '/' . $script;
if (file_exists($file) && is_readable($file)) {
$PAGE->requires->js('/'.$script);
} else if ($postaction) {
// Try to load the postaction javascript if exists
$script = $CFG->admin . '/tool/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
$file = $CFG->dirroot . '/' . $script;
if (file_exists($file) && is_readable($file)) {
$PAGE->requires->js('/'.$script);
}
}
}
}
// Go with standard admin header
echo $OUTPUT->header();
echo $OUTPUT->heading($xmldb_action->getTitle());
echo $xmldb_action->getOutput();
echo $OUTPUT->footer();
break;
case ACTION_GENERATE_XML:
header('Content-type: application/xhtml+xml; charset=utf-8');
echo $xmldb_action->getOutput();
break;
}
} else {
// TODO: need more detailed error info
print_error('xmldberror');
// Go with standard admin header
echo $OUTPUT->header();
echo $OUTPUT->heading($xmldb_action->getTitle());
echo $xmldb_action->getOutput();
echo $OUTPUT->footer();
break;
case ACTION_GENERATE_XML:
header('Content-type: application/xhtml+xml; charset=utf-8');
echo $xmldb_action->getOutput();
break;
}
} else {
$a = new stdClass();
$a->action = $action;
$a->actionclass = $actionclass;
print_error('cannotinstantiateclass', 'tool_xmldb', '', $a);
// TODO: need more detailed error info
print_error('xmldberror');
}
} else {
print_error('invalidaction');
$a = new stdClass();
$a->action = $action;
$a->actionclass = $actionclass;
print_error('cannotinstantiateclass', 'tool_xmldb', '', $a);
}
} else {
print_error('invalidaction');
}
if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
if (debugging()) {
// print_object($XMLDB);
}
if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
if (debugging()) {
// print_object($XMLDB);
}
}

View File

@ -17,8 +17,7 @@
/**
* Strings for component 'tool_xmldb', language 'en', branch 'MOODLE_22_STABLE'
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -17,8 +17,7 @@
/**
* Link to xmldb editor
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

View File

@ -17,8 +17,7 @@
/**
* Plugin version info
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/