Class AppModel
The parent model for the application.
- Model
- 
			 AppModel AppModel
Direct known subclasses
			Accounts, 
			ApiKeys, 
			Currencies, 
			EmailGroups, 
			Emails, 
			Encryption, 
			GatewayManager, 
			Invoices, 
			InvoiceTemplateManager, 
			Languages, 
			Logs, 
			Marketplace, 
			CalendarEvents, 
			ModuleClientMeta, 
			ModuleManager, 
			Navigation, 
			PackageGroups, 
			PackageOptionGroups, 
			PackageOptions, 
			Packages, 
			Payments, 
			Permissions, 
			PluginManager, 
			ClientGroups, 
			Pricings, 
			ReportManager, 
			ServiceChanges, 
			Services, 
			Settings, 
			Staff, 
			StaffGroups, 
			States, 
			Taxes, 
			Themes, 
			Clients, 
			Transactions, 
			Users, 
			Companies, 
			Contacts, 
			Countries, 
			Coupons, 
			CronTasks
		
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/app_model.php
Methods summary
| 
				 public 
				
				
				 | |
| 
				 public 
				integer
				
				 | |
| 
				 public 
				
				
				 | 
			#
			 setPerPage( integer $per_page )Sets the number of results set to be returned per page result. Minimum value is 1. | 
| 
				 public 
				string
				
				 | 
			#
			 currencyToDecimal( string $value, string $currency, integer $decimals = 2 )Converts currency values (those submitted via an add/edit invoice request) to their decimal format for use in inserting into the database | 
| 
				 public static
				
				
				 | 
			#
			 truncateDecimal( string $value, integer $min, char $decimal_char = '.' )Removes trailing zeros from a string preserving $min decimal places | 
| 
				 public 
				string
				
				 | 
			#
			 dateToUtc( string $date, string $format = "Y-m-d H:i:s", boolean $use_cur_time = false )Converts dates and date times to a UTC date time stamp suitable for inserting into the database. | 
| 
				 public 
				mixed
				
				 | |
| 
				 protected 
				array
				
				 | 
			#
			 setRulesIfSet( array $rules, boolean $status = true )Sets each of the the given rules to contain the 'if_set' key with the given status | 
| 
				 protected 
				
				
				 | |
| 
				 protected 
				string
				
				 | 
			#
			 ifSet( string & $str, string $alt = "" )Returns the given string as-is, if it exists, and an alternative value may be returned if the given $str does not exist. It's useful for rules and passing text into AppModel::_() for language replacement. | 
| 
				 public 
				mixed
				
				 | 
			#
			 setDefaultIfEmpty( string $value )Sets a value to the default value of it's table column if it is an empty string | 
| 
				 public 
				boolean
				
				 | 
			#
			 validateExists( mixed $value, string $field, string $table, boolean $allow_empty = true )Validates a table field contains the value given | 
| 
				 public 
				boolean
				
				 | 
			#
			 validateStateCountry( string $state, string $country )Validates that the given state belongs to the given country | 
| 
				 public 
				string
				
				 | 
			#
			 systemEncrypt( string $value, string $key = null, string $iv = null )Encrypts the given value using 256-bit AES in CBC mode using a SHA-256 HMAC hash as the key, based on the system configured setting in Blesta.system_key | 
| 
				 public 
				string
				
				 | 
			#
			 systemDecrypt( string $value, string $key = null, string $iv = null )Decrypts the given value using 256-bit AES in CBC mode using SHA-256 HMAC hash as the key, based on the system configured setting in Blesta.system_key | 
| 
				 public 
				string
				
				 | 
			#
			 systemHash( string $value, string $key = null, string $hash = "sha256" )Hashes the given value using the given hash algorithm in HMAC (defaults to sha256) | 
| 
				 public 
				integer
				
				 | 
			#
			 boolToInt( mixed $value )Converts a boolean or string value to integer (0 if "false" or boolean false, 1 otherwise) | 
| 
				 public 
				boolean
				
				 | |
| 
				 protected 
				
				
				 | 
			#
			 loadCrypto( array $other_libs = null )Prepares the crypto systems for use. Loads the Security components and AES and Hash component libraries as needed. | 
Methods inherited from Model
			affectedRows(), 
			begin(), 
			commit(), 
			getConnection(), 
			lastInsertId(), 
			makeDSN(), 
			prepare(), 
			query(), 
			rollBack(), 
			setAttribute(), 
			setFetchMode()
		
Magic methods summary
Properties summary
| 
				protected  
				array
			 | $replacement_keys | 
				#
				 An array of replacement keys used by various models and set in config |