yana

Description
  Class trees
  Index of elements
  Todo List
core
  Classes
    FormCreator
    Index
    Language
    Object
    Plugin
    PluginManager
    Singleton
    SmartTemplate
    SmartView
    Utility
    Yana
database
  Classes
    DbBlob
    DbCreator
    DbDesigner4
    DbExtractor
    DbQuery
    DbQueryParser
    DbServer
    DbStream
    DbStructure
    FileDb
error_reporting
  Classes
    Alert
    Error
    ErrorUtility
    Log
    Message
    Report
    Warning
file_system
  Classes
    DatFile
    Dir
    Executeable
    File
    FileReadonly
    FileSystemResource
    SML
javascript
  Classes
    AjaxRequest
  Functions
    preview
    yanaAddEventListener
    yanaAddIcon
    yanaCheckEmbTags
    yanaCloseAll
    yanaGetCookie
    yanaGetElementsByClassName
    yanaMaxLength
    yanaMenu
    yanaMenuCookie
    yanaSetCookie
mail
  Classes
    FormMailer
    Mailer
plugins
  Classes
    plugin_blog
    plugin_check
    plugin_db_admin
    plugin_db_tools
    plugin_default_library
    plugin_diagnostics
    plugin_guestbook
    plugin_guestbook_admin
    plugin_ipblock
    plugin_ipblock_admin
    plugin_rss
    plugin_rss_admin
    plugin_sdk
    plugin_search
    plugin_search_admin
    plugin_user
    plugin_user_admin
utilities
  Classes
    Brush
    Counter
    Hashtable
    Image
    Microsummary
    RSS
    RSSitem
    String
  Functions
    checkArgumentList
    cloneArray
    dirlist
    qSearchArray
    untaintInput
    XMLencode
vdrive
  Classes
    Registry
    VDrive
zip
  Classes
    PclZip

phpDocumentor v 1.4.0

YANA Framework for PHPDocs For Class FormCreator

### Class FormCreator

#### Description

Form-generator
This class is a form-generator, that produces HTML-code from database structure files.
Example of usage:

1. $form = new FormCreator();
2. // use database structure in file 'project'
3. $form->setFile('project');
4. // use table 'effort' from file 'project'
5. $form->setTable('effort');
6. // choose which form to create (here: a form to edit entries)
7. $form->setTemplate(FORM_EDIT);
8. // set which columns to show
9. $form->setColumns(array (
10. "effort_id",
11. "effort_date",
12. "effort_description",
13. "effort_state"
14. ));
15. // limit entries to show by adding a where clause
16. $form->setWhere( array (
17. array("effort_duration", 2, '>'),
18. array("effort_duration", 20, '<')
19. ));
20. // select a column to sort the entries
21. $form->setSort('effort_id');
22. // set the number of entries to show per page
23. $form->setEntriesPerPage(5);
24. // set what action (function) should be triggered,
25. // when the user clicks the "edit" button
26. $form->setEditAction('project_edit_effort');
27. // set what action (function) should be triggered,
28. // when the user clicks the "new" button
29. $form->setNewAction('project_new_effort');
30. // generate the HTML code of the requested form
31. $string = $form->createForm();

- access: public

    Object
       |
       --FormCreator

##### Method Summary

- FormCreator FormCreator ()
- bool allowNewEntry ([bool $allowNewEntry = null])
- string createForm ()
- bool enableAdvancedSearch ([bool $advancedSearch = true])
- bool enableArrayKeys ([bool $arrayKeys = true])
- bool enableTitles ([bool $titles = true])
- bool(false)|string getAction (string $name)
- bool getAdvancedSearch ()
- bool getArrayKeys ()
- array getColumns ()
- bool(false)|string getDeleteAction ()
- bool(false)|string getDownloadAction ()
- bool(false)|string getEditAction ()
- bool(false)|int getEntriesPerPage ()
- bool(false)|string getFile ()
- array|bool(false) getFormdata (int $form, string|DbStructure $source, string $table, [array $data = null], [array $columns = null])
- string|bool(false) getNamespace ()
- bool(false)|string getNewAction ()
- bool(false)|int getPage ()
- array &getRows ()
- bool(false)|string getSearchAction ()
- bool(false)|string getSort ()
- bool(false)|string getTable ()
- bool(false)|string getTemplate ()
- bool getTitles ()
- bool(false)|string|array getWhere ()
- bool hasFilter (string $column)
- bool isDescending ()
- bool setAction (string $name, string $value)
- bool setColumns ([array $columns = null])
- bool setDeleteAction (string $action)
- bool setDownloadAction (string $action)
- bool setEditAction (string $action)
- bool setEntriesPerPage ([int $entries = null])
- bool setFile (string $file)
- bool setNewAction (string $action)
- bool setPage (int $page)
- bool setSearchAction (string $action)
- bool setSort ([string $orderBy = ''], [bool $desc = null])
- bool setTable (string $table)
- bool setTemplate (int|string $template, int $layout)
- bool setWhere ([string|array $where = null], [bool $replace = false])

#### Methods

##### create a new instance

FormCreator FormCreator ()

###### Description:

This creates and initializes a new instance of this class.

##### trigger wether the user should be allowed to create new entries

bool allowNewEntry (
[bool $allowNewEntry = null]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$allowNewEntry | bool |

###### Description:

Use this function to trigger the "new entry" row on edit-forms. If $allowNewEntries is true, the row will be shown, else it will be hidden.
Note that this row can be hidden automatically, if a not-nullable column is not visible to the user, making it practically impossible to add entries. However: you may overrule this behavior by calling this function and setting the value to true.
Returns the old value of the property. If you just want to read the current setting, call this function without providing any argument.

- since: 2.9.5
- access: public

##### create a form from the current instance and return it

string createForm ()

###### Description:

Returns the HTML-code for this form.

- access: public

##### turn advanced search on / off

bool enableAdvancedSearch (
[bool $advancedSearch = true]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$advancedSearch | bool |

###### Description:

Triggers wether advanced search is to be used (true=yes, false=no). Returns bool(true) on success and bool(false) on error.

- access: public

##### turn array keys on / off

bool enableArrayKeys (
[bool $arrayKeys = true]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$arrayKeys | bool |

###### Description:

Triggers wether for columns of type array the keys are to be used (true=yes, false=no). Returns bool(true) on success and bool(false) on error.

- see: FormCreator::getArrayKeys()
- since: 2.9.4
- access: public
- name: FormCreator::enableArrayKeys()

##### turn titles on / off

bool enableTitles (
[bool $titles = true]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$titles | bool |

###### Description:

Triggers wether fieldnames are to be shown (true=yes, false=no). Returns bool(true) on success and bool(false) on error.

- access: public

##### get action for an event

bool(false)|string getAction (
string $name
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$name | string | name of event

###### Description:

Returns the lower-cased name of the currently selected action, or bool(false) if none has been selected yet.

- access: public

##### get state of advanced search (on / off)

bool getAdvancedSearch ()

###### Description:

Returns bool(true) if enabled, or bool(false) if disabled.

- access: public

##### get state of array keys (on / off)

bool getArrayKeys ()

###### Description:

This option triggers how to display columns of type "array". If enabled the keys are visible and editable (on edit forms). If disabled the keys are hidden.
Returns bool(true) if enabled, or bool(false) if disabled.

- see: FormCreator::enableArrayKeys()
- since: 2.9.4
- access: public
- name: FormCreator::getArrayKeys()

##### get selected columns

array getColumns ()

###### Description:

- access: public

##### get delete action

bool(false)|string getDeleteAction ()

###### Description:

- see: FormCreator::getAction()

##### get download action

bool(false)|string getDownloadAction ()

###### Description:

- see: FormCreator::getAction()

##### get edit action

bool(false)|string getEditAction ()

###### Description:

- see: FormCreator::getAction()

##### get number of entries to show per page

bool(false)|int getEntriesPerPage ()

###### Description:

Returns the number of the current page, or bool(false) on error.

- access: public

##### get the currently selected file

bool(false)|string getFile ()

###### Description:

Returns the lower-cased name of the currently selected file, or bool(false) if none has been selected yet.

- access: public

##### get data from posted form

array|bool(false) getFormdata (
int $form, string|DbStructure $source, string $table, [array $data = null], [array $columns = null]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$form | int | choose the form, the data came from (FORM_NEW, FORM_EDIT, FORM_SEARCH, FORM_ADV_SEARCH)
$source | string|DbStructure | name of the database structure file to use
$table | string | name of the database table, the data is related to
$data | array | provide the form data
$columns | array | you may limit the results to these columns (if not provided, all columns are returned)

###### Description:

This function can be used to collect the data submitted by a form, which was created using the Yana form generator.
It returns an array containing the converted form data or bool(false) on error.
If the argument $data is not provided, the function automatically takes it from the $_POST array instead.
Example of usage:

1. $args = FormCreator::getFormdata(FORM_NEW, "guestbook", "guestbook");

- access: public

##### get namespace

string|bool(false) getNamespace ()

###### Description:

Returns bool(false) on error.

- since: 2.9.2
- access: public

##### get new action

bool(false)|string getNewAction ()

###### Description:

- see: FormCreator::getAction()

##### get the currently selected page

bool(false)|int getPage ()

###### Description:

Returns the number of the current page, or bool(false) on error.

- access: public

##### get result rows

array &getRows ()

###### Description:

This function returns a reference to the rows that will be displayed. You may use this to modify the result before it is send to the browser.
Example:

1. $rows =& $form->getRows();
2. foreach ($rows as $i => $row)
3. {
4. $rows[$i]['FOO'] = $row['BAR'] . "\n" . $row['FOO'];
5. unset($rows[$i]['BAR']);
6. }

Returns an empty array on error.

- since: 2.9.6
- access: public

##### get search action

bool(false)|string getSearchAction ()

###### Description:

- see: FormCreator::getAction()

##### get the name of the column the resultset is ordered by

bool(false)|string getSort ()

###### Description:

Returns the lower-cased column name, or bool(false) if none has been set yet.

- access: public

##### get the currently selected table

bool(false)|string getTable ()

###### Description:

Returns the lower-cased name of the currently selected table, or bool(false) if none has been selected yet.

- access: public

##### get the currently selected template file

bool(false)|string getTemplate ()

###### Description:

Returns the filename of the template that is currently, selected, or bool(false) if none has been set.

- access: public

##### get state of titles (on / off)

bool getTitles ()

###### Description:

Triggers wether fieldnames are to be shown (true=yes, false=no). Returns bool(true) if enabled, or bool(false) if disabled.

- access: public

##### get the currently set where clause

bool(false)|string|array getWhere ()

###### Description:

Returns the current where clause, or bool(false) if none has been set yet.

- access: public

##### check if a filter is set on a column

bool hasFilter (
string $column
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$column | string | name of column to check

###### Description:

Returns bool(true) if a filter has been set on the column and bool(false) otherwise.

- since: 2.9.5
- access: public

##### check if resultset is sorted in descending order

bool isDescending ()

###### Description:

Returns bool(true) if sorted descending and bool(false) otherwise.

- access: public

##### set action for an event

bool setAction (
string $name, string $value
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$name | string |
$value | string |

###### Description:

Returns bool(true) on success and bool(false) on error.

- access: public

##### select columns to view in form

bool setColumns (
[array $columns = null]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$columns | array |

###### Description:

Returns bool(true) on success and bool(false) on error.

- access: public

##### set delete action

bool setDeleteAction (
string $action
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$action | string |

###### Description:

- see: FormCreator::setAction()

##### set download action

bool setDownloadAction (
string $action
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$action | string |

###### Description:

- see: FormCreator::setAction()

##### set edit action

bool setEditAction (
string $action
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$action | string |

###### Description:

- see: FormCreator::setAction()

##### set number of entries per page

bool setEntriesPerPage (
[int $entries = null]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$entries | int | number of entries per page

###### Description:

The number of entries per page needs to greater 0, defaults to 5.
Returns bool(true) on success and bool(false) on error.
Note that 'get' and 'session' vars may overrule this setting.

- access: public

##### set source file

bool setFile (
string $file
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$file | string |

###### Description:

Returns bool(true) on success and bool(false) on error.

- access: public

##### set new action

bool setNewAction (
string $action
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$action | string |

###### Description:

- see: FormCreator::setAction()

##### set current page

bool setPage (
int $page
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$page | int | number of start page

###### Description:

The first page is 0, the second is 1, aso., defaults to 0.
Returns bool(true) on success and bool(false) on error.
Note that 'get' and 'session' vars may overrule this setting.

- access: public

##### set search action

bool setSearchAction (
string $action
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$action | string |

###### Description:

- see: FormCreator::setAction()

##### set column to sort the resultset by

bool setSort (
[string $orderBy = ''], [bool $desc = null]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$orderBy | string | column name (defaults to primary key)
$desc | bool | sort descending (true=yes, false=no, defaults to false)

###### Description:

Note that 'get' and 'session' vars overrule this setting.
Returns bool(true) on success and bool(false) on error.

- access: public

##### set source table

bool setTable (
string $table
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$table | string |

###### Description:

Returns bool(true) on success and bool(false) on error.

- access: public

##### select a template for output

bool setTemplate (
int|string $template, int $layout
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$template | int|string |
$layout | int | does only apply if $template is a string

###### Description:

You may use either a filename, or one of the following constants:

- FORM_VIEW
- FORM_EDIT
- FORM_NEW
- FORM_SEARCH

Returns bool(true) on success and bool(false) on error. Issues an E_USER_WARNING, if the template is unknown.
Note that the argument $layout can be overruled by 'get' and 'session' vars.

- access: public

##### set where clause (filter)

bool setWhere (
[string|array $where = null], [bool $replace = false]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$where | string|array |
$replace | bool |

###### Description:

The syntax is as follows: column1=value1,column2=value2,...,columnN=valueN
The alternative is as follows: array(array(0=>column1,1=>value1,2=>operator1),...) Where "operator" can be one of the following: '=', 'LIKE', '<', '>', '!=', '<=', '>='
To unset the where clause, call this function without providing a parameter.
Returns bool(true) on success and bool(false) on error.

- access: public

##### inherited from base classes

Inherited From Object

- Object::cloneObject()
- Object::equals()
- Object::getClass()
- Object::serialize()
- Object::toString()

Documentation generated on Sun, 04 Jan 2009 03:49:00 +0100 by phpDocumentor 1.4.0

yana author: Thomas Meyerwww.yanaframework.net