Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cContentTypePifaForm
  • DefaultFormModule
  • DefaultFormProcessor
  • ExampleOptionsDatasource
  • MailedFormProcessor
  • Pifa
  • PifaAbstractFormModule
  • PifaAbstractFormProcessor
  • PifaAjaxHandler
  • PifaExporter
  • PifaExternalOptionsDatasourceInterface
  • PifaField
  • PifaFieldCollection
  • PifaForm
  • PifaFormCollection
  • PifaImporter
  • PifaLeftBottomPage
  • PifaRightBottomFormDataPage
  • PifaRightBottomFormExportPage
  • PifaRightBottomFormFieldsPage
  • PifaRightBottomFormImportPage
  • PifaRightBottomFormPage
  • SolrRightBottomPage

Exceptions

  • PifaDatabaseException
  • PifaException
  • PifaIllegalStateException
  • PifaMailException
  • PifaNotImplementedException
  • PifaNotYetStoredException
  • PifaValidationException
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class PifaForm

PIFA form item class. It's a kind of a model.

cGenericDb
Extended by cItemBaseAbstract
Extended by Item
Extended by PifaForm
Package: Plugin\FormAssistant
Copyright: four for business AG
Author: Marcus Gnaß <marcus.gnass@4fb.de>
Located at plugins/form_assistant/classes/class.pifa.form.php
Methods summary
public
# __construct( mixed $id = false )

Create an instance.

Create an instance.

Parameters

$id
mixed
$id ID of item to be loaded or false

Throws

cInvalidArgumentException
If table name or primary key is not set

Overrides

Item::__construct()
public array
# getErrors( )

Returns

array
public
# setErrors( array $_errors )

Parameters

$_errors
array
$_errors
public
# loadFields( )

Read this forms fields from database and aggregate them.

Read this forms fields from database and aggregate them.

public array:PifaField
# getFields( )

Returns aggregated list of PIFA fields. If no fields are aggregated, this forms fields are read from database and aggregated.

Returns aggregated list of PIFA fields. If no fields are aggregated, this forms fields are read from database and aggregated.

Returns

array:PifaField
public integer
# getLastInsertedId( )

Returns

integer
public
# setLastInsertedId( integer $_lastInsertedId )

Parameters

$_lastInsertedId
integer
$_lastInsertedId
public array
# getValues( )

Returns an array containing current values of all fields of this form where the fields column name is used as key.

Returns an array containing current values of all fields of this form where the fields column name is used as key.

Returns

array
public
# setValues( array $values = NULL, boolean $clear = false )

Sets values for this form fields.

Sets values for this form fields.

The given data array is searched for keys corresponding to this form field names. Other values are omitted. This method is meant to be called with the $_GET or $_POST superglobal variables. Validation is performed according to the specifications defined for aech form field.

Parameters

$values
array
$data
$clear
boolean
$clear if missing values should be interpreted as NULL
public array:mixed
# getFiles( )

Returns an array containing uploaded files of all fields of this form where the fields column name is used as key.

Returns an array containing uploaded files of all fields of this form where the fields column name is used as key.

Returns

array:mixed
public
# setFiles( array $files = NULL )

Sets uploaded file(s) for appropriate form fields.

Sets uploaded file(s) for appropriate form fields.

Parameters

$files
array
$files super global files array
public
# getLastError( )

Getter for protected prop.

Getter for protected prop.

public
# fromForm( )
public string
# toHtml( array $opt = NULL )

Returns HTML for this form that should be displayed in frontend.

Returns HTML for this form that should be displayed in frontend.

Parameters

$opt
array
$opt to determine form attributes

Returns

string
public
# validate( )

Loops all fields and checks their value for being obligatory and conforming to the fields rule.

Loops all fields and checks their value for being obligatory and conforming to the fields rule.

Throws

PifaValidationException
if at least one field was invalid
public boolean
# store( )

Stores the loaded and modified item to the database.

Stores the loaded and modified item to the database.

In contrast to its parent method this store() method returns true even if there were no modiifed values and thus no statement was executed. This helps in handling database errors.

Returns

boolean

Todo

Check if method store() should be implemented for PifaField too.

Overrides

Item::store()
public
# storeData( )

Stores values of each field of this form in defined data table. For fields of type INPUT_FILE the uploaded file is stored in the FileSystem (in $cfg['path']['contenido_cache'] . 'form_assistant/').

Stores values of each field of this form in defined data table. For fields of type INPUT_FILE the uploaded file is stored in the FileSystem (in $cfg['path']['contenido_cache'] . 'form_assistant/').

Throws

PifaDatabaseException
if values could not be stored
public
# toMailRecipient( array $opt )

Parameters

$opt
array
$opt
public array
# getData( )

Returns an array containing this forms stored data.

Returns an array containing this forms stored data.

Returns

array

Throws

PifaException
if form is not loaded
PifaException
if table does not exist
public
# getDataAsCsv( string $optionally = 'OPTIONALLY' )

Echoes a CSV file containing all of this forms stored data. Thatfor proper headers are sent, that add the created file as attachment for easier download.

Echoes a CSV file containing all of this forms stored data. Thatfor proper headers are sent, that add the created file as attachment for easier download.

Parameters

$optionally
string
$optionally

Throws

PifaException
if form is not loaded
PifaException
if table does not exist
private
# _getCsvFromLocalDatabaseServer( string $optionally = 'OPTIONALLY' )

Parameters

$optionally
string
$optionally

Throws

PifaException
if form is not loaded
PifaException
if table does not exist
private
# _getCsvFromRemoteDatabaseServer( )

TODO use fputcsv()

TODO use fputcsv()

Throws

PifaException
if form is not loaded
PifaException
if table does not exist
public string
# getCsv( boolean $oneRowPerField = false, array $additionalFields = NULL )

This method returns the current data as CSV file. This file usually contains two rows, one header and one value line. If $oneRowPerField is set to true the CSV-file is mirrored so that each line contains the fields header and then its value. An assoc array of $additionalFields can be given which will be appended to the current values of this form. (CON-1648)The CSV is created using a temporary file in the systems (not CONTENIDOs) TEMP folder.

This method returns the current data as CSV file. This file usually contains two rows, one header and one value line. If $oneRowPerField is set to true the CSV-file is mirrored so that each line contains the fields header and then its value. An assoc array of $additionalFields can be given which will be appended to the current values of this form. (CON-1648)The CSV is created using a temporary file in the systems (not CONTENIDOs) TEMP folder.

Parameters

$oneRowPerField
boolean
$oneRowPerField
$additionalFields
array
$additionalFields

Returns

string
public
# existsTable( mixed $tableName, mixed $bySchema = false )

Throws

PifaException
if existance of table could not be determined

See

http://www.electrictoolbox.com/check-if-mysql-table-exists/
public
# createTable( boolean $withTimestamp )

Create data table for form if it does not already exist. If there are any fields defined for this form, their columns will be created too! N.b. these fields don't have to be aggregated yet. They will be read from database if this form does not aggregate them yet.

Create data table for form if it does not already exist. If there are any fields defined for this form, their columns will be created too! N.b. these fields don't have to be aggregated yet. They will be read from database if this form does not aggregate them yet.

Parameters

$withTimestamp
boolean
$withTimestamp if table should include column for timestamp

Throws

PifaException
if form is not loaded
PifaException
if existance of table could not be determined
PifaException
if table already exists
PifaException
if table could not be created
public
# alterTable( string $oldTableName, boolean $oldWithTimestamp )

Alter data table. Renames data table if name has changed and adds or drops column for timestamp if setting has changed.

Alter data table. Renames data table if name has changed and adds or drops column for timestamp if setting has changed.

HINT: passing the old values is correct! The new values have already been stored inside the pifaForm object!

Parameters

$oldTableName
string
$oldTableName
$oldWithTimestamp
boolean
$oldWithTimestamp

Throws

PifaException
if form is not loaded
public
# storeColumn( PifaField $pifaField, string $oldColumnName )

Parameters

$pifaField
PifaField
$pifaField
$oldColumnName
string
$oldColumnName

Throws

PifaException
if form is not loaded
PifaException
if field is not loaded
public
# changeColumn( string $columnName, string $dataType, string $oldColumnName )

rename column if name has changed

rename column if name has changed

Parameters

$columnName
string
$columnName
$dataType
string
$dataType
$oldColumnName
string
$oldColumnName

Throws

PifaException
if column already exists
PifaException
if column could not be changed
public
# dropColumn( string $columnName )

Adds a column for the current field to the table of the current form.

Adds a column for the current field to the table of the current form.

Parameters

$columnName
string
$columnName

Throws

PifaException
if column already exists
public
# addColumn( string $columnName, string $dataType )

Adds a column for the current field to the table of the current form.

Adds a column for the current field to the table of the current form.

Parameters

$columnName
string
$columnName
$dataType
string
$dataType

Throws

PifaException
if field is not loaded
protected boolean
# _existsColumn( string $columnName )

Parameters

$columnName
string
$columnName

Returns

boolean

Throws

PifaException
if columns could not be read
public
# delete( )

Deletes this form with all its fields and stored data. The forms data table is also dropped.

Deletes this form with all its fields and stored data. The forms data table is also dropped.

public
# getTableName( )

Deprecated

use $this->get('data_table') instead
Methods inherited from Item
_inFilter(), _loadByWhereClause(), _onLoad(), _resetItem(), _setMetaObject(), deleteProperty(), deletePropertyById(), get(), getField(), getMetaObject(), getProperty(), loadBy(), loadByMany(), loadByPrimaryKey(), loadByRecordSet(), outFilter(), set(), setField(), setFilters(), setProperty(), toArray(), toObject()
Methods inherited from cItemBaseAbstract
__get(), __set(), _getPropertiesCollectionInstance(), _getSecondDBInstance(), _setLoaded(), _setPrimaryKeyName(), escape(), getPrimaryKeyName(), isLoaded()
Methods inherited from cGenericDb
_executeCallbacks(), register(), unregister()
Constants inherited from cGenericDb
CREATE_BEFORE, CREATE_FAILURE, CREATE_SUCCESS, DELETE_BEFORE, DELETE_FAILURE, DELETE_SUCCESS, STORE_BEFORE, STORE_FAILURE, STORE_SUCCESS
Properties summary
private array $_fields NULL
#

aggregated collection of this form fields

aggregated collection of this form fields

private array $_errors array()
#

array of errors with field names as keys and error messages as values

array of errors with field names as keys and error messages as values

private integer $_lastInsertedId NULL
#

lastInsertedId

lastInsertedId

Properties inherited from Item
$_arrInFilters, $_arrOutFilters, $_lastSQL, $_metaObject, $modifiedValues, $oldPrimaryKey, $values
Properties inherited from cItemBaseAbstract
$_className, $_loaded, $_oCache, $_primaryKeyName, $_settings, $db, $lasterror, $properties, $secondDb, $table
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0