Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Form Class Reference
Inheritance diagram for Form:
Asset Bridge MySource_Object Form_Email Form_Ecommerce

Public Member Functions

 Form ($assetid=0)
 
 create (&$link)
 
 _createAdditional (&$link)
 
 _getAllowedLinks ()
 
 linksUpdated ()
 
 cloneComponents (&$clone, $components, $override=FALSE)
 
 cloneComponentsAdditional (&$clone, $components)
 
 _cloneDIVContents ($content_type, $original_clones=Array(), $replace_keywords=Array())
 
 getAsset ($assetid, $type_code='', $mute_errors=FALSE)
 
 getLinks ($assetid, $link_types, $type_code='', $strict_type_code=TRUE, $side_of_link='major', $sort_by=NULL)
 
 getAssetMapLinks ()
 
 getParents ($shadowid, $type_code='', $strict_type_code=TRUE)
 
 getChildren ($assetid, $type_code='', $strict_type_code=TRUE, $dependant=NULL, $sort_by=NULL)
 
 _updated ($update_parents=TRUE)
 
 canCreateLink (&$minor, $link_type, $exclusive)
 
 prepareLink (&$asset, $side_of_link, &$link_type, &$value, &$sort_order, &$dependant, &$exclusive)
 
 countLinks ($assetid, $side_of_link='major', $link_types=0, $type_code='', $strict_type_code=TRUE, $ignore_linkid=0)
 
 getLineageFromURL ($assetid, $protocol, $url)
 
 getPermission ($assetid, $permission, $granted=NULL, $and_greater=TRUE, $expand_groups=FALSE, $all_info=FALSE)
 
 setPermission ($assetid, $userid, $permission, $granted)
 
 deletePermission ($assetid, $userid, $permission)
 
 getAssetInfo ($assetids, $type_code=Array(), $strict_type_code=TRUE, $field='')
 
 assetExists ($assetids)
 
 getLink ($assetid, $link_type=NULL, $type_code='', $strict_type_code=TRUE, $value=NULL, $side_of_link='major', $exclusive=NULL)
 
 getLinkById ($linkid, $assetid=0, $side_of_link='major')
 
 getLinkByAsset ($assetid, $other_assetid, $link_types=NULL, $value=NULL, $side_of_link='major', $force_array=FALSE, $dependant=NULL, $exclusive=NULL)
 
 getAllChildLinks ($assetid, $link_type=0)
 
 updateLink ($linkid, $link_type=NULL, $value=NULL, $sort_order=NULL)
 
 deleteAssetLink ($linkid, $moving=FALSE)
 
 getAssetMapAssetInfo ($assetid)
 
 createAssetLink (&$major, &$minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0', $moving=FALSE)
 
getQuestions ()
 
getAllQuestions ()
 
getQuestionAssets ($type_code=NULL)
 
getAllQuestionAssets ($type_code=NULL)
 
 getQuestionAssetsOnPage ($page_number)
 
 attachQuestion ($type_code)
 
 deleteQuestion (&$question)
 
 getQuestionCount ()
 
 getQuestionByID ($questionid)
 
getQuestionByOrder ($orderid)
 
getSections ()
 
getAllSections ()
 
 getSectionCount ()
 
getSectionLinks ()
 
 printBody ()
 
 getFormHeader ()
 
 getFormAction ()
 
 getPageContents ($page_number)
 
 getFormFooter ()
 
 printPageContentsBodycopy ()
 
 printThankYouBodycopy ()
 
 printForm ($replacements=Array())
 
 printDefaultPageContents ($also_print_sections=TRUE)
 
 getResumeSubmissionPageContents ()
 
 printStandard ()
 
 getExitPage ()
 
 createBodycopy ($name, $content=Array())
 
getBodycopy ($name='', $link_type=SQ_LINK_TYPE_2)
 
 includeContentFile ($type='Standard')
 
 getTotalPages ()
 
 getConfirmationPageContents ()
 
 getDefaultConfirmationPageContents ()
 
 fileRegeneration ()
 
 processPage ($page_number, $validate_page=TRUE, $mute_errors=FALSE)
 
 repopulate ()
 
 printErrors ()
 
 getXML ($time=NULL)
 
 printSummary ($html=FALSE)
 
 printSemanticSummary ()
 
 getFormInfo ()
 
 generateJSCode ()
 
 getClientSideFunction ()
 
 completeSubmission ()
 
 finishForm ()
 
 getSubmissionsFolder ($link_value='submissions_folder')
 
 createSubmissionsFolder ($folder_name, $link_value)
 
createSubmission ($create_in_completed=FALSE)
 
getSubmissionAsset ()
 
 updateSubmission (Form_Submission $submission_asset)
 
 getIncompleteSubmissions ()
 
 getCurrentPageNumber ()
 
 getLatestPageNumber ()
 
 getTempFileUploadPath ()
 
 restoreFromSubmissionCookie ()
 
 updateSubmissionCookie ()
 
 convertSubmissionCookieToAsset ()
 
 onRequestKeywords (&$broadcaster, $vars=Array())
 
 _getPageContentsBodycopyKeywords ()
 
 _getSubmissionLimitReachedBodycopyKeywords ()
 
 _getThankYouBodycopyKeywords ()
 
 getDisplayKeywordReplacement ($keyword)
 
 getCurrentPageContentsKeywordReplacement ()
 
 getCurrentPageNameKeywordReplacement ($current_page=NULL)
 
 getPageNumberKeywordReplacement ()
 
 getTotalPagesKeywordReplacement ()
 
 getFormContentsKeywordReplacement ()
 
 getFormContentsNoSectionsKeywordReplacement ()
 
 getFormCaptchaKeywordReplacement ()
 
 getFormCaptchaImageKeywordReplacement ()
 
 getFormCaptchaFieldKeywordReplacement ()
 
 getFormCaptchaLinkKeywordReplacement ()
 
 getFormErrorsKeywordReplacement ()
 
 getFormErrorsMessageKeywordReplacement ()
 
 getSubmitButtonKeywordReplacement ()
 
 getSaveButtonKeywordReplacement ()
 
 getSaveConfirmationKeywordReplacement ()
 
 getSaveAndExitButtonKeywordReplacement ()
 
 getResetButtonKeywordReplacement ()
 
 getPreviousPageButtonKeywordReplacement ()
 
 getPageListKeywordReplacement ()
 
 _getThankYouKeywordReplacement ($keyword)
 
 performFormSectionActions ($page_number)
 
 _finaliseStepsActions ()
 
 getSubmissionCount ()
 
 printSubmissionLimitReachedBodycopy ($replacements=Array())
 
- Public Member Functions inherited from Asset
 Asset ($assetid=0)
 
 create (Array &$link)
 
 load ($assetid)
 
 _loadDataPaths ()
 
 reload ()
 
 canDelete ()
 
 delete ($release_lock=TRUE, $check_locked=TRUE)
 
 useSystemVersion ()
 
 loadSystemVersion ()
 
 saveSystemVersion ()
 
 clearSystemVersion ()
 
 revertToSystemVersion ()
 
 revertNoticeLinksToSystemVersion ()
 
 _updated ($update_parents=TRUE)
 
 type ()
 
 getTypeAncestors ($include_asset=TRUE)
 
 incrementVersion ($number='micro', $update_parents=TRUE)
 
 getLanguages ()
 
 setLanguages (Array $languages)
 
 setCharset ($charset)
 
 setForceSecure ($force_secure)
 
 remapAssetids (Array $map)
 
 morph ($new_type_code)
 
 _morphCleanup ($new_type_code)
 
 onRequestKeywords (Asset $broadcaster, Array $vars=Array())
 
 canClone ()
 
 cloneComponents (Asset $clone, Array $components, $override=FALSE)
 
 cloneComponentsAdditional (Asset $clone, Array $components)
 
 cloneLinks (Asset $clone)
 
 getStatus ()
 
 getAvailableStatii ()
 
 getStatusDescription ()
 
 processStatusChange ($new_status, $update_parents=TRUE, $run_updated=TRUE)
 
 setDate ($date_type, $time=NULL, $userid=NULL)
 
 lockTypes ()
 
 canForceablyAcquireLock ($lock_type)
 
 getEditingLocks ($keywords)
 
 _getAllowedLinks ()
 
 createLink (Asset $minor, $link_type, $value='', $sort_order=NULL, $dependant='0', $exclusive='0', $moving=FALSE, $locked=0)
 
 prepareLink (Asset $asset, $side_of_link, &$link_type, &$value, &$sort_order, &$dependant, &$exclusive)
 
 canCreateLink (Asset $minor, $link_type, $exclusive)
 
 canMoveLink (Asset $minor, Asset $old_major, $link_type)
 
 describeLink ($linkid)
 
 isDeletableLink ($linkid)
 
 canDeleteLink ($linkid)
 
 deleteLink ($linkid, $check_locked=TRUE)
 
 linksUpdated ()
 
 canCloneLink ()
 
 saveAttributes ($dont_run_updated=FALSE, $log_message=TRUE)
 
 setAttrValue ($name, $value)
 
 attr ($name)
 
attrByRef ($name)
 
 getAttribute ($name, $mute_errors=FALSE)
 
 getAssetKeywords ($descriptions=FALSE)
 
 getAvailableKeywords ()
 
 getKeywordReplacement ($keyword)
 
 getAssetWebPathKeywordReplacement ()
 
 getCustomKeywordReplacements ($keywords=Array(), $invoke_backend=FALSE)
 
 processCustomKeywords ($keywords=Array())
 
 getContent ()
 
 setContent ()
 
 getEffectiveLastUpdatedTime ($assetids)
 
 readAccess (Array $assetids=Array())
 
 writeAccess ($lock_type='', Array $assetids=Array(), $only_workflow=TRUE)
 
 adminAccess ($lock_type='', Array $assetids=Array())
 
 backendAccess ()
 
 liveEditAccess ($lock_type)
 
 canliveEdit ($lock_type)
 
 effectiveUnrestricted ()
 
 checkAccess ($perm, $lock_type, Array $assetids=Array(), $only_workflow=TRUE)
 
 accessEffective ()
 
 permissionsUpdated ()
 
 printFrontend ()
 
 printFrontendAsset (Asset $asset, $design=NULL)
 
 getValidProtocols ()
 
 printHead ()
 
 printBody ()
 
 getCurrentPaintLayoutName ()
 
 getCurrentDesignName ()
 
 printBodyWithPaintLayout ($layout_id='')
 
 initLimbo ()
 
 printLimbo ()
 
 paintBackend (Backend_Outputter $o)
 
 getPrefix ()
 
 processBackend (Backend_Outputter $o, Array &$link)
 
 getEI ()
 
 getEditFns ()
 
 getBackendHref ($screen='', $backend_page=TRUE)
 
 getURL ($base_url=NULL, $ignore_rollback=FALSE, $base_contextid=NULL)
 
 getURLs ()
 
 getHref ($base_url=NULL, $ignore_rollback=FALSE)
 
 getWebDataPath ()
 
 getWebPaths ()
 
 saveWebPaths ($paths, $auto_add_remaps=TRUE)
 
 getLookups ($field='')
 
 getDesignLookups ()
 
 getLookupValues ($inherited=NULL, $prefix='', $like_search=TRUE, $ignore_override=FALSE)
 
 deleteLookupValue ($layout_name, $layout_value)
 
 setPaintLayouts ($layouts)
 
 updateLookups ($auto_add_remaps=TRUE)
 
 setLookupValues (Array $values)
 
 getAssetStatusDescriptionKeywordReplacement ()
 
 getAssetStatusColourKeywordReplacement ()
 
 replaceKeywordsInString ($string)
 
 fastTrack ($tasks)
 
 unFastTrack ($tasks)
 
 shouldFastTrack ($task, $assetid=NULL)
 
 getFaskTrackedTaskAssetids ($task)
 
 getDependantParentsURL ()
 
- Public Member Functions inherited from MySource_Object
 MySource_Object ()
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

 $current_answers = Array()
 
 $extra_data = Array()
 
 $active_section = NULL
 
 $submission_errors = NULL
 
 $submission_asset = NULL
 
- Data Fields inherited from Asset
 $id = 0
 
 $version = ''
 
 $name = ''
 
 $short_name = ''
 
 $status
 
 $languages = ''
 
 $charset = ''
 
 $force_secure = '0'
 
 $created
 
 $created_userid
 
 $updated
 
 $updated_userid
 
 $published
 
 $published_userid
 
 $status_changed
 
 $status_changed_userid
 
 $_is_cacheable = FALSE
 
 $vars = Array()
 
 $_available_keywords = Array()
 
 $data_path_suffix = ''
 
 $data_path = ''
 
 $data_path_public = ''
 
 $_ser_attrs = FALSE
 
- Data Fields inherited from MySource_Object
 $_tmp
 

Protected Member Functions

 _getName ($short_name=FALSE, $contextid=NULL)
 
 _handleCompletedFileUploads ()
 
 _getConfirmationPageContentsBodycopyKeywords ()
 
 _getCommonQuestionKeywords (Form_Question $question, Asset $parent)
 
 _getCommonSectionKeywords (Form_Section $section)
 
 _getQuestionResponseKeywords (Form_Question $question, Asset $parent)
 
 _getCaptchaDisplayKeywords ()
 
 _getMollomCaptchaDisplayKeywords ()
 
- Protected Member Functions inherited from Asset
 _preCreateCheck (Array &$link)
 
 _createAdditional (Array &$link)
 
 _abortCreate ($trigger_level_changed=FALSE, $linkid=0)
 
 _loadVars ()
 
 _getName ($short_name=FALSE, $contextid=NULL)
 
 _getKeywordReplacement ($keyword)
 
 _checkPermissionAccess ($perm, $assetids=Array(), $only_workflow=TRUE)
 
 makeAndSaveInitialWebPath ($path, $parent_link=NULL)
 

Detailed Description

Definition at line 37 of file form.inc.

Member Function Documentation

_cloneDIVContents (   $content_type,
  $original_clones = Array(),
  $replace_keywords = Array() 
)

Clone the contents div assets

Parameters
object$content_typeThe content type asset to be cloned
array$original_clonesAn array containing the assetids of the original and cloned assets
array$replace_keywordsAn array containing the keyword of the assets
Returns
boolean private

Definition at line 401 of file form.inc.

_createAdditional ( $link)

Perform any additional processing required during the creation of this asset

For example, creating other child assets should be performed in this method

Parameters
array&$linkinformation used to create the initial link
Array (
  'asset'        => [ref major asset to create link under],
  'link_type'    => SQ_LINK_?,
  'value'        => [link value],
  'sort_order'   => [link sort order],
  'is_dependant' => [0|1],
  'is_exclusive' => [0|1],
)
Returns
boolean private

Definition at line 138 of file form.inc.

_finaliseStepsActions ( )

Perform any operations that needs to be done for selected section submission actions, after all the individual form step actions are executed and the form is submitted

public

Returns
void

Definition at line 5058 of file form.inc.

_getAllowedLinks ( )

Returns an array of all the permitted link type, the type asset and the cardinality

Returns
array private
See Also
Asset::_getAllowLinks()

Definition at line 184 of file form.inc.

_getCaptchaDisplayKeywords ( )
protected

Return CAPTCHA display keywords so they can be injected where necessary

Returns
array

Definition at line 4133 of file form.inc.

_getCommonQuestionKeywords ( Form_Question  $question,
Asset  $parent 
)
protected

Get an array of question-related keywords applicable to all contexts

Parameters
Form_Question$questionThe form question we getting keywords for
Asset$parent(Form|Form_Section) parent asset
Returns
array

Definition at line 4045 of file form.inc.

_getCommonSectionKeywords ( Form_Section  $section)
protected

Get an array of section-related keywords applicable to all contexts

Parameters
Form_Section$sectionThe form section we are gathering keywords for
Returns
array

Definition at line 4083 of file form.inc.

_getConfirmationPageContentsBodycopyKeywords ( )
protected

Get an array of keywords for the Confirmation Page Contents bodycopy

Returns
array

Definition at line 4005 of file form.inc.

_getMollomCaptchaDisplayKeywords ( )
protected

Return Mollom CAPTCHA display keywords so they can be injected where necessary

Returns
array

Definition at line 4153 of file form.inc.

_getName (   $short_name = FALSE,
  $contextid = NULL 
)
protected

Returns name of the asset

Parameters
boolean$short_namewhether or not we are after the shortname or the full name
int$contextidwhat context to return the name from
Returns
string private
See Also
Asset::_getName()

Definition at line 159 of file form.inc.

_getPageContentsBodycopyKeywords ( )

Get an array of keywords for Page Contents Bodycopy

Returns
array private

Definition at line 3902 of file form.inc.

_getQuestionResponseKeywords ( Form_Question  $question,
Asset  $parent 
)
protected

Get an array of question-related keywords applicable to response contexts

"Response contexts" include: Thank You summary pages, Confirmation page,

Parameters
Form_Question$questionThe form question we getting keywords for
Asset$parent(Form|Form_Section) parent asset
Returns
array

Definition at line 4105 of file form.inc.

_getSubmissionLimitReachedBodycopyKeywords ( )

Get an array of keywords for Submission Limit Reached (bodycopy)

Returns
array private

Definition at line 3948 of file form.inc.

_getThankYouBodycopyKeywords ( )

Get an array of keywords for Thank You Context (bodycopy)

Returns
array private

Definition at line 3965 of file form.inc.

_getThankYouKeywordReplacement (   $keyword)

Get appropriate keywords for Thank You bodycopy and emails

This can be extended further down the line. For instance, Form_Email (the "standard" custom form asset in Matrix) adds referrer-related keywords.

Parameters
string$keywordkeyword to replace
Returns
string

Definition at line 4808 of file form.inc.

_handleCompletedFileUploads ( )
protected

Handle file uploads for a complete submission

Does two things, depending on whether a create location is set:

  • Create Location: create a NOTICE link between the File asset and the submission.
  • No Create Location: Move file upload to the submission asset's data directory.
Returns
void

Definition at line 3218 of file form.inc.

_updated (   $update_parents = TRUE)

Set the last updated info for this asset

Call this function when the asset has been changed in some way so we can indicated in the asset table when the asset was last changed and who by. This function will also increment the micro version number for the asset.

Parameters
boolean$update_parentsshould we go through an update all our dependant parents as well ? NOTE: this is passed to incrementVersion to let it know that the parents should have their versions updated as well.
Returns
boolean private

Definition at line 874 of file form.inc.

assetExists (   $assetids)

Determine if the passed assetid or assetids refer(s) to a valid asset in the system

Note that this will always return FALSE if you pass it a shadow asset

Parameters
mixed$assetidsthe ID of the asset we are going to the check for existence or an array of assetids we want to check
Returns
mixed boolean|array public

Definition at line 1074 of file form.inc.

attachQuestion (   $type_code)

attach a question to this form

Returns boolean FALSE if a database problem occurs or if question already attached, or TRUE if sucessful

Parameters
string$type_codethe type code of the question we are adding
Returns
boolean public

Definition at line 1414 of file form.inc.

canCreateLink ( $minor,
  $link_type,
  $exclusive 
)

Returns TRUE if the passed minor asset can be linked to this asset, or a string with the error msg

Parameters
object&$minorthe minor asset that we are linking to
string$link_typethe type of link this is
int$exclusivethe exclusive status of the link (gets passed to canLinkToType)
Returns
mixed boolean|string public

Definition at line 893 of file form.inc.

cloneComponents ( $clone,
  $components,
  $override = FALSE 
)

Clones certain specified components of the asset

Parameters
object&$clonethe clone asset shell
array$componentsthe wanted components to clone eg.
                                Array(
                                    'attributes',
                                    'metadata_schemas',
                                    'metadata',
                                    'workflow',
                                    'permissions',
                                    'data',
                                    'content_tags',
                                    'roles',
                                );
                                or alternately
                                Array('all');
boolean$overridewhether or not to override the existing permission, metadata schemas, workflow schemas with the new ones.
Returns
boolean public
See Also
asset::cloneComponents()

Definition at line 245 of file form.inc.

cloneComponentsAdditional ( $clone,
  $components 
)

Perform any additional processing required during the cloning of this asset

This function is being called by asset_manager after the dependants of asset have been cloned.

Parameters
object&$clonethe clone asset shell
array$componentsthe wanted components to clone eg. Array ( 'attributes', 'metadata_schemas', 'metadata', 'workflow', 'permissions', 'data', ); or alternately Array('all');
Returns
boolean public
See Also
asset::cloneComponentsAdditional()

Definition at line 298 of file form.inc.

completeSubmission ( )

Complete a submission and clean up

Does the following actions:

  • fill in final information - complete attribute and XML version of submission result
  • On a multi-page form with submissions logged, move the submission from incomplete to completed submissions
  • Or: on a single-page form, create the submission if we are logging them
  • Or: on a multi-page form when submissions are NOT logged, nuke the submission now we are done with using it
Returns
void

Definition at line 3115 of file form.inc.

convertSubmissionCookieToAsset ( )

Convert a submission stored in a session variable to an asset

Definition at line 3824 of file form.inc.

countLinks (   $assetid,
  $side_of_link = 'major',
  $link_types = 0,
  $type_code = '',
  $strict_type_code = TRUE,
  $ignore_linkid = 0 
)

Return the number of links in the system that involve the specified asset

Can be restricted by either link type and/or asset type code

Parameters
int$assetidid of the the $side_of_link asset
string$side_of_linkWhich side of the link this (the current) asset is on ('major' or 'minor')
int$link_typesinteger that can be the product of bitwise operations on the SQ_LINK_* constants
mixed$type_codethe type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values
boolean$strict_type_codewhether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes
int$ignore_linkidignore the link represented by this link id when returning the count
Returns
int public

Implements Bridge.

Definition at line 955 of file form.inc.

create ( $link)

Create this asset, setting attributes prior to creation

Parameters
array&$linkinformation used to create the initial link
Returns
mixed int|boolean public

Definition at line 109 of file form.inc.

createAssetLink ( $major,
$minor,
  $link_type,
  $value = '',
  $sort_order = NULL,
  $dependant = '0',
  $exclusive = '0',
  $moving = FALSE 
)

Create a link between the two supplied assets

Parameters
object&$majorthe major asset that we are linking from
object&$minorthe minor asset that we are linking to
string$link_typethe type of link this is
string$valuethe value that is to be associated with this link
string$sort_orderthe position in the links list that this link should take, if null or less than zero places at end of list
string$dependant'0' / '1' - whether the minor asset is dependant on the major
string$exclusive'0' / '1' - whether the major asset is to be the minor's only parent
boolean$movingwhether or not this asset is being moved
Returns
int public

Definition at line 1238 of file form.inc.

createBodycopy (   $name,
  $content = Array() 
)

create a bodycopy and attach to the Bodycopies folder of the form

The $name attribute will also be used for the Link Value of the link between the form's Bodycopies folder and the new bodycopy. The name will be lowercased, spaces replaced with underscores, and assigned to the link value. So if 'Thank You' is the name of the bodycopy (for instance), it will be linked to the Bodycopies folder with the link value 'thank_you'. Returns boolean FALSE if the bodycopy already exists or if the creation failed for some reason, or TRUE if it was successfully created

Parameters
string$namethe name of the bodycopy to create
Returns
boolean public

Definition at line 2288 of file form.inc.

& createSubmission (   $create_in_completed = FALSE)

creates a new submission object

Parameters
boolean$create_in_completedIf true, it will be created in Completed Submissions folder - otherwise, place in Incomplete Submissions.
Returns
object public

Definition at line 3453 of file form.inc.

createSubmissionsFolder (   $folder_name,
  $link_value 
)

Create a submissions folder

Parameters
string$folder_nameThe name of the folder
string$link_valueThe value of the link between the form and the folder
Returns
mixed Folder|null public

Definition at line 3378 of file form.inc.

deleteAssetLink (   $linkid,
  $moving = FALSE 
)

Remove a link by id

Parameters
int$linkidthe link id of the link to remove
boolean$movingTRUE if this delete is part of a move operation
Returns
boolean public

Implements Bridge.

Definition at line 1200 of file form.inc.

deletePermission (   $assetid,
  $userid,
  $permission 
)

Deletes a permission with the passed user or user_group

Parameters
int$assetidthe assetid for asset whose permissions to delete
int$useridthe id of the user or user_group to remove the permission from
string$permissionthe permission code you are deleting
Returns
boolean public

Definition at line 1035 of file form.inc.

deleteQuestion ( $question)

delete a question to this form

Returns boolean FALSE if a database problem occurs or if question already attached, or TRUE if sucessful

Parameters
object&$questionthe Form_Question object to delete
Returns
boolean public

Definition at line 1477 of file form.inc.

fileRegeneration ( )

regenerates the content file for this form

Returns
boolean public

Definition at line 2540 of file form.inc.

finishForm ( )

function to finish off form and print thank you bodycopy

Returns
boolean public

Definition at line 3268 of file form.inc.

Form (   $assetid = 0)

Constructor

Parameters
int$assetidthe asset id to be loaded
Returns
void public

Definition at line 89 of file form.inc.

generateJSCode ( )

writes JavaScript code for client side validation

This function assumes the skeleton of a JS validation function has been created around this code with a form variable named 'form' passed (this is done when generating the content file).

Returns
string public

Definition at line 2980 of file form.inc.

getAllChildLinks (   $assetid,
  $link_type = 0 
)

Get details of the links from the specified asset to all its children

Parameters
string$assetidthe assetid of the asset to find the child links for
int$link_typethe type of links to get
Returns
array public

Definition at line 1163 of file form.inc.

& getAllQuestionAssets (   $type_code = NULL)

get the question assets attached to this form, even inside sections

This also includes all questions inside nested sections.

Parameters
string$type_codeWhen specified, only return assets of this exact type
Returns
array public

Definition at line 1336 of file form.inc.

& getAllQuestions ( )

get the assetids of ALL of this form's questions, including those inside sections (even nested sections).

Returns an array of (full assetid => question detail)

Returns
array public

Definition at line 1273 of file form.inc.

& getAllSections ( )

Returns all sections regardless of depth

Structure of return array is Array(object Form_Section).

Returns
array public

Definition at line 1593 of file form.inc.

getAsset (   $assetid,
  $type_code = '',
  $mute_errors = FALSE 
)

Returns a reference to the asset represented by the passed assetid (or NULL on error)

Parameters
int$assetidthe full asset ID to be loaded
string$type_codeif this exists then this object is used to load the asset, if not then the DB is queried to find out the asset type
boolean$mute_errorsstops the outputting of errors in this fn, needed because you can't use the '@' operator when returning by reference
Returns
object public
See Also
Asset_Manager::&getAsset()

Implements Bridge.

Definition at line 448 of file form.inc.

getAssetInfo (   $assetids,
  $type_code = Array(),
  $strict_type_code = TRUE,
  $field = '' 
)

Returns an array of information about assets of the passed codes

If one value in $field then the return value is Array(assetid => '[field]'), otherwise Array(assetid => Array())

Parameters
array$assetidsan array of assets to limit
mixed$type_codean asset type code, or array of typecodes, to limit results to
boolean$strict_type_codeensure returned assets are of the passed type codes
string$fieldsingle field from the asset table to return (along with the assetid) Default is all fields
Returns
array public

Definition at line 1056 of file form.inc.

getAssetMapAssetInfo (   $assetid)

Get asset info for use by asset map

Parameters
string$assetidFull Asset id to get information for
Returns
array public

Implements Bridge.

Definition at line 1215 of file form.inc.

getAssetMapLinks ( )

Used by asset map to return a asset map-style link array

Returns
array public

Definition at line 650 of file form.inc.

& getBodycopy (   $name = '',
  $link_type = SQ_LINK_TYPE_2 
)

returns a reference to a bodycopy based of the name of the bodycopy

Parameters
string$namethe name of the bodycopy
Returns
object public

Definition at line 2364 of file form.inc.

getChildren (   $assetid,
  $type_code = '',
  $strict_type_code = TRUE,
  $dependant = NULL,
  $sort_by = NULL 
)

Get all asset ids that are below the passed assetid in the various trees in which it exists

Return structure: Array(int => string) - asset id => type_code

Parameters
int$assetidthe id of the asset to get its children for
string | array$type_codethe type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values
boolean$strict_type_codewhether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes
boolean$dependantif TRUE, results will be filtered to assets that are dependants. If FALSE, results will all not be dependants. If NULL, results will not be filtered
string$sort_bya field in the asset table you would like the results sorted by (eg. name, short_name etc)
Returns
array public
See Also
Asset_Manager::getChildren()

Implements Bridge.

Definition at line 777 of file form.inc.

getClientSideFunction ( )

Builds a JavaScript fn that can be called to initiate client-side validation

Returns
string public

Definition at line 3061 of file form.inc.

getConfirmationPageContents ( )

Get the Confirmation Page, wherever it comes from

Returns
string

Definition at line 2466 of file form.inc.

getCurrentPageContentsKeywordReplacement ( )

Current Page Contents keyword replacement

Returns
string public

Definition at line 4335 of file form.inc.

getCurrentPageNameKeywordReplacement (   $current_page = NULL)

Current Page Contents keyword replacement

Parameters
int$current_pageSpecify a page number to get the name of. If NULL, return current page.
Returns
string public

Definition at line 4356 of file form.inc.

getCurrentPageNumber ( )

Return the current page number

Returns
string

Definition at line 3672 of file form.inc.

getDefaultConfirmationPageContents ( )

Get the default contents of the Confirmation Page

Returns
string

Definition at line 2509 of file form.inc.

getDisplayKeywordReplacement (   $keyword)

Get a replacement for a keyword used during the display of the form

If no suitable replacement exists, the function will return NULL instead.

Parameters
string$keywordThe keyword to replace
Returns
mixed string|NULL

Definition at line 4181 of file form.inc.

getExitPage ( )

Create the "Exit Page", which will be displayed when "Save and Exit" is selected on a form

If the Exit Page Contents bodycopy is not customised, then... ???

Returns
string

Definition at line 2236 of file form.inc.

getFormAction ( )

Returns the action this form should be using

Returns
string

Definition at line 1895 of file form.inc.

getFormCaptchaFieldKeywordReplacement ( )

Form Captcha Field keyword replacement

Returns
string public

Definition at line 4541 of file form.inc.

getFormCaptchaImageKeywordReplacement ( )

Form Captcha Image keyword replacement

Returns
string public

Definition at line 4497 of file form.inc.

getFormCaptchaKeywordReplacement ( )

Form Captcha keyword replacement

Returns
string public

Definition at line 4451 of file form.inc.

getFormCaptchaLinkKeywordReplacement ( )

Form Captcha Link keyword replacement

Returns
string public

Definition at line 4556 of file form.inc.

getFormContentsKeywordReplacement ( )

Form Contents keyword replacement

Returns
string public

Definition at line 4418 of file form.inc.

getFormContentsNoSectionsKeywordReplacement ( )

Form Contents keyword replacement

Returns
string public

Definition at line 4437 of file form.inc.

getFormErrorsKeywordReplacement ( )

Form Errors keyword replacement

Returns
string public

Definition at line 4571 of file form.inc.

getFormErrorsMessageKeywordReplacement ( )

Form Errors Message keyword replacement

Returns
string public

Definition at line 4588 of file form.inc.

getFormFooter ( )

Returns the form footer and anything else needed by it

Returns
string

Definition at line 2019 of file form.inc.

getFormHeader ( )

Returns the header of the form, ie. the start form tags and anything else needed by them

Returns
string

Definition at line 1853 of file form.inc.

getFormInfo ( )

returns information about where the form exists

Returns
array public

Definition at line 2947 of file form.inc.

getIncompleteSubmissions ( )

Returns an array of asset IDs representing submissions sitting in the incomplete submissions folder

Returns
array

Definition at line 3632 of file form.inc.

getLatestPageNumber ( )

Return the latest page number

Returns
string

Definition at line 3696 of file form.inc.

getLineageFromURL (   $assetid,
  $protocol,
  $url 
)

Returns an array of assetid's + info in the order that they propogate out from THIS BRIDGE'S url

Parameters
string$assetidthe id of the last asset in the lineage
string$protocolthe protocol to match -> null means it is ignored
string$urlthe url to check for -> null defaults it to current url
Returns
array public

Implements Bridge.

Definition at line 973 of file form.inc.

getLink (   $assetid,
  $link_type = NULL,
  $type_code = '',
  $strict_type_code = TRUE,
  $value = NULL,
  $side_of_link = 'major',
  $exclusive = NULL 
)

Get details of a link with the specified characteristics

Parameters
int$assetidid of the the $side_of_link asset
int$link_typeinteger that should be a single integer of the SQ_LINK_* constants
mixed$type_codethe type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values
boolean$strict_type_codewhether we are finding an asset that is just a $type_code or potentially an inherited type or $type_code and any of it's sub-classes
string$valuethe value that is associated with this link
string$side_of_linkWhich side of the link this (the current) asset is on ('major' or 'minor')
boolean$exclusiveThe exclusive status for the link must be this (if not null)
Returns
array public

Definition at line 1102 of file form.inc.

getLinkByAsset (   $assetid,
  $other_assetid,
  $link_types = NULL,
  $value = NULL,
  $side_of_link = 'major',
  $force_array = FALSE,
  $dependant = NULL,
  $exclusive = NULL 
)

Get details of the link(s) between the two specified assets

Parameters
int$assetidid of the the $side_of_link asset
int$other_assetidthe asset on the other side of the link
int$link_typesinteger that can be the product of bitwise operations on the SQ_LINK_* constants
string$valuethe value that is associated with this link
string$side_of_linkWhich side of the link the first assetid is on ('major' or 'minor')
boolean$force_arrayforce the results to return an array of links even if there is only one link
boolean$dependantThe dependant status for all the links must be this (if not null)
boolean$exclusiveThe exclusive status for all the links must be this (if not null)
Returns
array public

Definition at line 1147 of file form.inc.

getLinkById (   $linkid,
  $assetid = 0,
  $side_of_link = 'major' 
)

Get details of the link with specified linkid

Parameters
int$linkidid of the link were returning
int$assetidid of the the $side_of_link asset if zero no check is made and both major and minor information is returned
string$side_of_linkWhich side of the link the asset represented by $assetid is on ('major' or 'minor')
Returns
array public

Definition at line 1120 of file form.inc.

getLinks (   $assetid,
  $link_types,
  $type_code = '',
  $strict_type_code = TRUE,
  $side_of_link = 'major',
  $sort_by = NULL 
)

Return all links that this asset has to any shadow assets

Parameters
int$assetidid of the the $side_of_link asset
int$link_typesinteger that can be the product of bitwise operations on the SQ_LINK_* constants
string | array$type_codethe type of asset that is linked (eg 'Page', 'File', etc) if an array returns link if matches any of the array values
boolean$strict_type_codewhether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes
string$side_of_linkWhich side of the link this (the current) asset is on ('major' or 'minor')
string$sort_bya field in the asset table you would like the results sorted by (eg. name, short_name etc)
Returns
array public

Implements Bridge.

Definition at line 507 of file form.inc.

getPageContents (   $page_number)

Print a single page of a multiple page form

Page number is 1-indexed. If there are unattached questions, this will be page 1, then the first section is page 2. If no unattached questions, the first section is page 1.

Parameters
int$page_numberThe current page number
Returns
string

Definition at line 1935 of file form.inc.

getPageListKeywordReplacement ( )

Get a keyword replacement for Page List

Returns
string

Definition at line 4731 of file form.inc.

getPageNumberKeywordReplacement ( )

Page Number keyword replacement

Returns
string public

Definition at line 4392 of file form.inc.

getParents (   $shadowid,
  $type_code = '',
  $strict_type_code = TRUE 
)

Get all asset ids that are above the passed assetid in the various trees in which it exists

Parameters
int$shadowidthe shadow ID of the shadow asset to get (ie. the part after the ':')
string | array$type_codethe type of asset that is linked (eg 'User', 'User_Group', etc) if an array returns link if matches any of the array values
boolean$strict_type_codewhether we are finding assets that are just a $type_code or $type_code and any of it's sub-classes
Returns
array public
See Also
Asset_Manager::getParents()

Implements Bridge.

Definition at line 722 of file form.inc.

getPermission (   $assetid,
  $permission,
  $granted = NULL,
  $and_greater = TRUE,
  $expand_groups = FALSE,
  $all_info = FALSE 
)

Returns an array of all user or user_group assets that have the passed permission for the passed asset

Parameters
int$assetidthe assetid for asset whose permissions to get
string$permissionthe permission code you are getting
boolean$grantedtype of Access : null = all, TRUE = granted, FALSE = denied
boolean$and_greaterget effective permission (eg read access = read or write or admin)
boolean$expand_groupsexpand user groups so only user ids get returned (NOTE: only valid if $all_info is FALSE)
boolean$all_infowhen FALSE fn just returns an array of userids for those that have permission When TRUE fn returns all info about the permission in the form of Array(userid => granted) (NOTE: TRUE is only valid if $and_greater and $expand_groups are FALSE)
Returns
array public

Definition at line 1000 of file form.inc.

getPreviousPageButtonKeywordReplacement ( )

Previous Page Button keyword replacement

Returns
string public

Definition at line 4707 of file form.inc.

& getQuestionAssets (   $type_code = NULL)

Gets only the question assets that are attached to this form.

Parameters
string$type_codeWhen specified, only return assets of this exact type
Returns
array public

Definition at line 1306 of file form.inc.

getQuestionAssetsOnPage (   $page_number)

Get questions attached to certain page

Parameters
int$page_numberThe page number to get questions from
Returns
array

Definition at line 1358 of file form.inc.

getQuestionByID (   $questionid)

get a specific question, and return the question's link

Parameters
string$questionidThe question's (shadow?) ID
Returns
array public

Definition at line 1535 of file form.inc.

& getQuestionByOrder (   $orderid)

get specific question by order, and return the question's link

Parameters
int$orderidThe question's sort order
Returns
array public

Definition at line 1551 of file form.inc.

getQuestionCount ( )

returns the number of sections in this form

Returns
int public

Definition at line 1519 of file form.inc.

& getQuestions ( )

Get the question links attached to this form (and only to this form).

Returns an array of (question ID => question detail).

Returns
array public

Definition at line 1256 of file form.inc.

getResetButtonKeywordReplacement ( )

Reset Button keyword replacement

Returns
string public

Definition at line 4690 of file form.inc.

getResumeSubmissionPageContents ( )

Gets the contents of a "resume submission" page

Definition at line 2193 of file form.inc.

getSaveAndExitButtonKeywordReplacement ( )

"Save and Exit" Button keyword replacement

Only display if the "Exit Page Contents" bodycopy has been enabled.

Returns
string public

Definition at line 4665 of file form.inc.

getSaveButtonKeywordReplacement ( )

Save Button keyword replacement

Returns
string public

Definition at line 4627 of file form.inc.

getSaveConfirmationKeywordReplacement ( )

Save Confirmation keyword replacement

Returns
string public

Definition at line 4644 of file form.inc.

getSectionCount ( )

returns the number of sections in this form

Returns
int public

Definition at line 1618 of file form.inc.

& getSectionLinks ( )

Get the question links attached to this form (and only to this form).

Returns an array of (question ID => question detail).

Returns
array public

Definition at line 1633 of file form.inc.

& getSections ( )

returns immediate sections in this form in order of 'sort_order'

Structure of return array is Array(object Form_Section).

Returns
array public

Definition at line 1571 of file form.inc.

& getSubmissionAsset ( )

Returns the current submission asset

Returns
object public

Definition at line 3533 of file form.inc.

getSubmissionCount ( )

Gets the (completed) submission count for this form

public

Returns
boolean/int

Definition at line 5087 of file form.inc.

getSubmissionsFolder (   $link_value = 'submissions_folder')

Get the submissions folder specified by the link value

If called with zero arguments, points to the "Completed Submissions" folder, as per previous behaviour. This SHOULD be called with an attribute as much as possible, though, to avoid ambiguity.

Parameters
string$link_valueThe value of the link of the submissions folder to get
Returns
mixed Folder|null public

Definition at line 3357 of file form.inc.

getSubmitButtonKeywordReplacement ( )

Submit Button keyword replacement

Returns
string public

Definition at line 4603 of file form.inc.

getTempFileUploadPath ( )

Callback function to inform File Upload-type questions where to upload their incomplete submissions to

In our case, it is:

  • incomplete_attachments/[session_id] when no incomplete submission asset exists (ie. one-page form, or anonymous submission)
  • incomplete_attachments/s[subm. assetid] when an incomplete submission is represented by an asset
Returns
string

Definition at line 3727 of file form.inc.

getTotalPages ( )

Returns the total number of pages in this form.

If multi-page form is DISABLED, then the whole form is one page. If ENABLED, then each top-level section becomes a page, and any unattached questions share one extra page, if any.

In either case, if the confirmation page is enabled, add one page.

Returns
int

Definition at line 2440 of file form.inc.

getTotalPagesKeywordReplacement ( )

Total Pages keyword replacement

Returns
string public

Definition at line 4405 of file form.inc.

getXML (   $time = NULL)

returns an answer summary in XML format (suitable for submission logs)

Parameters
int$timeThe timestamp of the submission, NULL is to use the current time
Returns
boolean public

Definition at line 2771 of file form.inc.

includeContentFile (   $type = 'Standard')

includes the content file for this form

Options available for $type:

  • "Standard": include the whole form, including sections. Useful for single-page form.
  • "Questions": only include unattached questions. Useful for a multi-page form.
Parameters
string$typethe type of content file to generate
Returns
boolean public

Definition at line 2399 of file form.inc.

linksUpdated ( )

Allow any required processesing to occur when any link is updated for the asset

Bug Fix #1671 When a new link to the section is created or deleted, update the content file

Returns
void protected

Definition at line 212 of file form.inc.

onRequestKeywords ( $broadcaster,
  $vars = Array() 
)

Add valid keywords for this asset to an array of keywords when asked

Parameters
object&$broadcasterthe asset that triggered the event
array$varsthe vars that get submitted by the broadcaster we add keywords to the $vars['keywords'] array
Returns
boolean private

Definition at line 3845 of file form.inc.

performFormSectionActions (   $page_number)

Perform any section submission actions that are valid and active for current page in the form

Parameters
int$page_numberCurrent page number

public

Returns
boolean

Definition at line 5016 of file form.inc.

prepareLink ( $asset,
  $side_of_link,
$link_type,
$value,
$sort_order,
$dependant,
$exclusive 
)

Prepares for linking by checking that the link values are valid for this link

This function will be called if this asset is the major or minor party in the link, so the side_of_link flag should be checked to work out what side of the link this asset is on. The return value should indicate if any of the link fields were changed.

Parameters
object&$assetthe major or minor asset that we are linking to
string$side_of_linkthe side of the link we are on (major or minor)
string&$link_typethe type of link we are creating
string&$valuethe value that is to be associated with the link
string&$sort_orderthe position in the links list that this link should take,
string&$dependant'0' / '1' on whether the this asset is dependant on the asset that will be linked by the new link
string&$exclusive'0' / '1' on whether the this asset is linked exclusivly to the asset that will be linked by the new link
Returns
boolean public

Definition at line 924 of file form.inc.

printBody ( )

Print the body of this asset

Returns
void public

Definition at line 1671 of file form.inc.

printDefaultPageContents (   $also_print_sections = TRUE)

Prints the default page contents

Parameters
boolean$also_print_sectionsWhether to also print the sections of this form. If multi-page is turned on, this should be FALSE.
Returns
string

Definition at line 2119 of file form.inc.

printErrors ( )

prints the errors that occured in a form submission

Returns
boolean public

Definition at line 2747 of file form.inc.

printForm (   $replacements = Array())

Prints the form to screen

Parameter $replacements is DEPRECATED; consider placing additional replacements in a subclassed getDisplayKeywordReplacements(), or their own function, instead.

Parameters
array$replacementsa list of additional replacements that subclasses can use to insert additional keywords
Returns
void public

Definition at line 2071 of file form.inc.

printPageContentsBodycopy ( )

Print 'Page Contents' Bodycopy context

Returns
void public

Definition at line 2032 of file form.inc.

printStandard ( )

Prints the standard form i.e not a wizard

Returns
boolean public

Definition at line 2206 of file form.inc.

printSubmissionLimitReachedBodycopy (   $replacements = Array())

Prints the Submission limit reached bodycopy

Parameters
array$replacementsa list of additional replacements that subclasses can use to insert additional keywords
Returns
void public

Definition at line 5111 of file form.inc.

printSummary (   $html = FALSE)

returns a summary about the answers in the form submission

Parameters
boolean$htmlreturn html formatted or not
Returns
boolean public

Definition at line 2839 of file form.inc.

printThankYouBodycopy ( )

Print 'Thank You' Bodycopy context

Returns
void public

Definition at line 2045 of file form.inc.

processPage (   $page_number,
  $validate_page = TRUE,
  $mute_errors = FALSE 
)

Processes the specified page

Parameters
int$page_numberThe page number to be processed
boolean$validate_pageIf TRUE, the function will return FALSE if the question values are invalid or the CAPTCHA is incorrectly entered. This is usually only set TRUE when moving forward in the form
boolean$mute_errorsMute validation error
Returns
boolean

Definition at line 2561 of file form.inc.

repopulate ( )

re-populates the active submissions of its members

Returns
void public

Definition at line 2718 of file form.inc.

restoreFromSubmissionCookie ( )

Restore an anonymous submission from a session variable

Returns
void

Definition at line 3750 of file form.inc.

setPermission (   $assetid,
  $userid,
  $permission,
  $granted 
)

Sets a permission for the passed user or user_group

Parameters
int$assetidthe assetid for asset whose permissions to set
int$useridthe id of the user or user_group to add the permission for
string$permissionthe permission code you are adding
boolean$grantedwhether this permission grants access or not
Returns
boolean public

Definition at line 1018 of file form.inc.

updateLink (   $linkid,
  $link_type = NULL,
  $value = NULL,
  $sort_order = NULL 
)

Update the details of an existing link

If any of the detail vars are NULL they are not updated.

Parameters
int$linkidthe link id of the link to update
int$link_typethe type of the link (one of the SQ_LINK_* constants)
string$valuethe value to place on the link
int$sort_orderthe position in the links list that this link should take, if less than zero places at end of list
Returns
boolean public

Definition at line 1184 of file form.inc.

updateSubmission ( Form_Submission  $submission_asset)

Updates the submission with the current page's processed data

Parameters
Form_Submission$submission_assetThe submission asset to update
Returns
void

Definition at line 3581 of file form.inc.

updateSubmissionCookie ( )

Updates an anonymous submission being tracked through a session variable with the current page's processed data

Returns
void

Definition at line 3782 of file form.inc.


The documentation for this class was generated from the following file: