Procedural File: validation_functions.php

Source Location: /php/validation_functions.php



Classes:

Page Details:

validation_functions.php

holds validation functions

PHP versions 4 and 5

LICENSE: ARK - The Archaeological Recording Kit. An open-source framework for displaying and working with archaeological data Copyright (C) 2008 L - P : Partnership Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Tags:





chkAbk

string chkAbk( string $var, array $val_vars, array $field_vars)

[line 865]

checks to see if a submitted value is valid in the abk

Tags:

  • return - a valid date (or FALSE)
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $var - containing the string to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkChDown

string chkChDown( string $var, array $val_vars, array $field_vars)

[line 579]

checks for a downward chain attached to a fragment

Tags:

  • return - a list of chained frags (or FALSE)
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $var - containing the string to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkDate

string chkDate( string $var, array $val_vars, array $field_vars)

[line 511]

checks a string to see if it complies with certain date criteria

Tags:

  • return - a valid date (or FALSE)
  • author - Guy Hunt
  • since - 0.5

Parameters

  • string $var - containing the string to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkDateSet

string chkDateSet( string $var, array $val_vars, array $field_vars)

[line 554]

checks a date string to see if is set

Tags:

  • return - a valid date (or FALSE)
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $var - containing the string to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkDupDouble

string chkDupDouble( string $col1, string $val1, string $col2, string $val2, string $tbl)

[line 659]

checks for the presence of a pair of values

Tags:

  • return - the var or FALSE
  • author - Guy Hunt
  • since -

    0.4

    FIX ME: This is a NON standard chk function call

Parameters

  • string $val1 - the first value to check
  • string $col1 - the column in which the first value is located
  • string $val2 - the second value to check
  • string $col2 - the column in which the second value is located
  • string $tbl - the table in which the items reside

[ Top ]

chkDuplicate

string chkDuplicate( array $var, $val_vars, $field_vars, array $field_settings)

[line 465]

checks for the presence of an itemvalue in the db

Tags:

  • return - the var or FALSE
  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $val_vars -
  • $field_vars -

[ Top ]

chkDupSimple

TRUE chkDupSimple( string $item, string $tbl, string $col)

[line 698]

checks for the presence of an existing value of any type

Tags:

  • return - FALSE
  • author - Guy Hunt
  • since -

    0.4

    FIX ME: This is a NON standard chk function call

Parameters

  • string $item - item to check for
  • string $tbl - the table
  • string $col - the column

[ Top ]

chkDupStr

array chkDupStr( string $dup, string $col, string $tbl, string $sql, string $element, string $params)

[line 747]

checks for the presence of duplicate strings

Tags:

  • return - possible duplicate strings in the format id => alias
  • author - Guy Hunt
  • since -

    0.3

    FIX ME: This is a NON standard chk function call FIX ME: This function is surely OBSOLTETE?

    NOTE 1: LANGUAGES the alias returned will be the $col specified to this function. IF you want to display more than one language take the id and use the get alias function in a foreach loop after running this function.

    NOTE 2: This function has been written with the aim of reducing duplicate addtions to luts. It may be possible to hack it to serve other purposes.

    NOTE 3: The params option should contain an array of the types of check to be carried out

Parameters

  • string $dup - the string to check
  • string $col - the column in which the suspected duplicates reside
  • string $tbl - the table in which the suspected duplicates reside
  • string $sql - an optional sql 'WHERE' statement
  • string $element - an optional element
  • string $params - this is the type of string matching to run on the value

[ Top ]

chkFalse

string chkFalse( string $var, array $val_vars, array $field_vars)

[line 628]

checks a var to see if it is FALSE

Tags:

  • return - a valid date (or FALSE)
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $var - containing the string to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkItemList

string chkItemList( string $var, array $val_vars, array $field_vars)

[line 941]

takes an list of items (usually from an XMI), explodes the list and checks if all of the itemvalues are valid

Tags:

  • return - a reordered list containing only the valid itemvalues
  • author - Stuart Eve
  • since - 0.6

Parameters

  • string $var - containing the list to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkItemListAllowBlank

string chkItemListAllowBlank( string $var, array $val_vars, array $field_vars)

[line 1025]

takes an list of items (usually from an XMI), explodes the list and checks if all of the itemvalues are valid but this will allow blanks

Tags:

  • return - a reordered list containing only the valid itemvalues
  • author - Stuart Eve
  • since - 0.6

Parameters

  • string $var - containing the list to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkNumeric

string chkNumeric( array $var, $val_vars, $field_vars, array $field_settings)

[line 437]

checks to see if a var is numeric

Tags:

  • return - the var or FALSE
  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $val_vars -
  • $field_vars -

[ Top ]

chkSet

string chkSet( arrat $var, array $val_vars, $field_vars)

[line 413]

checks to if a value is 'set' ie not null or false or empty

Tags:

  • return - the var itself if its ok or errors if not
  • author - Guy Hunt
  • since - 0.5

Parameters

  • arrat $var - the field vars
  • array $val_vars - the validation vars
  • $field_vars -

[ Top ]

chkSkipBlank

string chkSkipBlank( string $var, array $val_vars, array $field_vars)

[line 912]

checks to see if a submitted value is blank and skip this field if it is

Tags:

  • return - a valid date (or FALSE)
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $var - containing the string to check
  • array $val_vars - containing the validation criteria
  • array $field_vars - containing the field criteria

[ Top ]

chkValid

TRUE chkValid( string $item_cd, string $ste_cd, string $item_id, string $tbl, string $clm)

[line 822]

checks for the presence and uniqueness of an item_value in the db

Tags:

  • return - FALSE
  • author - Guy Hunt
  • since -

    0.4

    NOTE 1: If you want to check an item_val you must set it. If you want to check ste_cd/no DON'T set item_val This is an either or option

    NOTE 2: It is possible to hack this function to check for just about anything do it by spoofing the $item_cd, $tbl and $clm values (see also note 1)

Parameters

  • string $item_cd - the full item value 'ste_item'
  • string $ste_cd - just the site code (IF ITEM_CD IS NOT SET)
  • string $item_id - just the second part of an item value (IF ITEM_CD IS NOT SET)
  • string $tbl - the table in which we want to check
  • string $clm - the column in which the item resides

[ Top ]

reqClassType

string reqClassType( $vars, array $field_settings, array $var)

[line 127]

requests a classtype number based on the field settings

Tags:

  • return - the classtype number or FALSE
  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $vars -

[ Top ]

reqDate

string reqDate( array $vars, array $field_settings)

[line 274]

requests dates from the an array (typically the qstr)

Tags:

  • return - the date in the normal datetime format
  • author - Guy Hunt
  • since -

    0.5

    The date can be split and formatted using other date handlers

Parameters

  • array $vars - the settings for this element of a field
  • array $field_settings - the settings of the field itself

[ Top ]

reqDateRange

string reqDateRange( array $vars, array $field_settings)

[line 341]

requests the parts of a date range and applies an AD/BC modifier

Tags:

  • return - the year modified if needed
  • author - Guy Hunt
  • since -

    0.6

    at present (0.6) this function isnt handling real dates, just years it would probably be possible to improve this but it would mean editing the frmElem function responsible for submitting spans

Parameters

  • array $vars - the settings for this element of a field
  • array $field_settings - the settings of the field itself

[ Top ]

reqField

string reqField( $vars, array $field_settings, array $var)

[line 160]

set a var from the vars in the field settings array

Tags:

  • return - the var or FALSE
  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $vars -

[ Top ]

reqFragId

int reqFragId( array $vars, array $field_settings)

[line 374]

requests a fragment id which is needed in edit and delete routines

Tags:

  • return - the id of the fragment
  • author - Guy Hunt
  • since - 0.6

Parameters

  • array $vars - contains variables specific to this var
  • array $field_settings - contains settings specific to the entire field

[ Top ]

reqItemList

string reqItemList( $vars, array $field_settings, array $var)

[line 106]

this is for requesting a itemlist

Tags:

  • return - the requested var
  • author - Stuart Eve
  • since -

    0.6

    Returns the var if it is present otherwise returns false Essentially a wrapper function for reqMulti

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $vars -

[ Top ]

reqItemVal

string reqItemVal( $vars, [array $field_settings = FALSE], array $var)

[line 213]

requests a particular form of an itemvalue

Tags:

  • return - the var or FALSE
  • author - Guy Hunt
  • since -

    0.5

    Note: essentially a wrapper for the reqMulti() function to better handle itemkeys

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $vars -

[ Top ]

reqManual

string reqManual( $vars, [array $field_settings = FALSE], array $var)

[line 185]

sets a var to a manual setting from the field array

Tags:

  • return - the var or FALSE
  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $vars -

[ Top ]

reqMulti

string reqMulti( $vars, [array $field_settings = FALSE], array $var)

[line 62]

cleanly requests a var returning FALSE

Tags:

  • return - the requested var
  • author - Guy Hunt
  • since -

    0.5

    Returns the var if it is present otherwise returns false Essentially a wrapper function for reqQst the non std function

Parameters

  • array $var - containing settings about this validation element
  • array $field_settings - containing all the settings for this field
  • $vars -

[ Top ]


Documentation generated on Thu, 26 Feb 2009 16:48:43 +0000 by phpDocumentor 1.4.1