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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • ArticleForum
  • ArticleForumCollection
  • ArticleForumItem
  • ArticleForumLeftBottom
  • ArticleForumRightBottom
  • cContentTypeUserForum
  • UserForum
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the class for visualisation and interactions in the right frame.
  4:  *
  5:  * @package Plugin
  6:  * @subpackage UserForum
  7:  * @author Claus Schunk
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: /**
 17:  * This class contains builds the content of the right frame.
 18:  *
 19:  *
 20:  * @package Plugin
 21:  * @subpackage UserForum
 22:  */
 23: 
 24: global $area;
 25: 
 26: /**
 27:  * Class ArticleForumRightBottom
 28:  */
 29: class ArticleForumRightBottom extends cGuiPage {
 30: 
 31:     /**
 32:      * @var int
 33:      */
 34:     private $_indentFactor = 20;
 35: 
 36:     /**
 37:      * @var ArticleForumCollection
 38:      */
 39:     protected $_collection;
 40: 
 41:     /**
 42:      *
 43:      */
 44:     function __construct() {
 45: 
 46:         $this->_collection = new ArticleForumCollection();
 47:         parent::__construct('right_bottom', 'user_forum');
 48:         $this->addStyle('right_bottom.css');
 49:         $this->addScript('location.js');
 50:         // Reload left bottom in this code because of irregular update problems in the location file
 51:         $this->setReload();
 52:     }
 53: 
 54:     /**
 55:      * @param $timeStamp
 56:      *
 57:      * @return array
 58:      */
 59:     protected function formatTimeString($timeStamp) {
 60:         $nullstring = '0';
 61:         if ($timeStamp == "0000-00-00 00:00:00") {
 62:             return array();
 63:         } else {
 64:             $ar = (date_parse($timeStamp));
 65:             // if elements are smaller than 2 digits add a '0' at front. e.g
 66:             // 2:10 -> 02:10
 67:             (cString::getStringLength($ar['day']) < 2) ? $ar['day'] = $nullstring . $ar['day'] : '';
 68:             (cString::getStringLength($ar['month']) < 2) ? $ar['month'] = $nullstring . $ar['month'] : '';
 69:             (cString::getStringLength($ar['minute']) < 2) ? $ar['minute'] = $nullstring . $ar['minute'] : '';
 70:             (cString::getStringLength($ar['hour']) < 2) ? $ar['hour'] = $nullstring . $ar['hour'] : '';
 71:         }
 72: 
 73:         return $ar;
 74:     }
 75: 
 76:     /**
 77:      * this function returns an deactive link or an link with mail-to directive
 78:      * if the given mail adress is valid
 79:      *
 80:      * @param string $emailadr
 81:      * @param string $realname
 82:      * @return cHTMLLink
 83:      */
 84:     protected function checkValidEmail($emailadr, $realname) {
 85:         $regex = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/';
 86:         // Run the preg_match() function on regex against the email address
 87:         if (preg_match($regex, $emailadr)) {
 88:             $mail = new cHTMLLink();
 89:             $mail->setClass('emailactive');
 90:             $mail->setLink("mailto:" . $emailadr);
 91:             $mail->setContent($realname);
 92:         } else {
 93:             $mail = new cHTMLLink();
 94:             $mail->setLink('#');
 95:             $mail->setClass('emaildeactive');
 96:             $mail->setContent($realname);
 97:         }
 98:         return $mail;
 99:     }
100: 
101:     /**
102:      * this function builds buttons for user interactions
103:      *
104:      * @param $key
105:      * @param $cont
106:      * @param $cfg
107:      * @param $mod
108:      * 
109:      * @return array with buttons
110:      */
111:     protected function buildOnlineButtonBackendListMode(&$key, &$cont, &$cfg, $mod = null) {
112:         global $area;
113:         $buttons = array();
114: 
115:         $id = $cont['id_user_forum'];
116: 
117:         // shows onlineState
118:         $online = new cHTMLLink();
119:         if ($cont['online'] == 1) {
120:             $online->setImage($cfg['path']['images'] . 'online.gif');
121:             $online->setCustom('action', 'online_toggle');
122:             $online->setAlt(UserForum::i18n('SETOFFLINE'));
123:         } else {
124:             $online->setImage($cfg['path']['images'] . 'offline.gif');
125:             $online->setCustom('action', 'offline_toggle');
126:             $online->setAlt(UserForum::i18n('SETONLINE'));
127:         }
128: 
129:         $online->setCLink($area, 4, 'show_form');
130:         $online->setTargetFrame('right_bottom');
131:         $online->setStyle('margin-right:10px;');
132: 
133:         $online->setCustom('action', 'online_toggle');
134:         $online->setCustom('idart', $cont['idart']);
135:         $online->setCustom('id_user_forum', $cont['id_user_forum']);
136:         $online->setCustom('idcat', $cont['idcat']);
137:         $online->setCustom('online', $cont['online']);
138: 
139:         $online->setAttribute('method', 'get');
140: 
141:         // link to edit mode
142:         $edit = new cHTMLButton("edit");
143:         $edit->setImageSource($cfg['path']['images'] . 'but_todo.gif');
144:         $edit->setEvent('click', "$('form[name=$id]').submit()");
145:         $edit->setStyle('margin-right:10px; ');
146:         $edit->setMode('image');
147:         $edit->setAlt(UserForum::i18n('EDIT'));
148: 
149:         // additional params to identify actions from moderator startpage
150:         if (isset($mod)) {
151:             $online->setCustom('mod', true);
152:             // $edit->setCustom('mod', true);
153:         }
154: 
155:         $message = UserForum::i18n('ALLDELETEFROMCATHIER');
156:         $level = $cont['level'];
157:         $keyy = $key;
158:         $id = $cont['id_user_forum'];
159:         $idacat = $cont['idcat'];
160:         $idaart = $cont['idart'];
161: 
162:         // button with delete action
163:         $deleteButton = '<a title="' . $cont['title'] . '" href="javascript:void(0)" onclick="Con.showConfirmation(&quot;' . $message . '&quot;, function(){ deleteArticlesByIdRight(' . $level . ', ' . $keyy . ', ' . $id . ', ' . $idacat . ', ' . $idaart . '); });return false;"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . $message . '" alt="' . $message . '"></a>';
164: 
165:         // insert buttons to array for return
166:         $buttons['online'] = $online;
167:         $buttons['edit'] = $edit;
168:         $buttons['delete'] = $deleteButton;
169: 
170:         return $buttons;
171:     }
172: 
173:     /**
174:      * generate main menu
175:      *
176:      * @param array $result array with comments
177:      * @param null  $mod
178:      *
179:      * @return ArticleForumRightBottom|cHTMLTable
180:      * @throws cException
181:      */
182:     public function getMenu(&$result, $mod = null) {
183:         $table = new cHTMLTable();
184:         if (count($result) < 1) {
185:             return new cHTMLTable();
186:         }
187:         $table->setCellPadding('100px');
188:         global $area;
189:         $table->updateAttributes(array(
190:             "class" => "generic",
191:             "cellspacing" => "0",
192:             "cellpadding" => "2"
193:         ));
194: 
195:         if (count($result) > 0) {
196:             $tr = new cHTMLTableRow();
197:             $th = new cHTMLTableHead();
198:             $th->setContent(i18n("FORUM_POST", "user_forum"));
199:             $th->setStyle('text-align: center');
200:             $tr->appendContent($th);
201: 
202:             $th = new cHTMLTableHead();
203:             $th->setContent(i18n("ACTIONS", "user_forum"));
204:             $th->setStyle('widht:20px');
205:             $th->setStyle('text-align: center');
206:             $th->setAttribute('valign', 'top');
207:             $tr->appendContent($th);
208: 
209:             $table->appendContent($tr);
210:         }
211: 
212:         $menu = new cGuiMenu();
213:         $cfg = cRegistry::getConfig();
214: 
215:         foreach ($result as $key => $cont) {
216: 
217:             $set = false;
218:             $like = $cont['like'];
219:             $dislike = $cont['dislike'];
220:             $timestamp = $cont['timestamp'];
221: 
222:             $datearray = $this->formatTimeString($cont['timestamp']);
223:             $date =  (empty($datearray)) ? '' : $datearray['day'] . '.' . $datearray['month'] . '.' . $datearray['year'] . ' ' . UserForum::i18n("AT") . ' ' . $datearray['hour'] . ':' . $datearray['minute'] . ' ' . UserForum::i18n("CLOCK");
224: 
225:             $buttons = array();
226:             $buttons = $this->buildOnlineButtonBackendListMode($key, $cont, $cfg, $mod);
227: 
228:             $online = $buttons['online'];
229:             $edit = $buttons['edit'];
230:             $delete = $buttons['delete'];
231: 
232:             // row
233:             $tr = new cHTMLTableRow();
234:             $trLike = new cHTMLTableRow();
235: 
236:             $likeButton = new cHTMLImage($cfg['path']['images'] . 'like.png');
237:             // $likeButton->setAttribute('valign', 'bottom');
238:             $dislikeButton = new cHTMLImage($cfg['path']['images'] . 'dislike.png');
239: 
240:             // valid email
241:             $maili = $this->checkValidEmail($cont['email'], $cont['realname']);
242:             $text = $cont['forum'];
243: 
244:             $timestamp = $cont['editedat'];
245: 
246:             $editarray = $this->formatTimeString($cont['editedat']);
247:             $editdate = (empty($editarray)) ? '' : $editarray['day'] . '.' . $editarray['month'] . '.' . $editarray['year'] . ' ' . UserForum::i18n("AT") . ' ' . $editarray['hour'] . ':' . $editarray['minute'] . ' ' . UserForum::i18n("CLOCK");
248: 
249:             $userColl = new cApiUserCollection();
250:             $user = $userColl->loadItem($cont['editedby'])->get('username');
251: 
252:             if (($cont['editedby'] != '') && ($cont['editedat'] != '') && $cont['editedat'] != "0000-00-00 00:00:00") {
253:                 $edit_information = (UserForum::i18n("EDITED") . $editdate . ' ' . UserForum::i18n("FROM") . $user);
254:                 $edit_information = "<em>$edit_information</em>";
255:             } else {
256:                 $edit_information = "<br>";
257:             }
258: 
259:             $tdEmpty = new cHTMLTableData();
260:             $tdEmpty->appendContent($edit_information);
261:             $tdLike = new cHTMLTableData();
262:             $tdEmpty->setAttribute('valign', 'top');
263:             $tdLike->setAttribute('valign', 'top');
264:             $tdLike->setStyle('text-align: center');
265: 
266:             // add like/dislike functionality to table
267:             $tdLike->appendContent($likeButton);
268:             $tdLike->appendContent(" $like ");
269:             $tdLike->appendContent($dislikeButton);
270:             $tdLike->appendContent(" $dislike");
271: 
272:             // in new row
273:             $trLike->appendContent($tdEmpty);
274:             $trLike->appendContent($tdLike);
275: 
276:             // build form element
277:             $form = new cHTMLForm($cont['id_user_forum']);
278:             $form->setAttribute('action', 'main.php?' . "area=" . $area . '&frame=4');
279: 
280:             $tdForm = new cHTMLTableData();
281:             $tdForm->setStyle('padding-left:' . $cont['level'] * $this->_indentFactor . 'px');
282: 
283:             // build buttons
284:             $tdButtons = new cHTMLTableData();
285:             $tdButtons->setAttribute('valign', 'top');
286:             $tdButtons->setStyle(' text-align: center');
287: 
288:             $tdButtons->appendContent($online);
289: 
290:             // not allowed at moderator starpage overview
291:             $tdButtons->appendContent($edit);
292:             if (!isset($mod)) {
293:                 $tdButtons->appendContent($delete);
294:             }
295: 
296:             $tdButtons->appendContent('<br>');
297:             $tdButtons->appendContent('<br>');
298: 
299:             // create hidden-fields
300:             $hiddenIdart = new cHTMLHiddenField('idart');
301:             $hiddenIdcat = new cHTMLHiddenField('idcat');
302:             $hiddenId_user_forum = new cHTMLHiddenField('id_user_forum');
303:             $hiddenLike = new cHTMLHiddenField('like');
304:             $hiddenDislike = new cHTMLHiddenField('dislike');
305:             $hiddenName = new cHTMLHiddenField('realname');
306:             $hiddenEmail = new cHTMLHiddenField('email');
307:             $hiddenLevel = new cHTMLHiddenField('level');
308:             $hiddenEditdat = new cHTMLHiddenField('editedat');
309:             $hiddenEditedby = new cHTMLHiddenField('editedby');
310:             $hiddenTimestamp = new cHTMLHiddenField('timestamp');
311:             $hiddenForum = new cHTMLHiddenField('forum');
312:             $hiddenOnline = new cHTMLHiddenField('online');
313:             $hiddenMode = new cHTMLHiddenField('mode');
314:             $hiddenKey = new cHTMLHiddenField('key');
315:             $hiddenaction = new cHTMLHiddenField('action');
316: 
317:             // set values
318:             $hiddenIdart->setValue($cont['idart']);
319:             $hiddenIdcat->setValue($cont['idcat']);
320:             $hiddenId_user_forum->setValue($cont['id_user_forum']);
321:             $hiddenLike->setValue($cont['like']);
322:             $hiddenDislike->setValue($cont['dislike']);
323:             $hiddenName->setValue(str_replace('\\', '', conHtmlSpecialChars($cont['realname'])));
324:             $hiddenEmail->setValue(str_replace('\\', '', conHtmlSpecialChars($cont['email'])));
325:             $hiddenLevel->setValue($cont['level']);
326:             $hiddenEditdat->setValue($cont['editedat']);
327:             $hiddenEditedby->setValue($cont['editedby']);
328:             $hiddenTimestamp->setValue($date);
329:             $hiddenForum->setValue(str_replace('\\', '', conHtmlSpecialChars($cont['forum'])));
330:             $hiddenOnline->setValue($cont['online']);
331:             $hiddenMode->setValue('edit');
332:             $hiddenKey->setValue($key);
333:             $hiddenaction->setValue('edit');
334: 
335:             // append to hidden-fields to form
336:             $form->appendContent($hiddenIdart);
337:             $form->appendContent($hiddenIdcat);
338:             $form->appendContent($hiddenId_user_forum);
339:             $form->appendContent($hiddenLike);
340:             $form->appendContent($hiddenDislike);
341:             $form->appendContent($hiddenName);
342:             $form->appendContent($hiddenEmail);
343:             $form->appendContent($hiddenLevel);
344:             $form->appendContent($hiddenForum);
345:             $form->appendContent($hiddenEditdat);
346:             $form->appendContent($hiddenEditedby);
347:             $form->appendContent($hiddenTimestamp);
348:             $form->appendContent($hiddenMode);
349:             $form->appendContent($hiddenOnline);
350:             $form->appendContent($hiddenKey);
351:             $form->appendContent($hiddenaction);
352: 
353:             if (isset($mod)) {
354:                 $form->appendContent(new cHTMLHiddenField('mod'));
355:             }
356: 
357:             // generate output text
358:             $form->appendContent($date . " von " . str_replace('\\', '', $maili) . " <br><br>");
359:             $form->appendContent((str_replace('\\', '', $text)) . "<br><br>");
360: 
361:             $tdForm->setContent($form);
362:             $tdForm->setAttribute('valign', 'top');
363:             $tr->setContent($tdForm);
364:             $tr->appendContent($tdButtons);
365:             $tr->appendContent($trLike);
366:             $table->appendContent($tr);
367:         }
368: 
369:         $this->appendContent($table);
370: 
371:         return $this;
372:     }
373: 
374:     /**
375:      * generate dialog for editmode
376:      *
377:      * @param array $post
378:      *
379:      * @return ArticleForumRightBottom
380:      * @throws cDbException
381:      * @throws cException
382:      */
383:     protected function getEditModeMenu($post) {
384: 
385:         global $area;
386:         $changes = 0;
387:         $cfg = cRegistry::getConfig();
388:         $idart = cRegistry::getArticleId();
389:         $idcat = cRegistry::getCategoryId();
390:         $menu = new cGuiMenu();
391:         $tr = new cHTMLTableRow();
392: 
393:         $th = new cHTMLTableHead();
394:         $th->setContent(UserForum::i18n("PARAMETER"));
395: 
396:         $th2 = new cHTMLTableHead();
397:         $th2->setContent(UserForum::i18n("CONTENT"));
398:         $th2->setStyle('widht:50px');
399:         $th2->setAttribute('valign', 'top');
400:         $tr->appendContent($th);
401:         $tr->appendContent($th2);
402: 
403:         // build form element
404:         $form1 = new cGuiTableForm("comment", "main.php?area=user_forum&frame=4", "post");
405:         $form1->addHeader($tr);
406:         $form1->setTableID("table");
407: 
408:         $user = new cApiUser();
409:         $user->loadByPrimaryKey($post['editedby']);
410:         $username = $user->getField('username');
411: 
412:         $id = $post['id_user_forum'];
413: 
414:         $likeButton = new cHTMLImage($cfg['path']['images'] . 'like.png');
415:         $dislikeButton = new cHTMLImage($cfg['path']['images'] . 'dislike.png');
416: 
417:         $name = new cHTMLTextBox("realname", str_replace('\\', '',(conHtmlSpecialChars($post['realname']))), 30, 255);
418:         $email = new cHTMLTextBox("email", $post['email'], 30, 255);
419:         $like = new cHTMLTextBox("like", $post['like'], 7, 7);
420:         $dislike = new cHTMLTextBox("dislike", $post['dislike'], 7, 7);
421: 
422:         $text = str_replace("<br />", "\n", conHtmlSpecialChars($post['forum']));
423:         $text = str_replace('\\', '', $text);
424: 
425:         $forum = new cHTMLTextArea("forum", $text);
426: 
427:         $datearray = $this->formatTimeString($post['timestamp']);
428:         $date = (empty($datearray)) ? '' : $datearray['day'] . '.' . $datearray['month'] . '.' . $datearray['year'] . ' ' . UserForum::i18n("AT") . ' ' . $datearray['hour'] . ':' . $datearray['minute'] . ' ' . UserForum::i18n("CLOCK");
429: 
430:         $editedatearray = $this->formatTimeString($post['editedat']);
431:         $editedat = (empty($editedatearray)) ? '' : $editedatearray['day'] . '.' . $editedatearray['month'] . '.' . $editedatearray['year'] . ' ' . UserForum::i18n("AT") . ' ' . $editedatearray['hour'] . ':' . $editedatearray['minute'] . ' ' . UserForum::i18n("CLOCK");
432: 
433:         $timestamp = new cHTMLTextBox("timestamp", $date, 30, 255);
434:         $editedat = new cHTMLTextBox("editedat", $editedat, 30, 255);
435:         $editedby = new cHTMLTextBox("editedby", $username, 30, 255);
436: 
437:         $editedat->setDisabled(true);
438:         $timestamp->setDisabled(true);
439:         $editedby->setDisabled(true);
440: 
441:         $form1->add(UserForum::i18n("USER"), $name, '');
442:         $form1->add(UserForum::i18n("EMAIL"), $email, '');
443:         $form1->add(UserForum::i18n("LIKE"), $like, '');
444:         $form1->add(UserForum::i18n("DISLIKE"), $dislike, '');
445:         $form1->add(UserForum::i18n("TIME"), $timestamp, '');
446:         $form1->add(UserForum::i18n("EDITDAT"), $editedat, '');
447:         $form1->add(UserForum::i18n("EDITEDBY"), $editedby, '');
448: 
449:         // handle moderation mode actions
450:         if (isset($post['mod'])) {
451:             $form1->setVar('mod', 'mod');
452:             $form1->addCancel("main.php?area=user_forum&frame=4&action=back&mod=mod");
453:         } else {
454:             $form1->addCancel("main.php?area=user_forum&frame=4&action=back&idart=$idart&idcat=$idcat");
455:         }
456: 
457:         $onlineBox = new cHTMLCheckbox("onlineState", "");
458: 
459:         $onlineBox->setChecked(($post['online'] == 1) ? true : false);
460:         $form1->add(UserForum::i18n("ONLINE"), $onlineBox, '');
461: 
462:         $idart = $post['idart'];
463:         $idcat = $post['idcat'];
464: 
465:         $form1->add(UserForum::i18n("COMMENT"), $forum, '');
466: 
467:         // $form1->setVar('online', $post['online']);
468:         $form1->setVar("id_user_forum", $post['id_user_forum']);
469:         $form1->setVar("idart", $post['idart']);
470:         $form1->setVar("idcat", $post['idcat']);
471:         $form1->setVar("action", 'update');
472:         $form1->setVar("mode", "list");
473:         $form1->setVar("activeChanges", $changes);
474: 
475:         $this->appendContent($form1);
476: 
477:         return $this;
478:     }
479: 
480:     /**
481:      * @param $id_cat
482:      * @param $id_art
483:      * @param $id_lang
484:      *
485:      * @return ArticleForumRightBottom
486:      * @throws cException
487:      */
488:     public function getForum($id_cat, $id_art, $id_lang) {
489:         $arrUsers = $this->_collection->getExistingforum();
490: 
491:         $arrforum = array();
492: 
493:         $this->_collection->getTreeLevel($id_cat, $id_art, $id_lang, $arrUsers, $arrforum);
494:         $result = array();
495:         $this->normalizeArray($arrforum, $result);
496: 
497:         $ret = $this->getMenu($result);
498: 
499:         return $ret;
500:     }
501: 
502:     /**
503:      * @param array $arrforum
504:      * @param array $result
505:      * @param int   $level
506:      */
507:     protected function normalizeArray($arrforum, &$result, $level = 0) {
508:         if (is_array($arrforum)) {
509:             foreach ($arrforum as $key => $value) {
510:                 $value['level'] = $level;
511:                 unset($value['children']);
512:                 $result[$key] = $value;
513:                 $this->normalizeArray($arrforum[$key]['children'], $result, $level + 1);
514:             }
515:         }
516:     }
517: 
518:     /**
519:      * this function calls different actions depending on the received values
520:      * via $_POST oder $_GET.
521:      *
522:      * @param $get
523:      * @param $post
524:      * @throws Exception
525:      */
526:     public function receiveData(&$get, &$post) {
527:         if (isset($_REQUEST['action']) && $_REQUEST['action'] != NULL) {
528:             $this->switchActions();
529:         }
530:     }
531: 
532:     /**
533:      * @throws cException
534:      */
535:     public function getStartpage()
536:     {
537:         $cGuiNotification = new cGuiNotification();
538:         echo $cGuiNotification->returnNotification(cGuiNotification::LEVEL_INFO, UserForum::i18n('MODMODE'));
539:         echo '<br />';
540: 
541:         $comments = $this->_collection->getUnmoderatedComments();
542:         $this->getMenu($comments, 'mod');
543:     }
544: 
545:     /**
546:      * switch case action calling
547:      *
548:      * @throws Exception
549:      */
550:     protected function switchActions() {
551: 
552:         $lang = cRegistry::getLanguageId();
553:         $idart = $_REQUEST['idart'];
554:         $idcat = $_REQUEST['idcat'];
555:         $action = $_REQUEST["action"];
556:         $online = (isset($_REQUEST['onlineState'])) ? 1 : 0;
557: 
558:         switch ($action) {
559: 
560:             // after click on online button in std dialog
561:             case 'online_toggle':
562:                 $this->_collection->toggleOnlineState($_REQUEST['online'], $_REQUEST['id_user_forum'], $idart);
563: 
564:                 if(!isset($_REQUEST['mod'])) {
565:                     $this->getForum($idcat, $idart, $lang);
566:                 } else{
567:                     $this->getStartpage();
568:                 }
569: 
570:                 break;
571:             // after click on delete button in std dialog
572:             case 'deleteComment':
573:                 $this->_collection->deleteHierarchy($_REQUEST['key'], $_REQUEST['level'], $idart, $idcat, $lang);
574:                 $this->getForum($idcat, $idart, $lang);
575:                 break;
576:             // after click on save button in edit dialog
577:             case 'update':
578:                 $this->_collection->updateValues($_POST['id_user_forum'], $_POST['realname'], $_POST['email'], $_POST['like'], $_POST['dislike'], $_POST['forum'], $online);
579:                 if(!isset($_REQUEST['mod'])) {
580:                     $this->getForum($idcat, $idart, $lang);
581:                 } else{
582:                     $this->getStartpage();
583:                 }
584: 
585:                 break;
586:             case 'show_form':
587:                 // lists all comments from given articleId
588:                 $this->getForum($idcat, $idart, $lang);
589:                 break;
590:             case 'edit':
591:                 // shows edit mode for a comment
592:                 $this->getEditModeMenu($_POST);
593:                 break;
594:                 // cancel Button in edit dialog
595:             case 'back':
596:                 if(!isset($_REQUEST['mod'])) {
597:                     $this->getForum($idcat, $idart, $lang);
598:                 } else{
599:                     $this->getStartpage();
600:                 }
601:                 // $this->getForum($idcat, $idart, $lang);
602:                 break;
603:             case 'empty':
604:                 // $this->getForum($idcat, $idart, $lang);
605:                 break;
606:             default:
607:                 $this->getForum($idcat, $idart, $lang);
608:                 throw new Exception('$_GET["action"] type ' . $_REQUEST["action"] . ' not implemented');
609:         }
610:     }
611: 
612: }
613: 
614: ?>
CMS CONTENIDO 4.10.1 API documentation generated by ApiGen 2.8.0