backup: live-stand vor erstem git-deployment
This commit is contained in:
5
module/infopoint/ajax_infopoint.php
Normal file
5
module/infopoint/ajax_infopoint.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$time = new DateTime();
|
||||
|
||||
echo $time->format('H:i:s');
|
||||
27
module/infopoint/content_infopoint.php
Normal file
27
module/infopoint/content_infopoint.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
function loadContent($current_page){
|
||||
switch ($current_page['type']) {
|
||||
case 'collection':
|
||||
echo $current_page['description'] . "<br>";
|
||||
$current_date = new DateTime();
|
||||
echo $current_date->format('H:i:s');
|
||||
break;
|
||||
case 'textcontent':
|
||||
loadTextContent($current_page['type_id']);
|
||||
break;
|
||||
case 'image':
|
||||
echo "<img class='fullscreen_image' src='../../userdata/infopoint/".$current_page['image']."'>";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function loadTextContent($id){
|
||||
$select_textcontent = $GLOBALS['pdo_conn']->prepare("SELECT * FROM textcontent_header WHERE id = :id");
|
||||
$select_textcontent->execute(array(':id' => $id));
|
||||
$res_textcontent = $select_textcontent->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
echo $res_textcontent['content'];
|
||||
}
|
||||
115
module/infopoint/dashboard_infopoint.php
Normal file
115
module/infopoint/dashboard_infopoint.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
require_once(MODULE_PATH . "infopoint/infopoint_config.inc.php");
|
||||
|
||||
$siteparts = \DynCom\mysyde\common\classes\Siteparts::get();
|
||||
$pageIds = array();
|
||||
$sitepartCount = array();
|
||||
$formname = "form_infopoint";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
|
||||
$action = (isset($_GET['action']) ? $_GET['action'] : "");
|
||||
|
||||
if ($action != "" && $action != "admin_login") {
|
||||
require_once(MODULE_PATH . "infopoint/infopoint.inc.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$pages_anzahl = array();
|
||||
|
||||
$query = "SELECT id, count(*) AS anzahl FROM main_infopoint_pages GROUP BY id";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
while ($row = @mysqli_fetch_array($result, 1)) {
|
||||
$pages_anzahl[] = $row['anzahl'];
|
||||
}
|
||||
|
||||
$presets_anzahl = array();
|
||||
|
||||
$query = "SELECT id, count(*) AS anzahl FROM main_infopoint_presets GROUP BY id";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
while ($row = @mysqli_fetch_array($result, 1)) {
|
||||
$presets_anzahl[] = $row['anzahl'];
|
||||
}
|
||||
|
||||
$screens_anzahl = array();
|
||||
|
||||
$query = "SELECT id, count(*) AS anzahl FROM main_infopoint_screens GROUP BY id";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
while ($row = @mysqli_fetch_array($result, 1)) {
|
||||
$screens_anzahl[] = $row['anzahl'];
|
||||
}
|
||||
|
||||
$anzahl_pages = count($pages_anzahl);
|
||||
$anzahl_presets = count($presets_anzahl);
|
||||
$anzahl_screens = count($screens_anzahl);
|
||||
?>
|
||||
|
||||
<div id="mainContent">
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('left_infopoint'); ?></h1>
|
||||
|
||||
<div class="dashboard_part_left">
|
||||
<h2><?php echo get_translation('left_infopoint'); ?></h2>
|
||||
|
||||
<a class="dashoard_box button_inhalt_collection"
|
||||
href="<?php echo get_menu_link($_GET["level_1"] . "/screens", $site, $language); ?>">
|
||||
<span class="dashboard_box_number"><?php echo(isset($anzahl_screens) ? $anzahl_screens : 0); ?></span>
|
||||
<span class="dashboard_box_description"><?php echo $translation->get("infopoint_screens"); ?></span>
|
||||
<img src="<?php echo PATH_SETUP_ICON_INFOPOINT . "liste.png"; ?>" />
|
||||
</a>
|
||||
|
||||
<a class="dashoard_box button_inhalt_collection"
|
||||
href="<?php echo get_menu_link($_GET["level_1"] . "/pages", $site, $language); ?>">
|
||||
<span class="dashboard_box_number"><?php echo(isset($anzahl_pages) ? $anzahl_pages : 0); ?></span>
|
||||
<span class="dashboard_box_description"><?php echo $translation->get("infopoint_pages"); ?></span>
|
||||
<img src="<?php echo PATH_SETUP_ICON_INFOPOINT . "dokumente_2.png"; ?>" />
|
||||
</a>
|
||||
|
||||
<a class="dashoard_box button_inhalt_collection"
|
||||
href="<?php echo get_menu_link($_GET["level_1"] . "/presets", $site, $language); ?>">
|
||||
<span class="dashboard_box_number"><?php echo(isset($anzahl_presets) ? $anzahl_presets : 0); ?></span>
|
||||
<span class="dashboard_box_description"><?php echo $translation->get("infopoint_presets"); ?></span>
|
||||
<img src="<?php echo PATH_SETUP_ICON_INFOPOINT . "dokumente_2.png"; ?>" />
|
||||
</a>
|
||||
</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", "infoboard_list");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
500
module/infopoint/infopoint.inc.php
Normal file
500
module/infopoint/infopoint.inc.php
Normal file
@@ -0,0 +1,500 @@
|
||||
<?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_screen':
|
||||
require_once("edit_faq_cardform.inc.php");
|
||||
break;
|
||||
case 'edit_screen':
|
||||
edit_screen();
|
||||
break;
|
||||
case 'delete_screen':
|
||||
delete_faq();
|
||||
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("infopoint_screens_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_screens( $_id = "", $messages = array() ) {
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
|
||||
$query = "SELECT * FROM main_infopoint_screens 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("infopoint_screens_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
require_once("infopoint_screens_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']);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
13
module/infopoint/infopoint.php
Normal file
13
module/infopoint/infopoint.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
function infopoint_screens() {
|
||||
require_once('infopoint_screens.inc.php');
|
||||
}
|
||||
|
||||
function infopoint_pages() {
|
||||
require_once('infopoint_pages.inc.php');
|
||||
}
|
||||
|
||||
function infopoint_presets() {
|
||||
require_once('infopoint_presets.inc.php');
|
||||
}
|
||||
22
module/infopoint/infopoint_config.inc.php
Normal file
22
module/infopoint/infopoint_config.inc.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?
|
||||
//Bildpfade
|
||||
define("PATH_ORIGINAL_PICTURE_INFOPOINT", "../../userdata/infopoint/");
|
||||
define("PATH_ICON_INFOPOINT", "/userdata/infopoint/");
|
||||
|
||||
// kollektionsbilder
|
||||
define("PATH_SETUP_ICON_INFOPOINT", "/layout/admin/img/icons/collections/");
|
||||
|
||||
$infopoint_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'
|
||||
);
|
||||
131
module/infopoint/infopoint_listform.inc.php
Normal file
131
module/infopoint/infopoint_listform.inc.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_infopoint_list";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new_menuitem"), $formname, "loadCard('new_navigation', true)"); ?>
|
||||
<?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_navigation')"); ?>
|
||||
<?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_navigation', false, '{$translation->get('delete_navitem_confirm')}')"); ?>
|
||||
|
||||
<li>
|
||||
<ul>
|
||||
<?= button("up", $translation->get("go_up"), $formname, "sendRequest('moveup_navigation')", "", FALSE); ?>
|
||||
<?= button("down", $translation->get("go_down"), $formname, "sendRequest('movedown_navigation')", "", FALSE); ?>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<ul>
|
||||
<?= button("left", $translation->get("go_left"), $formname, "sendRequest('moveleft_navigation')", "", FALSE); ?>
|
||||
<?= button("right", $translation->get("go_right"), $formname, "sendRequest('moveright_navigation')", "", FALSE); ?>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('left_navigation'); ?></h1>
|
||||
|
||||
<form id="<?php echo $formname; ?>" name="<?php echo $formname; ?>" method="post">
|
||||
<div class="requestLoader"></div>
|
||||
<input type="hidden" class="selected_linklist_row" name="input_main_navigation_id" value="" />
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="requestLoader"></div>
|
||||
<div id="page_linklist">
|
||||
<?
|
||||
// $query = "SELECT id, menu_name AS '".$translation->get("name")."', code, active AS ".$translation->get("state").", modified_date as '".$translation->get("changed_on")."', modified_admin_user_id AS '".$translation->get("changed_by")."' FROM main_navigation WHERE main_site_id = '" . $site["id"] . "' AND main_language_id = '" . $language["id"]."'";
|
||||
|
||||
// $result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
// $num_rows = mysqli_num_rows($result);
|
||||
|
||||
// $format = array('option', 'text', 'text','boolean_active','text','text');
|
||||
// if($num_rows > 0) {
|
||||
// // linklist($result,"form_page_list",$format, "input_page_id", "edit_content_page");
|
||||
// linklist($result, $formname, $format, "input_main_navigation_id", "edit_navigation", TRUE, "reorder_navigation", "sendRequest('delete_navigation', false, '{$translation->get('delete_collection_confirm')}')");
|
||||
// } else {
|
||||
// echo "<div class=\"infobox\">" . $translation->get("no_rows_found") . "</div>";
|
||||
// }
|
||||
show_main_navigation($site, $language);
|
||||
?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var reorderCall = null;
|
||||
var dragEnabled = false;
|
||||
|
||||
function toggleDragDrop( _aTag ) {
|
||||
if (dragEnabled === false) {
|
||||
dragEnabled = true;
|
||||
$('ol.sortable').addClass("enabled");
|
||||
$('ol.sortable').nestedSortable("option", "disabled", false);
|
||||
$(_aTag).html("<?php echo $translation->get('disable_drag_drop'); ?>");
|
||||
} else {
|
||||
dragEnabled = false;
|
||||
$('ol.sortable').removeClass("enabled");
|
||||
$('ol.sortable').nestedSortable("option", "disabled", true);
|
||||
$(_aTag).html("<?php echo $translation->get('enable_drag_drop'); ?>");
|
||||
}
|
||||
}
|
||||
|
||||
//$('.dd').nestable({ /* config options */ });
|
||||
$('ol.sortable').nestedSortable({
|
||||
forcePlaceholderSize: true,
|
||||
handle : '.dd-icon',
|
||||
helper : 'clone',
|
||||
items : 'li',
|
||||
opacity : .6,
|
||||
placeholder : 'placeholder',
|
||||
revert : 250,
|
||||
tabSize : 25,
|
||||
tolerance : 'pointer',
|
||||
toleranceElement : '> div',
|
||||
maxLevels : 5,
|
||||
isTree : true,
|
||||
expandOnHover : 1000,
|
||||
cookieIndex : 'nestedSortable_expanded',
|
||||
startCollapsed : true,
|
||||
stop : function ( event, ui ) {
|
||||
reorder_navigation();
|
||||
store_expanded();
|
||||
},
|
||||
disabled : false
|
||||
});
|
||||
|
||||
$('.disclose').click(function () {
|
||||
$(this).closest('li').toggleClass('mjs-nestedSortable-collapsed').toggleClass('mjs-nestedSortable-expanded');
|
||||
store_expanded();
|
||||
});
|
||||
|
||||
function store_expanded() {
|
||||
var list = [];
|
||||
$('ol.sortable').find('li.mjs-nestedSortable-expanded').each(function () {
|
||||
list.push($(this).attr("id"));
|
||||
});
|
||||
$.cookie('nestedSortable_expanded', list.join(','));
|
||||
}
|
||||
|
||||
function reorder_navigation() {
|
||||
if (reorderCall !== null) {
|
||||
reorderCall.abort();
|
||||
}
|
||||
|
||||
serialized = $('ol.sortable').nestedSortable('serialize');
|
||||
arraied = $('ol.sortable').nestedSortable('toHierarchy', {startDepthCount: 0});
|
||||
var parameter = {
|
||||
list: arraied
|
||||
};
|
||||
reorderCall = jQuery.post("?action=reorder_navigation", parameter, function ( output, status, xhr ) {
|
||||
if (xhr.getResponseHeader('REQUIRES_AUTH') == 1) {
|
||||
window.location.replace("/dc/");
|
||||
} else {
|
||||
console.log(output);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
263
module/infopoint/infopoint_pages.inc.php
Normal file
263
module/infopoint/infopoint_pages.inc.php
Normal file
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
date_default_timezone_set('Europe/Berlin');
|
||||
require_once("infopoint_config.inc.php");
|
||||
|
||||
$messages = array();
|
||||
$error = FALSE;
|
||||
|
||||
if (isset($custom_action)) {
|
||||
$action = $custom_action;
|
||||
} else {
|
||||
$action = $_REQUEST["action"];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'save_page':
|
||||
save_page();
|
||||
break;
|
||||
case 'new_page':
|
||||
require_once("infopoint_pages_cardform.inc.php");
|
||||
break;
|
||||
case 'edit_page':
|
||||
edit_page();
|
||||
break;
|
||||
case 'delete_page':
|
||||
delete_page();
|
||||
break;
|
||||
case 'update_sortorder_faq':
|
||||
update_sortorder_faq();
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once("infopoint_pages_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_page( $_id = "", $messages = array() ) {
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
|
||||
$query = "SELECT * FROM main_infopoint_pages 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("infopoint_pages_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
require_once("infopoint_pages_cardform.inc.php");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function save_page() {
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$messages = array();
|
||||
$id = $_REQUEST["input_id"];
|
||||
$type = $_REQUEST["type"];
|
||||
$default_active = $_REQUEST["input_default_active"];
|
||||
$header_id = "";
|
||||
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "UPDATE main_infopoint_pages SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "' ,
|
||||
type = '".$type."',
|
||||
modified_date = '" . time() . "',
|
||||
modified_user = '" . (int)$GLOBALS["admin_user"]['id'] . "'
|
||||
WHERE id = " . $_REQUEST["input_id"] . " LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
} else {
|
||||
$query = "INSERT INTO main_infopoint_pages (description, type, type_id, image, modified_date, modified_user) VALUES (
|
||||
'".mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"])."',
|
||||
'".$type."',
|
||||
'0',
|
||||
'0',
|
||||
'".time()."',
|
||||
'".(int)$GLOBALS["admin_user"]['id']."'
|
||||
)";
|
||||
$inserted = TRUE;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'textcontent':
|
||||
save_textcontent($id);
|
||||
break;
|
||||
case 'image':
|
||||
saveImg($id);
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
|
||||
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_infoboard_pages', $header_id, 'INSERT');
|
||||
$messages[] = '<div class="successbox">' . $translation->get("collection_group_msg_success1") . '</div>';
|
||||
} else {
|
||||
createMySydeLog('main_infoboard_pages', $_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"];
|
||||
}
|
||||
require_once("infopoint_pages_cardform.inc.php");
|
||||
}
|
||||
|
||||
function delete_page() {
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "DELETE FROM main_infopoint_pages WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
createMySydeLog('main_infopoint_pages', $_REQUEST['input_id'], 'DELETE');
|
||||
}
|
||||
require_once("infopoint_pages_listform.inc.php");
|
||||
}
|
||||
|
||||
function saveImg($page_id){
|
||||
$filekey = 'input_collection_link_' . $page_id;
|
||||
|
||||
$error = FALSE;
|
||||
if (!empty($_FILES[$filekey]['name'])) {
|
||||
$erlaubte_endungen = array("jpg", "jpeg", "gif", "png");
|
||||
$filename = strtolower($_FILES[$filekey]['name']);
|
||||
$filename_expl = explode(".", $filename);
|
||||
if (!in_array($filename_expl[count($filename_expl) - 1], $erlaubte_endungen)) {
|
||||
$messages = "<div class='errorbox'>" . $translation->get("error_slideshow_line2") . "</div>\n";
|
||||
$error = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_FILES[$filekey]['name']) && $error === FALSE) {
|
||||
|
||||
$saveFilename = $input_id . "_" . (int)$page_id . "_" . cleanFilename($_FILES[$filekey]['name']);
|
||||
|
||||
delete_infopoint_image($saveFilename);
|
||||
|
||||
move_uploaded_file($_FILES[$filekey]['tmp_name'], PATH_ORIGINAL_PICTURE_INFOPOINT . $saveFilename);
|
||||
|
||||
$postValue = $saveFilename;
|
||||
|
||||
$query = "UPDATE main_infopoint_pages SET
|
||||
type = 'image',
|
||||
image = '".$postValue."'
|
||||
WHERE id = " . $page_id . " LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
}
|
||||
}
|
||||
|
||||
function delete_infopoint_image($filename) {
|
||||
if (file_exists(PATH_ORIGINAL_PICTURE_INFOPOINT . $filename) && !empty($filename)) {
|
||||
unlink(PATH_ORIGINAL_PICTURE_INFOPOINT . $filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function create_infopoint_input_field($page_id){
|
||||
$query = "SELECT * FROM main_infopoint_pages WHERE id = '" . $page_id . "'";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$row = @mysqli_fetch_array($result);
|
||||
switch ($row['type']) {
|
||||
case 'image':
|
||||
if ($row['image'] != "") {
|
||||
echo "<table cellpadding=\"0\" cellspacing=\"0\">";
|
||||
echo "<tr><td>";
|
||||
echo "<img class='infopoint_icon' src=\"" . PATH_ICON_INFOPOINT . $row['image'] . "?time=" . time() . "\" /></td><td><input type=\"checkbox\" name=\"delete_collection_image_" . $page_id . "\" /> Bild entfernen</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
echo "<input id=\"input_collection_link_" . $page_id . "\" class=\"code\" type=\"file\" name=\"input_collection_link_" . $page_id . "\">";
|
||||
break;
|
||||
case 'textcontent':
|
||||
$query = "SELECT * FROM textcontent_header WHERE id = '" . $row['type_id'] . "'";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$headerData = @mysqli_fetch_array($result);
|
||||
echo '<input type="hidden" name="infopoint_modul_input_'.$fieldSetup['id'].'" value="textcontent" />';
|
||||
show_ck_editor($headerData['content'], "dc", 'layout/frontend/' . $GLOBALS["layout"]["code"] . '/dist/css/fck.css', 'layout/frontend/' . $GLOBALS["layout"]["code"] . '/fckstyles.xml', "module_input_textcontent_text_" . $page_id);
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function save_textcontent($page_id){
|
||||
$query = "SELECT * FROM main_infopoint_pages WHERE id = '" . $page_id . "'";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$infopoint_row = @mysqli_fetch_array($result);
|
||||
|
||||
if (is_array($infopoint_row)) {
|
||||
// update
|
||||
$query = "UPDATE textcontent_header SET
|
||||
modified_date = " . time() . ",
|
||||
modified_user = " . (int)$GLOBALS["admin_user"]['id'] . ",
|
||||
content = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['module_input_textcontent_text_' . $page_id]) . "',
|
||||
type = 0
|
||||
WHERE id = " . $infopoint_row['type_id'] . "
|
||||
LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
} else {
|
||||
// insert
|
||||
$query = "INSERT INTO textcontent_header
|
||||
(main_language_id, description, modified_date, modified_user, type, content, collection_header)
|
||||
VALUES (
|
||||
'" . $GLOBALS["language"]['id'] . "',
|
||||
'',
|
||||
" . time() . ",
|
||||
" . (int)$GLOBALS["admin_user"]['id'] . ",
|
||||
0,
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['module_input_textcontent_text_' . $page_id]) . "',
|
||||
1
|
||||
)";
|
||||
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$header_id = mysqli_insert_id($GLOBALS['mysql_con']);
|
||||
}
|
||||
$query = "UPDATE main_infopoint_pages SET
|
||||
type = 'textcontent',
|
||||
type_id = ".$header_id."
|
||||
WHERE id = " . $page_id . " LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
}
|
||||
89
module/infopoint/infopoint_pages_cardform.inc.php
Normal file
89
module/infopoint/infopoint_pages_cardform.inc.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?
|
||||
$formname = "form_infopoint_pages_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_infopoint_pages WHERE id = '" . $input_line['id'] . "'";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$input_text = @mysqli_fetch_array($result);
|
||||
|
||||
$preset_values = array();
|
||||
$preset_values_id = array();
|
||||
$query = "SELECT * FROM main_infopoint_presets";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
while ($row = @mysqli_fetch_array($result)) {
|
||||
$preset_values[] = $row['description'];
|
||||
$preset_values_id[] = $row['id'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php if ($input_line["id"] == "") {
|
||||
echo $translation->get("new_page");
|
||||
} else {
|
||||
echo $translation->get("edit_page");
|
||||
}
|
||||
?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?php
|
||||
|
||||
// Speichern buttons
|
||||
button("save", $translation->get("save"), $formname, "loadCard('save_page', true)");
|
||||
|
||||
button("save", $translation->get("save_and_close"), $formname, "loadCard('save_page', true, '', true)");
|
||||
|
||||
if ($input_line["id"] != "") {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_page', true, '{$translation->get('delete_page')}', true)");
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
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="type" type="hidden" value=<?= $input_line["type"] ?> />
|
||||
<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("collection_change_sorting"), "input_change_sorting", $values = array_keys($sorting_values), $value_names = array_values($sorting_values), "", FALSE, FALSE);
|
||||
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
|
||||
if ($input_line["id"] != "") {
|
||||
show_changed_on($input_line["id"], "main_infopoint_pages");
|
||||
show_changed_by($input_line["id"], "main_infopoint_pages");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
create_infopoint_input_field($input_line['id']);
|
||||
?>
|
||||
</form>
|
||||
36
module/infopoint/infopoint_pages_listform.inc.php
Normal file
36
module/infopoint/infopoint_pages_listform.inc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_infopoint_pages_list";
|
||||
$inputname = "input_group_id";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_page', true)"); ?>
|
||||
<?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_page')"); ?>
|
||||
<?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_page', false, '{$translation->get('delete_page')}')"); ?>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('infopoint_pages'); ?></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_infopoint_pages.id, main_infopoint_pages.description AS '" . $translation->get("description") . "', main_infopoint_pages.type, 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_infopoint_pages
|
||||
LEFT JOIN
|
||||
main_admin_user
|
||||
ON
|
||||
main_admin_user.id = main_infopoint_pages.modified_user";
|
||||
|
||||
$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>
|
||||
283
module/infopoint/infopoint_presets.inc.php
Normal file
283
module/infopoint/infopoint_presets.inc.php
Normal file
@@ -0,0 +1,283 @@
|
||||
<?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_preset':
|
||||
save_preset();
|
||||
break;
|
||||
case 'new_preset':
|
||||
require_once("infopoint_presets_cardform.inc.php");
|
||||
break;
|
||||
case 'edit_preset':
|
||||
edit_preset();
|
||||
break;
|
||||
case 'delete_preset':
|
||||
delete_preset();
|
||||
break;
|
||||
case 'delete_line_preset':
|
||||
delete_line();
|
||||
break;
|
||||
case 'moveup_line_preset':
|
||||
moveup_line_preset();
|
||||
require_once("infoboard_presets_cardform.inc.php");
|
||||
break;
|
||||
case 'movedown_line_preset':
|
||||
movedown_line_preset();
|
||||
require_once("infoboard_presets_cardform.inc.php");
|
||||
break;
|
||||
default:
|
||||
require_once("infopoint_presets_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_preset( $_id = "", $messages = array() ) {
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
|
||||
$query = "SELECT * FROM main_infopoint_presets 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("infopoint_presets_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
require_once("infopoint_presets_cardform.inc.php");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function save_preset() {
|
||||
$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_infopoint_presets SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "' ,
|
||||
modified_date = '" . time() . "',
|
||||
modified_user = '" . (int)$GLOBALS["admin_user"]['id'] . "',
|
||||
main_infopoint_preset_id = '" . $_REQUEST["input_infopoint_preset"] . "'
|
||||
WHERE id = " . $_REQUEST["input_id"] . " LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
} else {
|
||||
$hash = base64_encode(random_bytes(18));
|
||||
$query = "INSERT INTO main_infopoint_presets (hash, description, modified_date, modified_user, main_infopoint_preset_id) VALUES (
|
||||
'".$hash."',
|
||||
'".mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"])."',
|
||||
'".time()."',
|
||||
'".(int)$GLOBALS["admin_user"]['id']."',
|
||||
'".$_REQUEST["input_infopoint_preset"]."'
|
||||
)";
|
||||
$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_infoboard_presets', $header_id, 'INSERT');
|
||||
$messages[] = '<div class="successbox">' . $translation->get("collection_group_msg_success1") . '</div>';
|
||||
} else {
|
||||
createMySydeLog('main_infoboard_presets', $_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"];
|
||||
}
|
||||
require_once("infopoint_presets_cardform.inc.php");
|
||||
}
|
||||
|
||||
function delete_preset() {
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "DELETE FROM main_infopoint_presets WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
createMySydeLog('main_infopoint_presets', $_REQUEST['input_id'], 'DELETE');
|
||||
}
|
||||
require_once("infopoint_presets_listform.inc.php");
|
||||
}
|
||||
|
||||
function show_preset_rows() {
|
||||
|
||||
$main_layout_id = $GLOBALS["language"]["main_layout_id"];
|
||||
$input_preset_id = $_REQUEST["input_id"];
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
global $layoutareas;
|
||||
|
||||
// alle layoutareas
|
||||
$layoutareas = array();
|
||||
$query = "SELECT * FROM main_layout_area where main_layout_id = '" . $main_layout_id."'";
|
||||
if($result = @mysqli_query($GLOBALS['mysql_con'],$query)) {
|
||||
while ($row = @mysqli_fetch_array($result,1)) {
|
||||
$layoutareas[$row['id']] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$query = "SELECT
|
||||
main_infopoint_preset_link.id,
|
||||
main_infopoint_pages.description,
|
||||
main_infopoint_pages.type,
|
||||
main_infopoint_preset_link.time,
|
||||
main_infopoint_preset_link.active,
|
||||
from_unixtime(main_infopoint_preset_link.modified_date, '%d.%m.%Y %H:%i:%s') AS aenderungs_datum,
|
||||
main_admin_user.name AS username
|
||||
FROM
|
||||
main_infopoint_preset_link
|
||||
LEFT JOIN
|
||||
main_admin_user ON main_infopoint_preset_link.modified_user = main_admin_user.id
|
||||
LEFT JOIN
|
||||
main_infopoint_pages ON main_infopoint_preset_link.main_infopoint_page_id = main_infopoint_pages.id
|
||||
WHERE
|
||||
main_infopoint_preset_link.main_infopoint_preset_id = '" . $input_preset_id . "'
|
||||
ORDER BY
|
||||
sorting ASC";
|
||||
if($result = @mysqli_query($GLOBALS['mysql_con'],$query)) {
|
||||
$num_rows = @mysqli_num_rows($result);
|
||||
if($num_rows >= 1) {
|
||||
echo " <table cellpadding=0 cellspacing=0 border=0 class=\"linklist\">\n";
|
||||
|
||||
echo "<tr>";
|
||||
|
||||
echo "<td><div>" . $translation->get("description") . "</div></td>";
|
||||
echo "<td width=\"150\" align=\"left\"><div></div></td>";
|
||||
echo "<td width=\"150\" align=\"left\"><div>" . $translation->get("type") . "</div></td>";
|
||||
echo "<td width=\"150\" align=\"left\"><div>" . $translation->get("state") . "</div></td>";
|
||||
echo "<td width=\"250\" align=\"left\"><div>" . $translation->get("infopoint_time") . "</div></td>";
|
||||
echo "<td width=\"150\" align=\"left\"><div>" . $translation->get("action") . "</div></td>";
|
||||
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr>";
|
||||
echo format_seperator("");
|
||||
echo format_seperator("");
|
||||
echo format_seperator("");
|
||||
echo format_seperator("");
|
||||
echo format_seperator("");
|
||||
echo format_seperator("");
|
||||
echo "</tr>";
|
||||
|
||||
echo " </table>\n";
|
||||
|
||||
get_real_page_link_id();
|
||||
|
||||
echo "<ol class=\"linklist sortable contentlist\">";
|
||||
while ($row = @mysqli_fetch_array($result,1)) {
|
||||
$aktivText = ($row["active"] == 1 ? $translation->get("active") : $translation->get("inactive"));
|
||||
$activeClass = ($row["active"] == 1) ? 'active' : 'inactive';
|
||||
|
||||
echo "<li class=\"mjs-nestedSortable-no-nesting ".strtolower($activeClass)."\" id=\"list_{$row['id']}\">";
|
||||
echo "<div data-inputid=\"" . $row['id'] . "\" data-action=\"" . $dblClickAction . "\" data-inputname=\"input_id\" data-checked=\"{$checkedRow}\" class=\"linklist_content dd-handle\"><span class=\"disclose\"><span> </span></span>" . $row['description'] . "<div class=\"dd-icon\"></div>";
|
||||
echo "<div class=\"dd-code\">" . $row['type'] . "</div>";
|
||||
echo "<div class=\"dd-status\">" . $aktivText . "</div>";
|
||||
echo "<div class=\"dd-layout\">" . $row['time'] . "</div>";
|
||||
|
||||
echo '<div class="dd-status" style="right:0 !important;">'.'<a data-formname="form_field_list" class="button" href="javascript:void(0);" onclick="setCurrentToolbarClicked(this);loadCard(\'copy_content_page\');"> <span class="material-icons">content_copy</span></a>'.'</div></div>';
|
||||
echo '</li>';
|
||||
}
|
||||
echo "</ol>";
|
||||
|
||||
|
||||
} else {
|
||||
echo "<div class=\"infobox\">" . $translation->get("no_rows_found") . "</div>";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function get_real_page_link_id() {
|
||||
if(isset($_REQUEST['get_real_page_link_id']) && $_REQUEST['get_real_page_link_id'] == 1) {
|
||||
$_REQUEST['input_id'] = line_already_exists($_REQUEST["input_page_id"], $_REQUEST['data-sitepartid'], $_REQUEST["input_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
function moveup_line_preset() {
|
||||
move_line_preset("<","DESC",$_REQUEST["input_id"]);
|
||||
}
|
||||
|
||||
function movedown_line_preset() {
|
||||
move_line_preset(">","ASC",$_REQUEST["input_id"]);
|
||||
}
|
||||
|
||||
function move_line_preset($way,$order,$field_id) {
|
||||
$query = "SELECT * FROM main_infopoint_preset_link WHERE id = '" . $field_id . "' LIMIT 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'],$query);
|
||||
if(@mysqli_num_rows($result) == 1) {
|
||||
$curr_line = @mysqli_fetch_array($result);
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM main_infopoint_preset_link WHERE main_infopoint_preset_id = " . (int)$curr_line["main_infopoint_preset_id"] . " AND sorting " . $way . " " . $curr_line["sorting"] . " ORDER BY sorting " . $order . " LIMIT 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'],$query);
|
||||
if(@mysqli_num_rows($result) == 1) {
|
||||
$change_line = @mysqli_fetch_array($result);
|
||||
}
|
||||
if(($curr_line["id"]<>'') && ($change_line["id"]<>'')) {
|
||||
$query = "UPDATE main_infopoint_preset_link SET sorting = " . $change_line["sorting"] . " WHERE id = " . $curr_line["id"];
|
||||
@mysqli_query($GLOBALS['mysql_con'],$query);
|
||||
$query = "UPDATE main_infopoint_preset_link SET sorting = " . $curr_line["sorting"] . " WHERE id = " . $change_line["id"];
|
||||
@mysqli_query($GLOBALS['mysql_con'],$query);
|
||||
$query = "UPDATE main_infopoint_preset_link set modified_date = " . time() . ", modified_user = " . (int)$GLOBALS["admin_user"]['id'] . " where id = " . $curr_line["main_page_id"];
|
||||
@mysqli_query($GLOBALS['mysql_con'],$query);
|
||||
}
|
||||
}
|
||||
|
||||
function delete_line() {
|
||||
$query = "DELETE FROM main_infopoint_preset_link WHERE id = '" . $_POST['input_id'] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'],$query);
|
||||
|
||||
$query = "UPDATE main_infopoint_preset set modified_date = " . time() . ", modified_user = " . (int)$GLOBALS["admin_user"]['id'] . " where id = '" . (int)$_REQUEST["input_preset_id"]."'";
|
||||
@mysqli_query($GLOBALS['mysql_con'],$query);
|
||||
|
||||
require_once("infopoint_presets_cardform.inc.php");
|
||||
}
|
||||
161
module/infopoint/infopoint_presets_cardform.inc.php
Normal file
161
module/infopoint/infopoint_presets_cardform.inc.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?
|
||||
$formname = "form_infopoint_presets_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")
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php if ($input_line["id"] == "") {
|
||||
echo $translation->get("new_preset");
|
||||
} else {
|
||||
echo $translation->get("edit_preset");
|
||||
}
|
||||
?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("add_content2"), $formname, "toggleScrollerHeadline('" . $translation->get("add_content2") . "', 'new');"); ?>
|
||||
<?php
|
||||
|
||||
// Speichern buttons
|
||||
button("save", $translation->get("save"), $formname, "loadCard('save_preset', true)");
|
||||
|
||||
button("save", $translation->get("save_and_close"), $formname, "loadCard('save_preset', true, '', true)");
|
||||
|
||||
if ($input_line["id"] != "") {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_preset', true, '{$translation->get('delete_preset')}', true)");
|
||||
}
|
||||
?>
|
||||
|
||||
<li>
|
||||
<ul>
|
||||
<?= button("delete",$translation->get("delete_content"),$formname,"loadCard('delete_line_preset', false, '{$translation->get('delete_assoc_pageline')}')","", false); ?>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<ul>
|
||||
<?= button("up",$translation->get("go_up"),$formname,"loadCard('moveup_line_preset')", "", false); ?>
|
||||
<?= button("down",$translation->get("go_down"),$formname,"loadCard('movedown_line_preset')", "", false); ?>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
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="input_preset_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("collection_change_sorting"), "input_change_sorting", $values = array_keys($sorting_values), $value_names = array_values($sorting_values), "", FALSE, FALSE);
|
||||
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
|
||||
if ($input_line["id"] != "") {
|
||||
show_changed_on($input_line["id"], "main_infopoint_presets");
|
||||
show_changed_by($input_line["id"], "main_infopoint_presets");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<form id="form_field_list" name="form_field_list" method="post">
|
||||
<?
|
||||
show_preset_rows();
|
||||
?>
|
||||
</form>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var reorderCall = null;
|
||||
|
||||
//$('.dd').nestable({ /* config options */ });
|
||||
$('ol.sortable').nestedSortable({
|
||||
forcePlaceholderSize: true,
|
||||
handle : '.dd-icon',
|
||||
helper : 'clone',
|
||||
items : 'li',
|
||||
opacity : .6,
|
||||
placeholder : 'placeholder',
|
||||
revert : 250,
|
||||
tabSize : 25,
|
||||
tolerance : 'pointer',
|
||||
toleranceElement : '> div',
|
||||
maxLevels : 3,
|
||||
isTree : true,
|
||||
expandOnHover : 1000,
|
||||
cookieIndex : 'nestedSortable_pagecontent_expanded',
|
||||
startCollapsed : true,
|
||||
stop : function ( event, ui ) {
|
||||
reorder_navigation();
|
||||
store_expanded();
|
||||
},
|
||||
disabled : false,
|
||||
isAllowed : function ( placeholder, placeholderParent, originalItem ) {
|
||||
|
||||
// gruppe in eine gruppe hinzufuegen nicht moeglich
|
||||
if (placeholderParent !== null &&
|
||||
jQuery(originalItem).hasClass("mjs-nestedSortable-no-nesting") === false &&
|
||||
jQuery(placeholderParent).hasClass("mjs-nestedSortable-no-nesting") === false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$('.disclose').click(function () {
|
||||
$(this).closest('li').toggleClass('mjs-nestedSortable-collapsed').toggleClass('mjs-nestedSortable-expanded');
|
||||
store_expanded();
|
||||
});
|
||||
|
||||
function store_expanded() {
|
||||
var list = [];
|
||||
$('ol.sortable').find('li.mjs-nestedSortable-expanded').each(function () {
|
||||
list.push($(this).attr("id"));
|
||||
});
|
||||
$.cookie('nestedSortable_pagecontent_expanded', list.join(','));
|
||||
}
|
||||
|
||||
function reorder_navigation() {
|
||||
if (reorderCall !== null) {
|
||||
reorderCall.abort();
|
||||
}
|
||||
|
||||
serialized = $('ol.sortable').nestedSortable('serialize');
|
||||
arraied = $('ol.sortable').nestedSortable('toHierarchy', {startDepthCount: 0});
|
||||
var parameter = {
|
||||
list: arraied
|
||||
};
|
||||
reorderCall = jQuery.post("?action=reorder_content_page", parameter, function ( output, status, xhr ) {
|
||||
if (xhr.getResponseHeader('REQUIRES_AUTH') == 1) {
|
||||
window.location.replace("/mysyde/");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
37
module/infopoint/infopoint_presets_listform.inc.php
Normal file
37
module/infopoint/infopoint_presets_listform.inc.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_infopoint_presets_list";
|
||||
$inputname = "input_group_id";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_preset', true)"); ?>
|
||||
<?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_preset')"); ?>
|
||||
<?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_preset', false, '{$translation->get('delete_preset')}')"); ?>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('infopoint_presets'); ?></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_infopoint_presets.id, main_infopoint_presets.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_infopoint_presets
|
||||
LEFT JOIN
|
||||
main_admin_user
|
||||
ON
|
||||
main_admin_user.id = main_infopoint_presets.modified_user
|
||||
ORDER BY main_infopoint_presets.sorting asc";
|
||||
|
||||
$format = array('option', 'text', 'text', 'text');
|
||||
if ($result = @mysqli_query($GLOBALS['mysql_con'], $query)) {
|
||||
linklist($result, $formname, $format, "input_id", "infopoint_presets_list", TRUE, 'update_sortorder_faq');
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
160
module/infopoint/infopoint_screens.inc.php
Normal file
160
module/infopoint/infopoint_screens.inc.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?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_screen':
|
||||
save_screen();
|
||||
break;
|
||||
case 'new_screen':
|
||||
require_once("infopoint_screens_cardform.inc.php");
|
||||
break;
|
||||
case 'edit_screen':
|
||||
edit_screen();
|
||||
break;
|
||||
case 'delete_screen':
|
||||
delete_screen();
|
||||
break;
|
||||
case 'open_screen':
|
||||
open_screen();
|
||||
break;
|
||||
case 'update_sortorder_faq':
|
||||
update_sortorder_faq();
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once("infopoint_screens_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_screen( $_id = "", $messages = array() ) {
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} else {
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
if ($input_id <> '') {
|
||||
|
||||
$query = "SELECT * FROM main_infopoint_screens 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("infopoint_screens_cardform.inc.php");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
require_once("infopoint_screens_cardform.inc.php");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function save_screen() {
|
||||
$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_infopoint_screens SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "' ,
|
||||
modified_date = '" . time() . "',
|
||||
modified_user = '" . (int)$GLOBALS["admin_user"]['id'] . "',
|
||||
main_infopoint_preset_id = '" . $_REQUEST["input_infopoint_preset"] . "'
|
||||
WHERE id = " . $_REQUEST["input_id"] . " LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
} else {
|
||||
$hash = base64_encode(random_bytes(18));
|
||||
$query = "INSERT INTO main_infopoint_screens (hash, description, modified_date, modified_user, main_infopoint_preset_id) VALUES (
|
||||
'".$hash."',
|
||||
'".mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"])."',
|
||||
'".time()."',
|
||||
'".(int)$GLOBALS["admin_user"]['id']."',
|
||||
'".$_REQUEST["input_infopoint_preset"]."'
|
||||
)";
|
||||
$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_infoboard_screens', $header_id, 'INSERT');
|
||||
$messages[] = '<div class="successbox">' . $translation->get("collection_group_msg_success1") . '</div>';
|
||||
} else {
|
||||
createMySydeLog('main_infoboard_screens', $_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"];
|
||||
}
|
||||
require_once("infopoint_screens_cardform.inc.php");
|
||||
}
|
||||
|
||||
function delete_screen() {
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "DELETE FROM main_infopoint_screens WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
createMySydeLog('main_infopoint_screens', $_REQUEST['input_id'], 'DELETE');
|
||||
}
|
||||
require_once("infopoint_screens_listform.inc.php");
|
||||
}
|
||||
|
||||
function open_screen(){
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "SELECT * FROM main_infopoint_screens WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$input = @mysqli_fetch_array($result);
|
||||
$url = "https://".$_SERVER['HTTP_HOST']."/module/infopoint/show_infopoint.inc.php?hash=".$input['hash'];
|
||||
?>
|
||||
<script>
|
||||
window.open('<?php echo $url ?>', '_blank');
|
||||
</script>
|
||||
<?php }
|
||||
require_once("infopoint_screens_listform.inc.php");
|
||||
}
|
||||
87
module/infopoint/infopoint_screens_cardform.inc.php
Normal file
87
module/infopoint/infopoint_screens_cardform.inc.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?
|
||||
$formname = "form_infopoint_screens_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_infopoint_screens WHERE id = '" . $input_line['id'] . "'";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$input_text = @mysqli_fetch_array($result);
|
||||
|
||||
$preset_values = array();
|
||||
$preset_values_id = array();
|
||||
$query = "SELECT * FROM main_infopoint_presets";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
while ($row = @mysqli_fetch_array($result)) {
|
||||
$preset_values[] = $row['description'];
|
||||
$preset_values_id[] = $row['id'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php if ($input_line["id"] == "") {
|
||||
echo $translation->get("new_screen");
|
||||
} else {
|
||||
echo $translation->get("edit_screen");
|
||||
}
|
||||
?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?php
|
||||
|
||||
// Speichern buttons
|
||||
button("save", $translation->get("save"), $formname, "loadCard('save_screen', true)");
|
||||
|
||||
button("save", $translation->get("save_and_close"), $formname, "loadCard('save_screen', true, '', true)");
|
||||
|
||||
if ($input_line["id"] != "") {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_screen', true, '{$translation->get('delete_screen')}', true)");
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<?php
|
||||
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>
|
||||
<?
|
||||
input($translation->get("description"), "input_description", "text", $input_line["description"], 255);
|
||||
input_select($translation->get("collection_change_sorting"), "input_change_sorting", $values = array_keys($sorting_values), $value_names = array_values($sorting_values), "", FALSE, FALSE);
|
||||
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
|
||||
if ($input_line["id"] != "") {
|
||||
show_changed_on($input_line["id"], "main_infopoint_screens");
|
||||
show_changed_by($input_line["id"], "main_infopoint_screens");
|
||||
}
|
||||
input_select($translation->get("infopoint_preset"), "input_infopoint_preset", $values = array_values($preset_values_id), $value_names = array_values($preset_values), $input_line["main_infopoint_preset_id"]);
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
38
module/infopoint/infopoint_screens_listform.inc.php
Normal file
38
module/infopoint/infopoint_screens_listform.inc.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_infopoint_screens_list";
|
||||
$inputname = "input_group_id";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_screen', true)"); ?>
|
||||
<?= button("edit", $translation->get("edit"), $formname, "loadCard('edit_screen')"); ?>
|
||||
<?= button("delete", $translation->get("delete"), $formname, "sendRequest('delete_screen', false, '{$translation->get('delete_screen')}')"); ?>
|
||||
<?= button("open_screen", $translation->get("open_screen"), $formname, "loadCard('open_screen')"); ?>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('infopoint_screens'); ?></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_infopoint_screens.id, main_infopoint_screens.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_infopoint_screens
|
||||
LEFT JOIN
|
||||
main_admin_user
|
||||
ON
|
||||
main_admin_user.id = main_infopoint_screens.modified_user
|
||||
ORDER BY main_infopoint_screens.sorting asc";
|
||||
|
||||
$format = array('option', '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>
|
||||
54
module/infopoint/reload_infopoint.php
Normal file
54
module/infopoint/reload_infopoint.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
//Vendor Autoloader
|
||||
include(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/vendor/autoload.php');
|
||||
include(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/mysyde/DcAutoloader.php');
|
||||
|
||||
$dcAutoloader = new DcAutoloader();
|
||||
$dcAutoloader->register();
|
||||
|
||||
require_once("../../mysyde/common/common_functions.inc.php");
|
||||
$envDir = rtrim(dirname(dirname(__DIR__)), '/') . '/config';
|
||||
if (is_dir($envDir)) {
|
||||
$dotenv = new \Dotenv\Dotenv($envDir);
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
require_once((local_environment()) ? "../../mysyde/dc.config.php" : "../../mysyde/dc-server.config.php");
|
||||
db_connect();
|
||||
|
||||
function updateReload(){
|
||||
$update = $GLOBALS['pdo_conn']->prepare("UPDATE main_infopoint_screens SET block_reload_active = :block_reload_active WHERE hash = :hash");
|
||||
$update->execute(array(':block_reload_active' => '0', ':hash' => $_POST['hash']));
|
||||
}
|
||||
|
||||
$select_reload = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_infopoint_screens WHERE hash = :hash");
|
||||
$select_reload->execute(array(':hash' => $_POST['hash']));
|
||||
$res_select = $select_reload->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$reload_time = $res_select['block_reload_time'];
|
||||
$block_active = $res_select['block_reload_active'];
|
||||
$reload = $res_select['reload'];
|
||||
|
||||
$current_date = new DateTime();
|
||||
|
||||
$time = 2;
|
||||
|
||||
$return = 0;
|
||||
$fadeTime = new DateTime('');
|
||||
$fadeTime->modify('+'.$time.' second');
|
||||
if($fadeTime->format('d.m.Y H:i:s') >= $reload_time){
|
||||
$return = 2;
|
||||
}
|
||||
|
||||
if($block_active == 1){
|
||||
if($current_date->format('d.m.Y H:i:s') >= $reload_time){
|
||||
updateReload();
|
||||
$return = 1;
|
||||
}
|
||||
}else{
|
||||
if($reload == 1){
|
||||
$return = 1;
|
||||
}
|
||||
}
|
||||
|
||||
echo $return;
|
||||
163
module/infopoint/show_infopoint.inc.php
Normal file
163
module/infopoint/show_infopoint.inc.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
//Vendor Autoloader
|
||||
include(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/vendor/autoload.php');
|
||||
include(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/mysyde/DcAutoloader.php');
|
||||
|
||||
$dcAutoloader = new DcAutoloader();
|
||||
$dcAutoloader->register();
|
||||
|
||||
require_once("../../mysyde/common/common_functions.inc.php");
|
||||
$envDir = rtrim(dirname(dirname(__DIR__)), '/') . '/config';
|
||||
if (is_dir($envDir)) {
|
||||
$dotenv = new \Dotenv\Dotenv($envDir);
|
||||
$dotenv->load();
|
||||
}
|
||||
|
||||
require_once((local_environment()) ? "../../mysyde/dc.config.php" : "../../mysyde/dc-server.config.php");
|
||||
db_connect();
|
||||
|
||||
function blockReloadTime($seconds){
|
||||
$modiefied_date = new DateTime();
|
||||
$modiefied_date->modify('+ '.$seconds.' seconds');
|
||||
updateReloadTime($modiefied_date->format('d.m.Y H:i:s'));
|
||||
}
|
||||
|
||||
function updateReloadTime($reload_time){
|
||||
$update = $GLOBALS['pdo_conn']->prepare("UPDATE main_infopoint_screens SET block_reload_active = :block_reload_active, block_reload_time = :block_reload_time WHERE hash = :hash");
|
||||
$update->execute(array(':block_reload_active' => '1', ':block_reload_time' => $reload_time, ':hash' => $_GET['hash']));
|
||||
}
|
||||
|
||||
function updateReload(){
|
||||
$update = $GLOBALS['pdo_conn']->prepare("UPDATE main_infopoint_screens SET reload = :reload WHERE hash = :hash");
|
||||
$update->execute(array(':reload' => '0', ':hash' => $_GET['hash']));
|
||||
}
|
||||
|
||||
function getCurrentPreset(){
|
||||
$select_reload = $GLOBALS['pdo_conn']->prepare("SELECT main_infopoint_preset_id FROM main_infopoint_screens WHERE hash = :hash");
|
||||
$select_reload->execute(array(':hash' => $_GET['hash']));
|
||||
$res_reload = $select_reload->fetch(PDO::FETCH_ASSOC);
|
||||
return $res_reload['main_infopoint_preset_id'];
|
||||
}
|
||||
|
||||
function getCurrentPage(){
|
||||
$select_reload = $GLOBALS['pdo_conn']->prepare("SELECT current_page FROM main_infopoint_screens WHERE hash = :hash");
|
||||
$select_reload->execute(array(':hash' => $_GET['hash']));
|
||||
$res_reload = $select_reload->fetch(PDO::FETCH_ASSOC);
|
||||
return $res_reload['current_page'];
|
||||
}
|
||||
|
||||
function updateCurrentPage($current_page, $transition_id){
|
||||
$update_reload = $GLOBALS['pdo_conn']->prepare("UPDATE main_infopoint_screens SET current_page = :current_page, main_infopoint_transition_id = :main_infopoint_transition_id WHERE hash = :hash");
|
||||
$update_reload->execute(array(':current_page' => $current_page, ':main_infopoint_transition_id' => $transition_id, ':hash' => $_GET['hash']));
|
||||
}
|
||||
|
||||
$GLOBALS['main_infopoint_preset_id'] = getCurrentPreset();
|
||||
|
||||
$select_presets = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_infopoint_preset_link LEFT JOIN main_infopoint_pages ON main_infopoint_pages.id = main_infopoint_preset_link.main_infopoint_page_id WHERE main_infopoint_preset_id = :main_infopoint_preset_id AND active = 1 ORDER BY sorting");
|
||||
$select_presets->execute(array(':main_infopoint_preset_id' => $GLOBALS['main_infopoint_preset_id']));
|
||||
$res_presets = $select_presets->fetchALL(PDO::FETCH_ASSOC);
|
||||
|
||||
function selectCurrentPage($sort){
|
||||
$select_plan = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_infopoint_pages LEFT JOIN main_infopoint_preset_link ON main_infopoint_pages.id = main_infopoint_preset_link.main_infopoint_page_id WHERE sorting = :sorting AND main_infopoint_preset_id = :main_infopoint_preset_id");
|
||||
$select_plan->execute(array(':sorting' => $sort, ':main_infopoint_preset_id' => $GLOBALS['main_infopoint_preset_id']));
|
||||
$res_plan = $select_plan->fetch(PDO::FETCH_ASSOC);
|
||||
return $res_plan;
|
||||
}
|
||||
|
||||
function selectPageBySorting($sorting){
|
||||
$select_presets = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_infopoint_preset_link LEFT JOIN main_infopoint_pages ON main_infopoint_pages.id = main_infopoint_preset_link.main_infopoint_page_id WHERE main_infopoint_preset_id = :main_infopoint_preset_id AND active = 1 ORDER BY sorting");
|
||||
$select_presets->execute(array(':main_infopoint_preset_id' => $GLOBALS['main_infopoint_preset_id']));
|
||||
$res_presets = $select_presets->fetchALL(PDO::FETCH_ASSOC);
|
||||
return $res_presets[$sorting-1]['id'];
|
||||
}
|
||||
|
||||
$count = count($res_presets);
|
||||
$current_page_sort = getCurrentPage();
|
||||
$current_page = selectCurrentPage($current_page_sort);
|
||||
blockReloadTime($current_page['time']);
|
||||
|
||||
$next_page = $current_page_sort + 1;
|
||||
if($current_page_sort >= $count){
|
||||
$next_page = 1;
|
||||
}
|
||||
$next_page_id = selectPageBySorting($next_page);
|
||||
// echo $next_page_id;
|
||||
updateReload();
|
||||
|
||||
function getTransitionID(){
|
||||
$select = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_infopoint_screens WHERE hash = :hash");
|
||||
$select->execute(array(':hash' => $_GET['hash']));
|
||||
$res_select = $select->fetch(PDO::FETCH_ASSOC);
|
||||
return $res_select;
|
||||
}
|
||||
|
||||
function randomTransition(){
|
||||
$select = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_infopoint_transition WHERE type = :type AND active = 1 ORDER BY RAND() LIMIT 1");
|
||||
$select->execute(array(':type' => 'out'));
|
||||
$res_select = $select->fetch(PDO::FETCH_ASSOC);
|
||||
return $res_select;
|
||||
}
|
||||
|
||||
function TransitionFromBefore($transition_id){
|
||||
$select = $GLOBALS['pdo_conn']->prepare("SELECT * FROM main_infopoint_transition WHERE parent = :parent");
|
||||
$select->execute(array(':parent' => $transition_id));
|
||||
$res_select = $select->fetch(PDO::FETCH_ASSOC);
|
||||
return $res_select;
|
||||
}
|
||||
|
||||
$last_transition = getTransitionID();
|
||||
$current_transition = TransitionFromBefore($last_transition['main_infopoint_transition_id']);
|
||||
$next_transition = randomTransition();
|
||||
|
||||
updateCurrentPage($next_page, $next_transition['id']);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<link href="../../layout/frontend/b2c/dist/css/infopoint.css?t=<?= filemtime($_SERVER['DOCUMENT_ROOT'] . '/layout/frontend/b2c/dist/css/infopoint.css')?>" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body class='<?php echo $current_transition['class'] ?>'>
|
||||
<?php
|
||||
require_once('content_infopoint.php');
|
||||
loadContent($current_page)
|
||||
?>
|
||||
<div class='ajax_timer'></div>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
function ajaxCall() {
|
||||
$.ajax({
|
||||
url: "reload_infopoint.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
option: "reload",
|
||||
hash: "<?php echo $_GET['hash']?>",
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
if(data == 1){
|
||||
location.reload();
|
||||
}else if(data == 2){
|
||||
$('body').addClass("<?php echo $next_transition['class'] ?>");
|
||||
}
|
||||
}
|
||||
});
|
||||
setTimeout(function () {
|
||||
ajaxCall();
|
||||
}, 1000);
|
||||
}
|
||||
ajaxCall();
|
||||
</script>
|
||||
Reference in New Issue
Block a user