Class AppController
The parent controller for the application.
- Controller
- 
			 AppController AppController
Direct known subclasses
			_404, 
			AdminBilling, 
			AdminCompanyGroups, 
			AdminCompanyLookandfeel, 
			AdminCompanyModules, 
			AdminCompanyPlugins, 
			AdminCompanyTaxes, 
			AdminCompanyThemes, 
			AdminController, 
			AdminDialog, 
			AdminLicense, 
			AdminLogin, 
			AdminClients, 
			AdminLogout, 
			AdminMyinfo, 
			AdminPackageOptions, 
			AdminPackages, 
			AdminSearch, 
			AdminSettings, 
			AdminSystemApi, 
			AdminSystemAutomation, 
			AdminSystemBackup, 
			AdminSystemCompanies, 
			AdminCompanyAutomation, 
			AdminSystemGeneral, 
			AdminSystemHelp, 
			AdminSystemMarketplace, 
			AdminSystemStaff, 
			AdminSystemUpgrade, 
			AdminTest, 
			AdminTests, 
			AdminTheme, 
			AdminTools, 
			AdminUpgrade, 
			AdminCompanyBilling, 
			Api, 
			Callback, 
			ClientController, 
			ClientLogin, 
			ClientLogout, 
			ClientMaintenance, 
			ClientPay, 
			ClientTheme, 
			Cron, 
			Uploads, 
			AdminCompanyCurrencies, 
			AdminCompanyCustomfields, 
			AdminCompanyEmails, 
			AdminCompanyGateways, 
			AdminCompanyGeneral
		
Indirect known subclasses
			AdminClientsService, 
			AdminReports, 
			AdminReportsCustomize, 
			ClientAccounts, 
			ClientContacts, 
			ClientDialog, 
			ClientInvoices, 
			ClientServices, 
			ClientTransactions
		
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/app_controller.php
Methods summary
| 
				final public 
				
				
				 | 
			#
			 __construct( mixed $controller, mixed $action, mixed $is_cli )The main app controller constructor. Performs just-in-time bootstrapping for this particular application. | 
| 
				 protected 
				mixed
				
				 | |
| 
				 protected 
				
				
				 | |
| 
				 public 
				
				
				 | 
			#
			 preAction( )Overwritable method called before the index method, or controller specified action. This method is public to make compatible with PHP 5.1 (due to a bug not fixed until 5.2). It is, however, not a callable action. | 
| 
				 protected 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 protected 
				
				
				 | |
| 
				 protected 
				
				
				 | 
			#
			 verifyCsrfToken( )Verifies the CSRF token for the POST request, evaluates that CSRF is required for the form, and if the token fails to validate removes all post data and sets an erorr message. Also strips the CSRF token from valid post data after verification. | 
| 
				 protected 
				
				
				 | 
			#
			 setMessage( string $type, string $value, boolean $return = false, array $params = null, boolean $in_current_view = true )Sets the given error type into the view | 
| 
				 protected 
				
				
				 | 
			#
			 flashMessage( string $type, string $value, array $params = null, boolean $in_current_view = true )Sets the given message type to be displayed on the next page load | 
| 
				 protected 
				integer
				
				 | 
			#
			 requireLogin( string $redirect_to = null )Ensures that the user has an active session with a "blesta_id" set. Detects whether the current request is an AJAX request, and only redirects non-AJAX based requests, otherwise issues "401 Unauthorized". | 
| 
				 protected 
				integer
				
				 | |
| 
				 protected 
				boolean
				
				 | 
			#
			 isStaffAsClient( )Checks whether the current user is a staff user and whether the user is currently logged into the client portal. | 
| 
				 protected 
				boolean
				
				 | |
| 
				 protected 
				boolean
				
				 | 
			#
			 renderAjaxWidgetIfAsync( mixed $content_only = false )Invokes AppController:renderAjaxWidget if the request was made Asynchronously, also sets $is_ajax to true within the view | 
| 
				 protected 
				
				
				 | 
			#
			 renderAjaxWidget( string $view, mixed $content_only = false )Output the swappable content section of a widget box using the given view in JSON format suitable for AJAX handling and replacement | 
| 
				 protected 
				
				
				 | |
| 
				 protected 
				array
				
				 | |
| 
				 protected 
				array
				
				 | 
			#
			 getDaysOfWeek( )Retrieves a list of the days of the week and their abbreviations for the calendar | 
| 
				 protected 
				array
				
				 | |
| 
				 public 
				
				
				 | 
			#
			 reorderWidgets( )Record the state of the widget windows on the Home Dashboard screen via an ajax request | 
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | 
			#
			 getWidgets( )Outputs a JSON encoded array of all widgets to be displayed within the requested controller. Expects $this->get[0] to identify the client ID for which items are to be rendered. | 
| 
				 protected 
				
				
				 | |
| 
				 protected 
				
				
				 | |
| 
				 protected 
				
				
				 | 
			#
			 setWidgetState( string $widget_location )Loads and sets the current widget state for all widgets stored | 
| 
				 protected 
				integer
				
				 | |
| 
				final protected 
				
				
				 | 
			#
			 licenseCheck( )Checks to ensure the license is valid, redirects user to update license key if invalid | 
| 
				 protected 
				
				
				 | 
			#
			 setNav( )Sets the primary and secondary navigation links. Performs authorization checks on each navigational element. May cache nav results if possible for better performance. | 
| 
				 protected 
				array
				
				 | |
| 
				 protected 
				
				
				 | |
| 
				 protected 
				boolean
				
				 | 
			#
			 authorized( string $controller = null, string $action = null, Verifies that the currently logged in user is authorized for the given Controller and Action (or current Controller/Action if none given). Will first check whether the Controller and Action is a permission value, and if so, checks to ensure the staff or client group user is authorized to access that resource | 
| 
				 protected 
				
				
				 | 
Methods inherited from Controller
			clearCache(), 
			components(), 
			draw(), 
			emptyCache(), 
			helpers(), 
			index(), 
			partial(), 
			redirect(), 
			render(), 
			set(), 
			setDefaultViewPath(), 
			startCaching(), 
			stopCaching(), 
			uses()
		
Magic methods summary
Properties summary
| 
				public  
				string
			 | $request_uri | 
				#
				 The requested URI | 
| 
				public  
				string
			 | $server_protocol | 
				#
				 The server protocol (e.g. HTTP/1.0) | 
| 
				public  
				string
			 | $base_url | 
				#
				 The base URL for this request (e.g https://www.domain.com/) | 
| 
				public  
				string
			 | $base_uri | 
				#
				 The base URI for this request (e.g. admin) | 
| 
				protected  
				mixed
			 | $company_id | 
				#
				 @ var int The company ID | 
| 
				protected  
				string
			 | $admin_uri | 
				#
				 The URI to the admin portal | 
| 
				protected  
				string
			 | $client_uri | 
				#
				 The URI to the client portal | 
| 
				protected  
				array
			 | $helpers | 
				#
				 All helpers to load by default | 
| 
				protected  
				array
			 | $components | 
				#
				 All components to load by default | 
| 
				protected  
				string
			 | $layout | 
				#
				 The view layout directory | 
Properties inherited from Controller
			$action, 
			$controller, 
			$files, 
			$get, 
			$is_cli, 
			$plugin, 
			$post, 
			$structure, 
			$structure_view, 
			$uri, 
			$uri_str, 
			$uses, 
			$view