1: <?php
2: /**
3: * This file contains the cContentTypeLink 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_LINK which displays the raw link.
20: *
21: * @package Core
22: * @subpackage ContentType
23: */
24: class cContentTypeLink 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 int $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: */
36: public function __construct($rawSettings, $id, array $contentTypes) {
37: // there are no raw settings here, because CMS_LINK is not saved
38: // separately any more
39: // so compute the appropriate raw settings and call the parent
40: // constructor with them
41:
42: if (!cXmlBase::isValidXML($rawSettings)) {
43: $rawSettings = $this->_getRawSettings("CMS_LINKEDITOR", $id, $contentTypes);
44: }
45:
46: parent::__construct($rawSettings, $id, $contentTypes);
47: }
48:
49: /**
50: * Generates the code which should be shown if this content type is shown in
51: * the frontend.
52: *
53: * @return string escaped HTML code which sould be shown if content type is
54: * shown in frontend
55: */
56: public function generateViewCode() {
57: return $this->_encodeForOutput($this->_generateHref());
58: }
59:
60: /**
61: * Generates the code which should be shown if this content type is edited.
62: *
63: * @return string escaped HTML code which should be shown if content type is
64: * edited
65: */
66: public function generateEditCode() {
67: return $this->generateViewCode();
68: }
69:
70: }