Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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

Classes

  • ArticleForumCollection
  • ArticleForumItem
  • ArticleForumLeftBottom
  • cContentTypeUserForum
  • UserForum
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the collection class for userforum plugin.
  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: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * This class contains functions for dB manipulations and for the interaction
 19:  * between the frontend module
 20:  * content_user_forum and the backend plugin.
 21:  *
 22:  * @package Plugin
 23:  * @subpackage UserForum
 24:  */
 25: class ArticleForumCollection extends ItemCollection {
 26: 
 27:     /**
 28:      *
 29:      * @var unknown_type
 30:      */
 31:     protected $cfg = 0;
 32: 
 33:     /**
 34:      *
 35:      * @var unknown_type
 36:      */
 37:     protected $db = 0;
 38: 
 39:     /**
 40:      *
 41:      * @var unknown_type
 42:      */
 43:     protected $item = 0;
 44: 
 45:     // contents array of translations from frontend module
 46:     /**
 47:      *
 48:      * @var unknown_type
 49:      */
 50:     protected $languageSync = 0;
 51: 
 52:     /**
 53:      *
 54:      * @var unknown_type
 55:      */
 56:     protected $idContentType = 0;
 57: 
 58:     /**
 59:      */
 60:     public function __construct() {
 61:         // sync time
 62:         date_default_timezone_set('Europe/Berlin');
 63:         $this->db = cRegistry::getDb();
 64:         $this->cfg = cRegistry::getConfig();
 65: 
 66:         parent::__construct($this->cfg['tab']['user_forum'], 'id_user_forum');
 67:         $this->_setItemClass('ArticleForum');
 68:         $this->item = new ArticleForumItem();
 69:         $this->idContentType = $this->getIdUserForumContenType();
 70:     }
 71: 
 72:     /**
 73:      *
 74:      * @return multitype:
 75:      */
 76:     public function getAllCommentedArticles() {
 77: 
 78:         $idclient = cRegistry::getClientId();
 79: 
 80: 
 81:         $this->db->query("-- ArticleForumCollection->getAllCommentedArticles()
 82:             SELECT DISTINCT
 83:                 art_lang.title
 84:                 , art_lang.idart
 85:                 , f.idcat
 86:             FROM
 87:                 `{$this->cfg[tab][art_lang]}` AS art_lang
 88:                 , `$this->table` AS  f
 89:             WHERE
 90:                 art_lang.idart = f.idart
 91:                 AND art_lang.idlang = f.idlang
 92:                 AND idclient = ".$idclient."
 93:             ORDER BY
 94:                 id_user_forum ASC
 95:             ;");
 96: 
 97:         $data = array();
 98:         while ($this->db->nextRecord()) {
 99:             array_push($data, $this->db->toArray());
100:         }
101: 
102:         return $data;
103:     }
104: 
105:     /**
106:      * deletes comment with all subcomments from this comment
107:      *
108:      * @param $keyPost
109:      * @param $level
110:      * @param $idart
111:      * @param $idcat
112:      * @param $lang
113:      */
114:     public function deleteHierarchie($keyPost, $level, $idart, $idcat, $lang) {
115:         $comments = $this->_getCommentHierachrie($idcat, $idart, $lang);
116: 
117:         $arri = array();
118: 
119:         foreach ($comments as $key => $com) {
120:             $com['key'] = $key;
121:             $arri[] = $com;
122:         }
123:         $idEntry = 0;
124:         $id_user_forum = array();
125:         $lastLevel = 0;
126:         for ($i = 0; $i < count($arri); $i++) {
127:             // select Entry
128:             if ($arri[$i]['key'] == $keyPost) {
129:                 $idEntry = $arri[$i]['id_user_forum'];
130:                 if ($arri[$i]['level'] < $arri[$i + 1]['level']) {
131:                     // check for more subcomments
132:                     for ($j = $i + 1; $j < $arri[$j]; $j++) {
133:                         if ($arri[$i]['level'] < $arri[$j]['level']) {
134:                             $id_user_forum[] = $arri[$j]['id_user_forum'];
135:                         }
136:                     }
137:                 }
138:             }
139:         }
140: 
141:         if (empty($id_user_forum)) {
142:             $this->deleteBy('id_user_forum', $idEntry);
143:         } else {
144:             $this->deleteBy('id_user_forum', $idEntry);
145:             foreach ($id_user_forum as $com) {
146:                 $this->deleteBy('id_user_forum', $com);
147:             }
148:         }
149:     }
150: 
151:     /**
152:      *
153:      * @param unknown_type $id_cat
154:      * @param unknown_type $id_art
155:      * @param unknown_type $id_lang
156:      * @return multitype:
157:      */
158:     protected function _getCommentHierachrie($id_cat, $id_art, $id_lang) {
159:         $this->query();
160:         while (false != $field = $this->next()) {
161:             $arrUsers[$field->get('userid')]['email'] = $field->get('email');
162:             $arrUsers[$field->get('userid')]['realname'] = $field->get('realname');
163:         }
164:         $arrforum = array();
165:         $this->getTreeLevel($id_cat, $id_art, $id_lang, $arrUsers, $arrforum);
166:         $result = array();
167:         $this->normalizeArray($arrforum, $result);
168: 
169:         return $result;
170:     }
171: 
172:     /**
173:      *
174:      * @param unknown_type $arrforum
175:      * @param unknown_type $result
176:      * @param unknown_type $level
177:      */
178:     public function normalizeArray($arrforum, &$result, $level = 0) {
179:         if (is_array($arrforum)) {
180:             foreach ($arrforum as $key => $value) {
181:                 $value['level'] = $level;
182:                 unset($value['children']);
183:                 $result[$key] = $value;
184:                 $this->normalizeArray($arrforum[$key]['children'], $result, $level + 1);
185:             }
186:         }
187:     }
188: 
189:     /**
190:      *
191:      * @param unknown_type $id_cat
192:      * @param unknown_type $id_art
193:      * @param unknown_type $id_lang
194:      * @param unknown_type $arrUsers
195:      * @param unknown_type $arrforum
196:      * @param unknown_type $parent
197:      * @param unknown_type $frontend
198:      */
199:     public function getTreeLevel($id_cat, $id_art, $id_lang, &$arrUsers, &$arrforum, $parent = 0, $frontend = false) {
200:         $db = cRegistry::getDb();
201:         if ($frontend) {
202:             // select only comments that are marked visible in frontendmode.
203:             $db->query("-- ArticleForumCollection->getTreeLevel()
204:                 SELECT
205:                     *
206:                 FROM
207:                     `{$this->cfg[tab][user_forum]}`
208:                 WHERE
209:                     idart = $id_art
210:                     AND idcat = $id_cat
211:                     AND idlang = $id_lang
212:                     AND id_user_forum_parent = $parent
213:                     AND online = 1
214:                 ORDER BY
215:                     timestamp DESC
216:                 ;");
217:         } else {
218:             // select all comments -> used in backendmode.
219:             $db->query("-- ArticleForumCollection->getTreeLevel()
220:                 SELECT
221:                     *
222:                 FROM
223:                     `{$this->cfg[tab][user_forum]}`
224:                 WHERE
225:                     idart = $id_art
226:                     AND idcat = $id_cat
227:                     AND idlang = $id_lang
228:                     AND id_user_forum_parent = $parent
229:                 ORDER BY
230:                     timestamp DESC
231:                 ;");
232:         }
233: 
234:         while ($db->nextRecord()) {
235:             $arrforum[$db->f('id_user_forum')]['userid'] = $db->f('userid');
236: 
237:             if (array_key_exists($db->f('userid'), $arrUsers)) {
238:                 $arrforum[$db->f('id_user_forum')]['email'] = $arrUsers[$db->f('userid')]['email'];
239:                 $arrforum[$db->f('id_user_forum')]['realname'] = $arrUsers[$db->f('userid')]['realname'];
240:             } else {
241:                 $arrforum[$db->f('id_user_forum')]['email'] = $db->f('email');
242:                 $arrforum[$db->f('id_user_forum')]['realname'] = $db->f('realname');
243:             }
244:             $arrforum[$db->f('id_user_forum')]['forum'] = str_replace(chr(13) . chr(10), '<br />', $db->f('forum'));
245:             $arrforum[$db->f('id_user_forum')]['forum_quote'] = str_replace(chr(13) . chr(10), '<br />', $db->f('forum_quote'));
246:             $arrforum[$db->f('id_user_forum')]['timestamp'] = $db->f('timestamp');
247:             $arrforum[$db->f('id_user_forum')]['like'] = $db->f('like');
248:             $arrforum[$db->f('id_user_forum')]['dislike'] = $db->f('dislike');
249: 
250:             $arrforum[$db->f('id_user_forum')]['editedat'] = $db->f('editedat');
251:             $arrforum[$db->f('id_user_forum')]['editedby'] = $db->f('editedby');
252: 
253:             // Added values to array for allocation
254:             $arrforum[$db->f('id_user_forum')]['idcat'] = $db->f('idcat');
255:             $arrforum[$db->f('id_user_forum')]['idart'] = $db->f('idart');
256:             $arrforum[$db->f('id_user_forum')]['id_user_forum'] = $db->f('id_user_forum');
257:             $arrforum[$db->f('id_user_forum')]['online'] = $db->f('online');
258:             $arrforum[$db->f('id_user_forum')]['editedat'] = $db->f('editedat');
259:             $arrforum[$db->f('id_user_forum')]['editedby'] = $db->f('editedby');
260: 
261:             $this->getTreeLevel($id_cat, $id_art, $id_lang, $arrUsers, $arrforum[$db->f('id_user_forum')]['children'], $db->f('id_user_forum'), $frontend);
262:         }
263:     }
264: 
265:     /**
266:      *
267:      * @param unknown_type $id_user_forum
268:      * @param unknown_type $name
269:      * @param unknown_type $email
270:      * @param unknown_type $like
271:      * @param unknown_type $dislike
272:      * @param unknown_type $forum
273:      * @param unknown_type $online
274:      * @param unknown_type $checked
275:      */
276:     public function updateValues($id_user_forum, $name, $email, $like, $dislike, $forum, $online, $checked) {
277:         $uuid = cRegistry::getAuth()->isAuthenticated();
278: 
279:         $this->item->loadByPrimaryKey($id_user_forum);
280: 
281:         if ($this->item->getField('realname') == $name && $this->item->getField('email') == $email && $this->item->getField('forum') == $forum) {
282: 
283:             // load timestamp from db to check if the article was already
284:             // edited.
285:             if ($this->item->getField('editedat') === "0000-00-00 00:00:00") {
286:                 // case : never edited
287:                 $timeStamp = "0000-00-00 00:00:00";
288:             } else {
289:                 $timeStamp = $this->item->getField('editedat');
290:             }
291:         } else {
292:             // actual timestamp: Content was edited
293:             $timeStamp = date('Y-m-d H:i:s', time());
294:         }
295: 
296:         if (preg_match('/\D/', $like)) {
297:             $like = $this->item->getField('like');
298:         }
299: 
300:         if (preg_match('/\D/', $dislike)) {
301:             $dislike = $this->item->getField('dislike');
302:         }
303: 
304:         // check for negative inputs
305:         // does not work with php 5.2
306:         // (!preg_match('/\D/', $like))? : $like =
307:         // $this->item->getField('like');
308:         // (!preg_match('/\D/', $dislike))? : $dislike =
309:         // $this->item->getField('dislike');
310: 
311:         $fields = array(
312:             'realname' => $name,
313:             'editedby' => $uuid,
314:             'email' => $email,
315:             'forum' => $forum,
316:             'editedat' => $timeStamp,
317:             'like' => $like,
318:             'dislike' => $dislike,
319:             'online' => $online
320:         );
321: 
322:         $whereClauses = array(
323:             'id_user_forum' => $id_user_forum
324:         );
325:         $statement = $this->db->buildUpdate($this->table, $fields, $whereClauses);
326:         $this->db->query($statement);
327:     }
328: 
329:     /**
330:      * toggles the given input with update in db.
331:      *
332:      * @param $onlineState
333:      * @param int $id_user_forum primary key
334:      */
335:     public function toggleOnlineState($onlineState, $id_user_forum) {
336:         // toggle state
337:         $onlineState = ($onlineState == 0) ? 1 : 0;
338: 
339:         $fields = array(
340:             'online' => $onlineState
341:         );
342:         $whereClauses = array(
343:             'id_user_forum' => (int) $id_user_forum
344:         );
345:         $statement = $this->db->buildUpdate($this->table, $fields, $whereClauses);
346:         $this->db->query($statement);
347:     }
348: 
349:     /**
350:      * email notification for registred moderator.
351:      * before calling this function it is necessary to receive the converted
352:      * language string from frontend module.
353:      *
354:      * @param unknown_type $realname
355:      * @param unknown_type $email
356:      * @param unknown_type $forum
357:      * @param unknown_type $idart
358:      * @param unknown_type $lang
359:      * @param unknown_type $forum_quote
360:      */
361:     public function mailToModerator($realname, $email, $forum, $idart, $lang, $forum_quote = 0) {
362: 
363:         // get article name
364:         $ar = $this->getArticleTitle($idart, $lang);
365: 
366:         $mail = new cMailer();
367:         $mail->setCharset('UTF-8');
368: 
369:         // build message content
370:         $message = $this->languageSync['NEWENTRYTEXT'] . " " . $this->languageSync['ARTICLE'] . $ar[0]["title"] . "\n" . "\n";
371:         $message .= $this->languageSync['USER'] . ' : ' . $realname . "\n";
372:         $message .= $this->languageSync['EMAIL'] . ' : ' . $email . "\n" . "\n";
373:         $message .= $this->languageSync['COMMENT'] . ' : ' . "\n" . $forum . "\n";
374:         if ($forum_quote != 0) {
375:             $message .= UserForum::i18n('QUOTE') . ' : ' . $forum_quote . "\n";
376:         }
377: 
378:         // send mail only if modEmail is set -> minimize traffic.
379:         if ($this->getModEmail($idart) != NULL) {
380:             $mail->sendMail(getEffectiveSetting("userforum", "mailfrom"), $this->getModEmail($idart), $this->languageSync['NEWENTRY'], $message);
381:         }
382:     }
383: 
384:     /**
385:      *
386:      * @param unknown_type $idart
387:      * @param unknown_type $idlang
388:      * @return multitype:
389:      */
390:     public function getArticleTitle($idart, $idlang) {
391:         $this->db->query("-- ArticleForumCollection->getArticleTitle()
392:             SELECT DISTINCT
393:                 title
394:             FROM
395:                 `{$this->cfg[tab][art_lang]}` AS art_lang
396:             WHERE
397:                 idart = $idart
398:                 AND idlang = $idlang
399:             ;");
400: 
401:         $data = array();
402:         while ($this->db->nextRecord()) {
403:             array_push($data, $this->db->toArray());
404:         }
405: 
406:         return $data;
407:     }
408: 
409:     /**
410:      *
411:      * @param $id_cat
412:      * @param $id_art
413:      * @param $id_lang
414:      * @return ArticleForumRightBottom
415:      */
416:     public function getExistingforum($id_cat, $id_art, $id_lang) {
417:         $userColl = new cApiUserCollection();
418:         $userColl->query();
419: 
420:         while (($field = $userColl->next()) != false) {
421:             $arrUsers[$field->get('user_id')]['email'] = $field->get('email');
422:             $arrUsers[$field->get('user_id')]['realname'] = $field->get('realname');
423:         }
424:         return $arrUsers;
425:     }
426: 
427:     /**
428:      *
429:      * @param unknown_type $idquote
430:      * @return multitype:NULL
431:      */
432:     function selectNameAndNameByForumId($idquote) {
433:         $ar = array();
434:         $this->item->loadByPrimaryKey($this->db->escape($idquote));
435:         $ar[] = $this->item->get('realname');
436:         return $ar;
437:     }
438: 
439:     /**
440:      *
441:      * @param unknown_type $userid
442:      */
443:     public function selectUser($userid) {
444:         return $this->item->loadByPrimaryKey($this->db->escape($userid));
445:     }
446: 
447:     /**
448:      * this function increments the actual value of likes from a comment and
449:      * persists it.
450:      *
451:      * @param $forum_user_id identifies a comment.
452:      */
453:     public function incrementLike($forum_user_id) {
454:         $db = cRegistry::getDb();
455:         $ar = array();
456:         // load actual value
457:         $this->item->loadByPrimaryKey($db->escape($forum_user_id));
458:         $ar = $this->item->toArray();
459:         $current = $ar['like'];
460:         // increment value
461:         $current += 1;
462: 
463:         $fields = array(
464:             'like' => $current
465:         );
466:         $whereClauses = array(
467:             'id_user_forum' => $forum_user_id
468:         );
469:         // persist inkremented value
470:         $statement = $this->db->buildUpdate($this->table, $fields, $whereClauses);
471:         $this->db->query($statement);
472:     }
473: 
474:     /**
475:      * this function inkrements the actual value of dislikes from a comment and
476:      * persists it.
477:      *
478:      * @param $forum_user_id identifies a comment.
479:      */
480:     public function incrementDislike($forum_user_id) {
481:         $db = cRegistry::getDb();
482:         $ar = array();
483:         // load actual value
484:         $this->item->loadByPrimaryKey($db->escape($forum_user_id));
485:         $ar = $this->item->toArray();
486:         $current = $ar['dislike'];
487:         // increment value
488:         $current += 1;
489: 
490:         $fields = array(
491:             'dislike' => $current
492:         );
493:         $whereClauses = array(
494:             'id_user_forum' => $forum_user_id
495:         );
496:         // persist inkremented value
497:         $statement = $this->db->buildUpdate($this->table, $fields, $whereClauses);
498:         $this->db->query($statement);
499:     }
500: 
501:     /**
502:      * persists a new comment created at the frontend module.
503:      *
504:      * @param $parent
505:      * @param $idart
506:      * @param $idcat
507:      * @param $lang
508:      * @param $userid
509:      * @param $email
510:      * @param $realname
511:      * @param $forum
512:      * @param $forum_quote
513:      */
514:     public function insertValues($parent, $idart, $idcat, $lang, $userid, $email, $realname, $forum, $forum_quote) {
515:         $db = cRegistry::getDb();
516: 
517:         // comments are marked as offline if the moderator mode is turned on.
518:         $modCheck = $this->getModeModeActive($idart);
519:         $online = $modCheck? 0 : 1;
520: 
521:         // build array for sql statemant
522:         $fields = array(
523:             'id_user_forum' => NULL,
524:             'id_user_forum_parent' => $db->escape($parent),
525:             'idart' => $db->escape($idart),
526:             'idcat' => $db->escape($idcat),
527:             'idlang' => $db->escape($lang),
528:             'userid' => $db->escape($userid),
529:             'email' => $db->escape($email),
530:             'realname' => $db->escape($realname),
531:             'forum' => ($forum),
532:             'forum_quote' => ($forum_quote),
533:             'idclient' => cRegistry::getClientId(),
534:             'like' => 0,
535:             'dislike' => 0,
536:             'editedat' => NULL,
537:             'editedby' => NULL,
538:             'timestamp' => date('Y-m-d H:i:s'),
539:             'online' => $online
540:         );
541: 
542:         $db->insert($this->table, $fields);
543: 
544:         // if moderator mode is turned on the moderator will receive an email
545:         // with the new comment and is able to
546:         // change the online state in the backend.
547:         if ($modCheck) {
548:             $this->mailToModerator($realname, $email, $forum, $idart, $lang, $forum_quote = 0);
549:         }
550:     }
551: 
552:     /**
553:      * this function deletes all comments related to the same articleId
554:      *
555:      * @param articleId $idart
556:      */
557:     public function deleteAllCommentsById($idart) {
558:         // var_dump($idart);
559:         $this->deleteBy('idart', (int) $idart);
560:     }
561: 
562:     /**
563:      *
564:      * @param unknown_type $id_cat
565:      * @param unknown_type $id_art
566:      * @param unknown_type $id_lang
567:      * @param unknown_type $frontend
568:      * @return multitype:
569:      */
570:     public function getExistingforumFrontend($id_cat, $id_art, $id_lang, $frontend) {
571:         // $cfg = cRegistry::getConfig();
572:         // $db = cRegistry::getDb();
573:         $userColl = new cApiUserCollection();
574:         $userColl->query();
575: 
576:         while (($field = $userColl->next()) != false) {
577:             $arrUsers[$field->get('user_id')]['email'] = $field->get('email');
578:             $arrUsers[$field->get('user_id')]['realname'] = $field->get('realname');
579:         }
580: 
581:         $arrforum = array();
582:         $this->getTreeLevel($id_cat, $id_art, $id_lang, $arrUsers, $arrforum, 0, $frontend);
583: 
584:         $result = array();
585:         $this->normalizeArray($arrforum, $result);
586:         return $result;
587:     }
588: 
589:     /**
590:      * returns the emailadress from the moderator for this article
591:      *
592:      * @param articleid $idart
593:      * @return string
594:      */
595:     public function getModEmail($idart) {
596:         $data = $this->readXML();
597:         for ($i = 0; $i < count($data); $i++) {
598:             if ($data[$i]['idart'] == $idart) {
599:                 return $data[$i]["email"];
600:             }
601:         }
602:         return NULL;
603:     }
604: 
605:     /**
606:      * returns if moderator mode is actice for this article
607:      *
608:      * @param articleid $idart
609:      * @return bool
610:      */
611:     public function getModeModeActive($idart) {
612:         $data = $this->readXML();
613:         for ($i = 0; $i < count($data); $i++) {
614:             if ($data[$i]['idart'] == $idart) {
615:                 if ($data[$i]["modactive"] === 'false') {
616:                     return false;
617:                 }
618:             }
619:         }
620:         return true;
621:     }
622: 
623:     /**
624:      * returns if quotes for comments are allowed in this article
625:      *
626:      * @param articleid $idart
627:      * @return bool
628:      */
629:     public function getQuoteState($idart) {
630:         // get content from con_type
631:         $data = $this->readXML();
632:         for ($i = 0; $i < count($data); $i++) {
633:             if ($data[$i]['idart'] == $idart) {
634:                 if ($data[$i]["subcomments"] === 'false') {
635:                     return false;
636:                 }
637:             }
638:         }
639:         return true;
640:     }
641: 
642:     /**
643:      * This function loads and returns the xml content from the contentType
644:      * aditionally the return array implies the articleId because of an easier
645:      * mapping in the frontend.
646:      *
647:      * @return array
648:      */
649:     public function readXML() {
650:         // get variables from global context
651:         $catId = cRegistry::getCategoryId();
652:         $idclient = cRegistry::getClientId();
653:         $cfgClient = cRegistry::getClientConfig();
654:         $idtype = $this->idContentType;
655: 
656:         try {
657:             $this->db->query("-- ArticleForumCollection->readXML()
658:                 SELECT
659:                     art_lang.idart
660:                     , content.value
661:                 FROM
662:                     `{$this->cfg[tab][art_lang]}` AS art_lang
663:                     , `{$this->cfg[tab][content]}` AS content
664:                 WHERE
665:                     art_lang.idartlang = content.idartlang
666:                     AND content.idtype = $idtype
667:                 ;");
668: 
669:             $data = array();
670:             while ($this->db->nextRecord()) {
671:                 array_push($data, $this->db->toArray());
672:             }
673: 
674:             $array = array();
675:             for ($i = 0; $i < count($data); $i++) {
676:                 $array[$i] = cXmlBase::xmlStringToArray($data[$i]['value']);
677:                 // add articleId
678:                 $array[$i]['idart'] = $data[$i]['idart'];
679:             }
680:         } catch (Exception $e) {
681:             // var_dump(e);
682:         }
683: 
684:         return $array;
685:     }
686: 
687:     /**
688:      * this function is used to get translations from the language of the
689:      * frontend module for example to generate
690:      * the e-mail text with correct language settings.
691:      *
692:      * @param array $str
693:      */
694:     public function languageSync(array &$str) {
695:         $this->languageSync = $str;
696:     }
697: 
698:     /**
699:      *
700:      * @return unknown_type multitype:
701:      */
702:     public function getlanguageSync() {
703:         if ($this->languageSync != 0) {
704:             return $this->languageSync;
705:         } else {
706:             return array();
707:         }
708:     }
709: 
710:     /**
711:      *
712:      * @param unknown_type $id_user_forum
713:      * @return multitype:NULL Ambigous <mixed, boolean>
714:      */
715:     public function getCommentContent($id_user_forum) {
716:         $item = $this->loadItem($id_user_forum);
717:         return array(
718:             'name' => $item->get("realname"),
719:             'content' => $item->get("forum")
720:         );
721:     }
722: 
723:     /**
724:      *
725:      * @return Ambigous <mixed, unknown>|boolean
726:      */
727:     protected function getIdUserForumContenType() {
728:         $this->db->query("-- ArticleForumCollection->getIdUserForumContenType()
729:             SELECT
730:                 idtype
731:             FROM
732:                 `{$this->cfg[tab][type]}`
733:             WHERE
734:                 type = 'CMS_USERFORUM'
735:             ;");
736:         if ($this->db->nextRecord()) {
737:             return $this->db->f('idtype');
738:         } else {
739:             return false;
740:         }
741:     }
742: }
743: 
744: ?>
CMS CONTENIDO 4.9.1 API documentation generated by ApiGen 2.8.0