Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
view_table_php Class Reference

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

Inheritance diagram for view_table_php:
XMLDBAction

Public Member Functions

 add_field_php ($structure, $table, $field)
 This function will generate all the PHP code needed to create one field using XMLDB objects and functions.
 
 add_index_php ($structure, $table, $index)
 This function will generate all the PHP code needed to create one index using XMLDB objects and functions.
 
 add_key_php ($structure, $table, $key)
 This function will generate all the PHP code needed to create one key using XMLDB objects and functions.
 
 change_field_default_php ($structure, $table, $field)
 This function will generate all the PHP code needed to change the default of one field using XMLDB objects and functions.
 
 change_field_notnull_php ($structure, $table, $field)
 This function will generate all the PHP code needed to change the nullability of one field using XMLDB objects and functions.
 
 change_field_precision_php ($structure, $table, $field)
 This function will generate all the PHP code needed to change the precision of one field using XMLDB objects and functions.
 
 change_field_type_php ($structure, $table, $field)
 This function will generate all the PHP code needed to change the type of one field using XMLDB objects and functions.
 
 drop_field_php ($structure, $table, $field)
 This function will generate all the PHP code needed to drop one field using XMLDB objects and functions.
 
 drop_index_php ($structure, $table, $index)
 This function will generate all the PHP code needed to drop one index using XMLDB objects and functions.
 
 drop_key_php ($structure, $table, $key)
 This function will generate all the PHP code needed to drop one key using XMLDB objects and functions.
 
 getDoesGenerate ()
 Returns the type of output of the file.
 
 getError ()
 getError method, returns the last error string.
 
 getOutput ()
 getOutput method, returns the output generated by the action.
 
 getPostAction ()
 getPostAction method, returns the action to launch after executing another one
 
 getTitle ()
 getTitle method returns the title of the action (that is part of the $str array attribute
 
 init ()
 Init method, every subclass will have its own.
 
 invoke ()
 Invoke method, every class will have its own returns true/false on completion, setting both errormsg and output as necessary.
 
 launch ($action)
 launch method, used to easily call invoke methods between actions
 
 loadStrings ($strings)
 loadStrings method, loads the required strings specified in the array parameter
 
 rename_field_php ($structure, $table, $field)
 This function will generate all the PHP code needed to rename one field using XMLDB objects and functions.
 
 rename_index_php ($structure, $table, $index)
 This function will generate all the PHP code needed to rename one index using XMLDB objects and functions.
 
 rename_key_php ($structure, $table, $key)
 This function will generate all the PHP code needed to rename one key using XMLDB objects and functions.
 
 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.
 

Protected Attributes

bool $can_subaction
 Set own core 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.
 
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.
 
mixed $subaction
 
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 field/key/index.

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

Member Function Documentation

◆ add_field_php()

view_table_php::add_field_php ( $structure,
$table,
$field )

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

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

◆ add_index_php()

view_table_php::add_index_php ( $structure,
$table,
$index )

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

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

◆ add_key_php()

view_table_php::add_key_php ( $structure,
$table,
$key )

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

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

◆ change_field_default_php()

view_table_php::change_field_default_php ( $structure,
$table,
$field )

This function will generate all the PHP code needed to change the default of one field using XMLDB objects and functions.

Parameters
xmldb_structurestructure object containing all the info
stringtable table name
stringfield field name to change null/not null

◆ change_field_notnull_php()

view_table_php::change_field_notnull_php ( $structure,
$table,
$field )

This function will generate all the PHP code needed to change the nullability of one field using XMLDB objects and functions.

Parameters
xmldb_structurestructure object containing all the info
stringtable table name
stringfield field name to change null/not null

◆ change_field_precision_php()

view_table_php::change_field_precision_php ( $structure,
$table,
$field )

This function will generate all the PHP code needed to change the precision of one field using XMLDB objects and functions.

Parameters
xmldb_structurestructure object containing all the info
stringtable table name
stringfield field name to change precision

◆ change_field_type_php()

view_table_php::change_field_type_php ( $structure,
$table,
$field )

This function will generate all the PHP code needed to change the type of one field using XMLDB objects and functions.

Currently these conversions are supported: integer to char char to integer number to char char to number float to char char to float

Parameters
xmldb_structurestructure object containing all the info
stringtable table name
stringfield field name to change precision

◆ drop_field_php()

view_table_php::drop_field_php ( $structure,
$table,
$field )

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

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

◆ drop_index_php()

view_table_php::drop_index_php ( $structure,
$table,
$index )

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

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

◆ drop_key_php()

view_table_php::drop_key_php ( $structure,
$table,
$key )

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

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

◆ 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_table_php::init ( )

Init method, every subclass will have its own.

Reimplemented from XMLDBAction.

◆ invoke()

view_table_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_field_php()

view_table_php::rename_field_php ( $structure,
$table,
$field )

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

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

◆ rename_index_php()

view_table_php::rename_index_php ( $structure,
$table,
$index )

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

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

◆ rename_key_php()

view_table_php::rename_key_php ( $structure,
$table,
$key )

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

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

◆ 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: