/** * * Presents a list of all available categories and forums. Also handles simple * operations like ordering or deleting forums. * * @access private * @return String HTML content */ function listAction() { # Handle some basic operations like deleting or sorting forums. if ($this->v['moveUp']) { $this->moveForumUp($this->v['moveUp']); } if ($this->v['moveDown']) { $this->moveForumDown($this->v['moveDown']); } if ($this->v['removeForum']) { $this->deleteForum($this->v['removeForum']); } # Load templates. $template = $this->cObj->fileResource($this->conf['templates.']['list']); $categoryTemplate = $this->cObj->getSubpart($template, '###ROW_CATEGORY###'); $forumTemplate = $this->cObj->getSubpart($template, '###ROW_FORUM###'); # Load all categories from the database. # NOTE: The "hidden" flag is NOT queried on purpose! $categoryHandle = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_forums', 'parentID=0 AND deleted=0 ' . $this->p->getStoragePIDQuery(), '', 'sorting ASC'); $categoryContent = ''; $categoryCount = $this->databaseHandle->sql_num_rows($categoryHandle); $i = 1; while ($categoryArray = $this->databaseHandle->sql_fetch_assoc($categoryHandle)) { $localCategoryTemplate = $categoryTemplate; $categoryMarkers = array('###CATEGORY_ICON###' => $this->p->getForumIcon($categoryArray, FALSE, FALSE), '###CATEGORY_NAME###' => $this->validator->specialChars($categoryArray['forum_name']), '###CATEGORY_DESC###' => $this->validator->specialChars($categoryArray['forum_desc']), '###CATEGORY_OPTIONS###' => $this->getForumOptions($categoryArray, $i == 1, $i == $categoryCount)); # Load all subforums for the current category from the database. # NOTE: The "hidden" flag is NOT queried on purpose! $forumHandle = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_forums', 'parentID=' . $categoryArray['uid'] . ' AND deleted=0 ' . $this->p->getStoragePIDQuery(), '', 'sorting ASC'); $forumContent = ''; $forumCount = $this->databaseHandle->sql_num_rows($forumHandle); $j = 1; while ($forumArray = $this->databaseHandle->sql_fetch_assoc($forumHandle)) { $forumMarkers = array('###FORUM_ICON###' => $this->p->getForumIcon($forumArray, FALSE, FALSE), '###FORUM_NAME###' => $this->validator->specialChars($forumArray['forum_name']), '###FORUM_DESC###' => $this->validator->specialChars($forumArray['forum_desc']), '###FORUM_OPTIONS###' => $this->getForumOptions($forumArray, $j == 1, $j == $forumCount)); $forumContent .= $this->cObj->substituteMarkerArray($forumTemplate, $forumMarkers); $j++; } # End forum loop $localCategoryTemplate = $this->cObj->substituteSubpart($localCategoryTemplate, '###ROW_FORUM###', $forumContent); $categoryContent .= $this->cObj->substituteMarkerArray($localCategoryTemplate, $categoryMarkers); $i++; } # End category loop $template = $this->cObj->substituteSubpart($template, '###ROW_CATEGORY###', $categoryContent); $marker = array('###NEW_CATEGORY_OPTIONS###' => $this->getOptionImage('newctg', !$this->checkActionAllowance('category', 'create'))); # Display a flashmessage if one was set. if ($this->flashmessage) { $marker['###FLASHMESSAGE###'] = htmlspecialchars($this->flashmessage); } else { $template = $this->cObj->substituteSubpart($template, '###FLASHMESSAGE_BOX###', ''); } $template = $this->cObj->substituteMarkerArray($template, $marker); $template = preg_replace_callback('/###L:([A-Z_-]+)###/i', array($this, 'replaceLL'), $template); return $template; }