OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Core\UtilsView Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Core\UtilsView:
+ Collaboration diagram for OxidEsales\EshopCommunity\Core\UtilsView:

Public Member Functions

 getSmarty ($blReload=false)
 
 getTemplateOutput ($templateName, $oObject)
 
 passAllErrorsToView (&$aView, $errors)
 
 addErrorToDisplay ($oEr, $blFull=false, $useCustomDestination=false, $customDestination="", $activeController="")
 
 parseThroughSmarty ($sDesc, $sOxid=null, $oActView=null, $blRecompile=false)
 
 setTemplateDir ($templatesDirectory)
 
 getTemplateDirs ()
 
 getTemplateCompileId ()
 
 getSmartyDir ()
 
 _smartyDefaultTemplateHandler ($resourceType, $resourceName, &$resourceContent, &$resourceTimestamp, $smarty)
 
 getTemplateBlocks ($templateFileName)
 

Protected Member Functions

 _fillCommonSmartyProperties ($smarty)
 
 getShopSmartyPluginDirectories ()
 
 _smartyCompileCheck ($smarty)
 
 _getTemplateBlock ($moduleId, $fileName)
 
 _getActiveModuleInfo ()
 
 addActiveThemeId ($themePath)
 

Protected Attributes

 $_aTemplateDir = []
 
 $_blIsTplBlocks = null
 
 $_aActiveModuleInfo = null
 

Static Protected Attributes

static $_oSmarty = null
 

Private Member Functions

 filterTemplateBlocks ($activeBlockTemplates)
 
 formListOfDuplicatedBlocks ($activeBlockTemplates)
 
 removeDefaultBlocks ($activeBlockTemplates, $templateBlocksToExchange)
 
 removeParentBlocks ($templateBlocks, $templateBlocksToExchange)
 
 fillTemplateBlockWithContent ($blockTemplates)
 
 isShopTemplateBlockOverriddenByActiveModule ()
 
 prepareBlockKey ($activeBlockTemplate)
 
 getModuleSmartyPluginDirectories ()
 
 getSmartyPluginDirectoryRepository ()
 
 getShopIdCalculator ()
 

Private Attributes

 $shopIdCalculator
 

Detailed Description

View utility class

Member Function Documentation

◆ _fillCommonSmartyProperties()

OxidEsales\EshopCommunity\Core\UtilsView::_fillCommonSmartyProperties (   $smarty)
protected

sets properties of smarty object

Parameters
Smarty$smartytemplate processor object (smarty)

◆ _getActiveModuleInfo()

OxidEsales\EshopCommunity\Core\UtilsView::_getActiveModuleInfo ( )
protected

Returns active module Ids

Returns
array

◆ _getTemplateBlock()

OxidEsales\EshopCommunity\Core\UtilsView::_getTemplateBlock (   $moduleId,
  $fileName 
)
protected

Retrieve module block contents from active module block file.

Parameters
string$moduleIdactive module id.
string$fileNamemodule block file name.
Deprecated:
since v6.0.0 (2016-04-13); Use ModuleTemplateBlockContentReader::getContent().
See also
getTemplateBlocks
Exceptions
oxExceptionif block is not found
Returns
string

◆ _smartyCompileCheck()

OxidEsales\EshopCommunity\Core\UtilsView::_smartyCompileCheck (   $smarty)
protected

Sets compile check property to smarty object.

Parameters
object$smartytemplate processor object (smarty)

◆ _smartyDefaultTemplateHandler()

OxidEsales\EshopCommunity\Core\UtilsView::_smartyDefaultTemplateHandler (   $resourceType,
  $resourceName,
$resourceContent,
$resourceTimestamp,
  $smarty 
)

is called when a template cannot be obtained from its resource.

Parameters
string$resourceTypetemplate type
string$resourceNametemplate file name
string$resourceContenttemplate file content
int$resourceTimestamptemplate file timestamp
object$smartytemplate processor object (smarty)
Returns
bool

◆ addActiveThemeId()

OxidEsales\EshopCommunity\Core\UtilsView::addActiveThemeId (   $themePath)
protected

Add active theme at the end of theme path to form full path to templates.

Parameters
string$themePath
Returns
string

◆ addErrorToDisplay()

OxidEsales\EshopCommunity\Core\UtilsView::addErrorToDisplay (   $oEr,
  $blFull = false,
  $useCustomDestination = false,
  $customDestination = "",
  $activeController = "" 
)

Adds an exception to the array of displayed exceptions for the view by default is displayed in the inc_header, but with the custom destination set to true the exception won't be displayed by default but can be displayed where ever wanted in the tpl

Parameters
StandardException | IDisplayError | string$oEran exception object or just a language local (string), which will be converted into a oxExceptionToDisplay object
bool$blFullif true the whole object is add to display (default false)
bool$useCustomDestinationtrue if the exception shouldn't be displayed at the default position (default false)
string$customDestinationdefines a name of the view variable containing the messages, overrides Parameter 'CustomError' ("default")
string$activeControllerdefines a name of the controller, which should handle the error.

◆ fillTemplateBlockWithContent()

OxidEsales\EshopCommunity\Core\UtilsView::fillTemplateBlockWithContent (   $blockTemplates)
private

Fill array with template content or skip if template does not exist. Logs error message if template does not exist.

Example of $activeBlockTemplates:

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_a" "content_a_active"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_b" OXFILE = "x" "content_b_x_default"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_b" OXFILE = "y" "content_b_y_default"

Example of return:

$templateBlocks = [ block_name_a = [ 0 => "content_a_active" ], block_name_c = [ 0 => "content_b_x_default", 1 => "content_b_y_default" ] ]

Parameters
array$blockTemplates
Returns
array

◆ filterTemplateBlocks()

OxidEsales\EshopCommunity\Core\UtilsView::filterTemplateBlocks (   $activeBlockTemplates)
private

Leave only one element for items grouped by fields: OXTEMPLATE and OXBLOCKNAME

Pick only one element from each group if OXTHEME contains (by following priority):

  • Active theme id
  • Parent theme id of active theme
  • Undefined

Example of $activeBlockTemplates:

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_a" (group a) OXTHEME = "" "content_a_default"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_a" (group a) OXTHEME = "parent_of_active_theme" "content_a_parent"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_a" (group a) OXTHEME = "active_theme" "content_a_active"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_b" (group b) OXTHEME = "" "content_b_default"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_b" (group b) OXTHEME = "parent_of_active_theme" "content_b_parent"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_c" (group c) OXTHEME = "" OXFILE = "x" "content_c_x_default"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_c" (group c) OXTHEME = "" OXFILE = "y" "content_c_y_default"

Example of return:

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_a" (group a) OXTHEME = "active_theme" "content_a_active"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_b" (group b) OXTHEME = "parent_of_active_theme" "content_b_parent"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_c" (group c) OXTHEME = "" OXFILE = "x" "content_c_x_default"

OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_c" (group c) OXTHEME = "" OXFILE = "y" "content_c_y_default"

Parameters
array$activeBlockTemplateslist of template blocks with all parameters.
Returns
array list of blocks with their content.

◆ formListOfDuplicatedBlocks()

OxidEsales\EshopCommunity\Core\UtilsView::formListOfDuplicatedBlocks (   $activeBlockTemplates)
private

Form list of blocks which has duplicates for specific theme.

Parameters
array$activeBlockTemplates
Returns
array

◆ getModuleSmartyPluginDirectories()

OxidEsales\EshopCommunity\Core\UtilsView::getModuleSmartyPluginDirectories ( )
private
Returns
array

◆ getShopIdCalculator()

OxidEsales\EshopCommunity\Core\UtilsView::getShopIdCalculator ( )
private
Returns
EshopShopIdCalculator

◆ getShopSmartyPluginDirectories()

OxidEsales\EshopCommunity\Core\UtilsView::getShopSmartyPluginDirectories ( )
protected
Returns
array

◆ getSmarty()

OxidEsales\EshopCommunity\Core\UtilsView::getSmarty (   $blReload = false)

returns existing or creates smarty object Returns smarty object. If object not yet initiated - creates it. Sets such default parameters, like cache lifetime, cache/templates directory, etc.

Parameters
bool$blReloadset true to force smarty reload
Returns
smarty

◆ getSmartyDir()

OxidEsales\EshopCommunity\Core\UtilsView::getSmartyDir ( )

Returns a full path to Smarty compile dir

Returns
string

◆ getSmartyPluginDirectoryRepository()

OxidEsales\EshopCommunity\Core\UtilsView::getSmartyPluginDirectoryRepository ( )
private
Returns
ModuleSmartyPluginDirectoryRepository

◆ getTemplateBlocks()

OxidEsales\EshopCommunity\Core\UtilsView::getTemplateBlocks (   $templateFileName)

Template blocks getter: retrieve sorted blocks for overriding in templates

Parameters
string$templateFileNamefilename of rendered template
See also
smarty_prefilter_oxblock
Returns
array

◆ getTemplateCompileId()

OxidEsales\EshopCommunity\Core\UtilsView::getTemplateCompileId ( )

Get template compile id.

Returns
string

◆ getTemplateDirs()

OxidEsales\EshopCommunity\Core\UtilsView::getTemplateDirs ( )

Initializes and returns templates directory info array

Returns
array

◆ getTemplateOutput()

OxidEsales\EshopCommunity\Core\UtilsView::getTemplateOutput (   $templateName,
  $oObject 
)

Returns rendered template output. According to debug configuration outputs debug information.

Parameters
string$templateNametemplate file name
object$oObjectobject, witch template we wish to output
Returns
string

◆ isShopTemplateBlockOverriddenByActiveModule()

OxidEsales\EshopCommunity\Core\UtilsView::isShopTemplateBlockOverriddenByActiveModule ( )
private

Check if at least one active module overrides at least one template (in active shop). To win performance when:

  • no active modules exists.
  • none active module overrides template.
Returns
bool

◆ parseThroughSmarty()

OxidEsales\EshopCommunity\Core\UtilsView::parseThroughSmarty (   $sDesc,
  $sOxid = null,
  $oActView = null,
  $blRecompile = false 
)

Runs long description through smarty. If you pass array of data to process, array will be returned, if you pass string - string will be passed as result

Parameters
mixed$sDescdescription or array of descriptions (array( [] => array(ident, value_to_process)))
string$sOxidcurrent object id
\OxidEsales\Eshop\Core\Controller\BaseController$oActViewview data to use its view data (optional)
bool$blRecompileforce to recompile if found in cache
Returns
mixed

◆ passAllErrorsToView()

OxidEsales\EshopCommunity\Core\UtilsView::passAllErrorsToView ( $aView,
  $errors 
)

adds the given errors to the view array

Parameters
array$aViewview data array
array$errorsarray of errors to pass to view

◆ prepareBlockKey()

OxidEsales\EshopCommunity\Core\UtilsView::prepareBlockKey (   $activeBlockTemplate)
private

Prepare indicator for template block. This indicator might be used to identify same template block for different theme.

Parameters
array$activeBlockTemplate
Returns
string

◆ removeDefaultBlocks()

OxidEsales\EshopCommunity\Core\UtilsView::removeDefaultBlocks (   $activeBlockTemplates,
  $templateBlocksToExchange 
)
private

Remove default blocks whose have duplicate for specific theme.

Parameters
array$activeBlockTemplates
array$templateBlocksToExchange
Returns
array

◆ removeParentBlocks()

OxidEsales\EshopCommunity\Core\UtilsView::removeParentBlocks (   $templateBlocks,
  $templateBlocksToExchange 
)
private

Remove parent theme blocks whose have duplicate for custom theme.

Parameters
array$templateBlocks
array$templateBlocksToExchange
Returns
array

◆ setTemplateDir()

OxidEsales\EshopCommunity\Core\UtilsView::setTemplateDir (   $templatesDirectory)

Templates directory setter

Parameters
string$templatesDirectorytemplates path

Member Data Documentation

◆ $_aActiveModuleInfo

OxidEsales\EshopCommunity\Core\UtilsView::$_aActiveModuleInfo = null
protected

◆ $_aTemplateDir

OxidEsales\EshopCommunity\Core\UtilsView::$_aTemplateDir = []
protected

◆ $_blIsTplBlocks

OxidEsales\EshopCommunity\Core\UtilsView::$_blIsTplBlocks = null
protected

◆ $_oSmarty

OxidEsales\EshopCommunity\Core\UtilsView::$_oSmarty = null
staticprotected

◆ $shopIdCalculator

OxidEsales\EshopCommunity\Core\UtilsView::$shopIdCalculator
private

The documentation for this class was generated from the following file: