| [ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/view/blogview.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php" ); 7 8 /** 9 * \ingroup View 10 * 11 * Loads template files from the plugins/ folder. This is the view class that plugins should use when 12 * creating their own views. It works in exactly the same way as the BlogView class but it knows how 13 * to load custom templates as provided by templates, which are located under 14 * plugins/plugin-name/templates/ instead of templates/template-set-name/ 15 * 16 * @see BlogView 17 */ 18 class PluginTemplatedView extends BlogView 19 { 20 21 var $_templateName; 22 var $_pluginId; 23 24 /** 25 * This initializes the class, but normally we'll only have to initialize the parent 26 * 27 * @param blogInfo 28 * @param pluginId 29 * @param templateName 30 * @param useHeaderFooter Whether to use the templates/admin/header.template and 31 * templates/admin/footer.template templates automatically 32 */ 33 function PluginTemplatedView( $blogInfo, $pluginId, $templateName, $cachingEnabled = SMARTY_VIEW_CACHE_CHECK, $data = Array()) 34 { 35 if( $cachingEnabled == SMARTY_VIEW_CACHE_CHECK ) { 36 // detect whether caching should be enabled or not 37 $config =& Config::getConfig(); 38 $cachingEnabled = $config->getValue( "template_cache_enabled" ); 39 } 40 41 $this->BlogView( $blogInfo, "" ); 42 43 $this->_templateService = new TemplateService(); 44 $this->_templateName = $templateName; 45 $this->_pluginId = $pluginId; 46 47 if ($cachingEnabled == SMARTY_VIEW_CACHE_DISABLED) { 48 $this->_template = $this->_templateService->PluginTemplate( $this->_pluginId, $this->_templateName, $blogInfo ); 49 } else { 50 $this->_template = $this->_templateService->PluginCachedTemplate( $this->_pluginId, $this->_templateName, $blogInfo ); 51 } 52 } 53 54 /** 55 * Renders the view. It simply gets all the parameters we've been adding to it 56 * and puts them in the context of the template renderer so that they can be accessed 57 * as normal parameters from within the template 58 * 59 * @return Returns a rendered template 60 */ 61 function render() 62 { 63 // assign all the values 64 $blogSettings = $this->_blogInfo->getSettings(); 65 $templateSet = $blogSettings->getValue( "template" ); 66 $this->_template->assign( $this->_params->getAsArray()); 67 $ts = new TemplateSets(); 68 $storage = new TemplateSetStorage(); 69 if( $ts->isBlogTemplate( $templateSet, $this->_blogInfo->getId())) 70 $blogTemplate = $storage->getTemplateFolder( $templateSet, $this->_blogInfo->getId()); 71 else 72 $blogTemplate = $storage->getTemplateFolder( $templateSet ); 73 74 $this->_template->assign( "blogtemplate", $blogTemplate ); 75 $this->_template->assign( "misctemplatepath", $storage->getMiscTemplateFolder()); 76 77 parent::render(); 78 } 79 } 80 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
|