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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cApiAction
  • cApiActionCollection
  • cApiActionlog
  • cApiActionlogCollection
  • cApiArea
  • cApiAreaCollection
  • cApiArticle
  • cApiArticleCollection
  • cApiArticleLanguage
  • cApiArticleLanguageCollection
  • cApiArticleLanguageVersion
  • cApiArticleLanguageVersionCollection
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • cApiContentVersion
  • cApiContentVersionCollection
  • cApiDbfs
  • cApiDbfsCollection
  • cApiFile
  • cApiFileCollection
  • cApiFileInformation
  • cApiFileInformationCollection
  • cApiFrameFile
  • cApiFrameFileCollection
  • cApiFrontendGroup
  • cApiFrontendGroupCollection
  • cApiFrontendGroupMember
  • cApiFrontendGroupMemberCollection
  • cApiFrontendPermission
  • cApiFrontendPermissionCollection
  • cApiFrontendUser
  • cApiFrontendUserCollection
  • cApiGroup
  • cApiGroupCollection
  • cApiGroupMember
  • cApiGroupMemberCollection
  • cApiGroupProperty
  • cApiGroupPropertyCollection
  • cApiInUse
  • cApiInUseCollection
  • cApiIso3166
  • cApiIso3166Collection
  • cApiIso6392
  • cApiIso6392Collection
  • cApiKeyword
  • cApiKeywordCollection
  • cApiLanguage
  • cApiLanguageCollection
  • cApiLayout
  • cApiLayoutCollection
  • cApiMailLog
  • cApiMailLogCollection
  • cApiMailLogSuccess
  • cApiMailLogSuccessCollection
  • cApiMetaTag
  • cApiMetaTagCollection
  • cApiMetaTagVersion
  • cApiMetaTagVersionCollection
  • cApiMetaType
  • cApiMetaTypeCollection
  • cApiModule
  • cApiModuleCollection
  • cApiNavMain
  • cApiNavMainCollection
  • cApiNavSub
  • cApiNavSubCollection
  • cApiOnlineUser
  • cApiOnlineUserCollection
  • cApiPathresolveCache
  • cApiPathresolveCacheCollection
  • cApiProperty
  • cApiPropertyCollection
  • cApiRight
  • cApiRightCollection
  • cApiSearchTracking
  • cApiSearchTrackingCollection
  • cApiStat
  • cApiStatCollection
  • cApiSystemProperty
  • cApiSystemPropertyCollection
  • cApiTemplate
  • cApiTemplateCollection
  • cApiTemplateConfiguration
  • cApiTemplateConfigurationCollection
  • cApiType
  • cApiTypeCollection
  • cApiUpload
  • cApiUploadCollection
  • cApiUploadMeta
  • cApiUploadMetaCollection
  • cApiUser
  • cApiUserCollection
  • cApiUserPasswordRequest
  • cApiUserPasswordRequestCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the nav sub collection and item class.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       GenericDB_Model
  8:  * @author           Frederic Schneider
  9:  * @copyright        four for business AG <www.4fb.de>
 10:  * @license          http://www.contenido.org/license/LIZENZ.txt
 11:  * @link             http://www.4fb.de
 12:  * @link             http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * File collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiNavSubCollection extends ItemCollection {
 24:     /**
 25:      * Constructor to create an instance of this class.
 26:      *
 27:      * @throws cInvalidArgumentException
 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
 44:      *                           AreaId or area name
 45:      * @param int        $level
 46:      * @param string     $location
 47:      * @param int        $online [optional]
 48:      *
 49:      * @return cApiNavSub
 50:      * 
 51:      * @throws cDbException
 52:      * @throws cException
 53:      * @throws cInvalidArgumentException
 54:      */
 55:     public function create($navm, $area, $level, $location, $online = 1) {
 56:         $item = $this->createNewItem();
 57: 
 58:         if (is_string($area)) {
 59:             $c = new cApiArea();
 60:             $c->loadBy('name', $area);
 61: 
 62:             if ($c->isLoaded()) {
 63:                 $area = $c->get('idarea');
 64:             } else {
 65:                 $area = 0;
 66:                 cWarning(__FILE__, __LINE__, "Could not resolve area [$area] passed to method [create], assuming 0");
 67:             }
 68:         }
 69: 
 70:         $item->set('idnavm', $navm);
 71:         $item->set('idarea', $area);
 72:         $item->set('level', $level);
 73:         $item->set('location', $location);
 74:         $item->set('online', $online);
 75: 
 76:         $item->store();
 77: 
 78:         return $item;
 79:     }
 80: 
 81:     /**
 82:      * Returns sub navigation by area name
 83:      * @param string $area
 84:      * @param int    $level  [optional]
 85:      * @param int    $online [optional]
 86:      * @return array
 87:      *                       List of assiziative arrays like
 88:      *                       <pre>
 89:      *                       $arr[] = array(
 90:      *                       'location' => location xml path
 91:      *                       'caption' => The tanslation of location from XML file
 92:      *                       'name' => area name for sub navigation item
 93:      *                       'menulesss' => Menuless state
 94:      *                       );
 95:      *                       </pre>
 96:      * @throws cDbException
 97:      * @throws cException
 98:      */
 99:     public function getSubnavigationsByAreaName($area, $level = 1, $online = 1) {
100:         global $cfg;
101: 
102:         $level = (int) $level;
103:         $online = (1 == $online) ? 1 : 0;
104: 
105:         $areasNsRs = array();
106: 
107:         $nav = new cGuiNavigation();
108: 
109:         $sql = "SELECT
110:                     ns.location AS location,
111:                     a.name AS name,
112:                     a.menuless AS menuless
113:                 FROM
114:                     " . $cfg['tab']['area'] . " AS a,
115:                     " . $this->table . " AS ns
116:                 WHERE
117:                     a.idarea = ns.idarea
118:                 AND
119:                     ns.level = " . $level . "
120:                 AND
121:                     ns.online = " . $online . "
122:                 AND (
123:                     a.parent_id = '" . $this->db->escape($area) . "'
124:                     OR
125:                     a.name = '" . $this->db->escape($area) . "'
126:                 )
127:                 ORDER BY
128:                     a.parent_id ASC,
129:                     ns.idnavs ASC";
130: 
131:         $this->db->query($sql);
132: 
133:         while ($this->db->nextRecord()) {
134:             $rs = $this->db->toArray();
135:             $rs['caption'] = $nav->getName($rs['location']);
136:             $areasNsRs[] = $rs;
137:         }
138: 
139:         return $areasNsRs;
140:     }
141: 
142: }
143: 
144: /**
145:  * NavMain item
146:  *
147:  * @package Core
148:  * @subpackage GenericDB_Model
149:  */
150: class cApiNavSub extends Item {
151:     /**
152:      * Constructor to create an instance of this class.
153:      *
154:      * @param mixed $mId [optional]
155:      *                   Specifies the ID of item to load
156:      *
157:      * @throws cDbException
158:      * @throws cException
159:      */
160:     public function __construct($mId = false) {
161:         global $cfg;
162:         parent::__construct($cfg['tab']['nav_sub'], 'idnavs');
163:         $this->setFilters(array(
164:             'addslashes'
165:         ), array(
166:             'stripslashes'
167:         ));
168:         if ($mId !== false) {
169:             $this->loadByPrimaryKey($mId);
170:         }
171:     }
172: 
173:     /**
174:      * Userdefined setter for navsub fields.
175:      *
176:      * @param string $name
177:      * @param mixed $value
178:      * @param bool $bSafe [optional]
179:      *         Flag to run defined inFilter on passed value
180:      * @return bool
181:      */
182:     public function setField($name, $value, $bSafe = true) {
183:         switch ($name) {
184:             case 'idarea':
185:             case 'idnavm':
186:             case 'level':
187:                 $value = (int) $value;
188:                 break;
189:             case 'online':
190:                 $value = (1 == $value) ? 1 : 0;
191:                 break;
192:         }
193: 
194:         return parent::setField($name, $value, $bSafe);
195:     }
196: 
197: }
198: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0