Esempio n. 1
0
 /**
  * Get the content of the template for the specified page and visualization mode.
  * Doesn't translates the atm-linx tags.
  *
  * @param CMS_language $language The language of the administration frontend (for FORM visualization mode)
  * @param CMS_page $page The page we want the content of
  * @param integer $visualizationMode The visualization mode of the page
  * @return string the content
  * @access private
  */
 function getContent(&$language, &$page, $visualizationMode)
 {
     if (!$page instanceof CMS_page || !SensitiveIO::isInSet($visualizationMode, CMS_page::getAllvisualizationModes())) {
         $this->raiseError("Page must be a CMS_page and visualization mode in the possibles");
         return false;
     }
     $returnIndexableContent = false;
     if ($visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE) {
         $visualizationMode = PAGE_VISUALMODE_PRINT;
         $returnIndexableContent = true;
     }
     $modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_CLIENTSPACE_TAGS, $visualizationMode, $this);
     $modulesTreatment->setTreatmentParameters(array("page" => $page, "language" => $language));
     if ($this->_parseDefinitionFile($modulesTreatment) === true) {
         if ($visualizationMode == PAGE_VISUALMODE_PRINT || $returnIndexableContent) {
             $data = '';
             $tags = $modulesTreatment->getTags(array(), true);
             foreach ($tags as $tag) {
                 $data .= $modulesTreatment->treatWantedTag($tag);
             }
         } else {
             $data = $modulesTreatment->treatContent(true);
         }
         //if we only need indexable content, return data here without any treatment on template
         if ($returnIndexableContent) {
             return '<html><body>' . $data . '</body></html>';
         }
         //separate processing for PRINT visualmode
         if ($visualizationMode == PAGE_VISUALMODE_PRINT) {
             //now put the data inside the template
             $template_data = file_get_contents(PATH_PRINT_TEMPLATES_FS);
             //we need to remove doctype if any
             $template_data = preg_replace('#<!doctype[^>]*>#siU', '', $template_data);
             return '<?php /* Template [' . str_replace(PATH_TEMPLATES_FS . '/', '', PATH_PRINT_TEMPLATES_FS) . '] */?>' . str_replace("{{data}}", $data, $template_data);
         } else {
             return '<?php /* Template [' . $this->getLabel() . ' - ' . $this->getDefinitionFile() . '] */?>' . $data;
         }
         return false;
     } else {
         return false;
     }
 }