コード例 #1
0
ファイル: Search.php プロジェクト: rybal06/phpMyFAQ
 /**
  * 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";
         $counter = $displayedCounter = 0;
         foreach ($resultSet->getResultset() as $result) {
             if ($displayedCounter >= $confPerPage) {
                 continue;
             }
             $counter++;
             if ($counter <= $firstPage) {
                 continue;
             }
             $displayedCounter++;
             $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&amp;cat=%d&amp;id=%d&amp;artlang=%s&amp;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 .= "<li>";
             $html .= sprintf("<strong>%s</strong>: %s<br />", $categoryName, $oLink->toHtmlAnchor());
             $html .= sprintf("<div class=\"searchpreview\"><strong>%s</strong> %s...</div><br />\n", $this->translation['msgSearchContent'], $answerPreview);
             $html .= "</li>";
         }
         $html .= "</ul>\n";
         if (1 < $totalPages) {
             $html .= $this->pagination->render();
         }
     } else {
         $html = $this->translation['err_noArticles'];
     }
     return $html;
 }
コード例 #2
0
ファイル: record.show.php プロジェクト: rybal06/phpMyFAQ
            $catInfo .= $isBracketOpened ? ')' : '';
            if ($cid != $old) {
                if ($old == 0) {
                    printf('<a name="cat_%d"></a>', $cid);
                } else {
                    print "    </tbody>\n    </table>\n    </div>";
                }
                ?>
    <div class="categorylisting">
        <img src="../images/more.gif" width="11" height="11" alt="" />
        <a href="javascript:void(0);" onclick="showhideCategory('category_<?php 
                print $cid;
                ?>
');">
        <?php 
                print $categoryLayout->renderBreadcrumb($categoryData->getPath($cid));
                ?>
</a><?php 
                print $catInfo;
                ?>
    </div>
    <div id="category_<?php 
                print $cid;
                ?>
" class="categorybox" style="display: <?php 
                print $currentcategory == $cid ? 'block' : 'none';
                ?>
;">
    <table class="listrecords">
    <thead>
    <tr>
コード例 #3
0
ファイル: stat.ratings.php プロジェクト: nosch/phpMyFAQ
    $faqRecord = new PMF_Faq_Record();
    $faqRecord->setLanguage($LANGCODE);
    $faqData = $faqRecord->fetchAll();
    ?>
    <h2><?php 
    print $PMF_LANG["ad_rs"];
    ?>
</h2>
    <table id="tableUserRatings">
<?php 
    foreach ($ratingdata as $data) {
        if ($data['category_id'] != $oldcategory) {
            ?>
    <tr>
        <th colspan="5"><strong><?php 
            print $categoryLayout->renderBreadcrumb($categoryData->getPath($data['category_id']));
            ?>
</strong></th>
    </tr>
<?php 
        }
        ?>
    <tr>
        <td><?php 
        print $data['id'];
        ?>
</td>
        <td><?php 
        print $data['lang'];
        ?>
</td>
コード例 #4
0
ファイル: record.add.php プロジェクト: nosch/phpMyFAQ
        });
    //-->
    </script>       
<?php 
        } else {
            print $PMF_LANG['ad_entry_savedfail'] . $db->error();
        }
    } elseif (isset($submit['submit'][2]) && !is_null($question) && !is_null($categories)) {
        // Preview
        $categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery($LANGCODE);
        $categoryTree = new PMF_Category_Tree($categoryDataProvider);
        $categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper($categoryTree));
        $categorylist = '';
        foreach ($categories['rubrik'] as $categoryId) {
            $categoryPath = $categoryDataProvider->getPath($categoryId);
            $categorylist .= $categoryLayout->renderBreadcrumb($categoryPath) . '<br />';
        }
        ?>
    <h3><strong><em><?php 
        print $categorylist;
        ?>
</em>
    <?php 
        print $question;
        ?>
</strong></h3>
    <?php 
        print html_entity_decode($content);
        ?>
    <p class="little"><?php 
        print $PMF_LANG["msgLastUpdateArticle"] . PMF_Date::createISODate(date("YmdHis"));
コード例 #5
0
ファイル: record.delquestion.php プロジェクト: nosch/phpMyFAQ
            <td>
                <?php 
                print PMF_Date::createIsoDate($question->date);
                ?>
<br />
                <a href="mailto:<?php 
                print $question->email;
                ?>
"><?php 
                print $question->username;
                ?>
</a>
            </td>
            <td>
                <?php 
                print $categoryLayout->renderBreadcrumb($categoryData->getPath($question->category_id));
                ?>
:<br />
                <?php 
                print $question->question;
                ?>
            </td>
            <td>
                <a href="?action=question&amp;id=<?php 
                print $question->id;
                ?>
&amp;is_visible=toggle">
                <?php 
                print 'Y' == $question->is_visible ? $PMF_LANG['ad_gen_no'] : $PMF_LANG['ad_gen_yes'];
                ?>
!</a>