init
This commit is contained in:
217
module/infoboard/infoboard.inc.php
Normal file
217
module/infoboard/infoboard.inc.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?
|
||||
switch ($_GET["action"]) {
|
||||
case 'save':
|
||||
save_infoboard();
|
||||
break;
|
||||
case 'new_infoboard':
|
||||
require_once("infoboard_cardform.inc.php");
|
||||
break;
|
||||
case 'save_infoboard_card':
|
||||
save_infoboard_card();
|
||||
break;
|
||||
default:
|
||||
require_once("infoboard_listform.inc.php");
|
||||
break;
|
||||
}
|
||||
|
||||
function filter_mandant($filter){ ?>
|
||||
<h3><?php echo get_translation('filter_mandant'); ?>:</h3>
|
||||
<div class="input">
|
||||
<select id="filter_mandant" name="filter_mandant" class="bigselect" onchange="filter_mandant();">
|
||||
<option value="0"><?php echo get_translation('all_mandate'); ?></option>
|
||||
<?php
|
||||
$query = "SELECT * FROM main_mandant";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
while($row = @mysqli_fetch_array($result)){ ?>
|
||||
<option value="<?= $row['id'] ?>" <?= ($filter == $row['id'] ? 'selected="selected"' : ""); ?>><?= $row['description'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
function save_infoboard(){
|
||||
$date = $_POST['input_date'];
|
||||
$category_id = $_POST['input_category'];
|
||||
$mandant_id = $_POST['input_mandant'];
|
||||
|
||||
$where_ids = "";
|
||||
if($mandant_id != 0){
|
||||
$where_ids = " AND main_contact_id IN (SELECT main_contact.id FROM main_contact LEFT JOIN main_contact_department ON main_contact.id = main_contact_department.main_contact_id WHERE main_mandant_id = ".$mandant_id.")";
|
||||
}
|
||||
$delete_query = "DELETE FROM infoboard WHERE date='".$date."' AND category_id = ".$category_id . $where_ids;
|
||||
$deleteInfoboard = @mysqli_query($GLOBALS["mysql_con"], $delete_query);
|
||||
|
||||
$input_contact = $_POST['input_contact'];
|
||||
$contacts = explode(',', $input_contact);
|
||||
if(!empty($contacts) && gettype($contacts) == 'array') {
|
||||
foreach($contacts as $key => $contact){
|
||||
$query = "INSERT INTO infoboard
|
||||
(category_id, date, main_contact_id)
|
||||
VALUES (
|
||||
'" . $category_id . "',
|
||||
'" . $date . "',
|
||||
'" . $contact . "'
|
||||
)";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function save_infoboard_card(){
|
||||
$start_date = new DateTime($_POST['input_start_date']);
|
||||
$end_date = new DateTime($_POST['input_end_date']);
|
||||
$category_id = $_POST['input_category'];
|
||||
|
||||
$input_contact = $_POST['input_contact'];
|
||||
$contacts = explode(',', $input_contact);
|
||||
if(!empty($contacts) && gettype($contacts) == 'array') {
|
||||
foreach($contacts as $key => $contact){
|
||||
for($i = $start_date; $i <= $end_date; $i->modify('+1 day')){
|
||||
$query = "SELECT * FROM infoboard WHERE date = '".$i->format('Y-m-d')."' AND category_id = ".$category_id. " AND main_contact_id = ".$contact;
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
$query = "INSERT INTO infoboard
|
||||
(category_id, date, main_contact_id)
|
||||
VALUES (
|
||||
'" . $category_id . "',
|
||||
'" . $i->format('Y-m-d') . "',
|
||||
'" . $contact . "'
|
||||
)";
|
||||
// var_dump($query);
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// require_once("infoboard_cardform.inc.php");
|
||||
}
|
||||
|
||||
function load_contact($date, $category_id){
|
||||
global $filter_mandant;
|
||||
$join_mandant = "";
|
||||
$where_mandant = "";
|
||||
if($filter_mandant != 0){
|
||||
$join_mandant = "LEFT JOIN main_contact_department ON main_contact.id = main_contact_department.main_contact_id";
|
||||
$where_mandant = " AND main_mandant_id = ".$filter_mandant;
|
||||
}
|
||||
$query = "SELECT main_contact.* FROM infoboard LEFT JOIN main_contact ON infoboard.main_contact_id = main_contact.id ".$join_mandant." WHERE date = '".$date."' AND category_id = ".$category_id. " AND main_contact.id != 0" . $where_mandant;
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
$person = "Keine Auswahl";
|
||||
}
|
||||
$i = 1;
|
||||
while($contact = @mysqli_fetch_array($result)) {
|
||||
if($i > 1){
|
||||
$person .= ", ";
|
||||
}
|
||||
$person .= $contact['shortcut'];
|
||||
$i++;
|
||||
}
|
||||
return $person;
|
||||
}
|
||||
|
||||
function load_contact_ids($date, $category_id){
|
||||
$preselect = array();
|
||||
|
||||
global $filter_mandant;
|
||||
$join_mandant = "";
|
||||
$where_mandant = "";
|
||||
if($filter_mandant != 0){
|
||||
$join_mandant = "LEFT JOIN main_contact_department ON main_contact.id = main_contact_department.main_contact_id";
|
||||
$where_mandant = " AND main_mandant_id = ".$filter_mandant;
|
||||
}
|
||||
|
||||
$query = "SELECT main_contact.* FROM infoboard LEFT JOIN main_contact ON infoboard.main_contact_id = main_contact.id ".$join_mandant." WHERE date = '".$date."' AND category_id = ".$category_id . $where_mandant;
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
while($row = @mysqli_fetch_array($result)){
|
||||
array_push($preselect,$row['id']);
|
||||
}
|
||||
|
||||
return $preselect;
|
||||
}
|
||||
|
||||
function load_infoboard(){
|
||||
global $filter_mandant;
|
||||
$current_date = new DateTime();
|
||||
$this_day = new DateTime('Monday this week');
|
||||
$next_week = $current_date->format('W')+1;
|
||||
$prev_week = $current_date->format('W')-1;
|
||||
if(isset($_GET['week'])){
|
||||
$this_day->setISODate($current_date->format('Y'), $_GET['week']);
|
||||
$next_week = $_GET['week']+1;
|
||||
$prev_week = $_GET['week']-1;
|
||||
}
|
||||
$categories = array("Abwesend", "Home Office", "Urlaub", "Berufsschule", "Anwesend");
|
||||
$days = array("Mo", "Di", "Mi", "Do", "Fr");
|
||||
|
||||
echo "<div class='infoboard_categories_wrapper'>";
|
||||
echo "KW ".$this_day->format('W');
|
||||
foreach($categories as $key_categories => $value_categories){
|
||||
echo "<div class='infoboard_categories'>".$value_categories."</div>";
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
|
||||
foreach ($days as $key_days => $value_days) {
|
||||
$current = "";
|
||||
if($this_day->format('d.m.Y') == $current_date->format('d.m.Y')){
|
||||
$current = "current";
|
||||
}
|
||||
echo "<div class='infoboard_day_person_group ".$current."'>";
|
||||
echo "<div class='infoboard_day'>".$value_days.". ".$this_day->format('d.m.Y')."</div>";
|
||||
echo "<div class='infoboard_person_wrapper'>";
|
||||
foreach($categories as $key_categories => $value_categories){
|
||||
$person = load_contact($this_day->format('Y-m-d'), $key_categories);
|
||||
$person_ids = load_contact_ids($this_day->format('Y-m-d'), $key_categories);
|
||||
echo "<div class='infoboard_person_border'>";
|
||||
echo "<div data-contact='".json_encode($person_ids)."' data-date='".$this_day->format('Y-m-d')."' data-category='".$key_categories."' data-mandant='".$filter_mandant."' class='infoboard_person'>".$person."</div>";
|
||||
echo "</div>";
|
||||
}
|
||||
echo "</div>";
|
||||
$this_day->modify("+1 day");
|
||||
echo "</div>";
|
||||
}
|
||||
echo "<div class='change_weeks'>";
|
||||
echo "<a class='change_week'href='?week=".$prev_week."&filter=".$filter_mandant."'>vorherige Woche</a>";
|
||||
echo "<a class='change_week'href='?week=".$next_week."&filter=".$filter_mandant."'>nächste Woche</a>";
|
||||
echo "</div>";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function select_contact(){
|
||||
global $filter_mandant;
|
||||
$join_mandant = "";
|
||||
$where_mandant = "";
|
||||
if($filter_mandant != 0){
|
||||
$join_mandant = "LEFT JOIN main_contact_department ON main_contact.id = main_contact_department.main_contact_id";
|
||||
$where_mandant = "WHERE main_mandant_id = ".$filter_mandant;
|
||||
}
|
||||
|
||||
$query = "SELECT main_contact.* FROM main_contact ". $join_mandant . " " . $where_mandant;
|
||||
$result_contact = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
if (@mysqli_num_rows($result_contact) == 0) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="contact bc-select-ui ui fluid multiple search selection dropdown" style="clear:both;display:inline-block;">
|
||||
<input type="hidden" name="input_contact">
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="default text">Personen hinzufügen</div>
|
||||
<div class="menu">
|
||||
<?
|
||||
while($contact = @mysqli_fetch_array($result_contact)) {
|
||||
echo "<div class=\"item\" data-value=\"{$contact['id']}\">".$contact["name"]."</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')?>">
|
||||
<?php
|
||||
}
|
||||
53
module/infoboard/infoboard_cardform.inc.php
Normal file
53
module/infoboard/infoboard_cardform.inc.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?
|
||||
$formname = "form_infoboard_card";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?= $translation->get("new_infoboard_post"); ?>
|
||||
<div id="closeoverlay" onclick="disableOverlay();"></div>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("save", $translation->get("save_and_close"), $formname, "loadCard('save_infoboard_card', true, '', true)"); ?>
|
||||
</ul>
|
||||
|
||||
|
||||
<?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_infoboard_id" type="hidden" value="<?= $input_infoboard["id"] ?>">
|
||||
<input name="input_main_layout_id" type="hidden" value="<?= $main_layout_id ?>">
|
||||
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td >
|
||||
<? input($translation->get("start_date"), "input_start_date", "date", '') ?>
|
||||
</td>
|
||||
<td >
|
||||
<? input($translation->get("end_date"), "input_end_date", "date", '') ?>
|
||||
</td>
|
||||
<td class="w-100">
|
||||
<?php
|
||||
$categories = array("Abwesend", "Home Office", "Urlaub", "Berufsschule", "Anwesend");
|
||||
?>
|
||||
<?php input_select($translation->get("category"), "input_category", $values = array_keys($categories), $value_names = array_values($categories), $preselect, FALSE, FALSE); ?>
|
||||
</td>
|
||||
<td class="w-100">
|
||||
<div class="label"><?=$translation->get("choose_person") ?></div>
|
||||
<?= select_contact();?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('.contact.ui.fluid.multiple.dropdown').dropdown('clear');
|
||||
</script>
|
||||
84
module/infoboard/infoboard_listform.inc.php
Normal file
84
module/infoboard/infoboard_listform.inc.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_infoboard_list";
|
||||
$inputname = "input_id";
|
||||
global $filter_mandant;
|
||||
$filter_mandant = (isset($_REQUEST['filter']) ? $_REQUEST['filter'] : 0);
|
||||
?>
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("edit", $translation->get("new_meeting"), $formname, "loadSite('".get_menu_link('collections/4', $site, $language, '?action=open_card_collection')."')"); ?>
|
||||
<?= button("edit", $translation->get("new_post"), $formname, "loadCard('new_infoboard', true)"); ?>
|
||||
<div class="filter_mandant">
|
||||
<?= filter_mandant($filter_mandant) ?>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
<div id="mainContent">
|
||||
<?php echo current_website_language($site, $language); ?>
|
||||
<h1><?php echo get_translation('top_infoboard'); ?></h1>
|
||||
|
||||
<div class='infoboard_form'>
|
||||
<?= load_infoboard()?>
|
||||
</div>
|
||||
|
||||
<div class="infoboard_add">
|
||||
<form method='post' name='<?= $formname ?>' id='<?= $formname ?>'>
|
||||
<div class="form_title_and_close">
|
||||
<h3><?php echo get_translation('add_person'); ?></h3>
|
||||
<div class='close'></div>
|
||||
</div>
|
||||
<input type='hidden' name='input_date' value=''>
|
||||
<input type='hidden' name='input_category' value=''>
|
||||
<input type='hidden' name='input_mandant' value=''>
|
||||
<?= select_contact()?>
|
||||
<ul class="toolbar_menu new w-auto">
|
||||
<?= button("save", $translation->get("save_and_close"), $formname, "loadCard('save', true, '', true)"); ?>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(".infoboard_person").click(function(){
|
||||
contact = $(this).data('contact');
|
||||
date = $(this).data('date');
|
||||
category = $(this).data('category');
|
||||
mandant = $(this).data('mandant');
|
||||
|
||||
$("input[name='input_date']").val(date);
|
||||
$("input[name='input_category']").val(category);
|
||||
$("input[name='input_mandant']").val(mandant);
|
||||
|
||||
|
||||
$(".infoboard_add").show();
|
||||
|
||||
$('.contact.ui.fluid.multiple.dropdown').dropdown('clear');
|
||||
$('.contact.ui.fluid.multiple.dropdown').dropdown('set selected', contact);
|
||||
});
|
||||
|
||||
$(".infoboard_add .close").click(function(){
|
||||
$(".infoboard_add").hide();
|
||||
});
|
||||
|
||||
$(".infoboard_person").each(function() {
|
||||
$(this).on("click", function() {
|
||||
if ($(this).hasClass("person_active")) {
|
||||
$(this).removeClass("person_active");
|
||||
} else {
|
||||
$(".infoboard_person").removeClass("person_active");
|
||||
$(this).addClass("person_active");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function filter_mandant() {
|
||||
var filter = jQuery('#filter_mandant').val();
|
||||
const url = window.location.href.split('&')[0];
|
||||
if(window.location.search){
|
||||
var newUrl = url + '&filter='+filter;
|
||||
}else{
|
||||
var newUrl = url + '?filter='+filter;
|
||||
}
|
||||
window.location.href = newUrl;
|
||||
}
|
||||
</script>
|
||||
95
module/infoboard/show_infoboard.inc.php
Normal file
95
module/infoboard/show_infoboard.inc.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
function load_contact($date, $category_id, $category){
|
||||
$where_ids = " AND main_contact_id IN (SELECT main_contact.id FROM main_contact LEFT JOIN main_contact_department ON main_contact.id = main_contact_department.main_contact_id WHERE main_mandant_id = ".$GLOBALS['main_contact']['current_mandant_id'].")";
|
||||
$query = "SELECT * FROM infoboard LEFT JOIN main_contact ON infoboard.main_contact_id = main_contact.id LEFT JOIN main_contact_department ON main_contact.id = main_contact_department.main_contact_id WHERE date = '".$date."' AND category_id = ".$category_id." AND main_mandant_id = ".$GLOBALS['main_contact']['current_mandant_id']." AND main_contact_department.active = 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
return;
|
||||
}
|
||||
while($contact = @mysqli_fetch_array($result)) {
|
||||
if(get_permission_state('show_on_infoboard', $GLOBALS['main_contact']['current_mandant_id'], $contact['main_contact_id']) == 1){
|
||||
$span = "<span class='infoboard_contact_tooltip'><span class='category'>".$category."</span>".$contact['name']."</span>";
|
||||
echo "<div class='infoboard_contact infoboard_category_".$category_id."'>".$span.$contact['shortcut']."</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_meeting_link($collection_id, $setup_id){
|
||||
$query = "SELECT * FROM main_collection_link LEFT JOIN main_collection_setup_content ON main_collection_link.main_collection_setup_content_id = main_collection_setup_content.id WHERE main_collection_link.main_collection_id = ".$collection_id. " AND main_collection_setup_content_id = ".$setup_id;
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$link = @mysqli_fetch_array($result);
|
||||
if($link['type_id'] == 6){
|
||||
$option_value = unserialize($link['data']);
|
||||
return $option_value;
|
||||
}else{
|
||||
return $link['data'];
|
||||
}
|
||||
}
|
||||
|
||||
function load_meetings_from_collection($date){
|
||||
$if_query = "main_collection_id IS NOT NULL AND main_mandant_id = ".$GLOBALS['main_contact']['current_mandant_id'];
|
||||
$query = "SELECT main_collection.* FROM main_collection LEFT JOIN main_collection_mandant_link ON main_collection.id = main_collection_mandant_link.main_collection_id WHERE main_collection_setup_id = 4";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
$i = 0;
|
||||
while($meeting = @mysqli_fetch_array($result)) {
|
||||
$coll_time = get_meeting_link($meeting['id'], 82);
|
||||
$coll_time2 = get_meeting_link($meeting['id'], 83);
|
||||
$coll_location = get_meeting_link($meeting['id'], 5);
|
||||
$time = get_meeting_link($meeting['id'], 4);
|
||||
$coll_date = get_meeting_link($meeting['id'], 54);
|
||||
$coll_contact = get_meeting_link($meeting['id'], 63);
|
||||
if($date == $coll_date){
|
||||
// $span = "<span class='infoboard_contact_tooltip'>".$coll_time." - ".$coll_time2."</span>";
|
||||
echo "<div class='infoboard_category_meeting'>";
|
||||
echo "<div class='infoboard_meeting'>" . $span . $meeting['description'] ." ". $time . "</div>";
|
||||
if($coll_contact != ""){
|
||||
$where_ids = " AND main_contact.id IN (SELECT main_contact.id FROM main_contact LEFT JOIN main_contact_department ON main_contact.id = main_contact_department.main_contact_id WHERE main_mandant_id = ".$GLOBALS['main_contact']['current_mandant_id']." AND main_contact_department.active = 1)";
|
||||
$query2 = "SELECT * FROM main_contact WHERE main_contact.id IN (".$coll_contact.")". $where_ids;
|
||||
$result2 = @mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
|
||||
// while($contact = @mysqli_fetch_array($result2)) {
|
||||
// $span = "<span class='infoboard_contact_tooltip'>".$contact['name']."</span>";
|
||||
// echo "<div class='infoboard_contact'>".$span.$contact['shortcut']."</div>";
|
||||
// }
|
||||
echo "</div>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($i == 0){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function load_board($start_date) {
|
||||
echo "<h3 class='termine_title'>Kommende Termine</h3>";
|
||||
echo "<div class='inhouse_and_outhouse'>";
|
||||
|
||||
// Iteriere über die nächsten 8 Wochen
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
// Berechne das Datum für diese Woche
|
||||
$date = clone $start_date;
|
||||
$date->modify("+$i week");
|
||||
|
||||
// Hier könnten wir die Daten für die Inhouse- und Outhouse-Meetings abrufen
|
||||
echo "<div class='outhouse'>";
|
||||
load_meetings_from_collection($date->format("Y-m-d"));
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
$this_day = new DateTime();
|
||||
?>
|
||||
|
||||
<div class='infoboard_boxes'>
|
||||
<div class="content_day this_day">
|
||||
<?= load_board($this_day); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user