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 the nav sub collection and item class.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       GenericDB_Model
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Frederic Schneider
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * File collection
 20:  *
 21:  * @package Core
 22:  * @subpackage GenericDB_Model
 23:  */
 24: class cApiNavSubCollection extends ItemCollection {
 25: 
 26:     /**
 27:      * Constructor
 28:      */
 29:     public function __construct() {
 30:         global $cfg;
 31:         parent::__construct($cfg['tab']['nav_sub'], 'idnavs');
 32:         $this->_setItemClass('cApiNavSub');
 33: 
 34:         // set the join partners so that joins can be used via link() method
 35:         $this->_setJoinPartner('cApiNavMainCollection');
 36:         $this->_setJoinPartner('cApiAreaCollection');
 37:     }
 38: 
 39:     /**
 40:      * Create new item with given values.
 41:      *
 42:      * @param int $navm
 43:      * @param int|string  $area  Aread id or area name
 44:      * @param int $level
 45:      * @param string $location
 46:      * @param int $online
 47:      * @return cApiNavSub
 48:      */
 49:     public function create($navm, $area, $level, $location, $online = 1) {
 50:         $item = $this->createNewItem();
 51: 
 52:         if (is_string($area)) {
 53:             $c = new cApiArea();
 54:             $c->loadBy('name', $area);
 55: 
 56:             if ($c->isLoaded()) {
 57:                 $area = $c->get('idarea');
 58:             } else {
 59:                 $area = 0;
 60:                 cWarning(__FILE__, __LINE__, "Could not resolve area [$area] passed to method [create], assuming 0");
 61:             }
 62:         }
 63: 
 64:         $item->set('idnavm', $navm);
 65:         $item->set('idarea', $area);
 66:         $item->set('level', $level);
 67:         $item->set('location', $location);
 68:         $item->set('online', $online);
 69: 
 70:         $item->store();
 71: 
 72:         return $item;
 73:     }
 74: 
 75:     /**
 76:      * Returns sub navigation by area name
 77:      * @param  string  $area
 78:      * @param  int  $level
 79:      * @param  int  $online
 80:      * @return  array  List of assiziative arrays like
 81:      * <pre>
 82:      *  $arr[] = array(
 83:      *      'location' => location xml path
 84:      *      'caption' => The tanslation of location from XML file
 85:      *      'name' => area name for sub navigation item
 86:      *      'menulesss' => Menuless state
 87:      *  );
 88:      * </pre>
 89:      */
 90:     public function getSubnavigationsByAreaName($area, $level = 1, $online = 1) {
 91:         global $cfg;
 92: 
 93:         $level = (int) $level;
 94:         $online = (1 == $online) ? 1 : 0;
 95: 
 96:         $areasNsRs = array();
 97: 
 98:         $nav = new cGuiNavigation();
 99: 
100:         $sql = "SELECT
101:                     ns.location AS location,
102:                     a.name AS name,
103:                     a.menuless AS menuless
104:                 FROM
105:                     " . $cfg['tab']['area'] . " AS a,
106:                     " . $this->table . " AS ns
107:                 WHERE
108:                     a.idarea = ns.idarea
109:                 AND
110:                     ns.level = " . $level . "
111:                 AND
112:                     ns.online = " . $online . "
113:                 AND (
114:                     a.parent_id = '" . $this->db->escape($area) . "'
115:                     OR
116:                     a.name = '" . $this->db->escape($area) . "'
117:                 )
118:                 ORDER BY
119:                     a.parent_id ASC,
120:                     ns.idnavs ASC";
121: 
122:         $this->db->query($sql);
123: 
124:         while ($this->db->nextRecord()) {
125:             $rs = $this->db->toArray();
126:             $rs['caption'] = $nav->getName($rs['location']);
127:             $areasNsRs[] = $rs;
128:         }
129: 
130:         return $areasNsRs;
131:     }
132: 
133: }
134: 
135: /**
136:  * NavMain item
137:  *
138:  * @package Core
139:  * @subpackage GenericDB_Model
140:  */
141: class cApiNavSub extends Item {
142: 
143:     /**
144:      * Constructor Function
145:      *
146:      * @param mixed $mId Specifies the ID of item to load
147:      */
148:     public function __construct($mId = false) {
149:         global $cfg;
150:         parent::__construct($cfg['tab']['nav_sub'], 'idnavs');
151:         $this->setFilters(array(
152:             'addslashes'
153:         ), array(
154:             'stripslashes'
155:         ));
156:         if ($mId !== false) {
157:             $this->loadByPrimaryKey($mId);
158:         }
159:     }
160: 
161:     /**
162:      * Userdefined setter for navsub fields.
163:      *
164:      * @param string $name
165:      * @param mixed $value
166:      * @param bool $bSafe Flag to run defined inFilter on passed value
167:      */
168:     public function setField($name, $value, $bSafe = true) {
169:         switch ($name) {
170:             case 'idarea':
171:             case 'idnavm':
172:             case 'level':
173:                 $value = (int) $value;
174:                 break;
175:             case 'online':
176:                 $value = (1 == $value) ? 1 : 0;
177:                 break;
178:         }
179: 
180:         return parent::setField($name, $value, $bSafe);
181:     }
182: 
183: }
184: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen