本文整理汇总了PHP中PMF_Link::toHtmlAnchor方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Link::toHtmlAnchor方法的具体用法?PHP PMF_Link::toHtmlAnchor怎么用?PHP PMF_Link::toHtmlAnchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Link
的用法示例。
在下文中一共展示了PMF_Link::toHtmlAnchor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
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: " . $questionData['username'] . ", 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']);
$oUser = new PMF_User();
$oUser->getUserById($userId);
$userEmail = $oUser->getUserData('email');
$mainAdminEmail = PMF_Configuration::getInstance()->get('main.administrationMail');
$mail = new PMF_Mail();
$mail->setReplyTo($questionData['email'], $questionData['username']);
$mail->addTo($mainAdminEmail);
示例2: header
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
$currentCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
if (!is_null($currentCategory) && isset($category->categoryName[$currentCategory])) {
$faqsession->userTracking('show_category', $currentCategory);
$parent = $category->categoryName[$currentCategory]['parent_id'];
$name = $category->categoryName[$currentCategory]['name'];
$records = $faq->showAllRecords($currentCategory, $faqconfig->get('records.orderby'), $faqconfig->get('records.sortby'));
if (!$records) {
$subCategory = new PMF_Category($current_user, $current_groups, true);
$subCategory->transform($currentCategory);
$records = $subCategory->viewTree();
}
$up = '';
if ($parent != 0) {
$url = sprintf('%saction=show&cat=%d', $sids, $parent);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $category->categoryName[$parent]['name'];
$oLink->text = $PMF_LANG['msgCategoryUp'];
$up = $oLink->toHtmlAnchor();
}
$tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgEntriesIn'] . $name, 'writeThemes' => $records, 'writeOneThemeBack' => $up));
$tpl->includeTemplate('writeContent', 'index');
} else {
$faqsession->userTracking('show_all_categories', 0);
$tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgFullCategories'], 'writeThemes' => $category->viewTree(), 'writeOneThemeBack' => ''));
$tpl->includeTemplate('writeContent', 'index');
}
示例3: renderCategoryDropDown
/**
* Renders the main navigation dropdown
*
* @return string
*/
public function renderCategoryDropDown()
{
global $sids, $PMF_LANG;
$open = 0;
$output = '';
$numCategories = $this->Category->height();
$this->Category->expandAll();
if ($numCategories > 0) {
for ($y = 0; $y < $this->Category->height(); $y = $this->Category->getNextLineTree($y)) {
list($hasChild, $categoryName, $parent, $description) = $this->Category->getLineDisplay($y);
$level = $this->Category->treeTab[$y]['level'];
$leveldiff = $open - $level;
$numChilds = $this->Category->treeTab[$y]['numChilds'];
if (!isset($number[$parent])) {
$number[$parent] = 0;
}
if ($this->_config->get('records.hideEmptyCategories') && 0 === $number[$parent] && '-' === $hasChild) {
continue;
}
if ($leveldiff > 1) {
$output .= '</li>';
for ($i = $leveldiff; $i > 1; $i--) {
$output .= sprintf("\n%s</ul>\n%s</li>\n", str_repeat("\t", $level + $i + 1), str_repeat("\t", $level + $i));
}
}
if ($level < $open) {
if ($level - $open == -1) {
$output .= '</li>';
}
$output .= sprintf("\n%s</ul>\n%s</li>\n", str_repeat("\t", $level + 2), str_repeat("\t", $level + 1));
} elseif ($level == $open && $y != 0) {
$output .= "</li>\n";
}
if ($level > $open) {
$output .= sprintf("\n%s<ul class=\"dropdown-menu\">\n%s", str_repeat("\t", $level + 1), str_repeat("\t", $level + 1));
if ($numChilds > 0) {
$output .= '<li class="dropdown-submenu">';
} else {
$output .= '<li>';
}
} else {
$output .= str_repeat("\t", $level + 1);
if ($numChilds > 0) {
$output .= '<li class="dropdown-submenu">';
} else {
$output .= '<li>';
}
}
$url = sprintf('%s?%saction=show&cat=%d', PMF_Link::getSystemRelativeUri(), $sids, $parent);
$oLink = new PMF_Link($url, $this->_config);
$oLink->itemTitle = $categoryName;
$oLink->text = $categoryName;
$oLink->tooltip = $description;
$output .= $oLink->toHtmlAnchor();
$open = $level;
}
if (isset($level) && $level > 0) {
$output .= str_repeat("</li>\n\t</ul>\n\t", $level);
}
return $output;
} else {
$output = '<li><a href="#">' . $PMF_LANG['no_cats'] . '</a></li>';
}
return $output;
}
示例4: getAllRelatedById
/**
* Returns all relevant Articles for a FAQ record
*
* @param integer $record_id
* @param string $thema
* @return string
* @since 2006-08-29
* @author Thomas Zeithaml <info@spider-trap.de>
*/
public function getAllRelatedById($record_id, $article_name, $keywords)
{
global $sids, $PMF_CONF;
$relevantslisting = '';
$begriffe = str_replace('-', ' ', $article_name) . $keywords;
$i = $last_id = 0;
$result = $this->db->search(SQLPREFIX . "faqdata", array(SQLPREFIX . "faqdata.id AS id", SQLPREFIX . "faqdata.lang AS lang", SQLPREFIX . "faqcategoryrelations.category_id AS category_id", SQLPREFIX . "faqdata.thema AS thema", SQLPREFIX . "faqdata.content AS content"), SQLPREFIX . "faqcategoryrelations", array(SQLPREFIX . "faqdata.id = " . SQLPREFIX . "faqcategoryrelations.record_id", SQLPREFIX . "faqdata.lang = " . SQLPREFIX . "faqcategoryrelations.record_lang"), array(SQLPREFIX . "faqdata.thema", SQLPREFIX . "faqdata.content", SQLPREFIX . "faqdata.keywords"), $begriffe, array(SQLPREFIX . "faqdata.active" => "'yes'"));
while (($row = $this->db->fetch_object($result)) && $i < $PMF_CONF['records.numberOfRelatedArticles']) {
if ($row->id == $record_id || $row->id == $last_id) {
continue;
}
$relevantslisting .= '' == $relevantslisting ? '<ul>' : '';
$relevantslisting .= '<li>';
$url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $row->thema;
$oLink->text = $row->thema;
$oLink->tooltip = $row->thema;
$relevantslisting .= $oLink->toHtmlAnchor() . '</li>';
$i++;
$last_id = $row->id;
}
$relevantslisting .= $i > 0 ? '</ul>' : '';
return '' == $relevantslisting ? '-' : $relevantslisting;
}
示例5: renderRelatedFaqs
/**
* @param PMF_Search_Resultset $resultSet
* @param integer $recordId
*
* @return string
*/
public function renderRelatedFaqs(PMF_Search_Resultset $resultSet, $recordId)
{
$html = '';
$numOfResults = $resultSet->getNumberOfResults();
if ($numOfResults > 0) {
$html .= '<ul>';
$counter = 0;
foreach ($resultSet->getResultset() as $result) {
if ($counter >= 5) {
continue;
}
if ($recordId == $result->id) {
continue;
}
$counter++;
$url = sprintf('%s?action=artikel&cat=%d&id=%d&artlang=%s', PMF_Link::getSystemRelativeUri(), $result->category_id, $result->id, $result->lang);
$oLink = new PMF_Link($url, $this->_config);
$oLink->itemTitle = $result->question;
$oLink->text = $result->question;
$oLink->tooltip = $result->question;
$html .= '<li>' . $oLink->toHtmlAnchor() . '</li>';
}
$html .= '</ul>';
}
return $html;
}
示例6: elseif
break;
} elseif ((int) $value == $current_user) {
$b_permission = true;
break;
} else {
$b_permission = false;
}
}
}
if (!$b_permission) {
continue;
}
$url = sprintf('?%saction=artikel&cat=%d&id=%d&artlang=%s&highlight=%s', $sids, $cat_content_item->category_id, $cat_content_item->id, $cat_content_item->lang, urlencode($cat_content_item->searchterm));
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . $url);
$oLink->text = $cat_content_item->question;
$tmp_result_html .= '<li>' . $oLink->toHtmlAnchor() . '<br /></li>' . "\n";
}
if ($tmp_result_html) {
// @todo: change code for new category
//$search_result_html .= '<strong>'.$category->getPath($cat_id).'</strong>: ';
$search_result_html .= '<ul class="phpmyfaq_ul">' . "\n";
$search_result_html .= $tmp_result_html;
$search_result_html .= '</ul>';
}
}
$search_result_html .= '<div class="searchpreview"><strong>' . $PMF_LANG['msgSearchContent'] . '</strong> ' . $content . '...</div>';
$tpl->processBlock('writeContent', 'adequateAnswers', array('answers' => $search_result_html));
$tpl->processBlock('writeContent', 'messageQuestionFound', array('BtnText' => $PMF_LANG['msgSendMailDespiteEverything'], 'Message' => $PMF_LANG['msgSendMailIfNothingIsFound'], 'Code' => $code));
$_SESSION['asked_questions'][$code] = array('username' => $username, 'usermail' => $usermail, 'usercat' => $usercat, 'content' => $content);
} else {
if (sendAskedQuestion($username, $usermail, $usercat, $content)) {
示例7: getPath
/**
* Gets the path from root to child as breadcrumbs
*
* @param integer $id Category ID
* @param string $separator Path separator
* @param boolean $renderAsMicroData Renders breadcrumbs as HTML5 microdata
* @param string $useCssClass Use CSS class "breadcrumb"
* @return string
*/
public function getPath($id, $separator = ' / ', $renderAsMicroData = false, $useCssClass = 'breadcrumb')
{
global $sids;
$ids = $this->getNodes($id);
$num = count($ids);
$temp = $catid = $desc = $breadcrumb = [];
for ($i = 0; $i < $num; $i++) {
$t = $this->getLineCategory($ids[$i]);
if (array_key_exists($t, $this->treeTab)) {
$temp[] = $this->treeTab[$this->getLineCategory($ids[$i])]['name'];
$catid[] = $this->treeTab[$this->getLineCategory($ids[$i])]['id'];
$desc[] = $this->treeTab[$this->getLineCategory($ids[$i])]['description'];
}
}
if (isset($this->treeTab[$this->getLineCategory($id)]['name'])) {
$temp[] = $this->treeTab[$this->getLineCategory($id)]['name'];
$catid[] = $this->treeTab[$this->getLineCategory($id)]['id'];
$desc[] = $this->treeTab[$this->getLineCategory($id)]['description'];
}
// @todo Maybe this should be done somewhere else ...
if ($renderAsMicroData) {
foreach ($temp as $k => $category) {
$url = sprintf('%s?%saction=show&cat=%d', PMF_Link::getSystemRelativeUri(), $sids, $catid[$k]);
$oLink = new PMF_Link($url, $this->_config);
$oLink->text = sprintf('<span itemprop="title">%s</span>', $category);
$oLink->itemTitle = $category;
$oLink->tooltip = $desc[$k];
$oLink->setItemProperty('url');
if (0 == $k) {
$oLink->setRelation('index');
}
$breadcrumb[] = sprintf('<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">%s</li>', $oLink->toHtmlAnchor());
}
$temp = $breadcrumb;
return sprintf('<ul class="%s">%s</ul>', $useCssClass, implode('', $temp));
} else {
return implode($separator, $temp);
}
}
示例8: printHTMLTagsCloud
/**
* Returns the HTML for the Tags Cloud
*
* @return string
*/
public function printHTMLTagsCloud()
{
global $sids;
$html = '';
$tags = array();
// Limit the result set (see: PMF_TAGS_CLOUD_RESULT_SET_SIZE)
// for avoiding an 'heavy' load during the evaluation
// of the number of records for each tag
$tagList = $this->getAllTags('', true);
foreach ($tagList as $tagId => $tagName) {
$totFaqByTag = count($this->getRecordsByTagName($tagName));
if ($totFaqByTag > 0) {
$tags[$tagName]['id'] = $tagId;
$tags[$tagName]['name'] = $tagName;
$tags[$tagName]['count'] = $totFaqByTag;
}
}
$min = 0;
$max = 0;
foreach ($tags as $tag) {
if ($min > $tag['count']) {
$min = $tag['count'];
}
if ($max < $tag['count']) {
$max = $tag['count'];
}
}
$CSSRelevanceLevels = 5;
$CSSRelevanceMinLevel = 1;
$CSSRelevanceMaxLevel = $CSSRelevanceLevels - $CSSRelevanceMinLevel;
$CSSRelevanceLevel = 3;
$html = '<div class="tagscloud">';
$i = 0;
foreach ($tags as $tag) {
$i++;
if ($max - $min > 0) {
$CSSRelevanceLevel = (int) ($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel * ($tag['count'] - $min) / ($max - $min));
}
$class = 'relevance' . $CSSRelevanceLevel;
$html .= '<span class="' . $class . '">';
$title = PMF_htmlentities($tag['name'] . ' (' . $tag['count'] . ')', ENT_QUOTES, 'utf-8');
$url = sprintf($sids . 'action=search&tagging_id=%d', $tag['id']);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $tag['name'];
$oLink->text = $tag['name'];
$oLink->tooltip = $title;
$html .= $oLink->toHtmlAnchor();
$html .= (count($tags) == $i ? '' : ' ') . '</span>';
}
$html .= '</div>';
return $html;
}
示例9: getRecordsFromLetter
/**
* Returns all records from the current first letter
*
* @param string $letter Letter
* @return array
* @since 2007-03-30
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
*/
public function getRecordsFromLetter($letter = 'A')
{
global $sids, $PMF_LANG;
if ($this->groupSupport) {
$permPart = sprintf("( fdg.group_id IN (%s)\n OR\n (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
} else {
$permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
}
$letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1)));
$writeMap = '';
switch ($this->type) {
case 'db2':
case 'sqlite':
$query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTR(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
break;
default:
$query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTRING(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart);
break;
}
$result = $this->db->query($query);
$oldId = 0;
while ($row = $this->db->fetch_object($result)) {
if ($oldId != $row->id) {
$title = PMF_String::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8');
$url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $row->thema;
$oLink->text = $title;
$oLink->tooltip = $title;
$writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n";
$writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25) . " ...</li>\n";
}
$oldId = $row->id;
}
$writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>';
return $writeMap;
}
示例10: header
* @since 2002-08-27
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit;
}
$categoryId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
if (!is_null($categoryId)) {
$faqsession->userTracking('show_category', $categoryId);
$categoryNode = new PMF_Category_Node();
$categoryNode->setLanguage($LANGCODE);
$selectedCategoryData = $categoryNode->fetch($categoryId);
$records = $faq->showAllRecords($categoryId, $faqconfig->get('records.orderby'), $faqconfig->get('records.sortby'));
if (!$records) {
$records = $categoryLayout->renderTree();
}
$backToParent = '';
if ($selectedCategoryData->parent_id != 0) {
$url = sprintf('%saction=show&cat=%d', $sids, $selectedCategoryData->parent_id);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->text = $PMF_LANG['msgCategoryUp'];
$backToParent = $oLink->toHtmlAnchor();
}
$tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgEntriesIn'] . $selectedCategoryData->name, 'writeCategoryDescription' => $selectedCategoryData->description, 'writeThemes' => $records, 'writeOneThemeBack' => $backToParent));
$tpl->includeTemplate('writeContent', 'index');
} else {
$categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper($categoryTree));
$faqsession->userTracking('show_all_categories', 0);
$tpl->processTemplate('writeContent', array('writeCategory' => $PMF_LANG['msgFullCategories'], 'writeCategoryDescription' => '', 'writeThemes' => $categoryLayout->renderTree(), 'writeOneThemeBack' => ''));
$tpl->includeTemplate('writeContent', 'index');
}
示例11: showAllRecordsWoPaging
/**
* Returns all records of one category
*
* @param integer $category
* @return string
* @access public
* @since 2007-04-04
* @author Georgi Korchev <korchev@yahoo.com>
*/
function showAllRecordsWoPaging($category)
{
global $sids, $PMF_CONF, $tree;
$now = date('YmdHis');
$query = '
SELECT
fd.id AS id,
fd.lang AS lang,
fd.thema AS thema,
fcr.category_id AS category_id,
fv.visits AS visits
FROM
' . SQLPREFIX . 'faqdata fd
LEFT JOIN
' . SQLPREFIX . 'faqcategoryrelations fcr
ON
fd.id = fcr.record_id
AND
fd.lang = fcr.record_lang
LEFT JOIN
' . SQLPREFIX . 'faqvisits fv
ON
fd.id = fv.id
AND
fv.lang = fd.lang
LEFT JOIN
' . SQLPREFIX . 'faqdata_group fdg
ON
fd.id = fdg.record_id
LEFT JOIN
' . SQLPREFIX . 'faqdata_user fdu
ON
fd.id = fdu.record_id
WHERE
fd.date_start <= \'' . $now . '\'
AND
fd.date_end >= \'' . $now . '\'
AND
fd.active = \'yes\'
AND
fcr.category_id = ' . $category . '
AND
fd.lang = \'' . $this->language . '\'
ORDER BY
fd.id';
$result = $this->db->query($query);
$output = '<ul class="phpmyfaq_ul">';
while ($row = $this->db->fetch_object($result)) {
$title = $row->thema;
$url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $row->thema;
$oLink->text = $title;
$oLink->tooltip = $title;
$listItem = sprintf('<li>%s</li>', $oLink->toHtmlAnchor(), $this->pmf_lang['msgViews']);
$listItem = '<li>' . $oLink->toHtmlAnchor() . '</li>';
$output .= $listItem;
}
$output .= '</ul>';
return $output;
}
示例12: renderSearchResult
/**
* Renders the result page for the main search page
*
* @param PMF_Search_Resultset $resultSet PMF_Search_Resultset object
* @param integer $currentPage Current page number
*
* @return string
*/
public function renderSearchResult(PMF_Search_Resultset $resultSet, $currentPage)
{
$html = '';
$confPerPage = PMF_Configuration::getInstance()->get('main.numberOfRecordsPerPage');
$numOfResults = $resultSet->getNumberOfResults();
$totalPages = ceil($numOfResults / $confPerPage);
$lastPage = $currentPage * $confPerPage;
$firstPage = $lastPage - $confPerPage;
if ($lastPage > $numOfResults) {
$lastPage = $numOfResults;
}
if (0 < $numOfResults) {
$html .= sprintf("<p>%s</p>\n", $this->plurals->GetMsg('plmsgSearchAmount', $numOfResults));
if (1 < $totalPages) {
$html .= sprintf("<p><strong>%s%d %s %s</strong></p>\n", $this->translation['msgPage'], $currentPage, $this->translation['msgVoteFrom'], $this->plurals->GetMsg('plmsgPagesTotal', $totalPages));
}
$html .= "<ul class=\"phpmyfaq_ul\">\n";
foreach ($resultSet->getResultset() as $result) {
$categoryName = $this->categoryLayout->renderBreadcrumb(array($result->category_id));
$question = PMF_Utils::chopString($result->question, 15);
$answerPreview = PMF_Utils::chopString(strip_tags($result->answer), 25);
$searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $this->searchterm);
$searchterm = preg_quote($searchterm, '/');
$searchItems = explode(' ', $searchterm);
if (PMF_String::strlen($searchItems[0]) > 1) {
foreach ($searchItems as $item) {
if (PMF_String::strlen($item) > 2) {
$question = PMF_Utils::setHighlightedString($question, $item);
$answerPreview = PMF_Utils::setHighlightedString($answerPreview, $item);
}
}
}
// Build the link to the faq record
$currentUrl = sprintf('%s?%saction=artikel&cat=%d&id=%d&artlang=%s&highlight=%s', PMF_Link::getSystemRelativeUri(), $this->sessionId, $result->category_id, $result->id, $result->lang, urlencode($searchterm));
$oLink = new PMF_Link($currentUrl);
$oLink->text = $oLink->itemTitle = $oLink->tooltip = $result->question;
$html .= sprintf("<li><strong>%s</strong>: %s<br /><div class=\"searchpreview\"><strong>%s</strong> %s...</div><br /></li>\n", $categoryName, $oLink->toHtmlAnchor(), $this->translation['msgSearchContent'], $answerPreview);
}
$html .= "</ul>\n";
if (1 > $totalPages) {
$html .= $this->pagination->render();
}
} else {
$html = $this->translation['err_noArticles'];
}
return $html;
}
示例13: getAllRelatedById
/**
* Returns all relevant articles for a FAQ record with the same language
*
* @param integer $record_id FAQ ID
* @param string $thema FAQ title
*
* @return string
*/
public function getAllRelatedById($record_id, $article_name, $keywords)
{
global $sids;
$relevantslisting = '';
$begriffe = str_replace('-', ' ', $article_name) . $keywords;
$search = PMF_Search_Factory::create($this->language, array('database' => PMF_Db::getType()));
$i = $last_id = 0;
$search->setDatabaseHandle($this->db)->setTable(SQLPREFIX . 'faqdata AS fd')->setResultColumns(array('fd.id AS id', 'fd.lang AS lang', 'fcr.category_id AS category_id', 'fd.thema AS thema', 'fd.content AS content'))->setJoinedTable(SQLPREFIX . 'faqcategoryrelations AS fcr')->setJoinedColumns(array('fd.id = fcr.record_id', 'fd.lang = fcr.record_lang'))->setConditions(array('fd.active' => "'yes'", 'fd.lang' => "'" . $this->language->getLanguage() . "'"))->setMatchingColumns(array('fd.thema', 'fd.content', 'fd.keywords'));
$result = $search->search($begriffe);
while (($row = $this->db->fetchObject($result)) && $i < PMF_Configuration::getInstance()->get('records.numberOfRelatedArticles')) {
if ($row->id == $record_id || $row->id == $last_id) {
continue;
}
$relevantslisting .= '' == $relevantslisting ? '<ul>' : '';
$relevantslisting .= '<li>';
$url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
$oLink->itemTitle = $row->thema;
$oLink->text = $row->thema;
$oLink->tooltip = $row->thema;
$relevantslisting .= $oLink->toHtmlAnchor() . '</li>';
$i++;
$last_id = $row->id;
}
$relevantslisting .= $i > 0 ? '</ul>' : '';
return '' == $relevantslisting ? '-' : $relevantslisting;
}
示例14: getLinkHtmlAnchor
function getLinkHtmlAnchor($url, $text = null, $target = null)
{
$link = new PMF_Link($url, $text, $target);
return $link->toHtmlAnchor();
}
示例15: searchEngine
//.........这里部分代码省略.........
$result = getSearchData(htmlentities($searchterm, ENT_COMPAT, 'utf-8'), true, $cat, $allLanguages);
$num = $db->numRows($result);
if (0 == $num) {
$output = $PMF_LANG['err_noArticles'];
}
$confPerPage = $faqconfig->get('main.numberOfRecordsPerPage');
$pages = ceil($num / $confPerPage);
$last = $seite * $confPerPage;
$first = $last - $confPerPage;
if ($last > $num) {
$last = $num;
}
if ($num > 0) {
$output .= '<p>' . $plr->GetMsg('plmsgSearchAmount', $num);
if ($hasMore && $pages > 1) {
$output .= sprintf($PMF_LANG['msgInstantResponseMaxRecords'], $confPerPage);
}
$output .= "</p>\n";
if (!$hasMore && $pages > 1) {
$output .= "<p><strong>" . $PMF_LANG["msgPage"] . $seite . " " . $PMF_LANG["msgVoteFrom"] . " " . $plr->GetMsg('plmsgPagesTotal', $pages) . "</strong></p>";
}
$output .= "<ul class=\"phpmyfaq_ul\">\n";
$faqUser = new PMF_Faq_User();
$faqGroup = new PMF_Faq_Group();
$counter = $displayedCounter = 0;
while (($row = $db->fetchObject($result)) && $displayedCounter < $confPerPage) {
$counter++;
if ($counter <= $first) {
continue;
}
$displayedCounter++;
$b_permission = false;
//Groups Permission Check
if ($faqconfig->get('main.permLevel') == 'medium') {
$perm_group = $faqGroup->fetch($row->id);
foreach ($current_groups as $value) {
if ($value == $perm_group->group_id) {
$b_permission = true;
}
}
}
if ($faqconfig->get('main.permLevel') == 'basic' || $b_permission) {
$perm_user = $faqUser->fetch($row->id);
foreach ($perm_user as $value) {
if ($value == -1) {
$b_permission = true;
break;
} elseif ((int) $value == $current_user) {
$b_permission = true;
break;
} else {
$b_permission = false;
}
}
}
if ($b_permission) {
$rubriktext = $categoryLayout->renderBreadcrumb(array($row->category_id));
$thema = chopString($row->thema, 15);
$content = chopString(strip_tags($row->content), 25);
$searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $searchterm);
$searchterm = preg_quote($searchterm, '/');
$searchItems = explode(' ', $searchterm);
if (PMF_String::strlen($searchItems[0]) > 1) {
foreach ($searchItems as $item) {
if (PMF_String::strlen($item) > 2) {
$thema = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $thema);
$content = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $content);
}
}
}
// Print the link to the faq record
$url = sprintf('?%saction=artikel&cat=%d&id=%d&artlang=%s&highlight=%s', $sids, $row->category_id, $row->id, $row->lang, urlencode($_searchterm));
if ($instantRespnse) {
$currentUrl = PMF_Link::getSystemRelativeUri('ajaxresponse.php') . 'index.php';
} else {
$currentUrl = PMF_Link::getSystemRelativeUri();
}
$oLink = new PMF_Link($currentUrl . $url);
$oLink->itemTitle = $row->thema;
$oLink->text = $thema;
$oLink->tooltip = $row->thema;
$output .= '<li><strong>' . $rubriktext . '</strong>: ' . $oLink->toHtmlAnchor() . '<br />' . '<div class="searchpreview"><strong>' . $PMF_LANG['msgSearchContent'] . '</strong> ' . $content . '...</div>' . '<br /></li>' . "\n";
}
}
$output .= "</ul>\n";
} else {
$output = $PMF_LANG["err_noArticles"];
}
if (!$hasMore && $num > $confPerPage) {
if ($faqconfig->get('main.enableRewriteRules')) {
$baseUrl = sprintf("search.html?search=%s&seite=%d%s&searchcategory=%d", urlencode($_searchterm), $seite, $langs, $cat);
} else {
$baseUrl = PMF_Link::getSystemRelativeUri() . '?' . (empty($sids) ? '' : "{$sids}&") . 'action=search&search=' . urlencode($_searchterm) . '&seite=' . $seite . $langs . "&searchcategory=" . $cat;
}
$options = array('baseUrl' => $baseUrl, 'total' => $num, 'perPage' => $confPerPage, 'pageParamName' => 'seite', 'nextPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG["msgNext"] . '</a>', 'prevPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG["msgPrevious"] . '</a>', 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
$pagination = new PMF_Pagination($options);
$output .= $pagination->render();
}
return $output;
}