Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Attributes | List of all members
view_structure_php Class Reference

This class will show the PHP needed (upgrade block) to perform the desired DDL action with the specified table. More...

Inheritance diagram for view_structure_php:
XMLDBAction

Public Member Functions

 create_table_php ($structure, $table)
 This function will generate all the PHP code needed to create one table using XMLDB objects and functions. More...
 
 drop_table_php ($structure, $table)
 This function will generate all the PHP code needed to drop one table using XMLDB objects and functions. More...
 
 getDoesGenerate ()
 Returns the type of output of the file. More...
 
 getError ()
 getError method, returns the last error string. More...
 
 getOutput ()
 getOutput method, returns the output generated by the action. More...
 
 getPostAction ()
 getPostAction method, returns the action to launch after executing another one More...
 
 getTitle ()
 getTitle method returns the title of the action (that is part of the $str array attribute More...
 
 init ()
 Init method, every subclass will have its own. More...
 
 invoke ()
 Invoke method, every class will have its own returns true/false on completion, setting both errormsg and output as necessary. More...
 
 launch ($action)
 launch method, used to easily call invoke methods between actions More...
 
 loadStrings ($strings)
 loadStrings method, loads the required strings specified in the array parameter More...
 
 rename_table_php ($structure, $table)
 This function will generate all the PHP code needed to rename one table using XMLDB objects and functions. More...
 
 upgrade_savepoint_php ($structure)
 This function will generate the PHP code needed to implement the upgrade_xxxx_savepoint() php calls in upgrade code generated from the editor. More...
 

Protected Attributes

bool $does_generate
 Type of value returned by the invoke method, ACTION_GENERATE_HTML have contents to show, set by each specialized invoke.
 
string $errormsg
 Last Error produced. More...
 
string $output
 Output of the action, set by each specialized invoke, get with getOutput.
 
string $postaction
 Action to execute at the end of the invoke script.
 
bool $sesskey_protected
 Actions must be protected by sesskey mechanism.
 
string $str
 Strings used by the action set by each specialized init, calling loadStrings.
 
string $title
 Title of the Action (class name, by default), set by parent init automatically.
 

Detailed Description

This class will show the PHP needed (upgrade block) to perform the desired DDL action with the specified table.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ create_table_php()

view_structure_php::create_table_php (   $structure,
  $table 
)

This function will generate all the PHP code needed to create one table using XMLDB objects and functions.

Parameters
xmldb_structurestructure object containing all the info
stringtable table code to be created
Return values
stringPHP code to be used to create the table

◆ drop_table_php()

view_structure_php::drop_table_php (   $structure,
  $table 
)

This function will generate all the PHP code needed to drop one table using XMLDB objects and functions.

Parameters
xmldb_structurestructure object containing all the info
stringtable table code to be dropped
Return values
stringPHP code to be used to drop the table

◆ getDoesGenerate()

XMLDBAction::getDoesGenerate ( )
inherited

Returns the type of output of the file.

Return values
bool

◆ getError()

XMLDBAction::getError ( )
inherited

getError method, returns the last error string.

Used if the invoke() methods returns false

Return values
string

◆ getOutput()

XMLDBAction::getOutput ( )
inherited

getOutput method, returns the output generated by the action.

Used after execution of the invoke() methods if they return true

Return values
string

◆ getPostAction()

XMLDBAction::getPostAction ( )
inherited

getPostAction method, returns the action to launch after executing another one

Return values
string

◆ getTitle()

XMLDBAction::getTitle ( )
inherited

getTitle method returns the title of the action (that is part of the $str array attribute

Return values
string

Reimplemented in add_persistent_mandatory.

◆ init()

view_structure_php::init ( )

Init method, every subclass will have its own.

Reimplemented from XMLDBAction.

◆ invoke()

view_structure_php::invoke ( )

Invoke method, every class will have its own returns true/false on completion, setting both errormsg and output as necessary.

Reimplemented from XMLDBAction.

◆ launch()

XMLDBAction::launch (   $action)
inherited

launch method, used to easily call invoke methods between actions

Parameters
string$action
Return values
mixed

◆ loadStrings()

XMLDBAction::loadStrings (   $strings)
inherited

loadStrings method, loads the required strings specified in the array parameter

Parameters
string[]$strings

◆ rename_table_php()

view_structure_php::rename_table_php (   $structure,
  $table 
)

This function will generate all the PHP code needed to rename one table using XMLDB objects and functions.

Parameters
xmldb_structurestructure object containing all the info
stringtable table code to be renamed
Return values
stringPHP code to be used to rename the table

◆ upgrade_savepoint_php()

XMLDBAction::upgrade_savepoint_php (   $structure)
inherited

This function will generate the PHP code needed to implement the upgrade_xxxx_savepoint() php calls in upgrade code generated from the editor.

It's used by the view_structure_php and view_table_php actions

Parameters
xmldb_structurestructure object containing all the info
Return values
stringPHP code to be used to mark a reached savepoint

Member Data Documentation

◆ $errormsg

string XMLDBAction::$errormsg
protectedinherited

Last Error produced.

Check when any invoke returns false, get with getError


The documentation for this class was generated from the following file: