1: <?php
2:
3: /**
4: * This file contains the cContentTypeLink class.
5: *
6: * @package Core
7: * @subpackage ContentType
8: * @author Simon Sprankel
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: * Content type CMS_LINK which displays the raw link.
19: *
20: * @package Core
21: * @subpackage ContentType
22: */
23: class cContentTypeLink extends cContentTypeLinkeditor {
24: /**
25: * Constructor to create an instance of this class.
26: *
27: * Initialises class attributes and handles store events.
28: *
29: * @param string $rawSettings
30: * the raw settings in an XML structure or as plaintext
31: * @param int $id
32: * ID of the content type, e.g. 3 if CMS_DATE[3] is used
33: * @param array $contentTypes
34: * array containing the values of all content types
35: *
36: * @throws cDbException
37: * @throws cException
38: */
39: public function __construct($rawSettings, $id, array $contentTypes) {
40:
41: // There are no raw settings here, because CMS_LINK is not saved
42: // separately any more. So compute the appropriate raw settings
43: // and call the parent constructor with them.
44: if (!cXmlBase::isValidXML($rawSettings)) {
45: $rawSettings = $this->_getRawSettings("CMS_LINKEDITOR", $id, $contentTypes);
46: }
47:
48: // call parent constructor
49: parent::__construct($rawSettings, $id, $contentTypes);
50: }
51:
52: /**
53: * Generates the code which should be shown if this content type is shown in
54: * the frontend.
55: *
56: * @return string
57: * escaped HTML code which sould be shown if content type is shown in frontend
58: * @throws cInvalidArgumentException
59: */
60: public function generateViewCode() {
61: return $this->_encodeForOutput($this->_generateHref());
62: }
63:
64: /**
65: * Generates the code which should be shown if this content type is edited.
66: *
67: * @return string
68: * escaped HTML code which should be shown if content type is edited
69: * @throws cInvalidArgumentException
70: */
71: public function generateEditCode() {
72: return $this->generateViewCode();
73: }
74:
75: }
76: