Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • idna_convert
  • SearchResultModule
  • TinyMCE_Compressor

Exceptions

  • SolrWarning

Functions

  • buildCategoryArray
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: ?><?php
  2: 
  3: /**
  4:  *
  5:  * @package Module
  6:  * @subpackage ContentSitemapXml
  7:  * @author simon.sprankel@4fb.de
  8:  * @author marcus.gnass@4fb.de
  9:  * @copyright four for business AG
 10:  * @link http://www.4fb.de
 11:  */
 12: 
 13: $db = cRegistry::getDb();
 14: $cfg = cRegistry::getConfig();
 15: $client = cRegistry::getClientId();
 16: 
 17: $selected = "CMS_VALUE[1]";
 18: $filename = "CMS_VALUE[2]";
 19: $selectName = "CMS_VAR[1]";
 20: 
 21: // if nothing is selected, select the root category
 22: if ($selected == '') {
 23:     $query = 'SELECT * FROM ' . $cfg['tab']['cat_tree'] . ' AS a, ' . $cfg['tab']['cat'] . ' AS b WHERE (a.idcat) AND (b.idcat) AND (b.idclient = ' . $client . ') ORDER BY a.idtree';
 24:     $db->query($query);
 25:     $db->nextRecord();
 26:     $selected = $db->f('idcat');
 27: }
 28: 
 29: $categories = buildCategoryArray();
 30: // construct the HTML
 31: $table = new cHTMLTable();
 32: $trs = array();
 33: 
 34: // construct the category select HTML
 35: $tr = new cHTMLTableRow();
 36: $tds = array();
 37: $td = new cHTMLTableData();
 38: $td->setContent(conHtmlSpecialChars(mi18n("Choose tree:")));
 39: $tds[] = $td;
 40: $td = new cHTMLTableData();
 41: //$select = new cHTMLInputSelectElement($selectName);
 42: $select = new cHTMLSelectElement($selectName);
 43: 
 44: foreach ($categories as $key => $value) {
 45:     $option = new cHTMLOptionElement($value['name_indented'], $value['idcat']);
 46:     if ($selected == $value['idcat']) {
 47:         $option->setSelected(true);
 48:     }
 49:     $select->appendOptionElement($option);
 50: }
 51: $td->setContent($select);
 52: $tds[] = $td;
 53: $tr->setContent($tds);
 54: $trs[] = $tr;
 55: 
 56: // construct the filename input HTML
 57: $tr = new cHTMLTableRow();
 58: $tds = array();
 59: $td = new cHTMLTableData();
 60: $td->setContent(conHtmlSpecialChars(mi18n("Enter filename (optional):")));
 61: $tds[] = $td;
 62: $td = new cHTMLTableData();
 63: $input = new cHTMLTextbox("CMS_VAR[2]", $filename, 20);
 64: // show error message if filename contains slashes or backslashes
 65: $td->setContent($input);
 66: $tds[] = $td;
 67: $tr->setContent($tds);
 68: $trs[] = $tr;
 69: 
 70: $table->setContent($trs);
 71: 
 72: // echo the whole HTML
 73: echo $table->render();
 74: 
 75: /**
 76:  * Builds an array with category information.
 77:  * Each entry has the following keys:
 78:  * idcat, level, name, name_indented
 79:  *
 80:  * @return array with category information
 81:  */
 82: function buildCategoryArray() {
 83:     $cfg = cRegistry::getConfig();
 84:     $lang = cRegistry::getLanguageId();
 85:     $db = cRegistry::getDb();
 86: 
 87:     $query = 'SELECT * FROM ' . $cfg['tab']['cat_lang'] . ' AS a, ' . $cfg['tab']['cat_tree'] . ' as b WHERE (a.idcat = b.idcat) AND (a.visible = 1) AND (a.public = 1) AND (a.idlang = ' . $lang . ') ORDER BY b.idtree';
 88:     $db->query($query);
 89: 
 90:     $categories = array();
 91:     while ($db->nextRecord()) {
 92:         $category = array();
 93:         $category['idcat'] = $db->f('idcat');
 94:         $category['level'] = $db->f('level');
 95: 
 96:         $prefix = '';
 97:         for ($i = 0; $i < $db->f('level'); $i++) {
 98:             $prefix .= '-->';
 99:         }
100: 
101:         $category['name'] = $db->f('name');
102:         $category['name_indented'] = $prefix . $db->f('name');
103: 
104:         $categories[] = $category;
105:     }
106: 
107:     return $categories;
108: }
109: 
110: ?><?php
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0