Project Application Core code
| package | Gems |
|---|---|
| subpackage | Project |
| copyright | Copyright (c) 2011 Erasmus MC |
| license | New BSD License |
| since | Class available since version 1.0 |
_(string $text, string|\Zend_Locale $locale = null) : string
Translates the given string returns the translation
stringTranslation string
string\Zend_Locale(optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information
string__construct(\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $application) : void
\Zend_Application\Zend_Application_Bootstrap_Bootstrapper
_initMailTransport()
This is needed to make sure a correct sender is set when using sendmail. Feel free to set a different default transport method in your project when needed.
addMessage(mixed $message_args) : \MUtil_Controller_Action
mixedCan be an array or multiple argemuents. Each sub element is a single message string
\MUtil_Controller_ActionbeforeRun() : void
This->init() has ran and the constructor has finisched so all _init{name} and application.ini resources have been loaded. The code between the constructor and the call to $this->run() has been executed in $this->run() has hooked $this as both a \Zend_Controller_Plugin and a \Zend_Controller_Action_Helper.
Not initialized are the $request, $response and $controller objects.
Previous hook: init() Actions since: $this->_inti{Name}; resources from configuration initialized Actions after: $this->request object created Next hook: requestChanged()
controllerBeforeAction(\Zend_Controller_Action $actionController = null) : void
Here you can change or check all values set in $controller->init(). All output echoed here is captured for the output.
Previous hook: controllerInit() Actions since: $controller->init(); ob_start(); $controller->dispatch() Actions after: $controller->preDispatch(); $controller->{name}Action(); $controller->postDispatch() Next hook: controllerAfterAction()
\Zend_Controller_Action
controllerInit(\Zend_Controller_Action $actionController = null) : void
This hook is called in the constructor of the controller. Nothing is done and $controller->init has not been called, so this is a good moment to change settings that should influence $controller->init().
Previous hook: preDispatch() Actions since: $dispatcher->dispatch(); $controller->__construct() Actions after: $controller->init(); ob_start(); $controller->dispatch() Next hook: controllerBeforeAction()
\Zend_Controller_Action
dispatchLoopStartup(\Zend_Controller_Request_Abstract $request) : void
This events enables you to adjust the request after the routing has been done.
This is the final hook before the dispatchLoop starts. All the hooks in the dispatchLoop can be executed more then once.
Not yet initialized is the $controller object - as the $controller can change during the dispatchLoop.
Previous hook: routeShutdown() Actions since: nothing, but the route consisting of controller, action and module should now be fixed Actions after: dispatch loop started Next hook: preDispatch()
\Zend_Controller_Request_Abstract
getCurrentOrganization() : integer
| deprecated | Since 1.7.2 Replaced by $this->currentOrganization->getId(); |
|---|
integerThe current active organization id or 0 when not knowngetCurrentUserId() : integer
| deprecated | Since 1.7.2 Replaced by $this->currentUser->getUserId(); |
|---|
integerThe current user id or 0 when not known.getDatabasePaths() : array
arrayOf index => array('path' =>, 'name' =>, 'db' =>,)getInstance() : \GemsEscort
\GemsEscortgetLoader() : \Gems_Loader
\Gems_LoaderOr a subclassed version when specified in the project codegetLoaderDirs() : array
arraygetMessenger() : \Zend_Controller_Action_Helper_FlashMessenger
\Zend_Controller_Action_Helper_FlashMessengergetRandomPassword() : string
stringgetStaticSession() : \Zend_Session_Namespace
\Zend_Session_NamespacegetUtil() : \Gems_Util
\Gems_UtilOr a subclassed version when specified in the project codehasPrivilege(string $privilege, string $role = null) : boolean
| deprecated | Since 1.7.2 Replaced by $this->currentUser->hasPrivilege(); |
|---|
string
string
booleanpasswordHash(string $value, $isNew= false, string $name= null, array $context= array()) : string
| deprecated | Since 1.5 |
|---|
stringThe value to hash.
stringOptional name, is here for ModelAbstract setOnSave compatibility
arrayOptional, the other values being saved
stringThe salted hash as a 32-character hexadecimal number.plural(string $singular, string $plural, integer $number, string|\Zend_Locale $locale = null) : string
Translates the given string using plural notations Returns the translated string
| see |
|---|
stringSingular translation string
stringPlural translation string
integerNumber for detecting the correct plural
string\Zend_Locale(Optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information
stringpostDispatch(\Zend_Controller_Request_Abstract $request) : void
This callback allows for proxy or filter behavior. By altering the request and resetting its dispatched flag (via {@link \Zend_Controller_Request_Abstract::setDispatched() setDispatched(false)}), a new action may be specified for dispatching.
\Zend_Layout_Controller_Plugin_Layout uses this event to change the output of the $response with the rendering of the layout. As the Layout plugin has a priority of 99, this Escort event will take place before the layout is rendered, unless $this->run() was called with a stackIndex lower than zero.
Previous hook: controllerAfterAction() Actions since: ob_get_clean(); $response->appendBody() Actions after: while (! Request->isDispatched()) or back to Hook 8 preDispatch() Next hook: dispatchLoopShutdown()
\Zend_Controller_Request_Abstract
preDispatch(\Zend_Controller_Request_Abstract $request) : void
This callback allows for proxy or filter behavior. By altering the request and resetting its dispatched flag (via \Zend_Controller_Request_Abstract::setDispatched()), the current action may be skipped.
Not yet initialized is the $controller object - as the $controller can change during the dispatchLoop.
Previous hook: dispatchLoopStartup() or new loop Actions since: dispatch loop started Actions after: $dispatcher->dispatch(); $controller->__construct() Next hook: controllerInit()
\Zend_Controller_Request_Abstract
prepareController()
return @void
requestChanged(\Zend_Controller_Request_Abstract $request) : void
All resources have been loaded and the $request object is created. Theoretically this event can be triggered multiple times, but this does not happen in a standard Zend application.
Not initialized are the $response and $controller objects.
Previous hook: beforeRun() Actions since: $this->request object created Actions after: $this->response object created Next hook: responseChanged()
\Zend_Controller_Request_Abstract
responseChanged(\Zend_Controller_Response_Abstract $response) : void
All resources have been loaded and the $request and $response object have been created. Theoretically this event can be triggered multiple times, but this does not happen in a standard Zend application.
Not initialized is the $controller object and the routing has not yet been executed.
Previous hook: requestChanged() Initialized since: the $this->response object Next hook: routeStartup()
routeShutdown(\Zend_Controller_Request_Abstract $request) : void
This events enables you to adjust the route after the routing has run it's course.
Not initialized is the $controller object.
Previous hook: routeStartup() Actions since: $router->route() Actions after: nothing, but the route consisting of controller, action and module should now be fixed Next hook: dispatchLoopStartup()
Also sets $this->currentOrganization and $this->menu to access afterwards
\Zend_Controller_Request_Abstract
setControllerDirectory(\Zend_Controller_Request_Abstract $request)
setError(string $message, integer $code= 200, string $info= null, boolean $isSecurity= false)
string
integer
string
boolean
\exception |
|---|
setException(\exception $e)
\exception
\exception |
|---|
_copyVariables(Object $object) : void
Copies all variables to the target object.
ObjectAn object who gets all variables from this object.
_initAccesslog() : \Gems_AccessLog
Use $this->accesslog to access afterwards
\Gems_AccessLog_initAcl() : \MUtil_Acl
Use $this->acl to access afterwards
\MUtil_Acl_initActionHelpers()
_initBasepath() : \Gems_Loader
Use $this->basepath to access afterwards
\Gems_Loader_initCache() : \Zend_Cache_Core
\Zend_Cache_Core_initCurrentUser() : \Gems_User_User
You can overrule this function to specify your own project translation method / file.
Use $this->currentUser to access afterwards
\Gems_User_User_initDb() : \Zend_Db
Use $this->db to access afterwards
\Zend_Db_initLoader() : \Gems_Loader
Use $this->loader to access afterwards
\Gems_Loader_initLocale() : \Zend_Locale
We use this function instead of the standard application.ini setting to simplify overruling the settings.
Also Firefox tends to overrule the locale settings.
You can overrule this function to specify your own project translation method / file.
Use $this->locale to access afterwards
\Zend_Locale_initLogger() : \Gems_Log
\Gems_Log_initOpenRosa()
_initProject() : \Gems_Project_ProjectSettings
The project component contains information about this project that are not Zend specific. For example: -- the super administrator, -- the project name, version and description, -- locales used, -- css and image directories used.
This is the place for you to store any project specific data that should not be in the code. I.e. if you make a controllor that needs a setting to work, then put the setting in this settings file.
Use $this->project to access afterwards
\Gems_Project_ProjectSettings_initSession() : \Zend_Session_Namespace
The session contains information on the registered user from @see $this->loadLoginInfo($username) This includes: -- user_id -- user_login -- user_name -- user_role -- user_locale -- user_organization_id
Use $this->session to access afterwards
| deprecated | since 1.5 |
|---|
\Zend_Session_Namespace_initSource() : \Gems_Loader
You can overrule this function to specify your own project translation method / file.
Use $this->source to access afterwards
\Gems_Loader_initTranslate() : \Zend_Translate
Scans the application and project dirs for available translations
Use $this->translate to access afterwards Also sets $this->translateAdapter to access afterwards
\Zend_Translate_initUtil() : \Gems_Util
You can overrule this function to specify your own project translation method / file.
Use $this->util to access afterwards
\Gems_Util_initView() : \Zend_View
Actions taken here can take advantage that the full framework has been activated by now, including session data, etc.
Use $this->view to access afterwards
\Zend_View_initZFDebug() : void
_layoutContact(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutCrumbs(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutCss() : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutFavicon() : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutJQuery() : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutLocaleSet(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutLogin(array $args = null) : mixed
Function called if specified in the Project.ini layoutPrepare section before the layout is drawn, but after the rest of the program has run it's course.
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutMenuActiveBranch() : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutMenuHtml() : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutMenuTopLevel() : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutMessages(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutOrganizationSwitcher(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutProjectName(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutTime(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutTitle(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutUser(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._layoutVersion(array $args = null) : mixed
mixedIf null nothing is set, otherwise the name of
the function is used as \Zend_View variable name._updateVariable(String|Array $name) : void
Updates selected variable(s) to the objects targeted in _copyVariables.
Do this when an object is created or when a non-object variable has changed. You do not need to call this method for changes to objects .
StringArrayA property name or array of property names to copy from this object to the previous copy targets.
createProjectClass(string $className, mixed $paramOne= null, mixed $paramTwo= null) : object
string
mixedOptional
mixedOptional
objectincludeFile(string $fileName) : mixed
When no extension is specified the system looks for a file with the right extension, in the order: .ini, .php, .xml, .inc.
.php and .inc files run within the context of this object and thus can access all $this-> variables and functions.
stringA filename in the include path
mixedfalse if nothing was returnedfindExtension($fullFileName, array $extensions)
$useBootstrap : boolean
false$useHtml5 : boolean
false$_copyDestinations : array
$_instanceOfSelf : self
$_loaderDirs : array
$_projectLoader : \MUtil_Loader_PluginLoader
$_startFirebird : boolean
RECEPTION_OK = 'OK'