/** * This function generates a list with the mosted voted or most visited records * * @param string $type Type definition visits/voted * @access public * @since 2009-11-03 * @author Max Köhler <*****@*****.**> * @return array */ public function getTopTen($type = 'visits') { if ('visits' == $type) { $result = $this->getTopTenData(PMF_NUMBER_RECORDS_TOPTEN, 0, $this->_config->getLanguage()->getLanguage()); } else { $result = $this->getTopVotedData(PMF_NUMBER_RECORDS_TOPTEN, 0, $this->_config->getLanguage()->getLanguage()); } $output = array(); if (count($result) > 0) { foreach ($result as $row) { if ('visits' == $type) { $output['title'][] = PMF_Utils::makeShorterText($row['thema'], 8); $output['url'][] = $row['url']; $output['visits'][] = $this->plr->GetMsg('plmsgViews', $row['visits']); } else { $output['title'][] = PMF_Utils::makeShorterText($row['thema'], 8); $output['url'][] = $row['url']; $output['voted'][] = sprintf('%s %s 5 - %s', round($row['avg'], 2), $this->pmf_lang['msgVoteFrom'], $this->plr->GetMsg('plmsgVotes', $row['user'])); } } } else { $output['error'] = $this->pmf_lang['err_noTopTen']; } return $output; }
/** * Calculates the rating of the user votings * * @param integer $id * @return string * @access public * @since 2002-08-29 * @author Thorsten Rinne <*****@*****.**> */ function getVotingResult($id) { $query = sprintf('SELECT (vote/usr) as voting, usr FROM %sfaqvoting WHERE artikel = %d', SQLPREFIX, $id); $result = $this->db->query($query); if ($this->db->num_rows($result) > 0) { $row = $this->db->fetch_object($result); return sprintf(' %s %s 5 (' . $this->plr->GetMsg('plmsgVotes', $row->usr) . ')', round($row->voting, 2), $this->pmf_lang['msgVoteFrom']); } else { return sprintf(' 0 %s 5 (' . $this->plr->GetMsg('plmsgVotes', 0) . ')', $this->pmf_lang['msgVoteFrom']); } }
/** * Calculates the rating of the user votings * * @param integer $id * * @return string */ function getVotingResult($id) { $query = sprintf(' SELECT (vote/usr) as voting, usr FROM %sfaqvoting WHERE artikel = %d', PMF_Db::getTablePrefix(), $id); $result = $this->_config->getDb()->query($query); if ($this->_config->getDb()->numRows($result) > 0) { $row = $this->_config->getDb()->fetchObject($result); return sprintf(' %s (' . $this->plr->GetMsg('plmsgVotes', $row->usr) . ')', round($row->voting, 2)); } else { return '0 (' . $this->plr->GetMsg('plmsgVotes', 0) . ')'; } }
$user = new PMF_User_CurrentUser(); $faqSearch = new PMF_Search($db, $Language); $faqSearchResult = new PMF_Search_Resultset($user, $faq); $searchResult = array(); $mergedResult = array(); foreach ($cleanQuestion as $word) { $searchResult[] = $faqSearch->search($word); } foreach ($searchResult as $resultSet) { foreach ($resultSet as $result) { $mergedResult[] = $result; } } $faqSearchResult->reviewResultset($mergedResult); if (0 < $faqSearchResult->getNumberOfResults()) { $response = sprintf('<p>%s</p>', $plr->GetMsg('plmsgSearchAmount', $faqSearchResult->getNumberOfResults())); $response .= '<ul>'; foreach ($faqSearchResult->getResultset() as $result) { $url = sprintf('/index.php?action=artikel&cat=%d&id=%d&artlang=%s', $result->category_id, $result->id, $result->lang); $oLink = new PMF_Link(PMF_Configuration::getInstance()->get('main.referenceURL') . $url); $oLink->text = PMF_Utils::chopString($result->question, 15); $oLink->itemTitle = $result->question; $response .= sprintf('<li>%s<br /><div class="searchpreview">%s...</div></li>', $oLink->toHtmlAnchor(), PMF_Utils::chopString(strip_tags($result->answer), 10)); } $response .= '</ul>'; $message = array('result' => $response); } else { $questionData = array('username' => $name, 'email' => $email, 'category_id' => $ucategory, 'question' => $question, 'is_visible' => $visibility); $faq->addQuestion($questionData); $questionMail = "User: "******", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['category_id']]["name"] . "\n\n" . wordwrap($question, 72) . "\n\n" . $faqconfig->get('main.referenceURL') . '/admin/'; $userId = $cat->getCategoryUser($questionData['category_id']);
/** * This function generates the Top Ten with the mosted viewed records * * @return array * @author Thorsten Rinne <*****@*****.**> * @since 2002-05-07 */ public function getTopTen() { $result = $this->getTopTenData(PMF_NUMBER_RECORDS_TOPTEN, 0, $this->language); $output = array(); if (count($result) > 0) { foreach ($result as $row) { $shortTitle = PMF_Utils::makeShorterText(PMF_htmlentities($row['thema'], ENT_QUOTES, $this->pmf_lang['metaCharset']), 8); $output['title'][] = $shortTitle; $output['url'][] = $row['url']; $output['visits'][] = $this->plr->GetMsg('plmsgViews', $row['visits']); } } else { $output['error'] = $this->pmf_lang['err_noTopTen']; } return $output; }