diff --git a/admin/xmldb/actions/view_structure_php/view_structure_php.class.php b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php
new file mode 100644
index 00000000000..cb46ad86935
--- /dev/null
+++ b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php
@@ -0,0 +1,219 @@
+loadStrings(array(
+ 'selectaction' => 'xmldb',
+ 'selecttable' => 'xmldb',
+ 'view' => 'xmldb',
+ 'back' => 'xmldb'
+ ));
+ }
+
+ /**
+ * Invoke method, every class will have its own
+ * returns true/false on completion, setting both
+ * errormsg and output as necessary
+ */
+ function invoke() {
+ parent::invoke();
+
+ $result = true;
+
+ /// Set own core attributes
+ $this->does_generate = ACTION_GENERATE_HTML;
+
+ /// These are always here
+ global $CFG, $XMLDB;
+
+ /// Do the job, setting result as needed
+ /// Get the dir containing the file
+ $dirpath = required_param('dir', PARAM_PATH);
+ $dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
+
+ /// Get the correct dirs
+ if (!empty($XMLDB->dbdirs)) {
+ $dbdir =& $XMLDB->dbdirs[$dirpath];
+ } else {
+ return false;
+ }
+ if (!empty($XMLDB->editeddirs)) {
+ $editeddir =& $XMLDB->editeddirs[$dirpath];
+ $structure =& $editeddir->xml_file->getStructure();
+ }
+ /// ADD YOUR CODE HERE
+
+ $tables =& $structure->getTables();
+ $table = reset($tables);
+ $defaulttable = null;
+ if ($table) {
+ $defaulttable = $table->getName();
+ }
+
+ /// Get parameters
+ $commandparam = optional_param('command', 'create_table', PARAM_PATH);
+ $tableparam = optional_param('table', $defaulttable, PARAM_PATH);
+
+ /// The back to edit xml button
+ $b = '
';
+ $b .= '[' . $this->str['back'] . ']';
+ $b .= '
';
+ $o = $b;
+
+ /// Calculate the popup of commands
+ $commands = array('create_table',
+ 'drop_table',
+ 'rename_table');
+ foreach ($commands as $command) {
+ $popcommands[$command] = str_replace('_', ' ', $command);
+ }
+ /// Calculate the popup of tables
+ foreach ($tables as $table) {
+ $poptables[$table->getName()] = $table->getName();
+ }
+ /// Now build the form
+ $o.= '';
+ $o.= ' ';
+
+ $this->output = $o;
+
+ /// Launch postaction if exists (leave this here!)
+ if ($this->getPostAction() && $result) {
+ return $this->launch($this->getPostAction());
+ }
+
+ /// Return ok if arrived here
+ return $result;
+ }
+
+ /**
+ * This function will generate all the PHP code needed to
+ * create one table using XMLDB objects and functions
+ *
+ * @param XMLDBStructure structure object containing all the info
+ * @param string table table code to be created
+ * @return string PHP code to be used to create the table
+ */
+ function create_table_php($structure, $table) {
+
+ $result = '';
+ /// Validate if we can do it
+
+ /// Add the standard PHP header
+ $result .= XMLDB_PHP_HEADER;
+
+ /// Add contents
+
+ /// Add standard PHP footer
+ $result .= XMLDB_PHP_FOOTER;
+
+ return $result;
+ }
+
+ /**
+ * This function will generate all the PHP code needed to
+ * drop one table using XMLDB objects and functions
+ *
+ * @param XMLDBStructure structure object containing all the info
+ * @param string table table code to be dropped
+ * @return string PHP code to be used to drop the table
+ */
+ function drop_table_php($structure, $table) {
+
+ $result = '';
+ /// Validate if we can do it
+
+ /// Add the standard PHP header
+ $result .= XMLDB_PHP_HEADER;
+
+ /// Add contents
+
+ /// Add standard PHP footer
+ $result .= XMLDB_PHP_FOOTER;
+
+ return $result;
+ }
+
+ /**
+ * This function will generate all the PHP code needed to
+ * rename one table using XMLDB objects and functions
+ *
+ * @param XMLDBStructure structure object containing all the info
+ * @param string table table code to be renamed
+ * @return string PHP code to be used to rename the table
+ */
+ function rename_table_php($structure, $table) {
+
+ $result = '';
+ /// Validate if we can do it
+
+ /// Add the standard PHP header
+ $result .= XMLDB_PHP_HEADER;
+
+ /// Add contents
+
+ /// Add standard PHP footer
+ $result .= XMLDB_PHP_FOOTER;
+
+ return $result;
+ }
+}
+?>