Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • 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

  • cZipArchive
  • SearchResultModule

Exceptions

  • SolrException
  • SolrWarning

Functions

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