1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23:
24: class cContentTypeText extends cContentTypeAbstract {
25:
26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36:
37: public function __construct($rawSettings, $id, array $contentTypes) {
38: $rawSettings = conHtmlSpecialChars($rawSettings);
39:
40:
41: parent::__construct($rawSettings, $id, $contentTypes);
42: $this->_type = 'CMS_TEXT';
43: $this->_prefix = 'text';
44:
45:
46:
47:
48: if (isset($_POST[$this->_prefix . '_action']) && $_POST[$this->_prefix . '_action'] === 'store' && isset($_POST[$this->_prefix . '_id']) && (int) $_POST[$this->_prefix . '_id'] == $this->_id) {
49: $this->_settings = $_POST[$this->_prefix . '_text_' . $this->_id];
50: $this->_rawSettings = $this->_settings;
51: $this->_storeSettings();
52: $this->_settings = stripslashes($this->_settings);
53: $this->_rawSettings = stripslashes($this->_rawSettings);
54: }
55: }
56:
57: 58: 59: 60: 61: 62:
63: public function generateEditCode() {
64: $script = $this->_getEditJavaScript();
65:
66: $div = new cHTMLDiv($this->_rawSettings);
67: $div->setID($this->_prefix . '_text_' . $this->_id);
68: $div->appendStyleDefinition('display', 'inline');
69:
70: $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithead.gif');
71: $editButton->setID($this->_prefix . '_editbutton_' . $this->_id);
72: $editButton->appendStyleDefinitions(array(
73: 'margin-left' => '5px',
74: 'cursor' => 'pointer'
75: ));
76:
77: return $this->_encodeForOutput($script . $div->render() . $editButton->render());
78: }
79:
80: 81: 82: 83: 84:
85: protected function _getEditJavaScript() {
86: $textbox = new cHTMLTextbox($this->_prefix . '_text_' . $this->_id, '', '', '', $this->_prefix . '_text_' . $this->_id, false, NULL, '', 'edit-textfield edit-' . $this->_prefix . '-textfield');
87:
88: $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . 'images/but_ok.gif');
89: $saveButton->setID($this->_prefix . '_savebutton_' . $this->_id);
90: $saveButton->appendStyleDefinitions(array(
91: 'margin-left' => '5px',
92: 'cursor' => 'pointer'
93: ));
94:
95: $template = new cTemplate();
96: $template->set('s', 'PREFIX', $this->_prefix);
97: $template->set('s', 'ID', $this->_id);
98: $template->set('s', 'TEXTBOX', $textbox->render());
99: $template->set('s', 'SAVEBUTTON', $saveButton->render());
100: $template->set('s', 'IDARTLANG', $this->_idArtLang);
101:
102: return $template->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_text_js.html', true);
103: }
104:
105: 106: 107: 108: 109: 110: 111:
112: public function generateViewCode() {
113: return $this->_encodeForOutput($this->_rawSettings);
114: }
115:
116: }