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

  • 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:     /**
 26:      * Constructor to create an instance of this class.
 27:      */
 28:     public function __construct() {
 29:         global $cfg;
 30:         parent::__construct($cfg['tab']['nav_sub'], 'idnavs');
 31:         $this->_setItemClass('cApiNavSub');
 32: 
 33:         // set the join partners so that joins can be used via link() method
 34:         $this->_setJoinPartner('cApiNavMainCollection');
 35:         $this->_setJoinPartner('cApiAreaCollection');
 36:     }
 37: 
 38:     /**
 39:      * Create new item with given values.
 40:      *
 41:      * @param int $navm
 42:      * @param int|string $area
 43:      *         AreaId or area name
 44:      * @param int $level
 45:      * @param string $location
 46:      * @param int $online [optional]
 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 [optional]
 79:      * @param int $online [optional]
 80:      * @return array
 81:      *         List of assiziative arrays like
 82:      *         <pre>
 83:      *         $arr[] = array(
 84:      *             'location' => location xml path
 85:      *             'caption' => The tanslation of location from XML file
 86:      *             'name' => area name for sub navigation item
 87:      *             'menulesss' => Menuless state
 88:      *         );
 89:      *         </pre>
 90:      */
 91:     public function getSubnavigationsByAreaName($area, $level = 1, $online = 1) {
 92:         global $cfg;
 93: 
 94:         $level = (int) $level;
 95:         $online = (1 == $online) ? 1 : 0;
 96: 
 97:         $areasNsRs = array();
 98: 
 99:         $nav = new cGuiNavigation();
100: 
101:         $sql = "SELECT
102:                     ns.location AS location,
103:                     a.name AS name,
104:                     a.menuless AS menuless
105:                 FROM
106:                     " . $cfg['tab']['area'] . " AS a,
107:                     " . $this->table . " AS ns
108:                 WHERE
109:                     a.idarea = ns.idarea
110:                 AND
111:                     ns.level = " . $level . "
112:                 AND
113:                     ns.online = " . $online . "
114:                 AND (
115:                     a.parent_id = '" . $this->db->escape($area) . "'
116:                     OR
117:                     a.name = '" . $this->db->escape($area) . "'
118:                 )
119:                 ORDER BY
120:                     a.parent_id ASC,
121:                     ns.idnavs ASC";
122: 
123:         $this->db->query($sql);
124: 
125:         while ($this->db->nextRecord()) {
126:             $rs = $this->db->toArray();
127:             $rs['caption'] = $nav->getName($rs['location']);
128:             $areasNsRs[] = $rs;
129:         }
130: 
131:         return $areasNsRs;
132:     }
133: 
134: }
135: 
136: /**
137:  * NavMain item
138:  *
139:  * @package Core
140:  * @subpackage GenericDB_Model
141:  */
142: class cApiNavSub extends Item {
143: 
144:     /**
145:      * Constructor to create an instance of this class.
146:      *
147:      * @param mixed $mId [optional]
148:      *         Specifies the ID of item to load
149:      */
150:     public function __construct($mId = false) {
151:         global $cfg;
152:         parent::__construct($cfg['tab']['nav_sub'], 'idnavs');
153:         $this->setFilters(array(
154:             'addslashes'
155:         ), array(
156:             'stripslashes'
157:         ));
158:         if ($mId !== false) {
159:             $this->loadByPrimaryKey($mId);
160:         }
161:     }
162: 
163:     /**
164:      * Userdefined setter for navsub fields.
165:      *
166:      * @param string $name
167:      * @param mixed $value
168:      * @param bool $bSafe [optional]
169:      *         Flag to run defined inFilter on passed value
170:      * @return bool
171:      */
172:     public function setField($name, $value, $bSafe = true) {
173:         switch ($name) {
174:             case 'idarea':
175:             case 'idnavm':
176:             case 'level':
177:                 $value = (int) $value;
178:                 break;
179:             case 'online':
180:                 $value = (1 == $value) ? 1 : 0;
181:                 break;
182:         }
183: 
184:         return parent::setField($name, $value, $bSafe);
185:     }
186: 
187: }
188: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0