init
This commit is contained in:
60
module/faq/collection_faq_line_listform.inc.php
Normal file
60
module/faq/collection_faq_line_listform.inc.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?
|
||||
|
||||
$formname = "form_faq_cardformtest";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$inputname = "input_id";
|
||||
$input_page_id = (isset($_REQUEST["input_page_id"]) ? $_REQUEST["input_page_id"] : "");
|
||||
$input_component_id = (isset($_REQUEST["input_component_id"]) ? $_REQUEST["input_component_id"] : "");
|
||||
|
||||
// erstellte FAQ sammeln
|
||||
$input_line;
|
||||
$queryFaq = "SELECT mfq.* FROM main_faq_header as mfq INNER JOIN main_collection_faq_header_group_link as mfl on mfq.id = mfl.header_id WHERE main_collection_id = '" . $collectionData['id'] . "' AND field_id = '".$fieldSetup['id']."' LIMIT 1";
|
||||
|
||||
$resultFAQ = @mysqli_query($GLOBALS['mysql_con'], $queryFaq);
|
||||
|
||||
if (@mysqli_num_rows($resultFAQ) == 1) {
|
||||
$input_line = @mysqli_fetch_array($resultFAQ);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
if ($messages !== null) {
|
||||
if (count($messages)) {
|
||||
echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_id_faq<?=$fieldSetup['id']?>" type="hidden" value="<?= ($input_line["id"]) ? $input_line["id"] : 0; ?>">
|
||||
|
||||
|
||||
|
||||
<input name="data-sitepartid<?=$fieldSetup['id'];?>" type="hidden" value="16">
|
||||
<input name="input_faq<?=$fieldSetup['id'];?>" type="hidden" value="<?=$fieldSetup['id'];?>">
|
||||
<input type="hidden" name="collection_modul_input_<?php echo $fieldSetup['id']; ?>" value="faq" />
|
||||
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<? input($translation->get("description"), "input_description_faq".$fieldSetup['id'], "text", $input_line['description'], 255) ?>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($input_line["id"] != "") {
|
||||
show_changed_on($input_line["id"], "main_faq_header");
|
||||
show_changed_by($input_line["id"], "main_faq_header");
|
||||
}
|
||||
|
||||
loadFAQGroupCollection($input_line['id'], $fieldSetup['id']);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
</form>
|
||||
99
module/faq/dashboard_faq.php
Normal file
99
module/faq/dashboard_faq.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
require_once(MODULE_PATH . "faq/faq_config.inc.php");
|
||||
|
||||
$siteparts = \DynCom\mysyde\common\classes\Siteparts::get();
|
||||
$pageIds = array();
|
||||
$sitepartCount = array();
|
||||
$formname = "form_edit_faq";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
|
||||
$action = (isset($_GET['action']) ? $_GET['action'] : "");
|
||||
|
||||
if ($action != "" && $action != "admin_login") {
|
||||
require_once(MODULE_PATH . "faq/edit_faq.inc.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$faq_group_anzahl = array();
|
||||
|
||||
|
||||
$query = "SELECT id, count(*) AS anzahl FROM main_faq_setup_group GROUP BY id";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
while ($row = @mysqli_fetch_array($result, 1)) {
|
||||
$faq_group_anzahl[] = $row['anzahl'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="mainContent">
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('top_faq'); ?></h1>
|
||||
|
||||
<div class="dashboard_part_left">
|
||||
<h2><?php echo get_translation('top_faq'); ?></h2>
|
||||
|
||||
<?php
|
||||
$anzahl_group = count($faq_group_anzahl);
|
||||
if ($anzahl_group): ?>
|
||||
<a class="dashoard_box button_inhalt_collection"
|
||||
href="<?php echo get_menu_link($_GET["level_1"] . "/faq_main", $site, $language); ?>">
|
||||
<span class="dashboard_box_description"><?php echo $translation->get("left_faq"); ?></span>
|
||||
<img src="<?php echo PATH_SETUP_ICON_FAQ . "liste.png"; ?>" />
|
||||
</a>
|
||||
|
||||
<a class="dashoard_box button_inhalt_collection"
|
||||
href="<?php echo get_menu_link($_GET["level_1"] . "/config", $site, $language); ?>">
|
||||
<span class="dashboard_box_number"><?php echo(isset($anzahl_group) ? $anzahl_group : 0); ?></span>
|
||||
<span class="dashboard_box_description"><?php echo $translation->get("faq_group"); ?></span>
|
||||
<img src="<?php echo PATH_SETUP_ICON_FAQ . "dokumente_2.png"; ?>" />
|
||||
</a>
|
||||
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<?php echo "<div class=\"infobox\">" . $translation->get("no_rows_found") . "</div>"; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="dashboard_part_right">
|
||||
<h2><?php echo get_translation('last_changed_faq'); ?></h2>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" class="selected_linklist_row" name="input_id" value="" />
|
||||
|
||||
<div class="requestLoader"></div>
|
||||
<div id="page_linklist">
|
||||
<?
|
||||
$query = "SELECT
|
||||
main_faq.id,
|
||||
GROUP_CONCAT(' ', IF(main_faq_group_link.active = 1,main_faq_setup_group.description,NULL)) AS '".$translation->get("linked_with")."',
|
||||
main_faq.description AS '" . $translation->get("description") . "',
|
||||
from_unixtime(main_faq.modified_date, '%d.%m.%Y %H:%i:%s') AS '" . $translation->get("changed_on") . "',
|
||||
main_admin_user.name AS '" . $translation->get("changed_by") . "'
|
||||
from
|
||||
main_faq left join main_admin_user
|
||||
ON
|
||||
main_faq.modified_user = main_admin_user.id
|
||||
LEFT JOIN
|
||||
main_faq_group_link
|
||||
ON
|
||||
main_faq_group_link.main_faq_id = main_faq.id
|
||||
LEFT JOIN
|
||||
main_faq_setup_group
|
||||
ON
|
||||
main_faq_setup_group.id = main_faq_group_link.main_faq_setup_group_id
|
||||
|
||||
where
|
||||
(main_faq.main_language_id = " . (int)$GLOBALS["language"]['id'] . ")
|
||||
GROUP BY main_faq_group_link.main_faq_id ORDER BY main_faq.modified_date desc limit 20";
|
||||
|
||||
$format = array('option', 'text', 'text', 'text', 'text');
|
||||
if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
|
||||
linklist($result, $formname, $format, "input_id", "edit_faq_list");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
505
module/faq/edit_faq.inc.php
Normal file
505
module/faq/edit_faq.inc.php
Normal file
@@ -0,0 +1,505 @@
|
||||
<?php
|
||||
date_default_timezone_set('Europe/Berlin');
|
||||
|
||||
$messages = array();
|
||||
$error = FALSE;
|
||||
|
||||
if (isset($custom_action)) {
|
||||
$action = $custom_action;
|
||||
} else {
|
||||
$action = $_REQUEST["action"];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'save_faq_list':
|
||||
save_faq();
|
||||
break;
|
||||
case 'save_faq_page_link':
|
||||
save_faq_page_link();
|
||||
break;
|
||||
case 'new_faq_list':
|
||||
require_once("edit_faq_cardform.inc.php");
|
||||
break;
|
||||
case 'edit_faq_list':
|
||||
edit_faq();
|
||||
break;
|
||||
case 'delete_faq_list':
|
||||
delete_faq();
|
||||
break;
|
||||
case 'new_faq':
|
||||
require_once("page_faq_preview_cardform.inc.php");
|
||||
break;
|
||||
|
||||
case 'new_faq':
|
||||
require_once("page_faq_preview_cardform.inc.php");
|
||||
break;
|
||||
|
||||
case 'edit_faq':
|
||||
edit_faq_page_link();
|
||||
break;
|
||||
|
||||
case 'update_sortorder_faq':
|
||||
update_sortorder_faq();
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once("edit_faq_listform.inc.php");
|
||||
break;
|
||||
}
|
||||
|
||||
function update_sortorder_faq()
|
||||
{
|
||||
$sorting = 1;
|
||||
foreach ($_POST['linklistid'] as $itemId) {
|
||||
$query = "UPDATE main_faq SET sorting = " . $sorting . " WHERE id = '" . $itemId."'";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$sorting++;
|
||||
}
|
||||
$sorting = 1;
|
||||
foreach ($_POST['linklistid'] as $itemId) {
|
||||
$query = "UPDATE main_faq_group_link SET sorting = " . $sorting . " WHERE main_faq_id = '" . $itemId."'";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$sorting++;
|
||||
}
|
||||
}
|
||||
|
||||
function edit_faq( $_id = "", $messages = array() ) {
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
|
||||
$query = "SELECT * FROM main_faq WHERE id = '" . $input_id . "' LIMIT 1";
|
||||
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if (@mysqli_num_rows($result) == 1) {
|
||||
|
||||
$input_line = @mysqli_fetch_array($result);
|
||||
|
||||
require_once("edit_faq_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
require_once("edit_faq_cardform.inc.php");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function save_faq() {
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$messages = array();
|
||||
$id = $_REQUEST["input_id"];
|
||||
$default_active = $_REQUEST["input_default_active"];
|
||||
$header_id = "";
|
||||
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "UPDATE main_faq SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "' ,
|
||||
modified_date = '" . time() . "',
|
||||
modified_user = '" . (int)$GLOBALS["admin_user"]['id'] . "',
|
||||
default_active = '" . $default_active . "'
|
||||
WHERE id = " . $_REQUEST["input_id"] . " LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
} else {
|
||||
$query = "INSERT INTO main_faq (main_language_id, description, modified_date, modified_user, default_active) VALUES (
|
||||
'".(int)$GLOBALS["language"]['id']."',
|
||||
'".mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"])."',
|
||||
'".time()."',
|
||||
'".(int)$GLOBALS["admin_user"]['id']."',
|
||||
'".$default_active."'
|
||||
)";
|
||||
$inserted = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if ($_REQUEST["input_description"] == '') {
|
||||
$messages[] = "<div class=\"errorbox\">" . $translation->get("error_description") . "</div>\n";
|
||||
$error = TRUE;
|
||||
}
|
||||
|
||||
// benoetigt fuer ajax calls
|
||||
if ($error === TRUE) {
|
||||
header('EDIT_ERROR: 1');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if ($inserted === TRUE) {
|
||||
$header_id = mysqli_insert_id($GLOBALS['mysql_con']);
|
||||
createMySydeLog('main_faq', $header_id, 'INSERT');
|
||||
$messages[] = '<div class="successbox">' . $translation->get("collection_group_msg_success1") . '</div>';
|
||||
} else {
|
||||
createMySydeLog('main_faq', $_REQUEST['input_id'], 'UPDATE');
|
||||
$messages[] = '<div class="successbox">' . $translation->get("collection_group_msg_success2") . '</div>';
|
||||
}
|
||||
|
||||
} else {
|
||||
$input_line["id"] = $_REQUEST["input_id"];
|
||||
$input_line["description"] = $_REQUEST["input_description"];
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
|
||||
$query2 = "UPDATE main_faq_line SET
|
||||
text1 = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["text_question"]) . "' ,
|
||||
text2 = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["text_answer"]) . "',
|
||||
hashtags = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["text_hashtags"]) . "'
|
||||
WHERE main_faq_id = " . $_REQUEST["input_id"] . " LIMIT 1";
|
||||
|
||||
} else {
|
||||
|
||||
$query2 = "INSERT INTO main_faq_line (main_faq_id, text1, text2, hashtags) VALUES (
|
||||
'".(int)$header_id."',
|
||||
'".mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["text_question"])."',
|
||||
'".mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["text_answer"])."',
|
||||
'".mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["text_hashtags"])."')";
|
||||
|
||||
}
|
||||
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
}
|
||||
|
||||
$groups = array();
|
||||
$group_ids = $_POST['select_group'];
|
||||
if($group_ids != NULL && isset($_POST['select_group'])){
|
||||
$groups = explode(',', $group_ids);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
||||
// gruppen speichern
|
||||
$query = "SELECT id, default_active FROM main_faq_setup_group";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$box = array();
|
||||
while ($box = @mysqli_fetch_assoc($result)) {
|
||||
$query_2 = "SELECT id, active FROM main_faq_group_link WHERE main_faq_setup_group_id = '" . $box["id"] . "' AND main_faq_id = '" . $id . "' LIMIT 1";
|
||||
$result_2 = @mysqli_query($GLOBALS['mysql_con'], $query_2);
|
||||
// $arr_ind = "input_faq_group_" . $box["id"] . "_active";
|
||||
if (!empty($groups) && in_array($box['id'], $groups)) {
|
||||
$active = '1';
|
||||
} else {
|
||||
$active = '0';
|
||||
}
|
||||
if (@mysqli_num_rows($result_2) == 0) {
|
||||
if ($header_id == "") {
|
||||
$header_id = $_REQUEST["input_id"];
|
||||
}
|
||||
$query_3 = "INSERT INTO main_faq_group_link SET
|
||||
main_faq_id = " . $header_id . ",
|
||||
main_faq_setup_group_id = " . $box["id"] . ",
|
||||
active = " . $active;
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query_3);
|
||||
} else {
|
||||
$row = @mysqli_fetch_assoc($result_2);
|
||||
$result_3 = $row[0];
|
||||
if ($active != $result_3["active"]) {
|
||||
$query_3 = "UPDATE main_faq_group_link SET
|
||||
active = " . $active . " WHERE
|
||||
main_faq_id = " . $id . " AND
|
||||
main_faq_setup_group_id = " . $box["id"];
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query_3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
edit_faq($header_id, $messages);
|
||||
|
||||
} else {
|
||||
edit_faq($header_id, $messages);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//FAQ
|
||||
|
||||
|
||||
|
||||
//Checkbox Groups
|
||||
function create_faq_groups_select2($input_faq)
|
||||
{
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
|
||||
$faq_id = $input_faq['id'];
|
||||
$setup_id = $input_collection['main_collection_setup_id'];
|
||||
|
||||
$query = "SELECT * FROM main_faq_setup_group";
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ($row = @mysqli_fetch_array($result)) {
|
||||
$query2 = "SELECT active FROM main_faq_group_link WHERE
|
||||
main_faq_id = '" . $faq_id . "' AND
|
||||
main_faq_setup_group_id = " . $row['id'];
|
||||
|
||||
$result2 = mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
if (@mysqli_num_rows($result2) == 0) {
|
||||
input($row['description'], "input_faq_group_" . $row["id"] . "_active", "checkbox");
|
||||
} else {
|
||||
input($row['description'], "input_faq_group_" . $row["id"] . "_active", "checkbox", @mysqli_result($result2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function create_faq_groups_select($input_faq)
|
||||
{
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
|
||||
$faq_id = $input_faq['id'];
|
||||
$setup_id = $input_collection['main_collection_setup_id'];
|
||||
|
||||
|
||||
$query = "SELECT * FROM main_faq_setup_group";
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$preselect = array();
|
||||
$query2 = "SELECT * FROM main_faq_group_link WHERE main_faq_id = '" . $faq_id . "' AND active = 1";
|
||||
$result2 = mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
|
||||
while($row2 = @mysqli_fetch_array($result2)){
|
||||
array_push($preselect,$row2['main_faq_setup_group_id']);
|
||||
}
|
||||
?>
|
||||
<div class="label"><label><?php echo 'FAQ-Gruppen'; ?></label></div>
|
||||
<div class="groups bc-select-ui ui fluid multiple search selection dropdown" style="clear:both;display:inline-block;">
|
||||
<input type="hidden" name="select_group">
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="default text"><?php echo 'FAQ-Gruppen'; ?></div>
|
||||
<div class="menu">
|
||||
<?
|
||||
|
||||
while($row = @mysqli_fetch_array($result)) {
|
||||
echo "<div class=\"item\" data-value=\"{$row['id']}\">".$row["description"]."</div>";
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="/plugins/jquery/jquery-3.5.1.min.js"></script>
|
||||
<script type="text/javascript" src="/plugins/Semantic-UI-master/semantic.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/plugins/Semantic-UI-master/bc-semantic.css?time=<?= filemtime($_SERVER['DOCUMENT_ROOT'] . '/plugins/Semantic-UI-master/bc-semantic.css')?>">
|
||||
<script>
|
||||
var $y = jQuery.noConflict();
|
||||
|
||||
$y( document ).ready(function() {
|
||||
$y('.groups.ui.fluid.multiple.dropdown').dropdown('set selected', <?= json_encode($preselect) ?>);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<? }
|
||||
|
||||
function delete_faq() {
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "DELETE FROM main_faq WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
createMySydeLog('main_faq', $_REQUEST['input_id'], 'DELETE');
|
||||
//Gruppe verlinkung loeschen
|
||||
$query = "DELETE FROM main_faq_group_link WHERE main_faq_id = '" . $_REQUEST["input_id"] . "'";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
echo "$query";
|
||||
|
||||
//Lines loeschen loeschen
|
||||
$query = "DELETE FROM main_faq_line WHERE main_faq_id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
/*$query = "DELETE FROM slidecontent_line WHERE header_id = '" . $_REQUEST["input_id"]."'";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);*/
|
||||
|
||||
// zuordnung von Seiten loeschen
|
||||
/*$query = "DELETE FROM main_page_link WHERE main_sitepart_id = 4 AND main_sitepart_header_id = '" . $_REQUEST["input_id"]."'";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);*/
|
||||
|
||||
//update_sitepart_changes(4, $_REQUEST["input_id"], TRUE);
|
||||
}
|
||||
require_once("edit_faq_listform.inc.php");
|
||||
}
|
||||
|
||||
//FAQ speichern im Seitenstruktur
|
||||
function save_faq_page_link() {
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$input_id = "";
|
||||
$input_all_languages = ($_POST["input_all_languages"] == "on") ? 1 : 0;
|
||||
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
|
||||
$query = "UPDATE main_faq_header SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||||
modified_date = " . time() . ",
|
||||
modified_user = " . (int)$GLOBALS["admin_user"]['id'] . ",
|
||||
all_languages = " . $input_all_languages . "
|
||||
WHERE id = '" . $_REQUEST["input_id"] . "'
|
||||
LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
save_header_group($input_id);
|
||||
} else {
|
||||
$query = "INSERT INTO main_faq_header
|
||||
(main_language_id, modified_date, modified_user, description, all_languages)
|
||||
VALUES (
|
||||
" . (int)$GLOBALS["language"]['id'] . ",
|
||||
" . time() . ",
|
||||
" . (int)$GLOBALS["admin_user"]['id'] . ",
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||||
" . $input_all_languages . "
|
||||
)";
|
||||
$inserted = TRUE;
|
||||
}
|
||||
|
||||
if (($_REQUEST["input_description"] == '')) {
|
||||
$messages[] = "<div class=\"errorbox\">" . $translation->get("error_description") . "</div>\n";
|
||||
$error = TRUE;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if ($inserted == TRUE) {
|
||||
$input_id = mysqli_insert_id($GLOBALS['mysql_con']);
|
||||
save_header_group($input_id);
|
||||
$messages[] = '<div class="successbox">' . $translation->get("slidecontent_msg_success1") . '</div>';
|
||||
} else {
|
||||
$messages[] = '<div class="successbox">' . $translation->get("slidecontent_msg_success2") . '</div>';
|
||||
}
|
||||
|
||||
update_sitepart_changes(16, $input_id);
|
||||
|
||||
if (is_page_edit()) {
|
||||
header('EDIT_ERROR: 1'); // verhindern, dass overlay geschlossen wird
|
||||
if (line_already_exists($_REQUEST["input_page_id"], 16, $input_id) === FALSE) {
|
||||
assoc_sitepart(16, $input_id, FALSE);
|
||||
}
|
||||
|
||||
if ($_REQUEST['force_close'] == 1) {
|
||||
edit_content_page();
|
||||
return;
|
||||
}
|
||||
|
||||
edit_faq_page_link($input_id, $messages);
|
||||
|
||||
} elseif (is_component_edit()) {
|
||||
header('EDIT_ERROR: 1'); // verhindern, dass overlay geschlossen wird
|
||||
if (line_already_exists($_REQUEST["input_component_id"], 16, $input_id) === FALSE) {
|
||||
assoc_sitepart(16, $input_id, FALSE);
|
||||
}
|
||||
|
||||
if ($_REQUEST['force_close'] == 1) {
|
||||
edit_component("", $messages);
|
||||
return;
|
||||
}
|
||||
|
||||
edit_faq_page_link($input_id, $messages);
|
||||
} else {
|
||||
edit_faq_page_link($input_id, $messages);
|
||||
}
|
||||
|
||||
} else {
|
||||
header('EDIT_ERROR: 1');
|
||||
$input_slidecontent = array();
|
||||
$input_slidecontent["id"] = $_REQUEST["input_id"];
|
||||
$input_slidecontent["description"] = $_REQUEST["input_description"];
|
||||
$input_slidecontent["all_languages"]= $input_all_languages;
|
||||
|
||||
require_once("page_faq_preview_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
function edit_faq_page_link ( $_id = "", $messages = array() ) {
|
||||
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
|
||||
$query = "SELECT * FROM main_faq_header WHERE id = '" . $input_id . "' LIMIT 1";
|
||||
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if (@mysqli_num_rows($result) == 1) {
|
||||
|
||||
$input_line = @mysqli_fetch_array($result);
|
||||
|
||||
require_once("page_faq_preview_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
require_once("page_faq_preview_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function loadFAQGroup($faq_id){
|
||||
$query = "SELECT * FROM main_faq_setup_group";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
return;
|
||||
}
|
||||
while ($row = @mysqli_fetch_array($result)) {
|
||||
$query2 = "SELECT * FROM main_faq_header_group_link WHERE header_id =" . $faq_id . " AND faq_group_id = " . $row['id'];
|
||||
$result2 = @mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
$row2 = @mysqli_fetch_array($result2);
|
||||
$checked = 0;
|
||||
if(isset($row2)){
|
||||
$checked = $row2['active'];
|
||||
}
|
||||
input($row['description'], "input_group_".$row['id'], "checkbox", $checked);
|
||||
}
|
||||
}
|
||||
|
||||
function save_header_group($faq_id){
|
||||
$query = "SELECT * FROM main_faq_setup_group";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
return;
|
||||
}
|
||||
while ($row = @mysqli_fetch_array($result)) {
|
||||
if($_POST['input_group_'.$row['id']] == 'on'){
|
||||
$active = 1;
|
||||
}else {
|
||||
$active = 0;
|
||||
}
|
||||
$query2 = "SELECT * FROM main_faq_header_group_link WHERE header_id =" . $faq_id . " AND faq_group_id = " . $row['id'];
|
||||
$result2 = @mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
$row2 = @mysqli_fetch_array($result2);
|
||||
if(isset($row2)){
|
||||
$query3 = "UPDATE main_faq_header_group_link SET
|
||||
active = ".$active."
|
||||
WHERE id = '" . $row2['id'] . "'
|
||||
LIMIT 1";
|
||||
}else {
|
||||
$query3 = "INSERT INTO main_faq_header_group_link
|
||||
(header_id, faq_group_id, active)
|
||||
VALUES (
|
||||
" . $faq_id . ",
|
||||
" . $row['id'] . ",
|
||||
" . $active . "
|
||||
)";
|
||||
}
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query3);
|
||||
}
|
||||
}
|
||||
95
module/faq/edit_faq_cardform.inc.php
Normal file
95
module/faq/edit_faq_cardform.inc.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?
|
||||
$formname = "form_faq_cardform";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$inputname = "input_id";
|
||||
$siteparts = \DynCom\mysyde\common\classes\Siteparts::get();
|
||||
|
||||
|
||||
$sorting_values = array(
|
||||
$translation->get("collection_sorting_keep"),
|
||||
$translation->get("collection_sorting_change_top"),
|
||||
$translation->get("collection_sorting_change_bottom")
|
||||
);
|
||||
|
||||
$query = "SELECT * FROM main_faq_line WHERE main_faq_id = '" . $input_line['id'] . "'";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$input_text = @mysqli_fetch_array($result);
|
||||
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php
|
||||
echo $translation->get("edit_faq_question");
|
||||
?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?php
|
||||
|
||||
// Speichern buttons
|
||||
button("save", $translation->get("save"), $formname, "loadCard('save_faq_list', true)");
|
||||
|
||||
button("save", $translation->get("save_and_close"), $formname, "loadCard('save_faq_list', true, '', true)");
|
||||
|
||||
if ($input_line["id"] != "") {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_faq_list', true, '{$translation->get('delete_faq_group')}', true)");
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
|
||||
if ($messages !== null) {
|
||||
if (count($messages)) {
|
||||
echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_id" type="hidden" value="<?= $input_line["id"] ?>" />
|
||||
<input name="save_and_close" id="save_and_close" type="hidden" value="0" />
|
||||
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="question">
|
||||
<?
|
||||
input($translation->get("faq_question"), "input_description", "text", $input_line["description"], 255);
|
||||
?>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<div class="faq_field">
|
||||
<?php
|
||||
input($translation->get("answer"), "text_answer", "textarea", $input_text['text2']);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<table class="faq-further">
|
||||
<tr>
|
||||
<td>
|
||||
<?
|
||||
input_select($translation->get("default_active"), "input_default_active", $values = array('1', '0'), $value_names = array($translation->get("yes"), $translation->get("no")), $input_line["default_active"]);
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php
|
||||
create_faq_groups_select($input_line);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
41
module/faq/edit_faq_listform.inc.php
Normal file
41
module/faq/edit_faq_listform.inc.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_faq_list";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_faq_list', true)"); ?>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('faq_questions'); ?></h1>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input type="hidden" class="selected_linklist_row" name="input_id" value="" />
|
||||
<div class="requestLoader"></div>
|
||||
<?
|
||||
$query = "SELECT main_faq.id, GROUP_CONCAT(' ', IF(main_faq_group_link.active = 1,main_faq_setup_group.description,NULL)) AS '".$translation->get("linked_with")."',main_faq.description AS '" . $translation->get("description") . "', from_unixtime(modified_date, '%d.%m.%Y %H:%i:%s') as '" . $translation->get("changed_on") . "', main_admin_user.name as '" . $translation->get("changed_by") . "' from main_faq
|
||||
LEFT JOIN
|
||||
main_admin_user
|
||||
ON
|
||||
main_admin_user.id = main_faq.modified_user
|
||||
LEFT JOIN
|
||||
main_faq_group_link
|
||||
ON
|
||||
main_faq_group_link.main_faq_id = main_faq.id
|
||||
LEFT JOIN
|
||||
main_faq_setup_group
|
||||
ON
|
||||
main_faq_setup_group.id = main_faq_group_link.main_faq_setup_group_id
|
||||
GROUP BY main_faq_group_link.main_faq_id ORDER BY main_faq.sorting asc";
|
||||
|
||||
$format = array('option', 'text', 'text', 'text', 'text');
|
||||
if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
|
||||
linklist($result, $formname, $format, "input_id", "edit_faq_list", TRUE, 'update_sortorder_faq');
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
149
module/faq/edit_faq_setup.inc.php
Normal file
149
module/faq/edit_faq_setup.inc.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?
|
||||
|
||||
date_default_timezone_set('Europe/Berlin');
|
||||
|
||||
$messages = array();
|
||||
$error = FALSE;
|
||||
|
||||
if (isset($custom_action)) {
|
||||
$action = $custom_action;
|
||||
} else {
|
||||
$action = $_REQUEST["action"];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'save_group_faq_setup':
|
||||
save_group_faq_setup();
|
||||
break;
|
||||
case 'new_faq_setup_group':
|
||||
require_once("edit_faq_setup_group_cardform.inc.php");
|
||||
break;
|
||||
case 'edit_group_faq_setup':
|
||||
edit_group_faq_setup();
|
||||
break;
|
||||
case 'delete_group_faq_setup':
|
||||
delete_group_faq_setup();
|
||||
break;
|
||||
case 'update_sortorder_faq_group':
|
||||
update_sortorder_faq_group();
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once("edit_faq_setup_listform.inc.php");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ++ DuP breadcrumb GmbH ++ */
|
||||
function update_sortorder_faq_group() {
|
||||
$sorting = 1;
|
||||
foreach ($_POST['linklistid'] as $itemId) {
|
||||
$query = "UPDATE main_faq_setup_group SET sorting = " . $sorting . " WHERE id = '" . $itemId."'";
|
||||
echo $query;
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$sorting++;
|
||||
}
|
||||
}
|
||||
|
||||
function edit_group_faq_setup( $_id = "", $messages = array() ) {
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_group_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
|
||||
$query = "SELECT * FROM main_faq_setup_group WHERE id = '" . $input_id . "' LIMIT 1";
|
||||
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if (@mysqli_num_rows($result) == 1) {
|
||||
|
||||
$input_line = @mysqli_fetch_array($result);
|
||||
|
||||
require_once("edit_faq_setup_group_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
require_once("edit_faq_setup_group_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
function save_group_faq_setup() {
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$messages = array();
|
||||
$id = $_REQUEST["input_group_id"];
|
||||
$default_active = $_REQUEST["input_default_active"];
|
||||
|
||||
if ($_REQUEST["input_group_id"] <> '') {
|
||||
$query = "UPDATE main_faq_setup_group SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "' ,
|
||||
default_active = '" . $default_active . "'
|
||||
WHERE id = " . $_REQUEST["input_group_id"] . " LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
} else {
|
||||
$query = "INSERT INTO main_faq_setup_group (description, default_active) VALUES (
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||||
'" . $default_active . "'
|
||||
)";
|
||||
$inserted = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if ($_REQUEST["input_description"] == '') {
|
||||
$messages[] = "<div class=\"errorbox\">" . $translation->get("error_description") . "</div>\n";
|
||||
$error = TRUE;
|
||||
}
|
||||
|
||||
// benoetigt fuer ajax calls
|
||||
if ($error === TRUE) {
|
||||
header('EDIT_ERROR: 1');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if ($_REQUEST['save_and_close'] == 1) {
|
||||
faq_edit_setup();
|
||||
} else {
|
||||
if ($inserted === TRUE) {
|
||||
$id = mysqli_insert_id($GLOBALS['mysql_con']);
|
||||
createMySydeLog('main_faq_setup_group', $id, 'INSERT');
|
||||
$messages[] = '<div class="successbox">' . $translation->get("collection_group_msg_success1") . '</div>';
|
||||
} else {
|
||||
createMySydeLog('main_faq_setup_group', $_REQUEST['input_group_id'], 'UPDATE');
|
||||
$messages[] = '<div class="successbox">' . $translation->get("collection_group_msg_success2") . '</div>';
|
||||
}
|
||||
edit_group_faq_setup($id, $messages);
|
||||
}
|
||||
|
||||
} else {
|
||||
$input_line["id"] = $_REQUEST["input_group_id"];
|
||||
$input_line["description"] = $_REQUEST["input_description"];
|
||||
require_once("edit_faq_setup_group_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ++ DuP breadcrumb GmbH ++ */
|
||||
|
||||
|
||||
|
||||
function delete_group_faq_setup() {
|
||||
if ($_REQUEST["input_group_id"] <> '') {
|
||||
$query = "DELETE FROM main_faq_setup_group WHERE id = '" . $_REQUEST["input_group_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
//Gruppe verlinkung loeschen
|
||||
$query = "DELETE FROM main_faq_group_link WHERE main_faq_setup_group_id = '" . $_REQUEST["input_group_id"] . "'";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
createMySydeLog('main_faq_setup_group', $_REQUEST['input_group_id'], 'DELETE');
|
||||
}
|
||||
|
||||
require_once("edit_faq_setup_listform.inc.php");
|
||||
}
|
||||
61
module/faq/edit_faq_setup_group_cardform.inc.php
Normal file
61
module/faq/edit_faq_setup_group_cardform.inc.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?
|
||||
$formname = "form_faq_group_cardform";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$inputname = "input_group_id";
|
||||
$siteparts = \DynCom\mysyde\common\classes\Siteparts::get();
|
||||
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php if ($input_line["id"] == "") {
|
||||
echo $translation->get("new_faq_group");
|
||||
} else {
|
||||
echo $translation->get("edit_faq_group");
|
||||
}
|
||||
?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?php
|
||||
// Zurueck zur uebersicht
|
||||
button("left", $translation->get("back"), $formname, "loadCard('edit_group_faq_setup', true)");
|
||||
|
||||
// Speichern buttons
|
||||
button("save", $translation->get("save"), $formname, "loadCard('save_group_faq_setup', true)");
|
||||
button("save", $translation->get("save_and_close"), $formname, "loadCard('save_group_faq_setup', true, '', true)");
|
||||
|
||||
if ($input_line["id"] != "") {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_group_faq_setup', true, '{$translation->get('delete_faq_group')}', true)");
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
|
||||
if ($messages !== null) {
|
||||
if (count($messages)) {
|
||||
echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_group_id" type="hidden" value="<?= $input_line["id"] ?>" />
|
||||
<input name="save_and_close" id="save_and_close" type="hidden" value="0" />
|
||||
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<? input($translation->get("description"), "input_description", "text", $input_line["description"], 255) ?>
|
||||
<? input_select($translation->get("default_active"), "input_default_active", $values = array('1', '0'), $value_names = array($translation->get("yes"), $translation->get("no")), $input_line["default_active"]); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</form>
|
||||
30
module/faq/edit_faq_setup_listform.inc.php
Normal file
30
module/faq/edit_faq_setup_listform.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_faq_config_list";
|
||||
$inputname = "input_group_id";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_faq_setup_group', true)"); ?>
|
||||
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('left_faq_config'); ?></h1>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input type="hidden" class="selected_linklist_row" name="input_group_id" value="" />
|
||||
|
||||
<div class="requestLoader"></div>
|
||||
<?
|
||||
$query = "SELECT main_faq_setup_group.id, description AS '" . $translation->get("description") . "', main_faq_setup_group.default_active as '" . $translation->get("state") . "' from main_faq_setup_group ORDER BY sorting asc";
|
||||
$format = array('option', 'text', 'boolean_active');
|
||||
if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
|
||||
linklist($result, $formname, $format, "input_group_id", "edit_group_faq_setup", TRUE, 'update_sortorder_faq_group');
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
14
module/faq/faq.php
Normal file
14
module/faq/faq.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
//require_once("collection_config.inc.php");
|
||||
|
||||
function faq_show( $sitepart_id ) {
|
||||
require("show_faq.inc.php");
|
||||
}
|
||||
|
||||
function faq_edit() {
|
||||
require_once('edit_faq.inc.php');
|
||||
}
|
||||
|
||||
function faq_edit_setup() {
|
||||
require_once('edit_faq_setup.inc.php');
|
||||
}
|
||||
19
module/faq/faq_config.inc.php
Normal file
19
module/faq/faq_config.inc.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?
|
||||
|
||||
// FAQ Bilder
|
||||
define("PATH_SETUP_ICON_FAQ", "/layout/admin/img/icons/2020/faq/");
|
||||
|
||||
$faq_setup_images = array(
|
||||
'artikel.png',
|
||||
'bilder.png',
|
||||
'calendar.png',
|
||||
'dokumente_2.png',
|
||||
'dokumente.png',
|
||||
'karriere.png',
|
||||
'liste.png',
|
||||
'news.png',
|
||||
'newsletter.png',
|
||||
'orte.png',
|
||||
'person.png',
|
||||
'videos.png'
|
||||
);
|
||||
74
module/faq/page_faq_preview_cardform.inc.php
Normal file
74
module/faq/page_faq_preview_cardform.inc.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?
|
||||
$formname = "form_faq_cardformtest";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$inputname = "input_id";
|
||||
$input_page_id = (isset($_REQUEST["input_page_id"]) ? $_REQUEST["input_page_id"] : "");
|
||||
$input_component_id = (isset($_REQUEST["input_component_id"]) ? $_REQUEST["input_component_id"] : "");
|
||||
|
||||
// erstellte FAQ sammeln
|
||||
$faq = array();
|
||||
$query = "SELECT * FROM main_faq WHERE (main_language_id = " . (int)$GLOBALS["language"]['id'] . " OR all_languages = 1)";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php
|
||||
echo $translation->get("new_faq");
|
||||
?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?php
|
||||
// Zurueck zur uebersicht
|
||||
if (is_page_edit() || is_component_edit()) {
|
||||
button("left", $translation->get("back"), $formname, "loadCard('edit_content_page', true)");
|
||||
}
|
||||
|
||||
// Speichern button
|
||||
button("save", $translation->get("save"), $formname, "loadCard('save_faq_page_link', true)");
|
||||
|
||||
// Speichern und schliessen
|
||||
button("save", $translation->get("save_and_close"), $formname, "loadCard('save_faq_page_link', true, '', true)");
|
||||
?>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
|
||||
if ($messages !== null) {
|
||||
if (count($messages)) {
|
||||
echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_id" type="hidden" value="<?= $input_line["id"] ?>">
|
||||
|
||||
<input type="hidden" name="get_real_page_link_id" value="1" />
|
||||
<input type="hidden" name="input_page_id" value="<?php echo $input_page_id; ?>" />
|
||||
<input type="hidden" name="input_component_id" value="<?php echo $input_component_id; ?>" />
|
||||
<input name="data-sitepartid" type="hidden" value="16">
|
||||
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<? input($translation->get("description"), "input_description", "text", $input_line["description"], 255) ?>
|
||||
<? input($translation->get("show_in_all_languages"), "input_all_languages", "checkbox", $input_line["all_languages"]) ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($input_line["id"] != "") {
|
||||
show_changed_on($input_line["id"], "main_faq_header");
|
||||
show_changed_by($input_line["id"], "main_faq_header");
|
||||
}
|
||||
loadFAQGroup($input_line['id']);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
</form>
|
||||
62
module/faq/search.php
Normal file
62
module/faq/search.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?
|
||||
//Wird benötigt um Enviroment Variable zu holen
|
||||
$currDir = __DIR__;
|
||||
$rootDir = dirname(dirname($currDir));
|
||||
$dcDir = $rootDir . '/dc';
|
||||
require_once($rootDir . '/vendor/autoload.php');
|
||||
$baseDir = rtrim(dirname(__DIR__,2),'/');
|
||||
$envDir = $baseDir . '/config';
|
||||
$envFilePath = $envDir . '/.env';
|
||||
if (is_dir($envDir) && file_exists($envFilePath) && is_file($envFilePath) && is_readable($envFilePath)) {
|
||||
$dotenv = new \Dotenv\Dotenv($envDir);
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
require_once("../../mysyde/common/common_functions.inc.php");
|
||||
require_once((local_environment()) ? "../../mysyde/dc.config.php" : "../../mysyde/dc-server.config.php");
|
||||
db_connect();
|
||||
|
||||
/* ++ DuP breadcrumb mediaoslutions GmbH */
|
||||
// Notwendig für Ajax
|
||||
|
||||
if ($_POST['search'] != '') {
|
||||
|
||||
$txt = replace_umlaut($_POST['search']);
|
||||
|
||||
$query = "SELECT * FROM main_faq_line WHERE
|
||||
MATCH(text1, text2, hashtags) AGAINST('+*".mysqli_real_escape_string($GLOBALS['mysql_con'],$txt)."*' IN BOOLEAN MODE)";
|
||||
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
echo "\n<div class=\"faq_group_container\">\n";
|
||||
echo "<div class=\"faq_headline\"><h2>Suchergebnisse</h2></div>\n";
|
||||
|
||||
if (@mysqli_num_rows($result) > 0) {
|
||||
|
||||
while ($questions = @mysqli_fetch_array($result)) {
|
||||
echo "<div class=\"faq_question_box\"><h3>{$questions[text1]}</h3></div>\n<div class=\"faq_answer_box\">{$questions['text2']}</div>";
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Keine Ergebnisse";
|
||||
}
|
||||
|
||||
echo "\n</div>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
||||
$(".search_result .faq_question_box").click(function(){
|
||||
$(this).toggleClass("active"),$(this).next(".faq_answer_box").slideToggle("slow");
|
||||
})
|
||||
|
||||
$(".faq_question_box").click(function() {
|
||||
$(this).toggleClass("active"),
|
||||
$(this).next(".faq_answer_box").slideToggle("slow")
|
||||
})
|
||||
|
||||
</script>
|
||||
63
module/faq/show_collection_faq.inc.php
Normal file
63
module/faq/show_collection_faq.inc.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
|
||||
?>
|
||||
<div class="faq">
|
||||
|
||||
<div class="faq_nearest_search">
|
||||
<input type="hidden" width="300px" name="nearest_faq_search" onkeyup="liveSearch(this)" placeholder="Suchbegriff eingeben">
|
||||
</div>
|
||||
|
||||
<div class="search_result"></div>
|
||||
|
||||
|
||||
<?
|
||||
|
||||
$query = "SELECT mfg.* FROM main_faq_setup_group as mfg INNER JOIN main_collection_faq_header_group_link as mfgl on mfg.id = mfgl.faq_group_id WHERE mfg.default_active = 1 AND mfgl.active = 1 AND mfgl.main_collection_id = ".$collectionData['id']." AND field_id = ".$fieldData['id']." ORDER BY sorting asc";
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if (@mysqli_num_rows($result) > 0) {
|
||||
|
||||
while ($faq_group = @mysqli_fetch_array($result)) {
|
||||
|
||||
$group_link = "SELECT * FROM main_faq_group_link WHERE main_faq_setup_group_id = '" . $faq_group['id'] . "' AND active = 1 ORDER BY sorting ASC";
|
||||
$result_group_link = @mysqli_query($GLOBALS['mysql_con'], $group_link);
|
||||
|
||||
echo "\n<div class=\"faq_group_container\">\n";
|
||||
echo "<div class=\"faq_headlines section-heading\"><h2>" . $faq_group['description'] . "</h2></div>\n";
|
||||
|
||||
while ($questions = @mysqli_fetch_array($result_group_link)) {
|
||||
|
||||
$faq_line = "SELECT mfq.*, mf.description as text1 FROM main_faq_line as mfq INNER JOIN main_faq as mf on mfq.main_faq_id = mf.id WHERE main_faq_id = '" . $questions['main_faq_id'] . "'";
|
||||
$result_faq_line = @mysqli_query($GLOBALS['mysql_con'], $faq_line);
|
||||
|
||||
while ($questions_result = @mysqli_fetch_array($result_faq_line)) {
|
||||
echo "<div class=\"faq_question_box\"><h3>{$questions_result[text1]}</h3></div>\n<div class=\"faq_answer_box\">{$questions_result['text2']}</div>";
|
||||
}
|
||||
}
|
||||
echo "\n</div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function liveSearch(str) {
|
||||
|
||||
var txt = str.value;
|
||||
|
||||
$.ajax({
|
||||
url: '/module/faq/search.php',
|
||||
data: {
|
||||
action: 'liveSearch',
|
||||
search: txt
|
||||
},
|
||||
type: 'post',
|
||||
success: function(data) {
|
||||
$('.search_result').html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
64
module/faq/show_faq.inc.php
Normal file
64
module/faq/show_faq.inc.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$page_id = (int)$GLOBALS["navigation"]['forward_page_id'];
|
||||
$header_id = (int)$GLOBALS['navigation']['sitepart_header_id'];
|
||||
?>
|
||||
<div class="faq">
|
||||
|
||||
<div class="faq_nearest_search">
|
||||
<input type="text" width="300px" name="nearest_faq_search" onkeyup="liveSearch(this)" placeholder="Suchbegriff eingeben">
|
||||
</div>
|
||||
|
||||
<div class = "search_result"></div>
|
||||
|
||||
|
||||
<?
|
||||
$query = "SELECT main_faq_setup_group.id, main_faq_setup_group.description FROM main_faq_setup_group RIGHT JOIN main_faq_header_group_link ON main_faq_setup_group.id = main_faq_header_group_link.faq_group_id WHERE active = 1 AND header_id = ".$header_id." ORDER BY sorting asc";
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) > 0) {
|
||||
|
||||
while ($faq_group = @mysqli_fetch_array($result)) {
|
||||
$group_link = "SELECT * FROM main_faq_group_link WHERE main_faq_setup_group_id = '".$faq_group['id']."' AND active = 1 ORDER BY sorting ASC";
|
||||
$result_group_link = @mysqli_query($GLOBALS['mysql_con'], $group_link);
|
||||
echo "\n<div class=\"faq_group_container\">\n";
|
||||
echo "<div class=\"faq_headline\"><h2>".$faq_group['description']."</h2></div>\n";
|
||||
|
||||
while ($questions = @mysqli_fetch_array($result_group_link)) {
|
||||
|
||||
$faq_line = "SELECT * FROM main_faq_line LEFT JOIN main_faq ON main_faq.id = main_faq_line.main_faq_id WHERE main_faq_id = '".$questions['main_faq_id']."'";
|
||||
$result_faq_line = @mysqli_query($GLOBALS['mysql_con'], $faq_line);
|
||||
|
||||
while ($questions_result = @mysqli_fetch_array($result_faq_line)) {
|
||||
echo "<div class=\"faq_question_box\"><h3>{$questions_result[description]}</h3></div>\n<div class=\"faq_answer_box\">{$questions_result['text2']}</div>";
|
||||
}
|
||||
|
||||
}
|
||||
echo "\n</div>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function liveSearch(str) {
|
||||
|
||||
var txt = str.value;
|
||||
|
||||
$.ajax({
|
||||
url: '/module/faq/search.php',
|
||||
data: {
|
||||
action: 'liveSearch',
|
||||
search: txt
|
||||
},
|
||||
type: 'post',
|
||||
success: function(data) {
|
||||
$('.search_result').html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user