예제 #1
0
파일: Pdf.php 프로젝트: ae120/phpMyFAQ
 /**
  * Generates the export
  *
  * @param integer $categoryId Category Id
  * @param boolean $downwards  If true, downwards, otherwise upward ordering
  * @param string  $language   Language
  *
  * @return string
  */
 public function generate($categoryId = 0, $downwards = true, $language = '')
 {
     global $PMF_LANG;
     // Set PDF options
     $this->pdf->enableBookmarks = true;
     $this->pdf->isFullExport = true;
     $filename = 'FAQs.pdf';
     // Initialize categories
     $this->category->transform($categoryId);
     $this->pdf->setCategory($categoryId);
     $this->pdf->setCategories($this->category->categoryName);
     $this->pdf->SetCreator($this->_config->get('main.titleFAQ') . ' - powered by phpMyFAQ ' . $this->_config->get('main.currentVersion'));
     $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XML, $categoryId, $downwards, $language);
     $categories = $this->category->catTree;
     $categoryGroup = 0;
     $this->pdf->AddPage();
     foreach ($categories as $category) {
         if ($category['id'] !== $categoryGroup) {
             $this->pdf->Bookmark(html_entity_decode($this->category->categoryName[$category['id']]['name'], ENT_QUOTES, 'utf-8'), $category['level'], 0);
             $categoryGroup = $category['id'];
         }
         foreach ($faqdata as $faq) {
             if ($faq['category_id'] === $category['id']) {
                 $this->pdf->AddPage();
                 $this->pdf->setCategory($category['id']);
                 $this->pdf->Bookmark(html_entity_decode($faq['topic'], ENT_QUOTES, 'utf-8'), $category['level'] + 1, 0);
                 if ($this->tags instanceof PMF_Tags) {
                     $tags = $this->tags->getAllTagsById($faq['id']);
                 }
                 $this->pdf->WriteHTML('<h2 align="center">' . $faq['topic'] . '</h2>', true);
                 $this->pdf->Ln(10);
                 $this->pdf->SetFont($this->pdf->getCurrentFont(), '', 12);
                 $this->pdf->WriteHTML(trim($faq['content']));
                 $this->pdf->Ln(10);
                 if (!empty($faq['keywords'])) {
                     $this->pdf->Ln();
                     $this->pdf->Write(5, $PMF_LANG['msgNewContentKeywords'] . ' ' . $faq['keywords']);
                 }
                 if (isset($tags) && 0 !== count($tags)) {
                     $this->pdf->Ln();
                     $this->pdf->Write(5, $PMF_LANG['ad_entry_tags'] . ': ' . implode(', ', $tags));
                 }
                 $this->pdf->Ln();
                 $this->pdf->Ln();
                 $this->pdf->Write(5, $PMF_LANG['msgLastUpdateArticle'] . PMF_Date::createIsoDate($faq['lastmodified']));
             }
         }
     }
     // remove default header/footer
     $this->pdf->setPrintHeader(false);
     $this->pdf->addFaqToc();
     return $this->pdf->Output($filename);
 }
예제 #2
0
     $faqData['dateStart'] = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING);
     $faqData['dateEnd'] = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING);
     $faqData['content'] = html_entity_decode($faqData['content']);
 } elseif ($action == 'editentry') {
     $id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
     $lang = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING);
     if (!isset($selectedCategory) && !isset($faqData['title']) || !is_null($id)) {
         $logging = new PMF_Logging();
         $logging->logAdmin($user, 'Beitragedit, ' . $id);
         $faqData['id'] = $id;
         $faqData['lang'] = $lang;
         $faq->setLanguage($faqData['lang']);
         $categories = $category->getCategoryRelationsFromArticle($faqData['id'], $faqData['lang']);
         $faq->getRecord($faqData['id'], null, true);
         $faqData = $faq->faqRecord;
         $tags = implode(',', $tagging->getAllTagsById($faqData['id']));
         $queryString = 'saveentry&amp;id=' . $faqData['id'];
     } else {
         $queryString = 'insertentry';
     }
 } elseif ($action == 'copyentry') {
     $faqData['id'] = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
     $faqData['lang'] = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING);
     $faq->language = $faqData['lang'];
     $categories = $category->getCategoryRelationsFromArticle($faqData['id'], $faqData['lang']);
     $faq->getRecord($faqData['id'], null, true);
     $faqData = $faq->faqRecord;
     $queryString = 'insertentry';
 } else {
     $logging = new PMF_Logging();
     $logging->logAdmin($user, 'Beitragcreate');
예제 #3
0
 $tagSearch = true;
 $tags = [];
 $tagIds = explode(',', $inputTag);
 $tagHelper->setTaggingIds($tagIds);
 foreach ($tagIds as $tagId) {
     if (!isset($tags[$tagId])) {
         $tags[$tagId] = $tagging->getTagNameById($tagId);
     }
 }
 $recordIds = $tagging->getRecordsByIntersectionTags($tags);
 if (0 === count($recordIds)) {
     $searchResult = '';
 } else {
     $relatedTags = [];
     foreach ($recordIds as $recordId) {
         $resultTags = $tagging->getAllTagsById($recordId);
         foreach ($resultTags as $resultTagId => $resultTagName) {
             if (isset($tags[$resultTagId])) {
                 // if the given tag is in the search term we don't want to list it
                 continue;
             }
             if (isset($relatedTags[$resultTagId])) {
                 $relatedTags[$resultTagId]++;
             } else {
                 $relatedTags[$resultTagId] = 1;
             }
         }
     }
     uasort($relatedTags, function ($a, $b) {
         return $b - $a;
     });