Table des matières

Environment

Description : Environment manager.
Php : 5.3
Category : Environment
Package : Core
Author : Tavm@n <tavman@gmail.com>
License : http://creativecommons.org/licenses/by-nc/2.0/
Link : none
See : All
Version : I-Radian v2.0.alpha 1
Since : 2010/02/13


Haut de page

DEV = 1

Description : Define a development type environment.
Signature : const DEV = 1


Haut de page

DEVELOPMENT = 1

Description : Define a development type environment.
Signature : const DEVELOPMENT = 1


Haut de page

TEST = 2

Description : Define a test type environment.
Signature : const TEST = 2


Haut de page

DESIGN = 3

Description : Define a designer / integrator type environment.
Signature : const DESIGN = 3


Haut de page

INTEGRATEUR = 3

Description : Define a designer / integrator type environment.
Signature : const INTEGRATEUR = 3


Haut de page

INTEGRATOR = 3

Description : Define a designer / integrator type environment.
Signature : const INTEGRATOR = 3


Haut de page

INTEGRATION = 3

Description : Define a designer / integrator type environment.
Signature : const INTEGRATION = 3


Haut de page

PROD = 4

Description : Define a production type environment.
Signature : const PROD = 4


Haut de page

PRODUCTION = 4

Description : Define a production type environment.
Signature : const PRODUCTION = 4


Haut de page

DEFAULT_ENVIRONMENT_TYPE = 1

Description : Defines the default environment type.
Signature : const DEFAULT_ENVIRONMENT_TYPE = 1
Note : switch automatically from 1 in dev to 4 in prod.


Haut de page

DEFAULT_ENVIRONMENT_NAME = 'dev'

Description : Defines the default environment name.
Signature : const DEFAULT_ENVIRONMENT_NAME = 'dev'
Note : switch automatically from 'dev' in dev to 'prod' in prod.


Haut de page

setEnvTypeByString

Description : Sets the environment type by a String.
Since : 2010/02/12
Signature : public static function setEnvTypeByString ($sEnvType)
Param : $sEnvType (String) : String environment type.


Haut de page

getEnvironmentType

Description : Environment type accessor.
Since : 2010/02/12
Signature : public static function getEnvironmentType ()
Usage :


<?php
class AccueilAction extends Action
{
    public function 
doindex ($aParams=array())
    {
        
$sEnv Environment::getEnvironmentType();
        if ( 
$sEnv == Environment::DEV ) {
            echo
'<pre>';print_r($aParams);echo'</pre>';
        }
    }
}

Haut de page

setEnvironments

Description : Sets avalaibles environments.
Since : 2010/02/12
Signature : public static function setEnvironments ($aEnvs)
Param : $aEnvs (Array) : Environments list
Note : You shouldn't have to use this method.


Haut de page

getEnvironments

Description : Environments list accessor.
Since : 2010/02/12
Signature : public static function getEnvironments ()
Return : Array Environments list.


Haut de page

getType

Description : Environment type accessor.
Since : 2010/02/12
Signature : public static function getType ()
Alias : getEnvironmentType()
Usage :


<?php
class AccueilAction extends Action
{
    public function 
doindex ($aParams=array())
    {
        
$iEnv Environment::getEnvironmentType();
        if ( 
$iEnv == Environment::DEV ) {
            echo
'<pre>';print_r($aParams);echo'</pre>';
        }
    }
}

Haut de page

setEnvironmentName

Description : Sets the environment type using a String.
Since : 2010/02/12
Signature : public static function setEnvironmentName ($sEnvName)
Return : String Environments type.


Haut de page

getEnvironmentName

Description : Environment name accessor.
Since : 2010/02/12
Signature : public static function getEnvironmentName ()
Usage :


<?php
class AccueilAction extends Action
{
    public function 
doindex ($aParams=array())
    {
        
$iEnv Environment::getEnvironmentName();
        if ( 
$iEnv == 'test' ) {
            echo
'<pre>';print_r($aParams);echo'</pre>';
        }
    }
}

Haut de page

setSpecifiqueEnvironmentName

Description : Sets the specifique environment name.
Since : 2010/02/12
Signature : public static function setSpecifiqueEnvironmentName ($sSpecEnvName)
Param : $sSpecEnvName (String) : Specifique environment name.


Haut de page

getSpecifiqueEnvironmentName

Description : Specifique environment name accessor.
Since : 2010/02/12
Signature : public static function getSpecifiqueEnvironmentName ()
Return : String Specifique environment name.
Usage :


<?php
class AccueilAction extends Action
{
    public function 
doindex ($aParams=array())
    {
        
$iEnv Environment::getSpecifiqueEnvironmentName();
        if ( 
$iEnv == 'test' ) {
            echo
'<pre>';print_r($aParams);echo'</pre>';
        }
    }
}

Haut de page

setErrorsShow

Description : Sets display errors by type.
Since : 2010/02/12
Signature : public static function setErrorsShow ($mErrors, $bShow=true)
Param : $mErrors (Mixed) : Array ou Int, errors to show.


Haut de page

getShowError

Description : Show error by type accessor.
Since : 2010/02/12
Signature : public static function getShowError ($iError)
Param : $iError (Int) : Error level.
Return : Bool TRUE if the error type can be show, else FALSE.


Haut de page

initEnvironments

Description : Initialize environment (using environments.js)
Since : 2010/02/12
Signature : public static function initEnvironments ()


Haut de page

initGlobalVariables

Description : Initialize environment variables (using global configuration file).
Since : 2010/02/12
Signature : public static function initGlobalVariables ()


Haut de page

initLocalVariables

Description : Initialize environment variables (using local configuration file).
Since : 2010/02/12
Signature : public static function initLocalVariables ($sSite)
Param : $sSite (String) : Site name.


Haut de page

initModuleVariables

Description : Initialize module variables (using modules configuration file).
Since : 2010/02/12
Signature : public static function initModuleVariables ($sModule)
Param : $sModule (String) : Module name
Usage :


<?php
// Module loader
Environment::initModuleVariables('my_module');

Haut de page

getModuleVariable

Description : Module variables accessor.
Since : 2010/02/12
Signature : public static function getModuleVariable ($sModule, $sVariable=null)
Param : $sModule (String) : Module name.
Return : Mixed Array : variables associative list OR variable value if the second parametter is null.
Usage :


<?php
// Module loader
$aVariables Environment::getModuleVariable('my_module''my_var');

Haut de page

readDefiner

Description : Read a configuration file.
Since : 2010/02/12
Signature : public static function readDefiner ($sFile, $sURIBase)
Param : $sFile (String) : File link.


Haut de page

setDefaults

Description : Sets project default values (image path, css path, javascript path, prefixes, suffixes, etc.).
Since : 2010/02/12
Signature : public static function setDefaults ($aDefaults)
Param : $aDefaults (Array) : Default values list.


Haut de page

setDefault

Description : Sets a default value of the projet.
Since : 2010/02/12
Signature : public static function setDefault ($sKey, $sValue)
Param : $sKey (String) : Value key.


Haut de page

getDefaults

Description : Defaults values accessor.
Since : 2010/02/12
Signature : public static function getDefaults ()
Return : Array Defaults values list.
Usage :


<?php
class AccueilAction extends Action
{
    public function 
doindex ($aParams=array())
    {
        echo
'<pre>';print_r(Environment::getDefaults());echo'</pre>';
    }
}

Haut de page

getDefault

Description : Default value accessor.
Since : 2010/02/12
Signature : public static function getDefault ($sKey=null)
Param : [$sKey=null] (String) : Value name (default: NULL)
Return : Misc Default values list if the key is null, else key default value.
Usage :


<?php
class AccueilAction extends Action
{
    public function 
doindex ($aParams=array())
    {
        echo 
Environment::getDefault('TEMPLATE_PATH');
    }
}

Haut de page

getIncludes

Description : Gets the includes files list defined in configurations files.
Since : 2010/02/12
Signature : public static function getIncludes ()
Return : Array Files list.
Usage :


<?php
class AccueilAction extends Action
{
    public function 
doindex ($aParams=array())
    {
        echo
'<pre>';print_r(Environment::getDefaults());echo'</pre>';
    }
}

Haut de page

addInclude

Description : Add an auto include file.
Since : 2010/02/12
Signature : public static function addInclude ($sFile)
Param : $sFile (String) : Link to the file.
Usage :


<?php
Environment
::addInclude('file_to_include.php');

Haut de page

addBeforeMeth

Description : Add a method to execute before start the page code.
Since : 2010/02/12
Signature : public static function addBeforeMeth ($sClass, $sMeth, $aParams)
Param : $sClass (String) : Class name.
Usage :


<?php
Environment
::addBeforeMeth('class''methode', array('params') );

Haut de page

addBeforeFunc

Description : Add a function to execute before start the page code.
Since : 2010/02/12
Signature : public static function addBeforeFunc ($sFunc, $aParams)
Param : $sFunc (String) : Function name.
Usage :


<?php
Environment
::addBeforeFunc('function', array('params') );

Haut de page

addAfterMeth

Description : Add a method to execute after start the page code.
Since : 2010/02/12
Signature : public static function addAfterMeth ($sClass, $sMeth, $aParams)
Param : $sClass (String) : Class name.
Usage :


<?php
Environment
::addAfterMeth('class''methode', array('params') );

Haut de page

addAfterFunc

Description : Add a function to execute after start the page code.
Since : 2010/02/12
Signature : public static function addAfterFunc ($sFunc, $aParams)
Param : $sFunc (String) : Function name.
Usage :


<?php
Environment
::addAfterFunc('function', array('params') );

Haut de page

callActionsBefore

Description : Execute methods and functions to execute before the page code.
Since : 2010/02/12
Signature : public static function callActionsBefore ()


Haut de page

callActionsAfter

Description : Execute methods and functions to execute after the page code.
Since : 2010/02/12
Signature : public static function callActionsAfter ()


Haut de page

includeExternalFiles

Description : Include page files.
Since : 2010/02/12
Signature : public static function includeExternalFiles ()