Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Form_Question Class Reference
Inheritance diagram for Form_Question:
Asset MySource_Object Form_Question_Type_Datetime Form_Question_Type_File_Upload Form_Question_Type_Password Form_Question_Type_Select Form_Question_Type_Text Form_Question_Type_Tickbox_List Form_Question_Type_Tickbox_Table Form_Question_Type_Country Form_Question_Type_Email_Address Form_Question_Type_Numeric Form_Question_Type_Option_List

Public Member Functions

 Form_Question ($formid=0, $data=Array())
 
 setAttrValue ($name, $value)
 
 saveAttributes ($dont_run_updated=FALSE)
 
 _updated ($update_parents=TRUE)
 
 canClone ()
 
 _getName ($short_name=FALSE)
 
 getVal ($field='')
 
 getAnswerByOffset ($offset=0)
 
 getOffsetByAnswer ($answer='')
 
 isSelection ()
 
 getSelectionTypeQuestions ()
 
getMySection ()
 
 getMySectionName ()
 
 generateJSCode ()
 
 getAllowedRules ()
 
addRule ($rule_code, $operator, $value)
 
removeRule (&$deleted_rule)
 
 getRules ()
 
 getRuleCount ()
 
 isEditable ()
 
 getHtmlField ()
 
 populate (Asset $parent=NULL)
 
 setValue ($value)
 
 setExtraData (Array $data=NULL)
 
 hasValidValue ($answer=NULL, $mute_errors=FALSE)
 
 saveValue ()
 
 getValue ()
 
 getSummary ()
 
 getExtraData ()
 
 getXML ()
 
 getErrors ()
 
 readAccess ($assetids=Array())
 
 writeAccess ($lock_type='', $assetids=Array())
 
 adminAccess ($lock_type='', $assetids=Array())
 
 liveEditAccess ($lock_type)
 
 checkAccess ($perm, $lock_type, $assetids=Array())
 
 _checkPermissionAccess ($perm, $assetids=Array())
 
 stickValue ($value)
 
 unstickValue ()
 
 getStickyValue ()
 
 _getCookieName ()
 
 processStatusChange ($new_status, $update_parent=TRUE)
 
 getHtmlLabel ()
 
- 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

 $_formid = 0
 
 $_questionid = 0
 
 $section_name = ''
 
 $section_id = 0
 
 $value = NULL
 
 $extra_data = Array()
 
 $submission_errors = NULL
 
 $active_form = NULL
 
 $failed_rules = Array()
 
- 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
 

Additional Inherited Members

- 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 35 of file form_question.inc.

Member Function Documentation

_checkPermissionAccess (   $perm,
  $assetids = Array() 
)

Returns true if at least one of the passed assetids has the passed permission Does not check current status of lock

Parameters
int$permthe permission to check access for
array$assetidsAn array of user_group and/or user ids to check for permission If the array is empty, the current user will be checked
Returns
boolean public

Definition at line 1017 of file form_question.inc.

_getCookieName ( )

Generates a safe name for the question so it can be used in session vars

Returns
string protected

Definition at line 1089 of file form_question.inc.

_getName (   $short_name = FALSE)

return the name of this question

Parameters
boolean$short_nameif TRUE, returns the short name
Returns
string private

Definition at line 314 of file form_question.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 279 of file form_question.inc.

& addRule (   $rule_code,
  $operator,
  $value 
)

Adds a validation rule to this question

Parameters
string$rule_codethe code of the rule that will be added
mixed$operatorthe operator being used by the rule - Possible values defined by rule, comparison questions generally have a string like '==', is/is not rules use a 0|1 integer
mixed$valuethe value to compare the question's response to
Returns
array public

Definition at line 531 of file form_question.inc.

adminAccess (   $lock_type = '',
  $assetids = Array() 
)

Returns true if at least one of the passed assetids has admin access to this asset

Parameters
string$lock_typethe type of write access required - if blank returns a plain check against permissions set for this asset, otherwise returns effective access based on locking and status
array$assetidsan array of user_group and/or user ids to check for write access If the array is empty, the current user will be checked
Returns
boolean public

Definition at line 948 of file form_question.inc.

canClone ( )

Returns TRUE if this type of asset can be cloned

Returns
boolean public

Definition at line 299 of file form_question.inc.

checkAccess (   $perm,
  $lock_type,
  $assetids = Array() 
)

Returns true if at least one of the passed assetids has the passed permission Can perform effective access check based on current status, lock, workflow, and metadata NOTE: Only for write and above access

Parameters
int$permthe permission to check access for
string$lock_typethe type of write access required - if blank returns a plain check against permissions set for this asset, otherwise returns effective access based on locking and status
array$assetidsAn array of user_group and/or user ids to check for permission If the array is empty, the current user will be checked
Returns
boolean public

Definition at line 996 of file form_question.inc.

Form_Question (   $formid = 0,
  $data = Array() 
)

Constructor

Parameters
int$formidthe asset id to be loaded
Array$datathe shadow asset data that will construct this question

Definition at line 106 of file form_question.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 484 of file form_question.inc.

getAllowedRules ( )

Returns an array of the types of rules

Returned array is 'short name' => 'full name' this should be overridden with something like (substitute actual allowed rules) eg. return Array('regexp', 'comparison', 'numeric', 'found_in', 'contain', 'length', 'email', 'begins_with', 'ends_with', 'select_limit');

Returns
array public

Definition at line 514 of file form_question.inc.

getAnswerByOffset (   $offset = 0)

Returns the answer by its offset in the list (select type questions)

Returns an array of selection options if an array is passed, or a single option if an int is passed

Parameters
array | int$offsetthe offset(s) to the answers
Returns
mixed array|string public

Definition at line 366 of file form_question.inc.

getErrors ( )

Return a list of errors from last time we processed the form

Returns
array public

Definition at line 885 of file form_question.inc.

getExtraData ( )

Get the current answer for this question, in a sensible format

Returns
string public

Definition at line 850 of file form_question.inc.

getHtmlField ( )

Get the HTML that allows answering of this question by the user

Returns
boolean public

Definition at line 611 of file form_question.inc.

getHtmlLabel ( )

Get the HTML label for this form question

Returns
boolean public

Definition at line 1122 of file form_question.inc.

& getMySection ( )

Returns the section that this question belongs to (or form if not attached to a section)

Returns
object public

Definition at line 447 of file form_question.inc.

getMySectionName ( )

Returns the section name that this question belongs to

Returns
string public

Definition at line 464 of file form_question.inc.

getOffsetByAnswer (   $answer = '')

Returns an Offset for a given answer (select type questions)

Parameters
string$answerthe answer to find the offset for
Returns
string public

Definition at line 391 of file form_question.inc.

getRuleCount ( )

Returns the number of rules this question has

Returns
array public

Definition at line 585 of file form_question.inc.

getRules ( )

Returns all the rules that this question has

Returns
array public

Definition at line 572 of file form_question.inc.

getSelectionTypeQuestions ( )

Returns a list of question types that are selections the rule uses this information to see if it should be displaying any more information in the rule itself

Returns
array public

Definition at line 427 of file form_question.inc.

getStickyValue ( )

Gets a sticky value if any, or NULL if there is none (or if it's not valid)

Returns
mixed int|string|array|object|NULL public

Definition at line 1063 of file form_question.inc.

getSummary ( )

Get the current answer for this question, in a sensible format

Returns
string public

Definition at line 837 of file form_question.inc.

getVal (   $field = '')

Get one of this question's parameters based on the parameter passed

Returns string relating to the $val field as described above, or empty string if other.

Parameters
string$fieldThe field you want; can be one of the following 'title' : The name of the question 'answer' : The HTML for the form field 'note' : The note attached to the question 'value' : The current value of the question
Returns
string public

Definition at line 336 of file form_question.inc.

getValue ( )

Returns the current value of the question, or the default value if no current value exists

Returns
mixed string|NULL public

Definition at line 772 of file form_question.inc.

getXML ( )

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

Returns
string public

Definition at line 863 of file form_question.inc.

hasValidValue (   $answer = NULL,
  $mute_errors = FALSE 
)

Look at user-specified and internal rules to see if this question currently has a valid value

Returns TRUE if all validation rules pass

Parameters
mixed$answerCustom value to compare with - if left NULL (or unspecified), use the current value of the question
boolean$mute_errorsIf TRUE, do not add to the "Failed Rules" log, but simply return FALSE
Returns
boolean public

Definition at line 707 of file form_question.inc.

isEditable ( )

Returns whether questions of this type can be edited after the form has been initially submitted

Returns
boolean public

Definition at line 598 of file form_question.inc.

isSelection ( )

Returns TRUE if the question that this rule belongs to is a selection type question

Returns
boolean public

Definition at line 409 of file form_question.inc.

liveEditAccess (   $lock_type)

Returns true if the current user can live edit this asset

Live edit means the asset is currently SQ_STATUS_LIVE but this user can edit the asset without going through a safe edit NOTE: will return false if asset is not currently live

Parameters
string$lock_typeThe type of lock
Returns
boolean public
See Also
canliveEdit()

Definition at line 971 of file form_question.inc.

populate ( Asset  $parent = NULL)

Populate the question with data from the POST

Override this function in a child (ie. question type) if any special processing of the answer is required.

$param object $parent the form this question is attached to

Returns
boolean public

Definition at line 629 of file form_question.inc.

processStatusChange (   $new_status,
  $update_parent = TRUE 
)

Processes the changes required when a new status is set

Ignore the status changes since the bridge handles it.

Parameters
int$new_statusthe new status to set for this asset
boolean$update_parentSpecify if we want to update the parent as well
Returns
boolean public

Definition at line 1109 of file form_question.inc.

readAccess (   $assetids = Array())

Returns true if at least one of the passed assetids has read access to this asset

Parameters
array$assetidsAn array of user_group and/or user ids to check for read access If the array is empty, the current user will be checked
Returns
boolean public

Definition at line 904 of file form_question.inc.

& removeRule ( $deleted_rule)

Removes a validation rule(s) from this question

Parameters
array&$deleted_rulethe rule(s) that will be removed
Returns
array public

Definition at line 550 of file form_question.inc.

saveAttributes (   $dont_run_updated = FALSE)

Save attributes set with setAttrValue to the database

Overriding the asset.inc here to make sure that they are saved to the asset_form_question table instead of asset_attribute.

Parameters
boolean$dont_run_updatedif true this->_updated() won't be run (THIS IS ONLY EVER CALLED FROM Asset::create())
Returns
boolean public
See Also
setAttrValue()

Definition at line 184 of file form_question.inc.

saveValue ( )

Do any work necessary to make this value "stick", eg create an asset

This gets called once we know the whole form is valid and we want to save all the values.

Returns
void public

Definition at line 759 of file form_question.inc.

setAttrValue (   $name,
  $value 
)

Queue the setting of the value of an attribute

This function sets the value of the attribute locally, but does not database updating. The change is queued awaiting the call of saveAttributes()

Parameters
string$namethe name of the attribute
string$valuethe new value of the attribute
Returns
boolean public
See Also
saveAttributes()

Definition at line 159 of file form_question.inc.

setExtraData ( Array  $data = NULL)

Set the current Extra Data of this question

Parameters
mixed$valueThe value to set for this question
Returns
void public

Definition at line 685 of file form_question.inc.

setValue (   $value)

Set the current value of this question

Parameters
mixed$valueThe value to set for this question
Returns
void public

Definition at line 670 of file form_question.inc.

stickValue (   $value)

Sticks a value into the cookie for this question name

Parameters
mixed$valueThe value to stick into this question
Returns
void public

Definition at line 1035 of file form_question.inc.

unstickValue ( )

Unsticks the value

Returns
void public

Definition at line 1049 of file form_question.inc.

writeAccess (   $lock_type = '',
  $assetids = Array() 
)

Returns true if at least one of the passed assetids has write access to this asset

Parameters
string$lock_typethe type of write access required - if blank returns a plain check against permissions set for this asset, otherwise returns effective access based on locking and status
array$assetidsAn array of user_group and/or user ids to check for write access If the array is empty, the current user will be checked
Returns
boolean public

Definition at line 926 of file form_question.inc.


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