Class AppController
This class is extended by the various controllers, and makes available methods that allow controllers to interact with views, models, components, helpers, and plugins.
- Controller
- AppController
Direct known subclasses
_404
,
AdminBilling
,
AdminCompanyGeneral
,
AdminCompanyGroups
,
AdminCompanyModules
,
AdminCompanyPlugins
,
AdminCompanyTaxes
,
AdminDialog
,
AdminLicense
,
AdminLogin
,
AdminLogout
,
AdminMain
,
AdminClient
,
AdminMyinfo
,
AdminPackages
,
AdminSearch
,
AdminSettings
,
AdminSystemApi
,
AdminSystemAutomation
,
AdminSystemBackup
,
AdminSystemCompanies
,
AdminSystemGeneral
,
AdminSystemHelp
,
AdminClients
,
AdminSystemMarketplace
,
AdminSystemStaff
,
AdminSystemThemes
,
AdminSystemUpgrade
,
AdminTest
,
AdminTests
,
AdminTheme
,
AdminTools
,
Api
,
Callback
,
AdminCompanyAutomation
,
ClientAccounts
,
ClientContacts
,
ClientDialog
,
ClientInvoices
,
ClientLogin
,
ClientLogout
,
ClientMain
,
ClientPay
,
ClientServices
,
ClientTheme
,
AdminCompanyBilling
,
ClientTransactions
,
Cron
,
Main
,
Upgrade
,
Uploads
,
AdminCompanyCurrencies
,
AdminCompanyCustomfields
,
AdminCompanyEmails
,
AdminCompanyGateways
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
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. |
public
|
|
private
|
|
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 )
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. |
private
|
|
private
|
|
protected
|
#
setWidgetState( string $widget_location )
Loads and sets the current widget state for all widgets stored |
private
integer
|
|
final protected
|
#
licenseCheck( )
Checks to ensure the license is valid, redirects user to update license key if invalid |
private
|
#
setNav( )
Sets the primary and secondary navigation links. Performs authorization checks on each navigational element. May cache nav results if possible for better performance. |
private
array
|
|
private
|
|
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 |
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 |
private
string
|
$portal |
#
The portal in use ("admin" or "client") |
private
array
|
$messages |
#
Messages set to view |
private
array
|
$params |
#
Additional message paramaters |
private
array
|
$widgets_state |
Properties inherited from Controller
$action
,
$controller
,
$files
,
$get
,
$is_cli
,
$plugin
,
$post
,
$structure
,
$structure_view
,
$uri
,
$uri_str
,
$uses
,
$view