Exemple #1
0
 /**
  * Returns all relevant articles for a FAQ record with the same language
  *
  * @param integer $recordId FAQ ID
  * @param string  $question FAQ title
  * @param string  $keywords FAQ keywords
  * 
  * @return array
  */
 public function getAllRelatedById($recordId, $question, $keywords)
 {
     $terms = str_replace('-', ' ', $question) . $keywords;
     $search = PMF_Search_Factory::create($this->language, array('database' => PMF_Db::getType()));
     $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 question', 'fd.content AS answer'))->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($terms);
     return $this->db->fetchAll($result);
 }