Admidio API
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Packages

  • com
    • tecnick
      • tcpdf
  • None
  • PHPMailer
    • easypeasyics
  • PHPWavUtils
  • Securimage
    • classes

Classes

  • AutoLogin
  • Component
  • ComponentUpdate
  • ConditionParser
  • Database
  • DateTimeExtended
  • Email
  • Folder
  • FormValidation
  • FunctionClass
  • Htaccess
  • HtmlDiv
  • HtmlElement
  • HtmlForm
  • HtmlFormBasic
  • HtmlFormInstallation
  • HtmlList
  • HtmlNavbar
  • HtmlPage
  • HtmlTable
  • HtmlTableBasic
  • Image
  • Inventory
  • InventoryFields
  • Language
  • LanguageData
  • ListConfiguration
  • Menu
  • Message
  • ModuleAnnouncements
  • ModuleDates
  • ModuleLists
  • ModuleMenu
  • ModuleMessages
  • Modules
  • ModuleWeblinks
  • MyFiles
  • Navigation
  • ntlm_sasl_client_class
  • Organization
  • Participants
  • PasswordHash
  • PasswordHashing
  • ProfileFields
  • RoleDependency
  • RolesRights
  • RSSfeed
  • Session
  • SystemMail
  • TableAccess
  • TableAnnouncement
  • TableCategory
  • TableDate
  • TableFile
  • TableFolder
  • TableGuestbook
  • TableGuestbookComment
  • TableInventory
  • TableInventoryField
  • TableLists
  • TableMembers
  • TableMessage
  • TablePhotos
  • TableRoles
  • TableRooms
  • TableText
  • TableUserField
  • TableUsers
  • TableWeblink
  • UploadHandlerDownload
  • UploadHandlerPhoto
  • User
  • UserRegistration

Exceptions

  • AdmException
  • WavFileException
  • WavFormatException

Functions

  • admFuncAutoload
  • admFuncGeneratePagination
  • admFuncGetBytesFromSize
  • admFuncGetDirectoryEntries
  • admFuncMaxUploadSize
  • admFuncProcessableImageSize
  • admFuncShowCreateChangeInfoById
  • admFuncShowCreateChangeInfoByName
  • admFuncVariableIsValid
  • admReadTemplateFile
  • admStrIsValidFileName
  • admStrStripTagsSpecial
  • admStrToLower
  • admStrToUpper
  • bzip2Version
  • checkDatabaseVersion
  • checkPhpVersion
  • EmailAttachment
  • FileSizeNiceDisplay
  • FormattedTimeRemaining
  • FunctionIsDisabled
  • getFormerRolesFromDatabase
  • getFutureRolesFromDatabase
  • getmicrotime
  • getRoleMemberships
  • getRolesFromDatabase
  • gzipVersion
  • hasRole
  • hl_attrval
  • hl_bal
  • hl_cmtcd
  • hl_ent
  • hl_prot
  • hl_regex
  • hl_spec
  • hl_tag
  • hl_tag2
  • hl_tidy
  • hl_version
  • htmLawed
  • HTMLFilter
  • isGroupLeader
  • isMember
  • kses
  • kses_hook
  • MySQLdumpVersion
  • OutputInformation
  • SafeExec
  • showNotice
  • strAddSlashesDeep
  • strNextLetter
  • strStripSlashesDeep
  • strStripTags
  • strValidCharacters
  • tln_body2div
  • tln_casenormalize
  • tln_deent
  • tln_defang
  • tln_findnxreg
  • tln_findnxstr
  • tln_fixatts
  • tln_fixstyle
  • tln_fixurl
  • tln_getnxtag
  • tln_sanitize
  • tln_skipspace
  • tln_tagprint
  • tln_unspace
  • version_compare_replacement
  • version_compare_replacement_sub

Class ConditionParser

Copyright: 2004-2016 The Admidio Team
License: GNU General Public License v2.0 only **********************************************************************************************
Brief:

Creates from a custom condition syntax a sql condition

The user can write a condition in a special syntax. This class will parse that condition and creates a valid SQL statement which can be used in another SQL statement to select data with these conditions. This class uses AdmExceptions when an error occurred. Make sure you catch these exceptions when using the class.


Class: ConditionParser
Code:

// create a valid SQL condition out of the special syntax $parser = new ConditionParser; $sqlCondition = $parser->makeSqlStatement('> 5 AND <= 100', 'usd_value', 'int'); $sql = 'SELECT * FROM '.TBL_USER_DATA.' WHERE usd_id > 0 AND '.$sqlCondition; @endcode


Par: Examples
Located at conditionparser.php

Methods summary

private string
# getFormatDate( string $date, string $operator )

Creates a valid date format @b YYYY-MM-DD for the SQL statement

Creates a valid date format @b YYYY-MM-DD for the SQL statement

Parameters

$date
The unformated date from user input e.g. @b 12.04.2012
$operator
The actual operator for the @b date parameter

Returns

string
String with a SQL valid date format @b YYYY-MM-DD
public string
# makeStandardCondition( string $sourceCondition )

Replace different user conditions with predefined chars that represents a special condition e.g. @b ! represents @b != and @b <>

Replace different user conditions with predefined chars that represents a special condition e.g. @b ! represents @b != and @b <>

Parameters

$sourceCondition
The user condition string

Returns

string
String with the predefined chars for conditions
public string
# makeSqlStatement( string $sourceCondition, string $columnName, string $columnType, string $fieldName )

Creates from a user defined condition a valid SQL condition

Creates from a user defined condition a valid SQL condition

Parameters

$sourceCondition
The user condition string
$columnName
The name of the database column for which the condition should be created
$columnType
The type of the column. Valid types are @b string, @b int, @b date and @b checkbox
$fieldName
The name of the profile field. This is used for error output to the end user

Returns

string
Returns a valid SQL string with the condition for that column

Throws

AdmException

LST_NOT_VALID_DATE_FORMAT LST_NOT_NUMERIC

public
# setNotExistsStatement( string $sqlStatement )

Stores an sql statement that checks if a record in a table does exists or not exists. This must bei a full subselect that starts with SELECT. The statement is used if a condition with EMPTY or NOT EMPTY is used.

Stores an sql statement that checks if a record in a table does exists or not exists. This must bei a full subselect that starts with SELECT. The statement is used if a condition with EMPTY or NOT EMPTY is used.

Parameters

$sqlStatement
String with the full subselect

Code

$parser->setNotExistsStatement('SELECT 1 FROM adm_user_data WHERE usd_usr_id = 1 AND usd_usf_id = 9'); @endcode

Par

Examples

Properties summary

private $mSrcCond
#
private $mDestCond
#
private $mSrcCondArray
#
private string $mNotExistsSql
# ''
private boolean $mOpenQuotes
# false
Admidio API API documentation generated by ApiGen