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

  • cCodeGeneratorAbstract
  • cCodeGeneratorFactory
  • cCodeGeneratorStandard
  • cContentTypeAbstract
  • cContentTypeAbstractTabbed
  • cContentTypeDate
  • cContentTypeFilelist
  • cContentTypeHead
  • cContentTypeHtml
  • cContentTypeHtmlhead
  • cContentTypeImg
  • cContentTypeImgdescr
  • cContentTypeImgeditor
  • cContentTypeLink
  • cContentTypeLinkdescr
  • cContentTypeLinkeditor
  • cContentTypeLinktarget
  • cContentTypeRaw
  • cContentTypeTeaser
  • cContentTypeText
  • cTypeGenerator
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
   1: <?php
   2: 
   3: /**
   4:  * This file contains the cContentTypeTeaser class.
   5:  *
   6:  * @package Core
   7:  * @subpackage ContentType
   8:  * @author Timo Trautmann
   9:  * @author Simon Sprankel
  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: cInclude('includes', 'functions.con.php');
  19: cInclude('includes', 'functions.api.images.php');
  20: 
  21: /**
  22:  * Content type CMS_TEASER which lets the editor select articles in various ways
  23:  * which are displayed as teasers.
  24:  *
  25:  * @package Core
  26:  * @subpackage ContentType
  27:  */
  28: class cContentTypeTeaser extends cContentTypeAbstractTabbed {
  29: 
  30:     /**
  31:      * Array which contains all avariable CMS_Types and its IDs in current
  32:      * CONTENIDO installation (described as hash [idtype => cmstypename]).
  33:      *
  34:      * @var array
  35:      */
  36:     private $_cmsTypes;
  37: 
  38:     /**
  39:      * Content types in this array will be completely ignored by CMS_TEASER.
  40:      *
  41:      * They won't be displayed in the frontend and they won't be shown as an
  42:      * option in the backend.
  43:      *
  44:      * @var array
  45:      */
  46:     private $_ignoreTypes = array();
  47: 
  48:     /**
  49:      * If CMS_TEASER tries to load one of the content types listed as the keys
  50:      * of this array it will load the value of that key instead.
  51:      *
  52:      * These won't be listed as an option in the backend either.
  53:      *
  54:      * @var array
  55:      */
  56:     private $_forwardTypes = array(
  57:         "CMS_EASYIMG" => "CMS_IMGEDITOR",
  58:         "CMS_IMG" => "CMS_IMGEDITOR",
  59:         "CMS_LINK" => "CMS_LINKEDITOR"
  60:     );
  61: 
  62:     /**
  63:      * Placeholders for labels in frontend.
  64:      *
  65:      * Important: This must be a static array!
  66:      *
  67:      * @var array
  68:      */
  69:     protected static $_translations = array(
  70:         "MORE"
  71:     );
  72: 
  73:     /**
  74:      * Variable for detecting current interation.
  75:      *
  76:      * @var int
  77:      */
  78:     protected $iteration = 0;
  79: 
  80:     /**
  81:      * Constructor to create an instance of this class.
  82:      *
  83:      * Initialises class attributes and handles store events.
  84:      *
  85:      * @param string $rawSettings
  86:      *         the raw settings in an XML structure or as plaintext
  87:      * @param int $id
  88:      *         ID of the content type, e.g. 3 if CMS_DATE[3] is used
  89:      * @param array $contentTypes
  90:      *         array containing the values of all content types
  91:      */
  92:     public function __construct($rawSettings, $id, array $contentTypes) {
  93: 
  94:         // set props
  95:         $this->_type = 'CMS_TEASER';
  96:         $this->_prefix = 'teaser';
  97:         $this->_settingsType = self::SETTINGS_TYPE_XML;
  98:         $this->_formFields = array(
  99:             'teaser_title',
 100:             'teaser_category',
 101:             'teaser_count',
 102:             'teaser_style',
 103:             'teaser_manual',
 104:             'teaser_start',
 105:             'teaser_source_head',
 106:             'teaser_source_head_count',
 107:             'teaser_source_text',
 108:             'teaser_source_text_count',
 109:             'teaser_source_image',
 110:             'teaser_source_image_count',
 111:             'teaser_filter',
 112:             'teaser_sort',
 113:             'teaser_sort_order',
 114:             'teaser_character_limit',
 115:             'teaser_image_width',
 116:             'teaser_image_height',
 117:             'teaser_manual_art',
 118:             'teaser_image_crop',
 119:             'teaser_source_date',
 120:             'teaser_source_date_count'
 121:         );
 122: 
 123:         // call parent constructor
 124:         parent::__construct($rawSettings, $id, $contentTypes);
 125: 
 126:         // if form is submitted, store the current teaser settings
 127:         // notice: also check the ID of the content type (there could be more
 128:         // than one content type of the same type on the same page!)
 129:         if (isset($_POST[$this->_prefix . '_action']) && $_POST[$this->_prefix . '_action'] == 'store' && isset($_POST[$this->_prefix . '_id']) && (int) $_POST[$this->_prefix . '_id'] == $this->_id) {
 130:             $this->_storeSettings();
 131:         }
 132: 
 133:         $this->_setDefaultValues();
 134:     }
 135: 
 136:     /**
 137:      * Returns all translation strings for mi18n.
 138:      *
 139:      * @param array $translationStrings
 140:      *         translation strings
 141:      * @return array
 142:      *         updated translation string
 143:      */
 144:     public static function addModuleTranslations(array $translationStrings) {
 145:         foreach (self::$_translations as $value) {
 146:             $translationStrings[] = $value;
 147:         }
 148: 
 149:         return $translationStrings;
 150:     }
 151: 
 152:     /**
 153:      * Sets some default values for teaser in case that there is no value
 154:      * defined.
 155:      */
 156:     private function _setDefaultValues() {
 157:         // character limit is 120 by default
 158:         if ((int) $this->_settings['teaser_character_limit'] == 0) {
 159:             $this->_settings['teaser_character_limit'] = 120;
 160:         }
 161: 
 162:         // teaser cont is 6 by default
 163:         if ((int) $this->_settings['teaser_count'] == 0) {
 164:             $this->_settings['teaser_count'] = 6;
 165:         }
 166: 
 167:         // teasersort is creationdate by default
 168:         if (strlen($this->_settings['teaser_sort']) == 0) {
 169:             $this->_settings['teaser_sort'] = 'creationdate';
 170:         }
 171: 
 172:         // teaser style is liststyle by default
 173:         if (strlen($this->_settings['teaser_style']) == 0) {
 174:             $this->_settings['teaser_style'] = 'cms_teaser_slider.html';
 175:         }
 176: 
 177:         // teaser image width default
 178:         if ((int) $this->_settings['teaser_image_width'] == 0) {
 179:             $this->_settings['teaser_image_width'] = 100;
 180:         }
 181: 
 182:         // teaser image height default
 183:         if ((int) $this->_settings['teaser_image_height'] == 0) {
 184:             $this->_settings['teaser_image_height'] = 75;
 185:         }
 186: 
 187:         // cms type head default
 188:         if (strlen($this->_settings['teaser_source_head']) == 0) {
 189:             $this->_settings['teaser_source_head'] = 'CMS_HTMLHEAD';
 190:         }
 191: 
 192:         // cms type text default
 193:         if (strlen($this->_settings['teaser_source_text']) == 0) {
 194:             $this->_settings['teaser_source_text'] = 'CMS_HTML';
 195:         }
 196: 
 197:         // cms type image default
 198:         if (strlen($this->_settings['teaser_source_image']) == 0) {
 199:             $this->_settings['teaser_source_image'] = 'CMS_IMG';
 200:         }
 201: 
 202:         // cms type date default
 203:         if (strlen($this->_settings['teaser_source_date']) == 0) {
 204:             $this->_settings['teaser_source_date'] = 'CMS_DATE';
 205:         }
 206: 
 207:         // sort order of teaser articles
 208:         if (strlen($this->_settings['teaser_sort_order']) == 0) {
 209:             $this->_settings['teaser_sort_order'] = 'asc';
 210:         }
 211: 
 212:         // teaser image crop option
 213:         if (strlen($this->_settings['teaser_image_crop']) == 0 || $this->_settings['teaser_image_crop'] == 'false') {
 214:             $this->_settings['teaser_image_crop'] = 'false';
 215:         }
 216:     }
 217: 
 218:     /**
 219:      * Generates the code which should be shown if this content type is shown in
 220:      * the frontend.
 221:      *
 222:      * @return string
 223:      *         escaped HTML code which sould be shown if content type is shown in frontend
 224:      */
 225:     public function generateViewCode() {
 226:         $code = '";?><?php
 227:                     $teaser = new cContentTypeTeaser(\'%s\', %s, %s);
 228:                     echo $teaser->generateTeaserCode();
 229:                  ?><?php echo "';
 230:         // escape ' to avoid accidently ending the string in $code
 231:         $code = sprintf($code, str_replace('\'', '\\\'', $this->_rawSettings), $this->_id, 'array()');
 232: 
 233:         return $code;
 234:     }
 235: 
 236:     /**
 237:      * Function returns idarts of selected articles as array
 238:      *
 239:      * @return array
 240:      */
 241:     public function getConfiguredArticles() {
 242:         $articles = array();
 243:         $articles = $this->generateTeaserCode(true);
 244: 
 245:         return $articles;
 246:     }
 247: 
 248:     /**
 249:      * Function is called in edit- and viewmode in order to generate teasercode
 250:      * for output
 251:      *
 252:      * @param bool $returnAsArray [optional]
 253:      *         modeswitch betwwen template generation and returning result as array
 254:      * @return mixed
 255:      *         string of select box or array of articles
 256:      */
 257:     public function generateTeaserCode($returnAsArray = false) {
 258:         global $contenido;
 259: 
 260:         $articles = array();
 261: 
 262:         $template = new cTemplate();
 263:         // set title of teaser
 264:         $template->set('s', 'TITLE', $this->_settings['teaser_title']);
 265: 
 266:         // decide if it is a manual or category teaser
 267:         if ($this->_settings['teaser_manual'] == 'true' && count($this->_settings['teaser_manual_art']) > 0) {
 268:             $manualArts = $this->_settings['teaser_manual_art'];
 269:             if (!empty($manualArts) && !is_array($manualArts)) {
 270:                 $manualArts = array(
 271:                     $manualArts
 272:                 );
 273:             }
 274:             if (is_array($manualArts)) {
 275:                 $i = 0;
 276:                 // in manual case get all art to display and generate article
 277:                 // objects manually
 278:                 foreach ($manualArts as $idArt) {
 279:                     $article = new cApiArticleLanguage();
 280:                     $article->loadByArticleAndLanguageId($idArt, $this->_lang);
 281: 
 282:                     // try to fill teaser image
 283:                     if ($returnAsArray == false && $this->_fillTeaserTemplateEntry($article, $template)) {
 284:                         $i++;
 285:                         // break render, if teaser limit is reached
 286:                         if ($i == $this->_settings['teaser_count']) {
 287:                             break;
 288:                         }
 289:                     }
 290: 
 291:                     if ($returnAsArray == true && $this->_fillTeaserTemplateEntry($article, $template)) {
 292:                         array_push($articles, $article);
 293: 
 294:                         if ($i == $this->_settings['teaser_count']) {
 295:                             break;
 296:                         }
 297:                     }
 298:                 }
 299:             }
 300:         } else {
 301:             // in case of automatic teaser use class cArticleCollector
 302:             // for getting all arts in category
 303: 
 304:             $options = array(
 305:                 'lang' => $this->_lang,
 306:                 'client' => $this->_client,
 307:                 'idcat' => $this->_settings['teaser_category'],
 308:                 'order' => $this->_settings['teaser_sort'],
 309:                 'direction' => $this->_settings['teaser_sort_order'],
 310:                 'limit' => $this->_settings['teaser_count'],
 311:                 'start' => false,
 312:                 'offline' => false
 313:             );
 314: 
 315:             if ($this->_settings['teaser_start'] == 'true') {
 316:                 $options['start'] = true;
 317:             }
 318: 
 319:             $artCollector = new cArticleCollector($options);
 320: 
 321:             foreach ($artCollector as $article) {
 322: 
 323:                 $title =  trim($this->_getArtContent($article, $this->_settings['teaser_source_head'], $this->_settings['teaser_source_head_count']));
 324:                 $text =  trim($this->_getArtContent($article, $this->_settings['teaser_source_text'], $this->_settings['teaser_source_text_count']));
 325:                 $imageId = trim($this->_getArtContent($article, $this->_settings['teaser_source_image'], $this->_settings['teaser_source_image_count']));
 326: 
 327:                 if (!empty($title) || !empty($text) || !empty($imageId)) {
 328:                       if ($returnAsArray == true) {
 329:                          array_push($articles, $article);
 330:                     } else {
 331:                          $this->_fillTeaserTemplateEntry($article, $template);
 332:                     }
 333:                    }
 334:             }
 335:         }
 336: 
 337:         $code = '';
 338: 
 339:         // generate teasertemplate
 340:         if ($returnAsArray == false && file_exists($this->_cfgClient[$this->_client]['path']['frontend'] . 'templates/' . $this->_settings['teaser_style']) && count($template->Dyn_replacements) > 0) {
 341:             $code = $template->generate($this->_cfgClient[$this->_client]['path']['frontend'] . 'templates/' . $this->_settings['teaser_style'], true);
 342:             return $code;
 343:         } else if ($returnAsArray == true) {
 344:             return $articles;
 345:         }
 346:     }
 347: 
 348:     /**
 349:      * In edit and view mode this function fills teaser template with
 350:      * informations from a CONTENIDO article object.
 351:      *
 352:      * @param cApiArticleLanguage $article
 353:      *         CONTENIDO Article object
 354:      * @param cTemplate $template
 355:      *         CONTENIDO Template object (as reference)
 356:      * @return bool
 357:      *         success state of this operation
 358:      */
 359:     private function _fillTeaserTemplateEntry(cApiArticleLanguage $article, cTemplate &$template) {
 360:         global $contenido;
 361: 
 362:         // get necessary informations for teaser from articles use properties in
 363:         // a Settings for retrieval
 364:         $title = $this->_getArtContent($article, $this->_settings['teaser_source_head'], $this->_settings['teaser_source_head_count']);
 365:         $text = $this->_getArtContent($article, $this->_settings['teaser_source_text'], $this->_settings['teaser_source_text_count']);
 366:         $imageId = $this->_getArtContent($article, $this->_settings['teaser_source_image'], $this->_settings['teaser_source_image_count']);
 367:         $date = $this->_getArtContent($article, $this->_settings['teaser_source_date'], $this->_settings['teaser_source_date_count']);
 368: 
 369:         // check if CMS type is date before trying to parse it as date
 370:         if ('CMS_DATE' === $this->_settings['teaser_source_date']) {
 371:             $date = trim($date);
 372:             $date = new cContentTypeDate($date, 1, array('CMS_DATE'));
 373:             $date = $date->generateViewCode();
 374:         } else {
 375:             $date = trim(strip_tags($date));
 376:         }
 377: 
 378:         $idArt = $article->getField('idart');
 379:         $published = $article->getField('published');
 380:         $online = $article->getField('online');
 381: 
 382:         if ($online == 1 || $contenido) {
 383:             // teaserfilter defines strings which must be contained in text for
 384:             // display.
 385:             // if string is defined check if article contains this string and
 386:             // abort, if article does not contain this string
 387:             if ($this->_settings['teaser_filter'] != '') {
 388:                 $iPosText = strrpos(conHtmlEntityDecode($text), $this->_settings['teaser_filter']);
 389:                 $iPosHead = strrpos(conHtmlEntityDecode($title), $this->_settings['teaser_filter']);
 390:                 if (is_bool($iPosText) && !$iPosText && is_bool($iPosHead) && !$iPosHead) {
 391:                     return false;
 392:                 }
 393:             }
 394: 
 395:             // convert date to readable format
 396:             if (preg_match('/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/', $published, $results)) {
 397:                 $published = $results[3] . '.' . $results[2] . '.' . $results[1];
 398:             }
 399: 
 400:             // strip tags in teaser text and cut it if it is to long
 401:             $title = trim(strip_tags($title));
 402:             $text = trim(strip_tags($text));
 403:             if (strlen($text) > $this->_settings['teaser_character_limit']) {
 404:                 $text = cString::trimAfterWord($text, $this->_settings['teaser_character_limit']) . '...';
 405:             }
 406: 
 407:             // try to get a teaser image directly from cms_img or try to extract
 408:             // if a content type is given, wich contains html
 409:             if ((int) $imageId > 0) {
 410:                 $image = $this->_getImage($imageId, $this->_settings['teaser_image_width'], $this->_settings['teaser_image_height'], $this->_settings['teaser_image_crop']);
 411:                 $template->set('d', 'IMAGE', $image['element']);
 412:                 $template->set('d', 'IMAGE_SRC', $image['src']);
 413:             } else if (strip_tags($imageId) != $imageId && strlen($imageId) > 0) {
 414:                 $image = $this->_extractImage($imageId);
 415:                 if (strlen($image['src']) > 0) {
 416:                     $template->set('d', 'IMAGE', $image['element']);
 417:                     $template->set('d', 'IMAGE_SRC', $image['src']);
 418:                 } else {
 419:                     $template->set('d', 'IMAGE', '');
 420:                     $template->set('d', 'IMAGE_SRC', '');
 421:                 }
 422:             } else {
 423:                 $template->set('d', 'IMAGE_SRC', '');
 424:                 $template->set('d', 'IMAGE', '');
 425:             }
 426: 
 427:             // strip all tags from manual teaser date
 428:             $date = strip_tags($date);
 429: 
 430:             // set generated values to teaser template
 431:             $template->set('d', 'TITLE', $title);
 432:             $template->set('d', 'TEXT', $text);
 433: 
 434:             $template->set('d', 'IDART', $idArt);
 435:             $template->set('d', 'ART_URL', 'front_content.php?idart=' . $idArt);
 436:             $template->set('d', 'PUBLISHED', $published);
 437:             $template->set('d', 'PUBLISHED_MANUAL', $date);
 438: 
 439:             if ($date != '') {
 440:                 $template->set('d', 'PUBLISHED_COMBINED', $date);
 441:             } else {
 442:                 $template->set('d', 'PUBLISHED_COMBINED', $published);
 443:             }
 444: 
 445:             foreach (self::$_translations as $translationString) {
 446:                 $template->set('d', $translationString, mi18n($translationString));
 447:             }
 448: 
 449:             if ($this->iteration == 0) {
 450:                 $template->set('d', 'ACTIVE', 'active');
 451:             } else {
 452:                 $template->set('d', 'ACTIVE', '');
 453:             }
 454:             $this->iteration++;
 455: 
 456:             $template->next();
 457:         }
 458: 
 459:         return true;
 460:     }
 461: 
 462:     /**
 463:      * Teaser allows to get a list of ids in which article content is searched
 464:      * in article like 1,2,5,6 the result with largest character count is
 465:      * returned
 466:      *
 467:      * @param cApiArticleLanguage $article
 468:      *         CONTENIDO article object
 469:      * @param string $contentTypeName
 470:      *         Name of Content type to extract informations from
 471:      * @param string $ids
 472:      *         list of ids to search in
 473:      * @return string
 474:      *         largest result of content
 475:      */
 476:     private function _getArtContent(cApiArticleLanguage &$article, $contentTypeName, $ids) {
 477:         $this->_initCmsTypes();
 478: 
 479:         $return = '';
 480:         // split ids, if there is only one id, array has only one place filled,
 481:         // that is also ok
 482:         foreach (explode(',', $ids) as $currentId) {
 483:             if ($this->_forwardTypes[$contentTypeName] != "") {
 484:                 $contentTypeName = $this->_forwardTypes[$contentTypeName];
 485:             }
 486:             $return .= ' ' . $article->getContent($contentTypeName, $currentId);
 487:         }
 488: 
 489:         return $return;
 490:     }
 491: 
 492:     /**
 493:      * When a HTML Code is given for a Teaser image try to find a image in this
 494:      * code and generate teaser image on that basis.
 495:      *
 496:      * @param string $content
 497:      *         HTML string to search image in
 498:      * @return string
 499:      *         img tag containing scaled image
 500:      */
 501:     private function _extractImage($content) {
 502:         $image = array();
 503: 
 504:         // search an image tag
 505:         $regEx = "/<img[^>]*?>.*?/i";
 506: 
 507:         $match = array();
 508:         preg_match($regEx, $content, $match);
 509: 
 510:         // if found extract its src content
 511:         $regEx = "/(src)(=)(['\"]?)([^\"']*)(['\"]?)/i";
 512:         $img = array();
 513:         preg_match($regEx, $match[0], $img);
 514: 
 515:         // check if this image lies in upload folder
 516:         $pos = strrpos($img[4], $this->_cfgClient[$this->_client]['upload']);
 517:         if (!is_bool($pos)) {
 518:             // if it is generate full internal path to image and scale it for
 519:             // display using class internal function getImage()
 520:             $file = $this->_cfgClient[$this->_client]['path']['frontend'] . $img[4];
 521:             $image = $this->_getImage($file, $this->_settings['teaser_image_width'], $this->_settings['teaser_image_height'], $this->_settings['teaser_image_crop'], true);
 522:         }
 523: 
 524:         return $image;
 525:     }
 526: 
 527:     /**
 528:      * Function gets path to an image of base of idupload in CONTENIDO,
 529:      * scales this image on basis of teaser settings and returns path to
 530:      * scaled image.
 531:      *
 532:      * It is also possible to give path to image directly, in this case set
 533:      * fourth parameter to true.
 534:      *
 535:      * @param int $image
 536:      *         idupl of image to use for teaser
 537:      * @param int $maxX
 538:      *         maximum image width
 539:      * @param int $maxY
 540:      *         maximum image height
 541:      * @param bool $isFile [optional]
 542:      *         in case of a direct file path retrival from database is not needed
 543:      * @return string
 544:      *         <img> tag contains scaled image
 545:      */
 546:     private function _getImage($image, $maxX, $maxY, $cropped, $isFile = false) {
 547:         $content = '';
 548:         $return = array();
 549: 
 550:         if ($cropped == 'true') {
 551:             $cropped = true;
 552:         } else {
 553:             $cropped = false;
 554:         }
 555: 
 556:         // check if there is a need to get image path
 557:         if ($isFile == false) {
 558:             $upload = new cApiUpload($image);
 559:             $dirname = $upload->get('dirname');
 560:             $filename = $upload->get('filename');
 561:             if (!empty($dirname) && !empty($filename)) {
 562:                 $teaserImage = $this->_cfgClient[$this->_client]['path']['frontend'] . 'upload/' . $dirname . $filename;
 563:             }
 564:         } else {
 565:             $teaserImage = $image;
 566:         }
 567: 
 568:         // scale image if exists and return it
 569:         if (file_exists($teaserImage)) {
 570:             // Scale Image using cApiImgScale
 571:             $imgSrc = cApiImgScale($teaserImage, $maxX, $maxY, $cropped);
 572: 
 573:             if ($this->_useXHTML == 'true') {
 574:                 $letter = ' /';
 575:             } else {
 576:                 $letter = '';
 577:             }
 578: 
 579:             // Put Image into the teasertext
 580:             $content = '<img alt="" src="' . $imgSrc . '" class="teaser_image"' . $letter . '>' . $content;
 581:         }
 582: 
 583:         $return['element'] = $content;
 584:         $return['src'] = $imgSrc;
 585: 
 586:         return $return;
 587:     }
 588: 
 589:     /**
 590:      * Generates the code which should be shown if this content type is edited.
 591:      *
 592:      * @return string
 593:      *         escaped HTML code which should be shown if content type is edited
 594:      */
 595:     public function generateEditCode() {
 596:         $this->_initCmsTypes();
 597: 
 598:         $template = new cTemplate();
 599:         // Set some values into javascript for a better handling
 600:         $template->set('s', 'ID', $this->_id);
 601:         $template->set('s', 'IDARTLANG', $this->_idArtLang);
 602:         $template->set('s', 'FIELDS', "'" . implode("','", $this->_formFields) . "'");
 603: 
 604:         $templateTabs = new cTemplate();
 605:         $templateTabs->set('s', 'PREFIX', $this->_prefix);
 606: 
 607:         // create code for general tab
 608:         $templateTabs->set('d', 'TAB_ID', 'general');
 609:         $templateTabs->set('d', 'TAB_CLASS', 'general');
 610:         $templateTabs->set('d', 'TAB_CONTENT', $this->_generateTabGeneral());
 611:         $templateTabs->next();
 612: 
 613:         // create code for advanced tab
 614:         $templateTabs->set('d', 'TAB_ID', 'advanced');
 615:         $templateTabs->set('d', 'TAB_CLASS', 'advanced');
 616:         $templateTabs->set('d', 'TAB_CONTENT', $this->_generateTabAdvanced());
 617:         $templateTabs->next();
 618: 
 619:         // create code for manual tab
 620:         $templateTabs->set('d', 'TAB_ID', 'manual');
 621:         $templateTabs->set('d', 'TAB_CLASS', 'manual');
 622:         $templateTabs->set('d', 'TAB_CONTENT', $this->_generateTabManual());
 623:         $templateTabs->next();
 624: 
 625:         $codeTabs = $templateTabs->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_tabs.html', true);
 626: 
 627:         // construct the top code of the template
 628:         $templateTop = new cTemplate();
 629:         $templateTop->set('s', 'ICON', 'images/isstart0.gif');
 630:         $templateTop->set('s', 'ID', $this->_id);
 631:         $templateTop->set('s', 'PREFIX', $this->_prefix);
 632:         $templateTop->set('s', 'HEADLINE', i18n('Teaser settings'));
 633:         $codeTop = $templateTop->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_top.html', true);
 634: 
 635:         // define the available tabs
 636:         $tabMenu = array(
 637:             'general' => i18n('Automatic'),
 638:             'advanced' => i18n('Manual'),
 639:             'manual' => i18n('Settings')
 640:         );
 641: 
 642:         // construct the bottom code of the template
 643:         $templateBottom = new cTemplate();
 644:         $templateBottom->set('s', 'PATH_FRONTEND', $this->_cfgClient[$this->_client]['path']['htmlpath']);
 645:         $templateBottom->set('s', 'ID', $this->_id);
 646:         $templateBottom->set('s', 'PREFIX', $this->_prefix);
 647:         $templateBottom->set('s', 'IDARTLANG', $this->_idArtLang);
 648:         $templateBottom->set('s', 'FIELDS', "'" . implode("','", $this->_formFields) . "'");
 649:         $templateBottom->set('s', 'SETTINGS', json_encode($this->_settings));
 650:         $templateBottom->set('s', 'JS_CLASS_SCRIPT', $this->_cfg['path']['contenido_fullhtml'] . 'scripts/content_types/cmsTeaser.js');
 651:         $templateBottom->set('s', 'JS_CLASS_NAME', 'Con.cContentTypeTeaser');
 652:         $codeBottom = $templateBottom->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_bottom.html', true);
 653: 
 654:         // construct the whole template code
 655:         $code = $this->generateViewCode();
 656:         $code .= $this->_encodeForOutput($codeTop);
 657:         $code .= $this->_generateTabMenuCode($tabMenu);
 658:         $code .= $this->_encodeForOutput($codeTabs);
 659:         $code .= $this->_generateActionCode();
 660:         $code .= $this->_encodeForOutput($codeBottom);
 661: 
 662:         return $code;
 663:     }
 664: 
 665:     /**
 666:      * Gets all currenty avariable content types and their ids
 667:      * from database and store it into class variable aCMSTypes.
 668:      * Because this information is used multiple times, this causes a better
 669:      * performance than gettting it seperately
 670:      */
 671:     private function _initCmsTypes() {
 672:         if (!empty($this->_cmsTypes)) {
 673:             return;
 674:         }
 675: 
 676:         $this->_cmsTypes = array();
 677: 
 678:         $sql = 'SELECT * FROM ' . $this->_cfg['tab']['type'] . ' ORDER BY type';
 679:         $db = cRegistry::getDb();
 680:         $db->query($sql);
 681:         while ($db->nextRecord()) {
 682:             // we do not want certain content types
 683:             if (in_array($db->f('type'), $this->_ignoreTypes)) {
 684:                 continue;
 685:             }
 686:             $this->_cmsTypes[$db->f('idtype')] = $db->f('type');
 687:         }
 688:     }
 689: 
 690:     /**
 691:      * Generates code for the general tab in which various settings can be made.
 692:      *
 693:      * @return string
 694:      *         the code for the general tab
 695:      */
 696:     private function _generateTabGeneral() {
 697:         // define a wrapper which contains the whole content of the general tab
 698:         $wrapper = new cHTMLDiv();
 699:         $wrapperContent = array();
 700: 
 701:         // $wrapperContent[] = new cHTMLParagraph(i18n('General settings'),
 702:         // 'head_sub');
 703:         $wrapperContent[] = new cHTMLLabel(i18n('Teaser title'), 'teaser_title_' . $this->_id);
 704:         $wrapperContent[] = new cHTMLTextbox('teaser_title_' . $this->_id, $this->_settings['teaser_title'], '', '', 'teaser_title_' . $this->_id);
 705:         $wrapperContent[] = new cHTMLLabel(i18n('Source category'), 'teaser_category_' . $this->_id);
 706:         $wrapperContent[] = buildCategorySelect('teaser_category_' . $this->_id, $this->_settings['teaser_category'], 0);
 707:         $wrapperContent[] = new cHTMLLabel(i18n('Number of articles'), 'teaser_count_' . $this->_id);
 708:         $wrapperContent[] = $this->_generateCountSelect();
 709: 
 710:         $wrapperContent[] = new cHTMLLabel(i18n("Include start article"), 'teaser_start_' . $this->_id);
 711:         $wrapperContent[] = new cHTMLCheckbox('teaser_start_' . $this->_id, '', 'teaser_start_' . $this->_id, ($this->_settings['teaser_start'] == 'true'));
 712: 
 713:         $wrapperContent[] = new cHTMLLabel(i18n("Teaser sort"), 'teaser_sort_' . $this->_id);
 714:         $wrapperContent[] = $this->_generateSortSelect();
 715:         $wrapperContent[] = new cHTMLLabel(i18n("Sort order"), 'teaser_sort_order_' . $this->_id);
 716:         $wrapperContent[] = $this->_generateSortOrderSelect();
 717: 
 718:         $wrapper->setContent($wrapperContent);
 719:         return $wrapper->render();
 720:     }
 721: 
 722:     /**
 723:      * Generats a select box for setting number of articles which should be
 724:      * displayed in teaser as a maximum.
 725:      *
 726:      * Only important in editmode.
 727:      *
 728:      * @return string
 729:      *         html string of select box
 730:      */
 731:     private function _generateCountSelect() {
 732:         $htmlSelect = new cHTMLSelectElement('teaser_count_' . $this->_id, '', 'teaser_count_' . $this->_id);
 733: 
 734:         // set please chose option element
 735:         $htmlSelectOption = new cHTMLOptionElement(i18n('Please choose'), '', true);
 736:         $htmlSelect->appendOptionElement($htmlSelectOption);
 737: 
 738:         // generate a select box containing count 1 to 20 for maximum teaser
 739:         // count
 740:         for ($i = 1; $i <= 20; $i++) {
 741:             $htmlSelectOption = new cHTMLOptionElement($i, $i, false);
 742:             $htmlSelect->appendOptionElement($htmlSelectOption);
 743:         }
 744: 
 745:         // set default value
 746:         $htmlSelect->setDefault($this->_settings['teaser_count']);
 747: 
 748:         return $htmlSelect->render();
 749:     }
 750: 
 751:     /**
 752:      * Generats a select box for setting teaser style.
 753:      *
 754:      * Currently four default teaser templates are supported but any number of
 755:      * user templates can be defined as settings of type "cms_teaser" having a
 756:      * label as name and a filename as value.
 757:      *
 758:      * The default templates are:
 759:      * - Slider style (cms_teaser_slider.html)
 760:      * - Image style (cms_teaser_image.html)
 761:      * - Text style (cms_teaser_text.html)
 762:      * - Blog style (cms_teaser_blog.html)
 763:      *
 764:      * @return string
 765:      *         html string of select box
 766:      */
 767:     private function _generateStyleSelect() {
 768:         $htmlSelect = new cHTMLSelectElement('teaser_style_' . $this->_id, '', 'teaser_style_' . $this->_id);
 769: 
 770:         // set please chose option element
 771:         $htmlSelectOption = new cHTMLOptionElement(i18n("Please choose"), '', true);
 772:         $htmlSelect->appendOptionElement($htmlSelectOption);
 773: 
 774:         // set other avariable options manually
 775:         $htmlSelectOption = new cHTMLOptionElement(i18n("Slider style"), 'cms_teaser_slider.html', false);
 776:         $htmlSelect->appendOptionElement($htmlSelectOption);
 777: 
 778:         $htmlSelectOption = new cHTMLOptionElement(i18n("Image style"), 'cms_teaser_image.html', false);
 779:         $htmlSelect->appendOptionElement($htmlSelectOption);
 780: 
 781:         $htmlSelectOption = new cHTMLOptionElement(i18n("Text style"), 'cms_teaser_text.html', false);
 782:         $htmlSelect->appendOptionElement($htmlSelectOption);
 783: 
 784:         $htmlSelectOption = new cHTMLOptionElement(i18n("Blog style"), 'cms_teaser_blog.html', false);
 785:         $htmlSelect->appendOptionElement($htmlSelectOption);
 786: 
 787:         $additionalOptions = getEffectiveSettingsByType('cms_teaser');
 788:         foreach ($additionalOptions as $sLabel => $sTemplate) {
 789:             $htmlSelectOption = new cHTMLOptionElement($sLabel, $sTemplate, false);
 790:             $htmlSelect->appendOptionElement($htmlSelectOption);
 791:         }
 792: 
 793:         // set default value
 794:         $htmlSelect->setDefault($this->_settings['teaser_style']);
 795: 
 796:         return $htmlSelect->render();
 797:     }
 798: 
 799:     /**
 800:      * Teaser gets informations from other articles and their content typs.
 801:      *
 802:      * Function builds a select box in which coresponding cms type can be
 803:      * selected after that a text box is rendered for setting id for this
 804:      * content type to get informations from.
 805:      *
 806:      * This function is used three times for source defintion of headline,
 807:      * text and teaserimage.
 808:      *
 809:      * @param string $selectName
 810:      *         name of input elements
 811:      * @param string $selected
 812:      *         value of select box which is selected
 813:      * @param string $value
 814:      *         current value of text box
 815:      * @return string
 816:      *         html string of select box
 817:      */
 818:     private function _generateTypeSelect($selectName, $selected, $value) {
 819:         // make sure that the ID is at the end of the form field name
 820:         $inputName = str_replace('_' . $this->_id, '_count_' . $this->_id, $selectName);
 821:         // generate textbox for content type id
 822:         $htmlInput = new cHTMLTextbox($inputName, $value, '', '', $inputName, false, '', '', 'teaser_type_count');
 823: 
 824:         // generate content type select
 825:         $htmlSelect = new cHTMLSelectElement($selectName, '', $selectName);
 826:         $htmlSelect->setClass('teaser_type_select');
 827: 
 828:         $htmlSelectOption = new cHTMLOptionElement(i18n("Please choose"), '', true);
 829:         $htmlSelect->addOptionElement(0, $htmlSelectOption);
 830: 
 831:         // use $this->_cmsTypes as basis for this select box which contains all
 832:         // avariable content types in system
 833:         foreach ($this->_cmsTypes as $key => $value) {
 834:             $htmlSelectOption = new cHTMLOptionElement($value, $value, false);
 835:             $htmlSelect->addOptionElement($key, $htmlSelectOption);
 836:         }
 837: 
 838:         // set default value
 839:         $htmlSelect->setDefault($selected);
 840: 
 841:         return $htmlSelect->render() . $htmlInput->render();
 842:     }
 843: 
 844:     /**
 845:      * Generates code for the advanced tab in which various advanced settings
 846:      * can be made.
 847:      *
 848:      * @return string
 849:      *         the code for the advanced tab
 850:      */
 851:     private function _generateTabAdvanced() {
 852:         // define a wrapper which contains the whole content of the advanced tab
 853:         $wrapper = new cHTMLDiv();
 854:         $wrapperContent = array();
 855: 
 856:         // $wrapperContent[] = new cHTMLParagraph(i18n('Manual teaser
 857:         // settings'), 'head_sub');
 858:         $wrapperContent[] = new cHTMLLabel(i18n('Manual teaser'), 'teaser_manual_' . $this->_id);
 859:         $wrapperContent[] = new cHTMLCheckbox('teaser_manual_' . $this->_id, '', 'teaser_manual_' . $this->_id, ($this->_settings['teaser_manual'] == 'true'));
 860: 
 861:         // $wrapperContent[] = new cHTMLParagraph(i18n('Add article'),
 862:         // 'head_sub');
 863:         $wrapperContent[] = new cHTMLLabel(i18n('Category'), 'teaser_cat_' . $this->_id);
 864:         $wrapperContent[] = buildCategorySelect('teaser_cat_' . $this->_id, 0, 0);
 865:         $wrapperContent[] = new cHTMLLabel(i18n('Article'), 'teaser_art_' . $this->_id);
 866:         $wrapperContent[] = buildArticleSelect('teaser_art_' . $this->_id, 0, 0);
 867: 
 868:         $wrapperContent[] = new cHTMLLabel(i18n('Add'), 'add_art_' . $this->_id);
 869:         $image = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . 'images/but_art_new.gif');
 870:         $image->setAttribute('id', 'add_art_' . $this->_id);
 871:         $image->appendStyleDefinition('cursor', 'pointer');
 872:         $wrapperContent[] = $image;
 873: 
 874:         $wrapperContent[] = new cHTMLParagraph(i18n('Included articles'), 'head_sub');
 875:         $selectElement = new cHTMLSelectElement('teaser_manual_art_' . $this->_id, '', 'teaser_manual_art_' . $this->_id, false, '', '', 'manual');
 876:         $selectElement->setAttribute('size', '4');
 877:         $selectElement->setAttribute('multiple', 'multiple');
 878:         // there can be one or multiple selected articles
 879:         if (is_array($this->_settings['teaser_manual_art'])) {
 880:             foreach ($this->_settings['teaser_manual_art'] as $index => $idArt) {
 881:                 $option = new cHTMLOptionElement($this->_getArtName($idArt), $idArt, true);
 882:                 $selectElement->addOptionElement($index, $option);
 883:             }
 884:         } else {
 885:             // check if the article really exists
 886:             $artName = $this->_getArtName($this->_settings['teaser_manual_art']);
 887:             if ($artName != i18n('Unknown article')) {
 888:                 $option = new cHTMLOptionElement($artName, $this->_settings['teaser_manual_art'], true);
 889:                 $selectElement->addOptionElement(0, $option);
 890:             }
 891:         }
 892:         $wrapperContent[] = $selectElement;
 893: 
 894:         $wrapperContent[] = new cHTMLLabel(i18n("Delete"), 'del_art_' . $this->_id);
 895:         $image = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . 'images/delete.gif');
 896:         $image->setAttribute('id', 'del_art_' . $this->_id);
 897:         $image->appendStyleDefinition('cursor', 'pointer');
 898:         $wrapperContent[] = $image;
 899: 
 900:         $wrapper->setContent($wrapperContent);
 901:         return $wrapper->render();
 902:     }
 903: 
 904:     /**
 905:      * Function which generated a select box for setting teaser sort argument.
 906:      *
 907:      * @return string
 908:      *         html string of select box
 909:      */
 910:     private function _generateSortSelect() {
 911:         $htmlSelect = new cHTMLSelectElement('teaser_sort_' . $this->_id, '', 'teaser_sort_' . $this->_id);
 912: 
 913:         // set please chose option element
 914:         $htmlSelectOption = new cHTMLOptionElement(i18n("Please choose"), '', true);
 915:         $htmlSelect->appendOptionElement($htmlSelectOption);
 916: 
 917:         // set other avariable options manually
 918:         $htmlSelectOption = new cHTMLOptionElement(i18n("Sort sequence"), 'sortsequence', false);
 919:         $htmlSelect->appendOptionElement($htmlSelectOption);
 920: 
 921:         $htmlSelectOption = new cHTMLOptionElement(i18n("Creation date"), 'creationdate', false);
 922:         $htmlSelect->appendOptionElement($htmlSelectOption);
 923: 
 924:         $htmlSelectOption = new cHTMLOptionElement(i18n("Published date"), 'publisheddate', false);
 925:         $htmlSelect->appendOptionElement($htmlSelectOption);
 926: 
 927:         $htmlSelectOption = new cHTMLOptionElement(i18n("Modification date"), 'modificationdate', false);
 928:         $htmlSelect->appendOptionElement($htmlSelectOption);
 929: 
 930:         // set default value
 931:         $htmlSelect->setDefault($this->_settings['teaser_sort']);
 932: 
 933:         return $htmlSelect->render();
 934:     }
 935: 
 936:     /**
 937:      * Function which generated a select box for setting teaser sort order argument.
 938:      *
 939:      * @return string
 940:      *         html string of select box
 941:      */
 942:     private function _generateSortOrderSelect() {
 943:         $htmlSelect = new cHTMLSelectElement('teaser_sort_order_' . $this->_id, '', 'teaser_sort_order_' . $this->_id);
 944: 
 945:         // set please chose option element
 946:         $htmlSelectOption = new cHTMLOptionElement(i18n("Please choose"), '', true);
 947:         $htmlSelect->appendOptionElement($htmlSelectOption);
 948: 
 949:         // set other avariable options manually
 950:         $htmlSelectOption = new cHTMLOptionElement(i18n("Ascending"), 'asc', false);
 951:         $htmlSelect->appendOptionElement($htmlSelectOption);
 952: 
 953:         $htmlSelectOption = new cHTMLOptionElement(i18n("Descending"), 'desc', false);
 954:         $htmlSelect->appendOptionElement($htmlSelectOption);
 955: 
 956:         // set default value
 957:         $htmlSelect->setDefault($this->_settings['teaser_sort_order']);
 958: 
 959:         return $htmlSelect->render();
 960:     }
 961: 
 962:     /**
 963:      * Function which provides select option for cropping teaser images.
 964:      *
 965:      * @return string
 966:      *         html string of select box
 967:      */
 968:     private function _generateCropSelect() {
 969:         $htmlSelect = new cHTMLSelectElement('teaser_image_crop_' . $this->_id, '', 'teaser_image_crop_' . $this->_id);
 970: 
 971:         // set please chose option element
 972:         $htmlSelectOption = new cHTMLOptionElement(i18n("Please choose"), '', true);
 973:         $htmlSelect->appendOptionElement($htmlSelectOption);
 974: 
 975:         // set other avariable options manually
 976:         $htmlSelectOption = new cHTMLOptionElement(i18n("Scaled"), 'false', false);
 977:         $htmlSelect->appendOptionElement($htmlSelectOption);
 978: 
 979:         $htmlSelectOption = new cHTMLOptionElement(i18n("Cropped"), 'true', false);
 980:         $htmlSelect->appendOptionElement($htmlSelectOption);
 981: 
 982:         // set default value
 983:         $htmlSelect->setDefault($this->_settings['teaser_image_crop']);
 984: 
 985:         return $htmlSelect->render();
 986:     }
 987: 
 988:     /**
 989:      * Generates code for the manual tab in which various settings for the
 990:      * manual teaser can be made.
 991:      *
 992:      * @return string
 993:      *         the code for the manual tab
 994:      */
 995:     private function _generateTabManual() {
 996:         // define a wrapper which contains the whole content of the manual tab
 997:         $wrapper = new cHTMLDiv();
 998:         $wrapperContent = array();
 999: 
1000:         $wrapperContent[] = new cHTMLParagraph(i18n("Content visualisation"), 'head_sub');
1001:         $wrapperContent[] = new cHTMLLabel(i18n("Teaser visualisation"), 'teaser_style');
1002:         $wrapperContent[] = $this->_generateStyleSelect();
1003:         $wrapperContent[] = new cHTMLLabel(i18n("Teaser filter"), 'teaser_filter_' . $this->_id);
1004:         $wrapperContent[] = new cHTMLTextbox('teaser_filter_' . $this->_id, $this->_settings['teaser_filter'], '', '', 'teaser_filter_' . $this->_id);
1005:         $wrapperContent[] = new cHTMLLabel(i18n('Character length'), 'teaser_character_limit_' . $this->_id);
1006:         $wrapperContent[] = new cHTMLTextbox('teaser_character_limit_' . $this->_id, $this->_settings['teaser_character_limit'], '', '', 'teaser_character_limit_' . $this->_id);
1007: 
1008:         $wrapperContent[] = new cHTMLParagraph(i18n("Pictures"), 'head_sub');
1009:         $wrapperContent[] = new cHTMLLabel(i18n('Image width'), 'teaser_image_width_' . $this->_id);
1010:         $wrapperContent[] = new cHTMLTextbox('teaser_image_width_' . $this->_id, $this->_settings['teaser_image_width'], '', '', 'teaser_image_width_' . $this->_id);
1011:         $wrapperContent[] = new cHTMLLabel(i18n('Image height'), 'teaser_image_height_' . $this->_id);
1012:         $wrapperContent[] = new cHTMLTextbox('teaser_image_height_' . $this->_id, $this->_settings['teaser_image_height'], '', '', 'teaser_image_height_' . $this->_id);
1013:         $wrapperContent[] = new cHTMLLabel(i18n('Image scale'), 'teaser_image_crop_' . $this->_id);
1014:         $wrapperContent[] = $this->_generateCropSelect();
1015: 
1016:         $wrapperContent[] = new cHTMLParagraph(i18n("Content types"), 'head_sub');
1017:         $wrapperContent[] = new cHTMLLabel(i18n("Headline source"), 'teaser_source_head_' . $this->_id);
1018:         $wrapperContent[] = $this->_generateTypeSelect('teaser_source_head_' . $this->_id, $this->_settings['teaser_source_head'], $this->_settings['teaser_source_head_count']);
1019:         $wrapperContent[] = new cHTMLLabel(i18n("Text source"), 'teaser_source_text_' . $this->_id);
1020:         $wrapperContent[] = $this->_generateTypeSelect('teaser_source_text_' . $this->_id, $this->_settings['teaser_source_text'], $this->_settings['teaser_source_text_count']);
1021:         $wrapperContent[] = new cHTMLLabel(i18n('Image source'), 'teaser_source_image_' . $this->_id);
1022:         $wrapperContent[] = $this->_generateTypeSelect('teaser_source_image_' . $this->_id, $this->_settings['teaser_source_image'], $this->_settings['teaser_source_image_count']);
1023:         $wrapperContent[] = new cHTMLLabel(i18n('Date source'), 'teaser_source_date_' . $this->_id);
1024:         $wrapperContent[] = $this->_generateTypeSelect('teaser_source_date_' . $this->_id, $this->_settings['teaser_source_date'], $this->_settings['teaser_source_date_count']);
1025: 
1026:         $wrapper->setContent($wrapperContent);
1027:         return $wrapper->render();
1028:     }
1029: 
1030:     /**
1031:      * Function retrives name of an article by its id from database.
1032:      *
1033:      * @param int $idArt
1034:      *         CONTENIDO article id
1035:      * @return string
1036:      *         name of article
1037:      */
1038:     private function _getArtName($idArt) {
1039:         $article = new cApiArticleLanguage();
1040:         $article->loadByArticleAndLanguageId((int) $idArt, $this->_lang);
1041: 
1042:         $title = $article->get('title');
1043:         if ($article->isLoaded() && !empty($title)) {
1044:             return $article->get('title');
1045:         } else {
1046:             return i18n('Unknown article');
1047:         }
1048:     }
1049: 
1050: }
1051: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0