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
    • 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

  • cApiAction
  • cApiActionCollection
  • cApiActionlog
  • cApiActionlogCollection
  • cApiArea
  • cApiAreaCollection
  • cApiArticle
  • cApiArticleCollection
  • cApiArticleLanguage
  • cApiArticleLanguageCollection
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • 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
  • 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
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the language collection and item class.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       GenericDB_Model
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Bjoern Behrens
 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: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * Language collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiLanguageCollection extends ItemCollection {
 24: 
 25:     /**
 26:      * Constructor
 27:      */
 28:     public function __construct() {
 29:         global $cfg;
 30:         parent::__construct($cfg['tab']['lang'], 'idlang');
 31:         $this->_setItemClass('cApiLanguage');
 32:     }
 33: 
 34:     /**
 35:      * Creates a language entry.
 36:      *
 37:      * @global object $auth
 38:      * @param string $name
 39:      * @param int $active
 40:      * @param string $encoding
 41:      * @param string $direction
 42:      * @return cApiLanguage
 43:      */
 44:     public function create($name, $active, $encoding, $direction) {
 45:         global $auth;
 46: 
 47:         $item = parent::createNewItem();
 48: 
 49:         $item->set('name', $this->escape($name), false);
 50:         $item->set('active', (int) $active, false);
 51:         $item->set('encoding', $this->escape($encoding), false);
 52:         $item->set('direction', $this->escape($direction), false);
 53:         $item->set('author', $this->escape($auth->auth['uid']), false);
 54:         $item->set('created', date('Y-m-d H:i:s'), false);
 55:         $item->set('lastmodified', '0000-00-00 00:00:00', false);
 56:         $item->store();
 57: 
 58:         return $item;
 59:     }
 60: 
 61:     /**
 62:      * Returns next accessible language for current client and current logged in
 63:      * user.
 64:      *
 65:      * @global object $perm
 66:      * @global array $cfg
 67:      * @global int $client
 68:      * @global int $lang
 69:      *
 70:      * @return cApiLanguage|NULL
 71:      */
 72:     public function nextAccessible() {
 73:         global $perm, $client, $lang;
 74: 
 75:         $item = parent::next();
 76: 
 77:         $lang = (int) $lang;
 78:         $client = (int) $client;
 79: 
 80:         $clientsLanguageColl = new cApiClientLanguageCollection();
 81:         $clientsLanguageColl->select('idlang = ' . $lang);
 82:         if (($clientsLang = $clientsLanguageColl->next()) !== false) {
 83:             if ($client != $clientsLang->get('idclient')) {
 84:                 $item = $this->nextAccessible();
 85:             }
 86:         }
 87: 
 88:         if ($item) {
 89:             if ($perm->have_perm_client('lang[' . $item->get('idlang') . ']') || $perm->have_perm_client('admin[' . $client . ']') || $perm->have_perm_client()) {
 90:                 // Do nothing for now
 91:             } else {
 92:                 $item = $this->nextAccessible();
 93:             }
 94: 
 95:             return $item;
 96:         } else {
 97:             return false;
 98:         }
 99:     }
100: 
101:     /**
102:      * Returns the language name of the language with the given ID.
103:      *
104:      * @param int $idlang the ID of the language
105:      * @return string the name of the language
106:      */
107:     public function getLanguageName($idlang) {
108:         $item = new cApiLanguage($idlang);
109:         if ($item->isLoaded()) {
110:             return $item->get('name');
111:         } else {
112:             return i18n('No language');
113:         }
114:     }
115: 
116: }
117: 
118: /**
119:  * Language item
120:  *
121:  * @package Core
122:  * @subpackage GenericDB_Model
123:  */
124: class cApiLanguage extends Item {
125: 
126:     /**
127:      * Constructor Function
128:      *
129:      * @param mixed $mId Specifies the ID of item to load
130:      */
131:     public function __construct($mId = false) {
132:         global $cfg;
133:         parent::__construct($cfg['tab']['lang'], 'idlang');
134:         if ($mId !== false) {
135:             $this->loadByPrimaryKey($mId);
136:         }
137:     }
138: 
139:     /**
140:      * Stores made changes.
141:      *
142:      * @return bool
143:      */
144:     public function store() {
145:         $this->set('lastmodified', date('Y-m-d H:i:s'), false);
146:         return parent::store();
147:     }
148: 
149: }
150: 
CMS CONTENIDO 4.9.4 API documentation generated by ApiGen 2.8.0