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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the class for contenttype CMS_USERFORUM
  4:  *
  5:  * @package Plugin
  6:  * @subpackage UserForum
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Claus Schunk
 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:  * This class contains the features of the contenttype CMS_USERFORUM.
 20:  *
 21:  *
 22:  * @package Plugin
 23:  * @subpackage UserForum
 24:  */
 25: class cContentTypeUserForum extends cContentTypeAbstractTabbed {
 26: 
 27:     // Width from Container set in file cms/css/contenido_backend.css
 28:     // .cms_userforum label {
 29:     // width: 210px !important;
 30:     // }
 31: 
 32:     /**
 33:      * Initialize class attributes and handles store events.
 34:      *
 35:      * @param string $rawSettings the raw settings in an XML structure or as
 36:      *        plaintext
 37:      * @param int $id ID of the content type, e.g. 3 if CMS_DATE[3] is
 38:      *        used
 39:      * @param array $contentTypes array containing the values of all content
 40:      *        types
 41:      */
 42:     function __construct($rawSettings, $id, array $contentTypes) {
 43: 
 44:         // set attributes of the parent class and call the parent constructor
 45:         $this->_type = 'CMS_USERFORUM';
 46:         $this->_prefix = 'userforum';
 47:         $this->_settingsType = self::SETTINGS_TYPE_XML;
 48:         $this->_formFields = array(
 49:             'userforum_email',
 50:             'userforum_subcomments',
 51:             'userforum_modactive'
 52:         );
 53: 
 54:         // encoding conversions to avoid problems with umlauts
 55:         $rawSettings = conHtmlEntityDecode($rawSettings);
 56:         $rawSettings = utf8_encode($rawSettings);
 57: 
 58:         parent::__construct($rawSettings, $id, $contentTypes);
 59: 
 60:         // if form is submitted, store the current settings
 61:         // notice: also check the ID of the content type (there could be more
 62:         // than one content type of the same type on the same page!)
 63:         $action = isset($_POST['userforum_action']) ? $_POST['userforum_action'] : NULL;
 64:         $id = isset($_POST['userforum_id']) ? $_POST['userforum_id'] : NULL;
 65:         if ('store' === $action && $this->_id == $id) {
 66:             $this->_storeSettings();
 67:         }
 68:     }
 69: 
 70:     /**
 71:      * Generate the escaped HTML code for editor.
 72:      *
 73:      * @return string escaped HTML code for editor
 74:      */
 75:     public function generateEditCode() {
 76:         $cfg = cRegistry::getConfig();
 77:         // build top code
 78:         $tplTop = new cTemplate();
 79:         $tplTop->set('s', 'ICON', 'plugins/user_forum/images/con_button.gif');
 80:         $tplTop->set('s', 'ID', $this->_id);
 81:         $tplTop->set('s', 'PREFIX', $this->_prefix);
 82:         $tplTop->set('s', 'HEADLINE', UserForum::i18n('ADMINISTRATION'));
 83:         $codeTop = $tplTop->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_top.html', true);
 84: 
 85:         // available tabs
 86:         // $tabMenu = array(
 87:         // 'base' => Pifa::i18n('form')
 88:         // );
 89: 
 90:         // build tab code
 91:         $tplPanel = new cTemplate();
 92:         $tplPanel->set('s', 'PREFIX', $this->_prefix);
 93:         $tplPanel->set('d', 'TAB_ID', 'base');
 94:         $tplPanel->set('d', 'TAB_CLASS', 'base');
 95:         $tplPanel->set('d', 'TAB_CONTENT', $this->_getPanel());
 96:         $tplPanel->next();
 97:         $codePanel = $tplPanel->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_tabs.html', true);
 98: 
 99:         // build bottom code
100:         $tplBottom = new cTemplate();
101:         $tplBottom->set('s', 'PATH_FRONTEND', $this->_cfgClient[$this->_client]['path']['htmlpath']);
102:         $tplBottom->set('s', 'ID', $this->_id);
103:         $tplBottom->set('s', 'PREFIX', $this->_prefix);
104:         $tplBottom->set('s', 'IDARTLANG', $this->_idArtLang);
105:         $tplBottom->set('s', 'FIELDS', "'" . implode("','", $this->_formFields) . "'");
106:         $tplBottom->set('s', 'SETTINGS', json_encode($this->_settings));
107:         $tplBottom->set('s', 'JS_CLASS_SCRIPT', UserForum::getUrl() . 'scripts/cmsUserforum.js');
108:         $tplBottom->set('s', 'JS_CLASS_NAME', get_class($this));
109:         $codeBottom = $tplBottom->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_abstract_tabbed_edit_bottom.html', true);
110: 
111:         // build template code
112:         $code = $this->_encodeForOutput($codeTop);
113:         // $code .= $this->_generateTabMenuCode($tabMenu);
114:         $code .= $this->_encodeForOutput($codePanel);
115:         $code .= $this->_generateActionCode();
116:         $code .= $this->_encodeForOutput($codeBottom);
117:         $code .= $this->generateViewCode();
118: 
119: $code = "\n\n<!-- CODE (class.content.type.user_forum.php) -->
120: $code
121: <!-- /CODE -->\n\n";
122: 
123:         return $code;
124:     }
125: 
126:     /**
127:      * Generates code for the base panel in which all data can be specified.
128:      *
129:      * @return string  The code for the base panel
130:      */
131:     private function _getPanel() {
132:         $wrapper = new cHTMLDiv(array(
133:             $this->_getModEmail(),
134:             $this->_getModMode(),
135:             $this->_getEditMode()
136:         ), $this->_prefix . '_panel_base', $this->_prefix . '_panel_base_' . $this->_id);
137:         $wrapper->setStyle('clear:both');
138: 
139:         return $wrapper->render();
140:     }
141: 
142:     private function _getModMode() {
143:         $id = 'userforum_modactive_' . $this->_id;
144: 
145:         // build html elements
146:         $labelModMode = new cHTMLLabel(UserForum::i18n('ACTIVATEMOD'), $id);
147:         $checkBoxMod = new cHTMLCheckbox($id, '', $id);
148:         $checkBoxMod->setID($id);
149: 
150:         // check state
151:         ($this->_settings['userforum_modactive'] === 'false') ? $checkBoxMod->setChecked(false) : $checkBoxMod->setChecked(true);
152: 
153:         // build div element as wrapper
154:         $div = new cHTMLDiv(array(
155:             '<br />',
156:             $labelModMode,
157:             $checkBoxMod
158:         ));
159:         $div->setClass('modMode');
160: 
161:         // return div element
162:         return $div;
163:     }
164: 
165:     private function _getEditMode() {
166:         $id = 'userforum_subcomments_' . $this->_id;
167: 
168:         // build html elements
169:         $labelModMode = new cHTMLLabel(UserForum::i18n('EDITABLE'), $id);
170:         $checkBoxMod = new cHTMLCheckbox($id, '', $id);
171:         $checkBoxMod->setID($id);
172: 
173:         // check state
174:         ($this->_settings['userforum_subcomments'] === 'false') ? $checkBoxMod->setChecked(false) : $checkBoxMod->setChecked(true);
175: 
176:         // build div element as wrapper
177:         $div = new cHTMLDiv(array(
178:             $labelModMode,
179:             $checkBoxMod
180:         ));
181:         $div->setClass('editMode');
182: 
183:         // return div element
184:         return $div;
185:     }
186: 
187:     /**
188:      * Builds a select element allowing to choose a single form that was created
189:      * for the current client.
190:      *
191:      * @return cHTMLDiv
192:      */
193:     private function _getModEmail() {
194:         $id = 'userforum_email_' . $this->_id;
195: 
196:         // build html elements
197:         $infoLabel = new cHTMLLabel(UserForum::i18n('MODSETTINGS'), $id);
198:         $labelEmail = new cHTMLLabel(UserForum::i18n('MODEMAIL'), $id);
199: 
200:         $inputEmail = new cHTMLTextbox($id);
201:         $inputEmail->setID($id);
202:         $inputEmail->setValue($this->_settings['userforum_email']);
203: 
204:         // build div element as wrapper
205:         $div = new cHTMLDiv(array(
206:             $labelEmail,
207:             $inputEmail
208:         ));
209:         $div->setClass('mail');
210:         // return div element
211:         return $div;
212:     }
213: 
214:     /**
215:      * Generates the code which should be shown if this content type is shown in
216:      * the frontend.
217:      * This code is cached. Thatfor ist no more than the initialisation of this
218:      * class and the call of its method buildCode(). Otherwise the generated
219:      * HTML would have been cached.
220:      *
221:      * @return string escaped HTML code which sould be shown if content type is
222:      *         shown in frontend
223:      */
224:     public function generateViewCode() {
225:         $code = '";?' . '><' . '?php $form = new %s(\'%s\', %s, %s); echo $form->buildCode(); ?' . '><' . '?php echo "';
226:         $code = sprintf($code, get_class($this), $this->_rawSettings, $this->_id, 'array()');
227: 
228:         return $code;
229:     }
230: 
231:     /**
232:      * Get code of form (either GET or POST request).
233:      *
234:      * @return string escaped HTML code which sould be shown if content type is
235:      *         shown in frontend
236:      */
237:     public function buildCode() {
238:         $out = '';
239:         return $out;
240:     }
241: 
242: }
243: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen