Constructor for the Table class
Table
Table
(string $name, [ $external_name = ''], [ $primary_key = ''])
-
string
$name: The name of the column
-
$external_name
-
$primary_key
Check that this table has the specified number of links with the specified tables
bool
check_row_link
(string $table, $condition, string $link_ids, mixed $conditions)
-
string
$table: Table name
-
mixed
$conditions: String/Int specifying the condition - options are 1, 2, 3... for specific, '+' for 1 or more
-
string
$link_ids: One or more colon separated IDs
-
$condition
Check that this table has the specified number of links with the specified tables
mixed
check_row_links
(int $table_id, mixed $tables, mixed $conditions)
-
int
$table_id: ID of the row in this table to check links for
-
mixed
$tables: String or array of strings of table names
-
mixed
$conditions: String/Int or array of string/int specifying the condition - options are 1, 2, 3... for specific, '+' for 1 or more
Delete a specific row from this table - for link tables
void
delete_link_table_row
(string $column_id, int $value)
-
string
$column_id: Name of the column - should be name of the primary key of a data table
-
int
$value: Value of the column - key of this data table
Delete a specific row from this table - for data tables
void
delete_table_row
(int $table_id)
-
int
$table_id: Primary key value for the row
Delete a specific row and all links to other tables
void
delete_table_row_and_links
(int $table_id)
-
int
$table_id: Primary key value for the row
Delete a specific row and all linked rows for this table
void
delete_table_row_and_link_rows
(int $table_id)
-
int
$table_id: Primary key value for the row
Delete all link table entries for the table id mentioned
void
delete_table_row_links
(int $table_id)
-
int
$table_id: Primary key value of row in this table
Delete all links for a table - for data tables
void
delete_table_row_link_rows
(int $table_id)
-
int
$table_id: Primary key value for the row
Get a column object by name
void
&get_column_by_name
(string $name)
-
string
$name: Name of the column
Get the external table name
string
get_external_name
()
Get the $links array
array
&get_linked_to
()
Get the table name
string
get_name
()
Get a specific row from this table
array
get_table_row
(int $table_id)
-
int
$table_id: Primary key value for the row
Get all the rows in this table
array
get_table_rows
([string $options = ''])
-
string
$options: Specify options to filter or order the results. (default: "")
Get all the rows in this table with the action field
If a Module:action is not specified, that action is not displayed. E.g. The update action is not displayed if $update_action is set to 0.
array
get_table_rows_with_actions
([string $view_action = 0], [string $update_action = 0], [string $del_action = 0], [string $options = ''], [string $params = ''], [mixed $ajax_element = ''])
-
string
$view_action: Action to execute when view button is clicked (Format: Module:action)
-
string
$update_action: Action to execute when update button is clicked(Format: Module:action)
-
string
$del_action: Action to execute when delete button is clicked(Format: Module:action)
-
string
$options: Specify options to filter or order the results. (default: "")
-
string
$params: Parameters required for the view, update and delete module:action combinations in "param=value¶m=value" format. (default: "")
-
mixed
$ajax_element: View, update and delete links will send their output to this element using AJAX if string specified. If array of strings then view[0], update[1], delete[2], (default: "")
Get specific row and all linked rows from this table - formatted for View::table_two_column_associative()
This function appends the results of the query to $data. This is useful to generate $data using data from multiple tables and showing the result using View::table_two_column_associative().
void
get_table_row_and_link_rows_for_view
(int $table_id, &$data, [bool $show_name = true], array $data)
-
int
$table_id: Primary key value for the row
-
array
$data: Return the data in this associative array
-
bool
$show_name: Show the name of the table (default: true)
-
&$data
Get a specific row from this table - formatted for View::table_two_column_associative()
This function appends the results of the query to $data. This is useful to generate $data using data from multiple tables and showing the result using View::table_two_column_associative().
void
get_table_row_for_view
(int $table_id, &$data, [bool $show_name = true], array $data)
-
int
$table_id: Primary key value for the row
-
array
$data: Return the data in this associative array
-
bool
$show_name: Show the name of the table (default: true)
-
&$data
Get links to a table row.
This function checks the table's $links array and searches all its link tables for the specified ID. If it exists, it means that this row has a link with the other table.
Result = array( array(Table1 Object, Table2 Object, ...), array(Table1 ID1:Table1 ID2:Table1:ID3, Table2 ID, ...));
array
get_table_row_links
(int $table_id)
-
int
$table_id: Primary key value for the row
Get all the link rows with the action field for the specified ID in this table
If a Module:action is not specified, that action is not displayed. E.g. The update action is not displayed if $update_action is set to 0.
array
get_table_row_links_with_actions
(int $table_id, string $link_table_name, [string $view_action = 0], [string $update_action = 0], [string $del_action = 0], [string $options = ''], [string $params = ''], [mixed $ajax_element = ''])
-
int
$table_id: Primary key value for the row
-
string
$link_table_name: Name of the table to which links need to be found
-
string
$view_action: Action to execute when view button is clicked (Format: Module:action)
-
string
$update_action: Action to execute when update button is clicked(Format: Module:action)
-
string
$del_action: Action to execute when delete button is clicked(Format: Module:action)
-
string
$options: Specify options to filter or order the results. (default: "")
-
string
$params: Parameters required for the view, update and delete module:action combinations in "param=value¶m=value" format. (default: 0)
-
mixed
$ajax_element: View, update and delete links will send their output to this element using AJAX if string specified. If array of strings then view[0], update[1], delete[2], (default: "")
Get all linked rows for a specific row from this table - formatted for View::table_two_column_associative()
This function appends the results of the query to $data. This is useful to generate $data using data from multiple tables and showing the result using View::table_two_column_associative().
void
get_table_row_link_rows_for_view
(int $table_id, &$data, [bool $show_name = true], array $data)
-
int
$table_id: Primary key value for the row
-
array
$data: Return the data in this associative array
-
bool
$show_name: Show the name of the table (default: true)
-
&$data
Get the table type
string
get_type
()
Helper function to concatenate options to the SQL syntax, internal function, do not use
string
process_sql_options
(string $options, string $where)
-
string
$options: Existing options
-
string
$where: Additional where options to add
Set the table type
void
set_type
(string $type)