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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
 1: <?php
 2: /**
 3:  * This file contains CONTENIDO Category API functions.
 4:  *
 5:  * If you are planning to add a function, please make sure that:
 6:  * 1.) The function is in the correct place
 7:  * 2.) The function is documented
 8:  * 3.) The function makes sense and is generically usable
 9:  *
10:  * @package          Core
11:  * @subpackage       Backend
12:  * @version          SVN Revision $Rev:$
13:  *
14:  * @author           Timo Hummel
15:  * @copyright        four for business AG <www.4fb.de>
16:  * @license          http://www.contenido.org/license/LIZENZ.txt
17:  * @link             http://www.4fb.de
18:  * @link             http://www.contenido.org
19:  */
20: 
21: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
22: 
23: /**
24:  * Seeks through the category tree and returns the node on a specific level.
25:  *
26:  * Example:
27:  * + Category A (15)
28:  * |-+ News (16)
29:  * | |- News A (17)
30:  * + Category B (18)
31:  * |-+ Internal (19)
32:  *
33:  * Given you are in the leaf "News A" (idcat 17), and you want to get out in which
34:  * "main" tree you are, you can call the function like this:
35:  *
36:  * cApiCatGetLevelNode(17,1);
37:  *
38:  * The example would return "Category A" (idcat 15). If you specify an invalid level,
39:  * the results are undefined.
40:  *
41:  * @param  int  $idcat     The category number
42:  * @param  int  $minLevel  The level to extract
43:  * @return int  The category node on a specific level
44:  */
45: function cApiCatGetLevelNode($idcat, $minLevel = 0) {
46:     global $cfg, $client, $lang;
47: 
48:     $db = cRegistry::getDb();
49: 
50:     $sql = "SELECT
51:                 a.name AS name,
52:                 a.idcat AS idcat,
53:                 b.parentid AS parentid,
54:                 c.level AS level
55:             FROM
56:                 " . $cfg['tab']['cat_lang'] . " AS a,
57:                 " . $cfg['tab']['cat'] . " AS b,
58:                 " . $cfg['tab']['cat_tree'] . " AS c
59:             WHERE
60:                 a.idlang   = " . (int) $lang . " AND
61:                 b.idclient = " . (int) $client . " AND
62:                 b.idcat    = " . (int) $idcat . " AND
63:                 c.idcat    = b.idcat AND
64:                 a.idcat    = b.idcat";
65: 
66:     $db->query($sql);
67:     $db->nextRecord();
68: 
69:     $parentid = $db->f('parentid');
70:     $thislevel = $db->f('level');
71: 
72:     if ($parentid != 0 && $thislevel >= $minLevel) {
73:         return cApiCatGetLevelNode($parentid, $minLevel);
74:     } else {
75:         return $idcat;
76:     }
77: }
78: 
79: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen