1: <?php
2: /**
3: * This file contains the cContentTypeLinkdescr class.
4: *
5: * @package Core
6: * @subpackage ContentType
7: * @version SVN Revision $Rev:$
8: *
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: /**
19: * Content type CMS_LINKDESCR which displays the link description.
20: *
21: * @package Core
22: * @subpackage ContentType
23: */
24: class cContentTypeLinkdescr extends cContentTypeLinkeditor {
25:
26: /**
27: * Initialises class attributes and handles store events.
28: *
29: * @param string $rawSettings the raw settings in an XML structure or as
30: * plaintext
31: * @param integer $id ID of the content type, e.g. 3 if CMS_DATE[3] is
32: * used
33: * @param array $contentTypes array containing the values of all content
34: * types
35: * @return void
36: */
37: public function __construct($rawSettings, $id, array $contentTypes) {
38: // there are no raw settings here, because the image description is now
39: // saved in con_upl_meta
40: // so compute the appropriate raw settings and call the parent
41: // constructor with them
42:
43: if (!isset($contentTypes['CMS_LINKEDITOR'][$id])) {
44: $idArtLang = cRegistry::getArticleLanguageId();
45: // get the idtype of the CMS_LINKEDITOR content type
46: $typeItem = new cApiType();
47: $typeItem->loadByType('CMS_LINKEDITOR');
48: $idtype = $typeItem->get('idtype');
49: // first load the appropriate content entry in order to get the
50: // idupl
51: $content = new cApiContent();
52: $content->loadByMany(array(
53: 'idartlang' => $idArtLang,
54: 'idtype' => $idtype,
55: 'typeid' => $id
56: ));
57: $rawSettings = $content->get('value');
58: } else {
59: $rawSettings = $contentTypes['CMS_LINKEDITOR'][$id];
60: }
61:
62: parent::__construct($rawSettings, $id, $contentTypes);
63: }
64:
65: /**
66: * Generates the code which should be shown if this content type is shown in
67: * the frontend.
68: *
69: * @return string escaped HTML code which sould be shown if content type is
70: * shown in frontend
71: */
72: public function generateViewCode() {
73: return $this->_encodeForOutput($this->_settings['linkeditor_title']);
74: }
75:
76: /**
77: * Generates the code which should be shown if this content type is edited.
78: *
79: * @return string escaped HTML code which should be shown if content type is
80: * edited
81: */
82: public function generateEditCode() {
83: return $this->generateViewCode();
84: }
85:
86: }