help.php

Go to the documentation of this file.
00001 <?php
00002 
00011 class Help extends oxUBase
00012 {
00017     protected $_sThisTemplate = 'help.tpl';
00018 
00023     protected $_sHelpText = null;
00024 
00029     protected $_sDefaultPage = 'default';
00030 
00036     protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
00037 
00047     public function render()
00048     {
00049         $this->_aViewData["helptext"] = $this->getHelpText();
00050 
00051         parent::render();
00052 
00053         return $this->_sThisTemplate;
00054     }
00055 
00064     protected function _getHelpPageContents( $sHelpPage, $sLang )
00065     {
00066         if ( $sHelpPage ) {
00067             $aHelpPages[] = basename( $sHelpPage );
00068         }
00069         $aHelpPages[] = $this->_sDefaultPage;
00070 
00071         $sContents = false;
00072         $sPath = getShopBasePath()."help/{$sLang}/";
00073 
00074         foreach ( $aHelpPages as $sPage ) {
00075             $sHelpPath = $sPath . $sPage . ".inc.tpl";
00076             if ( is_readable( $sHelpPath ) ) {
00077                 $sContents = file_get_contents( $sHelpPath );
00078                 break;
00079             }
00080         }
00081 
00082         return $sContents;
00083     }
00084 
00090     public function getHelpText()
00091     {
00092         if ( $this->_sHelpText === null ) {
00093             $sHelpPage = oxConfig::getParameter( 'tpl' );
00094             $sHelpPage = $sHelpPage ? $sHelpPage : oxConfig::getParameter( 'page' );
00095             $this->_sHelpText = $this->_getHelpPageContents( $sHelpPage, oxLang::getInstance()->getBaseLanguage() );
00096         }
00097         return $this->_sHelpText;
00098     }
00099 }