/** * additionalData * * @return */ function additionalData() { $settings = $this->settingsService->getSettings(); // Inlcude JS $javascript = $settings['additional']['javascript']; if (!empty($javascript['jQueryLib']['uri']) && $javascript['jQueryLib']['include'] == 1) { $jQueryLib = '<script src="' . $javascript['jQueryLib']['uri'] . '" type="text/javascript"></script>'; if ($javascript['jQueryLib']['includeInFooter'] == 1) { $GLOBALS['TSFE']->additionalFooterData['JsFaq.jQueryLib'] = $jQueryLib; } else { $GLOBALS['TSFE']->additionalHeaderData['JsFaq.jQueryLib'] = $jQueryLib; } } if (!empty($javascript['toggle']['uri'])) { $toggle = '<script src="' . $javascript['toggle']['uri'] . '" type="text/javascript"></script>'; if ($javascript['toggle']['includeInFooter'] == 1) { $GLOBALS['TSFE']->additionalFooterData['JsFaq.toggle'] = $toggle; } else { $GLOBALS['TSFE']->additionalHeaderData['JsFaq.toggle'] = $toggle; } } // Inlcude CSS $css = $settings['additional']['css']; if (!empty($css['basic']['uri'])) { $basicCSS = '<link rel="stylesheet" href="' . $css['basic']['uri'] . '" type="text/css" media="all" />'; } if (!empty($css['fancy']['uri'])) { $fancyCSS = '<link rel="stylesheet" href="' . $css['fancy']['uri'] . '" type="text/css" media="all" />'; } if (!empty($css['responsive']['uri'])) { $responsiveCSS = '<link rel="stylesheet" href="' . $css['responsive']['uri'] . '" type="text/css" media="all" />'; } $additionalDataCSS = $css['fancy']['include'] == 1 ? $fancyCSS : $basicCSS; if ($css['responsive']['include'] == 1) { $additionalDataCSS .= $responsiveCSS; } if ($css['includeInFooter'] == 1) { $GLOBALS['TSFE']->additionalFooterData['JsFaq.CSS'] = $additionalDataCSS; } else { $GLOBALS['TSFE']->additionalHeaderData['JsFaq.CSS'] = $additionalDataCSS; } }
/** * getFAQData * * @param $faq * @return */ public function getFAQData($faq) { $settings = $this->settingsService->getSettings(); $this->fullURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); $limit = ''; if (isset($settings['main']['order'])) { if ($settings['main']['order'] == 'expert') { $orderBy = ' e.name ' . $settings['main']['orderType']; } else { $orderBy = ' f.' . $settings['main']['order'] . ' ' . $settings['main']['orderType']; } } else { $orderBy = ' f.sorting desc'; } $limit = ""; if (isset($settings['main']['limit']) && $settings['main']['limit'] > 0) { $limit = $settings['main']['limit']; } if ($settings['main']['displayFAQ'] == 'CategoryGroupWise' && $faq == 0) { $orderBy = ' c.name ASC , ' . $orderBy; } $field = 'f.uid, f.question, f.asked_by, f.expert, f.answer, f.related, f.related_link, e.name, e.email, e.url, m.uid_foreign , group_concat( cast( c.name AS char ) ) AS categoryName, group_concat( cast( c.uid AS char ) ) AS categoryID'; $table = 'tx_jsfaq_domain_model_faq as f LEFT JOIN tx_jsfaq_domain_model_expert AS e ON f.expert = e.uid LEFT JOIN tx_jsfaq_faq_category_mm AS m ON f.uid = m.uid_local LEFT JOIN tx_jsfaq_domain_model_category AS c ON m.uid_foreign = c.uid '; $groupBy = '( f.uid )'; $where = ''; if ($faq > 0) { $where = ' AND f.uid = \'' . $faq . '\''; } else { if (isset($settings['main']['startingPoint']) && $settings['main']['startingPoint'] != '') { $storagePids = $this->pageService->extendPidListByChildrens($settings['main']['startingPoint'], $settings['main']['recursive']); $where .= ' AND f.pid in (' . $storagePids . ') '; } if (isset($settings['main']['categories']) && $settings['main']['categories'] != '') { $where .= ' AND m.uid_foreign IN (' . $settings['main']['categories'] . ') '; } } $currentTime = time(); $where = ' f.deleted = 0 AND f.hidden = 0 AND ( f.starttime =0 OR ( f.starttime <= ' . $currentTime . ' AND f.endtime >=' . $currentTime . ' )) ' . $where; $where .= ' AND f.sys_language_uid IN (-1, ' . (int) $GLOBALS['TSFE']->sys_language_uid . ')'; $conf = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($field, $table, $where, $groupBy, $orderBy, $limit); $data = array(); foreach ($conf as $key => $value) { $field1 = 'uid, options, description, image'; $orderBy1 = ' sorting'; $table1 = 'tx_jsfaq_domain_model_content'; $where1 = ' deleted = 0 AND hidden = 0 AND faq = \'' . $value['uid'] . '\''; $answers = $this->configuration->falImages($GLOBALS['TYPO3_DB']->exec_SELECTgetRows($field1, $table1, $where1, '', $orderBy1), $table1, 'image'); $field2 = 'f.uid, f.question'; $orderBy2 = 'm.sorting'; $table2 = 'tx_jsfaq_faq_faq_mm as m LEFT JOIN tx_jsfaq_domain_model_faq as f ON m.uid_foreign = f.uid'; $where2 = ' uid_local = ' . $value['uid']; $related_faq = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($field2, $table2, $where2, '', $orderBy2); $relatedFaq = array(); foreach ($related_faq as $key => $val) { $relatedFaq[$val['uid']] = $val; } $related_link = GeneralUtility::trimExplode(chr(10), $value['related_link'], true); $data[$value['uid']] = $value; $data[$value['uid']]['answers'] = $answers; $data[$value['uid']]['related_link'] = $related_link; $data[$value['uid']]['related_faq'] = $relatedFaq; } return $data; }