예제 #1
0
 /**
  * @desc Exports a Sitemap. You will be able to use the following variables into the templates used to export:
  * <ul>
  * 	<li>C_SITE_MAP which is a condition indicating if it's a site map (useful if you want to use a sigle template
  * for the whole export configuration)</li>
  * 	<li>SITE_NAME which contains the name of the site</li>
  * 	<li>A loop "element" in which the code of each element is in the variable CODE</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template The exported code of the Sitemap
  */
 public function export(SitemapExportConfig $export_config)
 {
     //We get the stream in which we are going to write
     $template = $export_config->get_site_map_stream();
     $template->put_all(array('C_SITE_MAP' => true, 'SITE_NAME' => TextHelper::htmlspecialchars($this->site_name, ENT_QUOTES)));
     //Let's export all the element it contains
     foreach ($this->elements as $element) {
         $template->assign_block_vars('element', array(), array('ELEMENT' => $element->export($export_config)));
     }
     return $template;
 }
예제 #2
0
 /**
  * @desc Exports the section according to the given configuration. You will use the following template variables:
  * <ul>
  * 	<li>SECTION_NAME which contains the name of the section</li>
  * 	<li>SECTION_URL which contains the URL of the link associated to the section</li>
  * 	<li>DEPTH which contains the depth of the section in the site map tree (useful for CSS classes names)</li>
  * 	<li>LINK_CODE which contains the code got by the associated link export</li>
  * 	<li>C_SECTION, boolean meaning that it's a section (useful if you want to use a sigle template for the whole export configuration)</li>
  * 	<li>A loop "element" containing evert element of the section (their code is available in the CODE variable of the loop)</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template the exported section
  */
 public function export(SitemapExportConfig $export_config)
 {
     //We get the stream in which we are going to write
     $template = $export_config->get_section_stream();
     $template->put_all(array('SECTION_NAME' => TextHelper::htmlspecialchars($this->get_name(), ENT_QUOTES), 'SECTION_URL' => !empty($this->link) ? $this->link->get_url() : '', 'DEPTH' => $this->depth, 'C_SECTION' => true));
     if ($this->link != null) {
         $template->put('LINK', $this->link->export($export_config));
     }
     foreach ($this->elements as $element) {
         $template->assign_block_vars('element', array(), array('ELEMENT' => $element->export($export_config)));
     }
     return $template;
 }
예제 #3
0
 /**
  * @desc Exports the section according to the given configuration. You will use the following template variables:
  * <ul>
  * 	<li>LOC containing the URL of the link</li>
  * 	<li>TEXT containing the name of the target page</li>
  * 	<li>C_DISPLAY_DATE indicating if the date is not empty</li>
  * 	<li>DATE containing the date of the last modification of the target page, formatted for the sitemap.xml file</li>
  * 	<li>ACTUALIZATION_FREQUENCY corresponding to the code needed in the sitemap.xml file</li>
  * 	<li>PRIORITY corresponding to the code needed in the sitemap.xml file to indicate the priority of the target page.</li>
  * 	<li>C_LINK indicating that we are displaying a link (useful if you want to use a signe template export configuration)</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template the exported link
  */
 public function export(SitemapExportConfig $export_config)
 {
     $display_date = $this->last_modification_date !== null;
     //We get the stream in which we are going to write
     $template = $export_config->get_link_stream();
     $template->put_all(array('LOC' => $this->get_url(), 'TEXT' => TextHelper::htmlspecialchars($this->name, ENT_QUOTES), 'C_DISPLAY_DATE' => $display_date, 'DATE' => $display_date ? $this->last_modification_date->to_date() : '', 'ACTUALIZATION_FREQUENCY' => $this->change_freq, 'PRIORITY' => $this->priority, 'C_LINK' => true));
     return $template;
 }
예제 #4
0
 /**
  * @desc Exports the sitemap (according to a configuration of templates).
  * In your template, you will be able to use the following variables:
  * <ul>
  * 	<li>MODULE_ID which contains the id of the module</li>
  *  <li>C_MODULE_ID tells whether the module identifier is known</li>
  * 	<li>MODULE_NAME which contains the name of the module</li>
  *  <li>MODULE_DESCRIPTION which contains the description of the module</li>
  *  <li>MODULE_URL which contains the URL of the module root page</li>
  *  <li>DEPTH which is the depth of the module map in the sitemap (generally 1).
  *  It might be usefull to apply different CSS styles to each level of depth.</li>
  *  <li>LINK_CODE which contains the code of the link associated to the module root exported with the same configuration.</li>
  *  <li>C_MODULE_MAP which is a boolean whose value is true, this will enable you to use a single template for the whole export configuration</li>
  *  <li>The loop "element" for which the variable CODE contains the code of each sub element of the module (for example categories)</li>
  *  </ul>
  * @param SitemapExportConfig $export_config export configuration
  * @return Template the template
  */
 public function export(SitemapExportConfig $export_config)
 {
     //We get the stream in which we are going to write
     $template = $export_config->get_module_map_stream();
     $template->put_all(array('MODULE_ID' => $this->get_module_id(), 'C_MODULE_ID' => $this->get_module_id() != '', 'MODULE_NAME' => TextHelper::htmlspecialchars($this->get_name(), ENT_QUOTES), 'MODULE_DESCRIPTION' => FormatingHelper::second_parse($this->description), 'MODULE_URL' => !empty($this->link) ? $this->link->get_url() : '', 'DEPTH' => $this->depth, 'C_MODULE_MAP' => true));
     if ($this->link != null) {
         $template->put('LINK', $this->link->export($export_config));
     }
     //We export all the elements contained by the module map
     foreach ($this->elements as $element) {
         $template->assign_block_vars('element', array(), array('ELEMENT' => $element->export($export_config)));
     }
     return $template;
 }