vendor/memo_development/contao-foundation-bundle/src/Module/FoundationModule.php line 378

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * @package   Memo\MemoFoundationBundle
  4.  * @author    Media Motion AG
  5.  * @license   LGPL-3.0+
  6.  * @copyright Media Motion AG
  7.  */
  8. namespace Memo\FoundationBundle\Module;
  9. use Contao\Model\Collection;
  10. use Contao\StringUtil;
  11. use Contao\System;
  12. use Memo\CategoryBundle\Model\CategoryModel;
  13. use Memo\FoundationBundle\Service\ToolboxService;
  14. use Memo\JobBundle\Model\JobAttributeModel;
  15. use SimplePie\Parse\Date;
  16. use Terminal42\ChangeLanguage\PageFinder;
  17. use Spatie\SchemaOrg\Schema;
  18. use Spatie\SchemaOrg\Graph;
  19. use Spatie\SchemaOrg\JobPosting;
  20. use Spatie\SchemaOrg\Organization;
  21. use Spatie\SchemaOrg\Place;
  22. use Spatie\SchemaOrg\PostalAddress;
  23. class FoundationModule extends \Module
  24. {
  25.     /**
  26.      * @return string
  27.      */
  28.     protected function compile()
  29.     {
  30.         if (TL_MODE == 'FE')
  31.         {
  32.             return '### Frontend-Modul ###';
  33.         }
  34.         else
  35.         {
  36.             return '### Backend-Modul ###';
  37.         }
  38.     }
  39.     public function setMetaDataCollection $colItem)
  40.     {
  41.         // Get Default Language
  42.         $strDefaultLanguage \System::getContainer()->get('memo.foundation.language')->getDefaultLanguage();
  43.         // Get the Model, Tablename and load the DCA
  44.         $arrAllModels $colItem->getModels();
  45.         $strItemModel get_class($arrAllModels[0]);
  46.         $strItemTable $strItemModel::getTable();
  47.         \Controller::loadDataContainer($strItemTable);
  48.         $arrPageMeta = [];
  49.         // Get Archive Model and Table
  50.         $arrTitleFields $GLOBALS['TL_DCA'][$strItemTable]['fields']['serpPreview']['eval']['titleFields'];
  51.         $arrDescriptionFields $GLOBALS['TL_DCA'][$strItemTable]['fields']['serpPreview']['eval']['descriptionFields'];
  52.         // Translate Item to current language
  53.         if($GLOBALS['TL_LANGUAGE'] != $strDefaultLanguage) {
  54.             $colItem[0]->getTranslatedModel($GLOBALS['TL_LANGUAGE']);
  55.         }
  56.         // Set the Meta-Title
  57.         $strTitleField 'title';
  58.         if(is_array($arrTitleFields)) {
  59.             foreach($arrTitleFields as $strField) {
  60.                 if($colItem[0]->$strField != ''){
  61.                     $strTitleField $strField;
  62.                     break;
  63.                 }
  64.             }
  65.         }
  66.         // If possible, get the full title, that is composed of multiple fields
  67.         if($strTitleField == 'title' && method_exists($colItem[0], 'getFullTitle')){
  68.             $arrPageMeta['title'] = $colItem[0]->getFullTitle();
  69.         } else {
  70.             $arrPageMeta['title'] = $colItem[0]->$strTitleField;
  71.         }
  72.         // Set the Meta-Robots
  73.         if ($colItem[0]->robots) {
  74.             $arrPageMeta['robots'] = $colItem[0]->robots;
  75.         } elseif ($colItem[0]->pid && $objItemArchive $colItem[0]->getRelated('pid')) {
  76.             $arrPageMeta['robots'] = $objItemArchive->robots ?: 'index,follow';
  77.         }
  78.         // Set the Meta-Description
  79.         $strDescriptionField 'description';
  80.         if (is_array($arrDescriptionFields)) {
  81.             foreach ($arrDescriptionFields as $strField) {
  82.                 if ($colItem[0]->$strField != '') {
  83.                     $strDescriptionField $strField;
  84.                     break;
  85.                 }
  86.             }
  87.         }
  88.         if (is_string($colItem[0]->$strDescriptionField)) {
  89.             $arrPageMeta['description'] = strip_tags($colItem[0]->$strDescriptionField);
  90.         } else {
  91.             $arrPageMeta['description'] = '';
  92.         }
  93.         ToolboxService::setPageHeaderMeta($arrPageMeta);
  94.     }
  95.     public function setJsonLdDataCollection $colItem)
  96.     {
  97.         if(!$colItem) {
  98.             return;
  99.         }
  100.         $objItem $colItem[0];
  101.         // Get Default Language
  102.         $strDefaultLanguage \System::getContainer()->get('memo.foundation.language')->getDefaultLanguage();
  103.         // Translate Item to current language
  104.         if($GLOBALS['TL_LANGUAGE'] != $strDefaultLanguage) {
  105.             $objItem->getTranslatedModel($GLOBALS['TL_LANGUAGE']);
  106.         }
  107.         // Get the Model, Tablename and load the DCA
  108.         $arrAllModels $colItem->getModels();
  109.         $strItemModel get_class($arrAllModels[0]);
  110.         $strItemTable $strItemModel::getTable();
  111.         \Controller::loadDataContainer($strItemTable);
  112.         // Get class of object to handle different specific cases
  113.         $strClass get_class($objItem);
  114.         // Case :: Jobs
  115.         if($strClass == "Memo\JobBundle\Model\JobModel"){
  116.             $objJobPosting = new JobPosting();
  117.             // If possible, get the full title, that is composed of multiple fields
  118.             if(method_exists($objItem'getFullTitle')){
  119.                 $objJobPosting->title($objItem->getFullTitle());
  120.             } else {
  121.                 $objJobPosting->title($objItem->title);
  122.             }
  123.             // Get Structured Data Fields
  124.             if($colAttributes JobAttributeModel::findAllPublished(array('sort' => 'sorting ASC'))) {
  125.                 $arrProperties = array();
  126.                 // Loop all attributes
  127.                 foreach ($colAttributes as $objAttribute) {
  128.                     // Get the value of this attribute
  129.                     $strValue $objItem->getAttributeValue($objAttribute->alias);
  130.                     if ($objAttribute->struct == 'direct') {
  131.                         if(array_key_exists($objAttribute->struct_data$arrProperties)){
  132.                             $arrProperties[$objAttribute->struct_data] .= $strValue;
  133.                         } else {
  134.                             $arrProperties[$objAttribute->struct_data] = $strValue;
  135.                         }
  136.                     }
  137.                 }
  138.                 // If there are properties, add them to the JobPosting
  139.                 if($arrProperties && count($arrProperties) > 0){
  140.                     foreach($arrProperties as $strKey => $strValue){
  141.                         $objJobPosting->setProperty($strKey$strValue);
  142.                     }
  143.                 }
  144.             }
  145.             // Get the Archive Data
  146.             if($objArchive $objItem->getRelated('pid')){
  147.                 // Add the hiringOrganization
  148.                 if($objArchive->organization_name || $objArchive->organization_url || $objArchive->singleSRC){
  149.                     $objOrganisation = new Organization();
  150.                     if($objArchive->organization_name != ''){
  151.                         $objOrganisation->name($objArchive->organization_name);
  152.                     }
  153.                     if($objArchive->organization_url != ''){
  154.                         $objOrganisation->url($objArchive->organization_url);
  155.                     }
  156.                     if($objArchive->singleSRC){
  157.                         $objImage \FilesModel::findByUuid($objArchive->singleSRC);
  158.                         // Get Absolute URL to Image
  159.                         $strImage \Contao\Controller::replaceInsertTags('{{env::path}}') . $objImage->path;
  160.                         $objOrganisation->logo($strImage);
  161.                     }
  162.                     $objJobPosting->hiringOrganization($objOrganisation);
  163.                 }
  164.                 // Add JobLocation
  165.                 if($objArchive->organization_address || $objArchive->organization_plz || $objArchive->organization_city || $objArchive->organization_country){
  166.                     $objPlace = new Place();
  167.                     $objPostalAddress = new PostalAddress();
  168.                     if($objArchive->organization_address != ''){
  169.                         $objPostalAddress->streetAddress($objArchive->organization_address);
  170.                     }
  171.                     if($objArchive->organization_plz != ''){
  172.                         $objPostalAddress->postalCode($objArchive->organization_plz);
  173.                     }
  174.                     if($objArchive->organization_city != ''){
  175.                         $objPostalAddress->addressLocality($objArchive->organization_city);
  176.                     }
  177.                     if($objArchive->organization_country != ''){
  178.                         $objPostalAddress->addressCountry($objArchive->organization_country);
  179.                     }
  180.                     $objPlace->address($objPostalAddress);
  181.                     $objJobPosting->jobLocation($objPlace);
  182.                 }
  183.                 // Add the datePosted
  184.                 if($objItem->date){
  185.                     $objJobPosting->datePosted(\Contao\Date::parse('Y-m-d'$objItem->date));
  186.                 } else {
  187.                     $objJobPosting->datePosted(\Contao\Date::parse('Y-m-d'$objItem->tstamp));
  188.                 }
  189.                 // Add the employmentType
  190.                 if (($objItem->workload_from == 100 && ($objItem->workload_from == $objItem->workload_to || !$objItem->workload_to)) || $objItem->workload_to == 100 && !$objItem->workload_from) {
  191.                     $objJobPosting->employmentType('FULL_TIME');
  192.                 } elseif ($objItem->workload_from) {
  193.                     $objJobPosting->employmentType('PART_TIME');
  194.                 }
  195.             }
  196.             // Send response
  197.             ToolboxService::setJsonLd($objJobPosting);
  198.         } elseif($strClass == 'TODO'){
  199.             // @TODO: Add more specific cases
  200.         } else {
  201.             throw new \Exception('Class ' $strClass ' not yet supported for JSON-LD');
  202.         }
  203.     }
  204.     /**
  205.      * @param Collection $objItems
  206.      * @param null $objDetailPage
  207.      * @param bool $bolAddDetailLinkToImage
  208.      * @return array
  209.      */
  210.     public function parseItems(Collection $objItems$objPresetDetailPage=null$bolAddDetailLinkToImage=true$arrCategories=array())
  211.     {
  212.         // Get Default Language
  213.         $strDefaultLanguage \System::getContainer()->get('memo.foundation.language')->getDefaultLanguage();
  214.         // Get Item Model and Table
  215.         $arrAllModels $objItems->getModels();
  216.         $this->strItemModel get_class($arrAllModels[0]);
  217.         $this->strItemTable $this->strItemModel::getTable();
  218.         \Controller::loadDataContainer($this->strItemTable);
  219.         // Get Archive Model and Table
  220.         $this->strArchiveTable $GLOBALS['TL_DCA'][$this->strItemTable]['config']['ptable'];
  221.         $this->strArchiveModel $GLOBALS['TL_MODELS'][$this->strArchiveTable];
  222.         $colArchives $this->strArchiveModel::findAll();
  223.         \Controller::loadDataContainer($this->strArchiveTable);
  224.         // Prepare all Archives in an array, for simple access (less DB requests)
  225.         if($colArchives)
  226.         {
  227.             // Get the page-finder
  228.             $objPageFinder = new PageFinder();
  229.             $objDetailPage false;
  230.             foreach($colArchives as $objArchive)
  231.             {
  232.                 if(!$objPresetDetailPage && $objArchive->jumpTo && $objPageModel \PageModel::findByPk$objArchive->jumpTo))
  233.                 {
  234.                     try {
  235.                         $objDetailPage $objPageFinder->findAssociatedForLanguage($objPageModel$GLOBALS['TL_LANGUAGE']);
  236.                     } catch (\InvalidArgumentException $e) {
  237.                         $objDetailPage \PageModel::findByPk$objArchive->jumpTo);
  238.                     }
  239.                 } elseif ($objPresetDetailPage){
  240.                     $objDetailPage $objPresetDetailPage;
  241.                 }
  242.                 $arrArchives[$objArchive->id] = array(
  243.                     'objArchive' => $objArchive,
  244.                     'objDetailPage' => $objDetailPage
  245.                 );
  246.             }
  247.         }
  248.         // Count Items
  249.         $intLimit $objItems->count();
  250.         if ($intLimit 1)
  251.         {
  252.             return array();
  253.         }
  254.         $intCount 0;
  255.         $arrItems = array();
  256.         // Get all Cateogries for class-names
  257.         $colCategories CategoryModel::findAll();
  258.         $arrAllCategories = array();
  259.         if($colCategories){
  260.             foreach($colCategories as $objCategory){
  261.                 $arrAllCategories[$objCategory->id] = ($objCategory->alias != '') ? $objCategory->alias $objCategory->id;
  262.             }
  263.         }
  264.         // Loop the Items and parse them
  265.         foreach ($objItems as $objItem)
  266.         {
  267.             $arrArchive $arrArchives[$objItem->pid];
  268.             // Filter by categories
  269.             $arrItemCategories false;
  270.             if(!is_null($objItem->categories)){
  271.                 $arrItemCategories unserialize($objItem->categories);
  272.             }
  273.             if(is_array($arrItemCategories) && is_array($arrCategories) && count($arrCategories) > 0){
  274.                 $bolCategory false;
  275.                 foreach($arrItemCategories as $arrReference){
  276.                     if($arrReference['category_id'] != '' && in_array($arrReference['category_id'], $arrCategories)){
  277.                         $bolCategory true;
  278.                     }
  279.                 }
  280.                 if(!$bolCategory){
  281.                     continue;
  282.                 }
  283.             }
  284.             $arrItems[] = $this->parseItem(
  285.                 $objItem,
  286.                 $arrArchive,
  287.                 $strDefaultLanguage,
  288.                 $bolAddDetailLinkToImage,
  289.                 ((++$intCount == 1) ? ' first' '') . (($intCount == $intLimit) ? ' last' '') . ((($intCount 2) == 0) ? ' odd' ' even'),
  290.                 $intCount,
  291.                 $arrAllCategories
  292.             );
  293.         }
  294.         return $arrItems;
  295.     }
  296.     public function parseItem($objItem$arrArchive=false$strDefaultLanguage=false$bolAddDetailLinkToImage=true$strClass=''$intCount=0$arrAllCategories)
  297.     {
  298.         // Get Default Language (if not set)
  299.         if (!$strDefaultLanguage)
  300.         {
  301.             $strDefaultLanguage \System::getContainer()->get('memo.foundation.language')->getDefaultLanguage();
  302.         }
  303.         // Get URL Generator
  304.         $urlGenerator \System::getContainer()->get('contao.routing.url_generator');
  305.         // Get Template
  306.         $objTemplate = new \FrontendTemplate($this->foundation_item_template);
  307.         // Translate Item to current language
  308.         if($GLOBALS['TL_LANGUAGE'] != $strDefaultLanguage)
  309.         {
  310.             $objItem->getTranslatedModel($GLOBALS['TL_LANGUAGE']);
  311.         }
  312.         if(method_exists($objItem'getFullTitle')) {
  313.             $objItem->title_full $objItem->getFullTitle();
  314.         }
  315.         // Generate categorie-classes
  316.         $arrItemCategories false;
  317.         if(!is_null($objItem->categories)){
  318.             $arrItemCategories unserialize($objItem->categories);
  319.         }
  320.         $strCategoryClasses '';
  321.         if(is_array($arrItemCategories) && count($arrItemCategories) > 0)
  322.         {
  323.             foreach($arrItemCategories as $arrCategoryReference)
  324.             {
  325.                 $intCategorID $arrCategoryReference['category_id'];
  326.                 if($intCategorID != ''){
  327.                     $strCategoryClasses .= ' category-' $arrAllCategories[$intCategorID];
  328.                 }
  329.             }
  330.         }
  331.         // Prepare Template
  332.         $objTemplate->setData($objItem->row());
  333.         $objTemplate->class .= $this->foundation_item_template $strClass $strCategoryClasses;
  334.         if(is_array($arrArchive))
  335.         {
  336.             $objTemplate->archive $arrArchive['objArchive'];
  337.         }
  338.         // Add link
  339.         if($arrArchive['objDetailPage'])
  340.         {
  341.             // Check if its an Archive or not
  342.             if(method_exists($objItem'getURL')) {
  343.                 $objTemplate->link $objItem->getURL();
  344.             } else {
  345.                 $objTemplate->link $urlGenerator->generate($arrArchive['objDetailPage']->alias '/{alias}',['alias' => $objItem->alias'auto_item' => 'alias']);
  346.             }
  347.         }
  348.         // Detect the image-fields
  349.         $arrFields $GLOBALS['TL_DCA'][$this->strItemTable]['fields'];
  350.         $objTemplate->imgSizeGallery $this->imgSizeGallery;
  351.         $objTemplate->imgSize $this->imgSize;
  352.         foreach($arrFields as $strFieldKey => $arrField)
  353.         {
  354.             // Detect the dca-fields with images
  355.             if (
  356.                 array_key_exists('inputType'$arrField)
  357.                 && $arrField['inputType'] == 'fileTree'
  358.                 && array_key_exists('eval'$arrField)
  359.                 && array_key_exists('extensions'$arrField['eval'])
  360.                 && preg_match('(jpg|png|svg|tif|webp)'$arrField['eval']['extensions']) === 1
  361.                 && array_key_exists('fieldType'$arrField['eval'])
  362.                 && $arrField['eval']['fieldType'] == 'radio'
  363.             )
  364.             {
  365.                 $strTemplateImageKey $strFieldKey '_image';
  366.                 $arrImage = (array) $this->parseImage($objItem->$strFieldKey$objItem$objTemplate$bolAddDetailLinkToImagefalse);
  367.                 if(isset($arrImage) && is_array($arrImage) && array_key_first($arrImage) !== false && array_key_exists($strFieldKey$arrImage) && file_exists($arrImage[$strFieldKey])){
  368.                     $objTemplate->$strTemplateImageKey $arrImage;
  369.                     $objTemplate->addImage true;
  370.                 }
  371.             }
  372.         }
  373.         // Detect the gallery-fields
  374.         $arrFields $GLOBALS['TL_DCA'][$this->strItemTable]['fields'];
  375.         foreach($arrFields as $strFieldKey => $arrField)
  376.         {
  377.             if (
  378.                 array_key_exists('inputType'$arrField)
  379.                 && $arrField['inputType'] == 'fileTree'
  380.                 && array_key_exists('eval'$arrField)
  381.                 && array_key_exists('extensions'$arrField['eval'])
  382.                 && preg_match('(jpg|png|svg|tif|webp)'$arrField['eval']['extensions']) === 1
  383.                 && array_key_exists('fieldType'$arrField['eval'])
  384.                 && $arrField['eval']['fieldType'] == 'checkbox'
  385.                 && is_string($objItem->$strFieldKey)
  386.             )
  387.             {
  388.                 $arrImageUids unserialize($objItem->$strFieldKey);
  389.                 if(is_array($arrImageUids))
  390.                 {
  391.                     $strTemplateImagesKey $strFieldKey '_images';
  392.                     unset($arrImages);
  393.                     $arrImages = array();
  394.                     foreach($arrImageUids as $strImageUuid)
  395.                     {
  396.                         $objFile \FilesModel::findByUuid($strImageUuid);
  397.                         if($objFile && $objFile->type == 'file' && file_exists($objFile->path))
  398.                         {
  399.                             $arrImages[]  = (array) $this->parseImage($strImageUuid$objItem$objTemplate$bolAddDetailLinkToImagetrue);
  400.                         }
  401.                         elseif($objFile && $objFile->type == 'folder')
  402.                         {
  403.                             $objSubfiles \FilesModel::findByPid($objFile->uuid, array('order' => 'name'));
  404.                             if ($objSubfiles === null)
  405.                             {
  406.                                 continue;
  407.                             }
  408.                             while ($objSubfiles->next())
  409.                             {
  410.                                 if ($objSubfiles->type == 'folder')
  411.                                 {
  412.                                     continue;
  413.                                 }
  414.                                 $objFile = new \Contao\File($objSubfiles->path);
  415.                                 if (!$objFile->isImage)
  416.                                 {
  417.                                     continue;
  418.                                 }
  419.                                 $arrImages[]  = (array) $this->parseImage($objSubfiles->uuid$objItem$objTemplate$bolAddDetailLinkToImagetrue);
  420.                             }
  421.                         }
  422.                     }
  423.                     $objTemplate->$strTemplateImagesKey $arrImages;
  424.                 }
  425.             }
  426.         }
  427.         // Enable a hook to be loaded here
  428.         if (isset($GLOBALS['TL_HOOKS']['parseFoundationTemplateItem']) && \is_array($GLOBALS['TL_HOOKS']['parseFoundationTemplateItem']))
  429.         {
  430.             foreach ($GLOBALS['TL_HOOKS']['parseFoundationTemplateItem'] as $callback)
  431.             {
  432.                 $this->import($callback[0]);
  433.                 $this->{$callback[0]}->{$callback[1]}($objTemplate$objItem->row(), $this);
  434.             }
  435.         }
  436.         // Return the parsed template
  437.         return $objTemplate->parse();
  438.     }
  439.     public function parseImage($strImageUuid$objItem$objTemplate$bolAddDetailLinkToImage$bolGallerySize=false)
  440.     {
  441.         // Add an image
  442.         if ( $strImageUuid != '' )
  443.         {
  444.             $objImage \FilesModel::findByUuid($strImageUuid);
  445.             if ($objImage !== null && is_file(\System::getContainer()->getParameter('kernel.project_dir') . '/' $objImage->path))
  446.             {
  447.                 // Prepare the Image-Item and Template
  448.                 $arrImageItem = array();
  449.                 $arrImageItem['singleSRC'] = $objImage->path;
  450.                 $objImageTemplate = new \stdClass();
  451.                 // Get Gallery-Image or Single-Image Size?
  452.                 $strImgSize false;
  453.                 if($bolGallerySize){
  454.                     $strImgSize $this->imgSizeGallery;
  455.                 } elseif($this->imgSize && (unserialize($this->imgSize)[0] != '' || unserialize($this->imgSize)[2] != '')) {
  456.                     $strImgSize $this->imgSize;
  457.                 } elseif($this->size && (unserialize($this->size)[0] != '' || unserialize($this->size)[2] != '')) {
  458.                     $strImgSize $this->size;
  459.                 }
  460.                 // Get Image Size
  461.                 if ($strImgSize)
  462.                 {
  463.                     $arrSize StringUtil::deserialize($strImgSize);
  464.                     if ($arrSize[0] > || $arrSize[1] > || is_numeric($arrSize[2]))
  465.                     {
  466.                         $arrImageItem['size'] = $strImgSize;
  467.                     } elseif (is_string($arrSize[2])) {
  468.                         $arrImageItem['size'] = $strImgSize;
  469.                     }
  470.                 }
  471.                 // Generate Image into ImageTemplate
  472.                 $this->addImageToTemplate($objImageTemplate$arrImageItemnullnull$objImage);
  473.                 // If there is no link defined in the Meta-Data, use the template-link (to the detail-page)
  474.                 if (!$objImageTemplate->fullsize && !$objImageTemplate->imageUrl && $bolAddDetailLinkToImage)
  475.                 {
  476.                     $picture $objImageTemplate->picture;
  477.                     $objImageTemplate->picture $picture;
  478.                     $objImageTemplate->href $objTemplate->link;
  479.                     $objImageTemplate->linkTitle \StringUtil::specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objItem->title), true);
  480.                     if (isset($objImageTemplate->source) && $objImageTemplate->source == 'external' && isset($objImageTemplate->target) && $objImageTemplate->target && (!isset($objImageTemplate->attributes) || strpos($objImageTemplate->attributes'target="_blank"') === false))
  481.                     {
  482.                         $objImageTemplate->attributes .= ' target="_blank"';
  483.                     }
  484.                 }
  485.                 return $objImageTemplate;
  486.             }
  487.         }
  488.         return false;
  489.     }
  490.     /**
  491.      * @param $strTable
  492.      * @return array
  493.      */
  494.     public function getFindByOptions($strTable)
  495.     {
  496.         $arrFindByOptions = [];
  497.         $arrFindByOptions['order'] = ToolboxService::convertOrderString($this->foundation_order$strTable);
  498.         return $arrFindByOptions;
  499.     }
  500.     /**
  501.      * get options for findBy Method of model
  502.      *
  503.      * @return array
  504.      */
  505.     public function parseBackendTemplate()
  506.     {
  507.         if ( $this->name )
  508.         {
  509.             $strTemplateName "## $this->name ##";
  510.         } elseif( $GLOBALS['TL_LANG']['CTE'][$this->type][0] ) {
  511.             $strTemplateName '<b>'.$GLOBALS['TL_LANG']['CTE'][$this->type][0] . "</b><br /><em>" $GLOBALS['TL_LANG']['CTE'][$this->type][1] . "</em>";
  512.         } else {
  513.             $strTemplateName "## $this->type ##";
  514.         }
  515.         $this->Template->items = array( $strTemplateName );
  516.     }
  517. }