DiogenesTableEditor Class Reference

Inheritance diagram for DiogenesTableEditor:

Inheritance graph
[legend]
Collaboration diagram for DiogenesTableEditor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DiogenesTableEditor ($table, $idfield, $idedit=false)
 addAction ($text, $url)
 add_join_table ($name, $joinid, $joindel, $joinextra="")
 add_join_field ($table, $name, $field, $value, $desc, $sum, $type="text")
 add_where_condition ($cond)
 delete_db ($id)
 describe ($name, $desc, $sum, $type='', $value='', $trans=null)
 describe_join_value ($name, $desc, $sum, $vtable, $vjoinid, $vfield)
 hide ($name, $value=null)
 hide_id ()
 lock ($name, $value=null)
 from_db ($id)
 from_request ()
 to_db ()
 make_join_flag ($val)
 make_select ($list, &$num)
 set_maxrows ($maxrows)
 run (&$page, $outputvar='', $template='')

Public Attributes

 $actions
 $autoinc
 $id
 $idedit
 $idsum = true
 $idfield
 $jtables = array()
 $wheres = array()
 $prefix = "frm_"
 $readonly = false
 $maxrows = 0
 $table_class = "light"
 $table_style = ""

Detailed Description

Generic class for editing MySQL tables.

TODO: give an example of how to use the class

See also:
DiogenesDatabaseTable

Definition at line 31 of file diogenes.table-editor.inc.php.


Member Function Documentation

DiogenesTableEditor::DiogenesTableEditor ( table,
idfield,
idedit = false 
)

The constructor.

Parameters:
$table the MySQL table we are operating on
$idfield the field we use as unique id
$idedit is the id field editable ?

Definition at line 67 of file diogenes.table-editor.inc.php.

References $idedit, $idfield, DiogenesDatabaseTable::$table, and DiogenesDatabaseTable::DiogenesDatabaseTable().

Here is the call graph for this function:

DiogenesTableEditor::addAction ( text,
url 
)

Add an "action" (hyperlink) to be displayed next to items in the summary.

Parameters:
text the text for the hyperlink
url the url for the hyperlink. anything of the form foobar% will be replaced by the value of the field 'foobar'

Definition at line 95 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::add_join_table ( name,
joinid,
joindel,
joinextra = "" 
)

Adds a join with another table.

Parameters:
$name the name of the table
$joinid the fields on which we do a join with our "id"
$joindel should we delete the joined entries in the table when we delete an entry from $this->table?
$joinextra extra clause for the join
See also:
delete_db

Definition at line 111 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::add_join_field ( table,
name,
field,
value,
desc,
sum,
type = "text" 
)

EXPERIMENTAL : Add a field from another table.

Parameters:
$table the table for which we are adding the field
$name name of the variable (AS clause)
$field the name of the table's field
$value the default value of the field
$desc a description
$sum should we display this field in the table summary?
$type type of the field : "enum", "set", "text", "textarea", "timestamp"

Definition at line 127 of file diogenes.table-editor.inc.php.

References DiogenesDatabaseTable::$table.

DiogenesTableEditor::add_where_condition ( cond  ) 

Add a WHERE condition to the SELECT used for listing.

Parameters:
cond string containing the WHERE condition

Definition at line 137 of file diogenes.table-editor.inc.php.

Referenced by make_select().

DiogenesTableEditor::delete_db ( id  ) 

Deletes the specified entry from the database.

Parameters:
$id id of the entry to be deleted

Definition at line 146 of file diogenes.table-editor.inc.php.

References $id.

Referenced by run().

DiogenesTableEditor::describe ( name,
desc,
sum,
type = '',
value = '',
trans = null 
)

Describe a column and sets it visibility

Parameters:
name the name of the field
desc the description for the field
sum a boolean indicating whether to display the field in the summary
type type of the field (optional)
value default value of the field (optional)
trans stores translations when it's a "set" value

Definition at line 173 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::describe_join_value ( name,
desc,
sum,
vtable,
vjoinid,
vfield 
)

Describe a column and tell where to find possible values and sets it visibility

Parameters:
name the name of the field
desc the description for the field
sum a boolean indicating whether to display the field in the summary
vtable the name of the table where are located the external values
vjoinid the $vtable field name corresponding to $this->table field $name
vfield the $vtable field wich hold the significative and comprehensive value

Definition at line 196 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::hide ( name,
value = null 
)

Make a field hidden and uneditable

Parameters:
name the name of the field
value default value of the field (optional)

Definition at line 215 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::hide_id (  ) 

Do not display the id field in the summary

Definition at line 230 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::lock ( name,
value = null 
)

Make a field uneditable

Parameters:
name the name of the field
value default value of the field (optional)

Definition at line 240 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::from_db ( id  ) 

Read the selected entry from database

Parameters:
id id of the entry we want to read

Definition at line 254 of file diogenes.table-editor.inc.php.

References $id, and make_select().

Referenced by run().

Here is the call graph for this function:

DiogenesTableEditor::from_request (  ) 

Read the current entry's values from the $_REQUEST variable

Definition at line 273 of file diogenes.table-editor.inc.php.

Referenced by run().

DiogenesTableEditor::to_db (  ) 

Write the current entry to database.

Definition at line 299 of file diogenes.table-editor.inc.php.

Referenced by run().

DiogenesTableEditor::make_join_flag ( val  ) 

Returns the JOIN clause to read a field.

Parameters:
$val the field we want to read

Definition at line 342 of file diogenes.table-editor.inc.php.

Referenced by make_select().

DiogenesTableEditor::make_select ( list,
&$  num 
)

Create the SELECT request to display the table summary or to read an entry from the database

Parameters:
$list boolean : are we displaying the summary?
$num depending on $list, either the column names or the entry to display

Definition at line 364 of file diogenes.table-editor.inc.php.

References add_where_condition(), and make_join_flag().

Referenced by from_db(), and run().

Here is the call graph for this function:

DiogenesTableEditor::set_maxrows ( maxrows  ) 

Set the maximum number of rows to return per page when viewing entries. By default, this is set to 0, meaning all rows are returned.

Parameters:
maxrows the maximum number of rows (0 means unlimited)

Definition at line 422 of file diogenes.table-editor.inc.php.

References $maxrows.

DiogenesTableEditor::run ( &$  page,
outputvar = '',
template = '' 
)

Process the requested action and fill out the Smarty variables for display. By default, displays the entries in the database table.

Parameters:
page the page that will display the editor's forms
outputvar the Smarty variable to which we should assign the output
template the template to use for display

Definition at line 440 of file diogenes.table-editor.inc.php.

References $actions, delete_db(), from_db(), from_request(), make_select(), and to_db().

Here is the call graph for this function:


Member Data Documentation

DiogenesTableEditor::$actions

The actions.

Definition at line 33 of file diogenes.table-editor.inc.php.

Referenced by run().

DiogenesTableEditor::$autoinc

Is the idfield automatically incremented?

Definition at line 35 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::$id

Id of the current entry.

Definition at line 37 of file diogenes.table-editor.inc.php.

Referenced by delete_db(), and from_db().

DiogenesTableEditor::$idedit

Is the id field editable?

Definition at line 39 of file diogenes.table-editor.inc.php.

Referenced by DiogenesTableEditor().

DiogenesTableEditor::$idsum = true

Is the id field in the summary?

Definition at line 41 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::$idfield

The field that is used as the primary key

Definition at line 43 of file diogenes.table-editor.inc.php.

Referenced by DiogenesTableEditor().

DiogenesTableEditor::$jtables = array()

The tables we do a join on.

Definition at line 45 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::$wheres = array()

The where clause for the select

Definition at line 47 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::$prefix = "frm_"

Prefix for all the form variables (to avoid conflicting with any parameters used by the site's pages).

Definition at line 50 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::$readonly = false

Should editing functions be disabled?

Definition at line 52 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::$maxrows = 0

Maximum number of results per page, 0 for unlimited

Definition at line 54 of file diogenes.table-editor.inc.php.

Referenced by set_maxrows().

DiogenesTableEditor::$table_class = "light"

CSS class of the table that contains the editor

Definition at line 57 of file diogenes.table-editor.inc.php.

DiogenesTableEditor::$table_style = ""

Extra CSS style info for the table that contains the editor

Definition at line 59 of file diogenes.table-editor.inc.php.


The documentation for this class was generated from the following file:
Generated on Fri Jan 11 01:20:09 2008 for Diogenes by  doxygen 1.5.1