include/MVC/Controller/SugarController.php
\SugarController
Main SugarCRM controller
- Children
- \UserPreferencesController
- \ModuleBuilderController
- \SugarFavoritesController
- \ProductCategoriesController
- \ReportsController
- \ImportController
- \UsersController
- \TeamsController
- \NotesController
- \CampaignsController
- \OAuthTokensController
- \NotificationsController
- \EmployeesController
- \ContractTypesController
- \ProductTemplatesController
- \CalendarController
- \ConfiguratorController
- \EmailManController
- \MailMergeController
- \LeadsController
- \ConnectorsController
- \ContactsController
- \AdministrationController
- \ExpressionEngineController
- \WorkflowController
- \OAuthKeysController
- \EAPMController
- \MergeRecordsController
- \FileController
- Api
Properties

bool
$_processed= 'false'
Whether or not the action has been handled by $process_tasks
falseDetails- Type
- bool

$action_case_file= 'array(
'editview'=>'EditView',
'detailview'=>'DetailView',
'listview'=>'ListView'
)'
Map case sensitive filenames to action. This is used for linux/unix systems where filenames are case sensitive
array(
'editview'=>'EditView',
'detailview'=>'DetailView',
'listview'=>'ListView'
)Details- Type
- n/a

$action_file_map= 'array()'
Map an action directly to a file. This will be loaded from action_file_map.php
array()Details- Type
- n/a

$action_remap= 'array('index'=>'listview')'
remap actions in here e.g. make all detail views go to edit views $action_remap = array('detailview'=>'editview');
array('index'=>'listview')Details- Type
- n/a

$action_view_map= 'array()'
Map an action directly to a view. This will be loaded from action_view_map.php
array()Details- Type
- n/a

$do_action= ''index''
If the action was remapped it will be set to do_action and then we will just use do_action for the actual action to perform.
'index'Details- Type
- n/a

$hasAccess= 'true'
This can be set from the application to tell us whether we have authorization to process the action. If this is set we will default to the noaccess view.
trueDetails- Type
- n/a

$process_tasks= 'array(
'blockFileAccess',
'handleEntryPoint',
'remapWirelessAction',
'callLegacyCode',
'remapAction',
'handle_action',
'handleActionMaps',
)'
List of options to run through within the process() method.
This list is meant to easily allow additions for new functionality as well as the ability to add a controller's own handling.
array(
'blockFileAccess',
'handleEntryPoint',
'remapWirelessAction',
'callLegacyCode',
'remapAction',
'handle_action',
'handleActionMaps',
)Details- Type
- n/a

$tasks= 'array(
'pre_action',
'do_action',
'post_action'
)'
This array holds the methods that handleAction() will invoke, in sequence.
array(
'pre_action',
'do_action',
'post_action'
)Details- Type
- n/a

$view= ''classic''
any subcontroller can modify this to change the view
'classic'Details- Type
- n/a
Methods

SugarController(
)
:
voidConstructor. This ie meant tot load up the module, action, record as well as the mapping arrays.

action_configuredashlet(
)
:
voidthis method is used within a Dashlet when the options configuration is posted

action_default(
)
:
voidAction to handle when using a file as was done in previous versions of Sugar.

action_deleteattachment(
)
:
voidGlobal method to delete an attachment
If the bean does not have a deleteAttachment method it will return 'false' as a string

blockFileAccess(
)
:
trueGiven the module and action, determine whether the super/admin has prevented access to this url. In addition if any links specified for this module, load the links into GLOBALS
| Type | Description |
|---|---|
| true | if we want to stop processing, false if processing should continue |

checkEntryPointRequiresAuth(
\$entrypoint $entryPoint
)
:
boolChecks to see if the requested entry point requires auth
| Name | Type | Description |
|---|---|---|
| $entryPoint | \$entrypoint | string name of the entrypoint |
| Type | Description |
|---|---|
| bool | true if auth is required, false if not |

execute(
)
:
voidThis method is called from SugarApplication->execute and it will bootstrap the entire controller process

getActionFilename(
$action
)
:
voidgetActionFilename
| Name | Type | Description |
|---|---|---|
| $action |

handleActionMaps(
)
:
voidIf the action has been remapped to a different action as defined in action_file_map.php or action_view_map.php load those maps here.

handleEntryPoint(
)
:
voidThis code is part of the entry points reworking. We have consolidated all entry points to go through index.php. Now in order to bring up an entry point it will follow the format: 'index.php?entryPoint=download' the download entry point is mapped in the following file: entry_point_registry.php

handleException(
\Exception $e
)
:
voidHandle exception
| Name | Type | Description |
|---|---|---|
| $e | \Exception |

handle_action(
)
:
trueThis method is called from the process method. I could also be called within an action_* method.
It allows a developer to override any one of these methods contained within, or if the developer so chooses they can override the entire action_* method.
| Type | Description |
|---|---|
| true | if any one of the pre_, do_, or post_ methods have been defined, false otherwise. This is important b/c if none of these methods exists, then we will run the action_default() method. |

hasFunction(
\function $function
)
:
trueDetermine if a given function exists on the objects
| Name | Type | Description |
|---|---|---|
| $function | \function |
|
| Type | Description |
|---|---|
| true | if the method exists on the object, false otherwise |

loadBean(
)
:
voidGiven a record id load the bean. This bean is accessible from any sub controllers.

loadMapping(
$var, $merge
=
false
)
:
voidGeneric load method to load mapping arrays.
| Name | Type | Description |
|---|---|---|
| $var | ||
| $merge |

post_action(
)
:
voidPerform an action after to the specified action has occurred.
This can be overridde in a sub-class

preProcess(
)
:
voidMeant to be overridden by a subclass and allows for specific functionality to be injected prior to the process() method being called.

pre_action(
)
:
voidPerform an action prior to the specified action.
This can be overridde in a sub-class

process(
)
:
voidif we have a function to support the action use it otherwise use the default action
1) check for file 2) check for action

remapWirelessAction(
)
:
voidRemap the action to the wireless equivalent if the module supports it and the user is on a mobile device. Also, map wireless actions to normal ones if the user is not using a wireless device.

setModule(
object $module
)
:
voidSet the module on the Controller
| Name | Type | Description |
|---|---|---|
| $module | object |

set_redirect(
string $url
)
:
voidSet the url to which we will want to redirect
| Name | Type | Description |
|---|---|---|
| $url | string | url - the url to which we will want to redirect |