2026-02-17 14:56:23 +01:00
< ? php
// Display only errors (no notices, warnings, or deprecation messages)
error_reporting ( E_ERROR | E_PARSE );
ini_set ( 'display_errors' , 1 );
?>
<!-- < script src = " https://code.jquery.com/jquery-3.7.1.min.js " integrity = " sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo= " crossorigin = " anonymous " ></ script > -->
<!-- < link href = " https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css " rel = " stylesheet " /> -->
<!-- < script src = " https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js " ></ script > -->
< style >
. select2 - container {
width : 100 % ! important ;
}
. select2 - container -- default . select2 - selection -- single {
border : 1 px solid var ( -- rahmen );
border - radius : 7 px ;
}
</ style >
< ?
date_default_timezone_set ( 'Europe/Berlin' );
$messages = array ();
$error = FALSE ;
if ( isset ( $custom_action )) {
$action = $custom_action ;
} else {
$action = $_REQUEST [ " action " ];
}
switch ( $action ) {
case 'close_category' :
require_once ( " category_listform.inc.php " );
break ;
case 'load_category' :
require_once ( " category_listform.inc.php " );
echo " <script>
location . reload ();
</ script > " ;
break ;
case 'new_category' :
require_once ( " category_cardform.inc.php " );
break ;
case 'edit_category' :
edit_category ();
break ;
case 'delete_category' :
delete_category ();
echo " <script>
location . reload ();
</ script > " ;
break ;
case 'save_category' :
save_category ();
break ;
case 'moveup_category' :
moveup_category ();
break ;
case 'movedown_category' :
movedown_category ();
break ;
case " moveleft_category " :
moveleft_category ();
break ;
case " moveright_category " :
moveright_category ();
break ;
case " reorder_category " :
reorder_category ();
break ;
case 'update_sortorder_category' :
update_sortorder_category ();
break ;
default :
require_once ( " category_listform.inc.php " );
break ;
}
function edit_category ( $_id = " " )
{
if (( int ) $_id > 0 ) {
$category_id = $_id ;
} else {
$category_id = $_REQUEST [ " input_category_id " ];
}
if ( $category_id <> '' ) {
$query = " SELECT * FROM main_tickets_category WHERE id = ' " . $category_id . " ' LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$input_category = @ mysqli_fetch_array ( $result );
require_once ( " category_cardform.inc.php " );
}
} else {
require_once ( " category_cardform.inc.php " );
}
}
function save_category ()
{
$translation = \DynCom\mysyde\common\classes\Registry :: get ( " translation " );
if ( $_REQUEST [ " input_category_id " ] <> '' ) {
$query = " UPDATE main_tickets_category SET
description = '" . mysqli_real_escape_string($GLOBALS[' mysql_con '], $_REQUEST["input_description"]) . "' ,
text = '" . mysqli_real_escape_string($GLOBALS[' mysql_con '], $_REQUEST["input_text"]) . "' ,
2026-02-19 16:48:26 +01:00
escalation_state = '" . $_REQUEST["input_escalation_state"] . "'
2026-02-17 14:56:23 +01:00
WHERE id = '" . $_REQUEST["input_category_id"] . "' LIMIT 1 " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
$id = $_REQUEST [ " input_category_id " ];
} else {
$sorting = @ mysqli_fetch_array (
@ mysqli_query (
$GLOBALS [ 'mysql_con' ],
" SELECT MAX(sorting)+1 AS newsorting FROM main_tickets_category "
)
);
$sorting = ( $sorting [ " newsorting " ] != " " ) ? $sorting [ " newsorting " ] : 1 ;
$query = "
INSERT INTO main_tickets_category
2026-02-19 16:48:26 +01:00
( description , text , code , escalation_state , sorting )
2026-02-17 14:56:23 +01:00
VALUES (
'" . mysqli_real_escape_string($GLOBALS[' mysql_con '], $_REQUEST["input_description"]) . "' ,
'" . mysqli_real_escape_string($GLOBALS[' mysql_con '], $_REQUEST["input_text"]) . "' ,
'" . mysqli_real_escape_string($GLOBALS[' mysql_con '], $_REQUEST["input_code"]) . "' ,
" . (int) $_REQUEST["input_escalation_state"] . " ,
" . (int) $sorting . "
) " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
$id = mysqli_insert_id ( $GLOBALS [ 'mysql_con' ]);
}
// if ($_POST["select_mandant"] != "0") {
save_mandant ( $id );
// }
// if ($_POST["select_department"] != "0") {
save_department ( $id );
// }
// if ($_POST["select_user"] != "0") {
save_contact ( $id );
// }
save_process ( $id );
if ( $_REQUEST [ 'save_and_close' ] == 1 ) {
require_once ( " category_listform.inc.php " );
echo " <script>
location . reload ();
</ script > " ;
} else {
edit_category ( $id );
}
}
function save_mandant ( $id )
{
$query = " DELETE FROM main_tickets_category_mandant WHERE main_tickets_category_id = ' " . $id . " ' " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( $_POST [ " select_mandant " ] == " " ) {
return ;
}
$mandant_list = explode ( " , " , $_POST [ " select_mandant " ]);
foreach ( $mandant_list as $mandant ) {
$query = " INSERT INTO main_tickets_category_mandant (main_tickets_category_id, main_mandant_id) VALUES (' " . $id . " ', ' " . $mandant . " ') " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
}
function save_department ( $id )
{
$query = " DELETE FROM main_tickets_category_department WHERE main_tickets_category_id = ' " . $id . " ' " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( $_POST [ " select_department " ] == " " ) {
return ;
}
$department_list = explode ( " , " , $_POST [ " select_department " ]);
foreach ( $department_list as $department ) {
$query = " INSERT INTO main_tickets_category_department (main_tickets_category_id, main_department_id) VALUES (' " . $id . " ', ' " . $department . " ') " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
}
function save_process ( $id )
{
if ( $_POST [ " select_process " ] <> '' ) {
$query = " DELETE FROM main_tickets_category_process WHERE main_tickets_category_id = ' " . $id . " ' " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( $_POST [ " select_process " ] == " " ) {
return ;
}
$process_list = explode ( " , " , $_POST [ " select_process " ]);
foreach ( $process_list as $process ) {
$query = " INSERT INTO main_tickets_category_process (main_tickets_category_id, main_tickets_process_id) VALUES (' " . $id . " ', ' " . $process . " ') " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
}
}
function save_contact ( $id )
{
// if ($_POST["select_user"] <> '') {
$query = " DELETE FROM main_tickets_category_contact WHERE main_tickets_category_id = ' " . $id . " ' " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( $_POST [ " select_user " ] == " " ) {
return ;
}
$contact_list = explode ( " , " , $_POST [ " select_user " ]);
foreach ( $contact_list as $contact ) {
$query = " INSERT INTO main_tickets_category_contact (main_tickets_category_id, main_contact_id) VALUES (' " . $id . " ', ' " . $contact . " ') " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
// }
}
function delete_category ()
{
if ( $_REQUEST [ " input_category_id " ] <> '' ) {
$query = " DELETE FROM main_tickets_category WHERE id = ' " . $_REQUEST [ " input_category_id " ] . " ' " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
require_once ( " category_listform.inc.php " );
}
function moveup_category ()
{
move_category ( " < " , " DESC " , $_POST [ " input_category_id " ]);
require_once ( " category_listform.inc.php " );
}
function movedown_category ()
{
move_category ( " > " , " ASC " , $_POST [ " input_category_id " ]);
require_once ( " category_listform.inc.php " );
}
function move_category ( $way , $order , $pic_id )
{
$query = " SELECT * FROM category WHERE id = ' " . $pic_id . " ' LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$curr_pic = @ mysqli_fetch_array ( $result );
}
$query = " SELECT * FROM category WHERE sorting " . $way . " " . $curr_pic [ " sorting " ] . " ORDER BY sorting " . $order . " LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$change_pic = @ mysqli_fetch_array ( $result );
}
if (( $curr_pic [ " id " ] <> '' ) && ( $change_pic [ " id " ] <> '' )) {
$query = " UPDATE main_tickets_category SET sorting = " . $change_pic [ " sorting " ] . " WHERE id = " . $curr_pic [ " id " ];
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
$query = " UPDATE main_tickets_category SET sorting = " . $curr_pic [ " sorting " ] . " WHERE id = " . $change_pic [ " id " ];
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
}
function update_sortorder_category ()
{
$sorting = 1 ;
foreach ( $_POST [ 'linklistid' ] as $itemId ) {
$query = " UPDATE main_tickets_category SET sorting = " . $sorting . " WHERE id = ' " . $itemId . " ' " ;
var_dump ( $query );
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
$sorting ++ ;
}
}
function moveleft_knowledgecenter ()
{
$query = " SELECT * FROM knowledgecenter_category WHERE id = ' " . $_POST [ " input_knowledgecenter_id " ] . " ' LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$curr_knowledgecenter = @ mysqli_fetch_array ( $result );
}
$query = " SELECT * FROM knowledgecenter_category WHERE id = ' " . $curr_knowledgecenter [ " parent_id " ] . " ' LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$parent_knowledgecenter = @ mysqli_fetch_array ( $result );
}
$query = " SELECT * FROM knowledgecenter_category WHERE parent_id = ' " . $curr_knowledgecenter [ " parent_id " ] . " ' ORDER BY sorting DESC LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$last_child_knowledgecenter = @ mysqli_fetch_array ( $result );
}
if (( $curr_knowledgecenter [ " id " ] <> '' ) && ( $parent_knowledgecenter [ " id " ] <> '' )) {
// Eigentlichen Menüeintrag aktualisieren
if ( $parent_knowledgecenter [ " parent_id " ] == '' ) {
$parent_knowledgecenter [ " parent_id " ] = " 0 " ;
}
$query = " UPDATE knowledgecenter_category SET parent_id = " . $parent_knowledgecenter [ " parent_id " ] . " , level = " . $parent_knowledgecenter [ " level " ] . " , sorting = " . ( $parent_knowledgecenter [ " sorting " ] + 1 ) . " WHERE id = " . $curr_knowledgecenter [ " id " ];
if ( @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query )) {
// Level der ursprünglichen Untermenüpunkte aktualisieren
update_knowledgecenter_children ( $curr_knowledgecenter [ " id " ], " - " );
// Parent-ID und Sortierung der neuen Untermenüpunkte aktualisieren
$parent_query = ( $curr_knowledgecenter [ " parent_id " ] <> '' ) ? " parent_id = ' " . $curr_knowledgecenter [ " parent_id " ] . " ' " : " parent_id = 0 " ;
$query = " SELECT * FROM knowledgecenter_category WHERE " . $parent_query . " AND sorting > " . $curr_knowledgecenter [ " sorting " ] . " AND main_site_id = ' " . $GLOBALS [ " site " ][ " id " ] . " ' AND main_language_id = ' " . $GLOBALS [ " language " ][ " id " ] . " ' " ;
$new_sorting = 1 ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) > 0 ) {
while ( $knowledgecenter = @ mysqli_fetch_array ( $result )) {
$query = " UPDATE knowledgecenter_category SET parent_id = " . $curr_knowledgecenter [ " id " ] . " , sorting = " . $new_sorting . " WHERE id = " . $knowledgecenter [ " id " ] . " LIMIT 1 " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
$new_sorting ++ ;
}
}
// Sortierung der neuen Nachfolger aktualisieren
$new_sorting = $parent_knowledgecenter [ " sorting " ] + 1 ;
$parent_query = ( $parent_knowledgecenter [ " parent_id " ] <> '0' ) ? " parent_id = ' " . $parent_knowledgecenter [ " parent_id " ] . " ' " : " parent_id = 0 " ;
$query = " SELECT * FROM knowledgecenter_category WHERE " . $parent_query . " AND id <> " . $curr_knowledgecenter [ " id " ] . " AND sorting >= " . $new_sorting . " AND main_site_id = " . $GLOBALS [ " site " ][ " id " ] . " AND main_language_id = " . $GLOBALS [ " language " ][ " id " ];
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) > 0 ) {
while ( $knowledgecenter = @ mysqli_fetch_array ( $result )) {
$new_sorting ++ ;
$query = " UPDATE knowledgecenter_category SET sorting = " . $new_sorting . " WHERE id = " . $knowledgecenter [ " id " ] . " LIMIT 1 " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
}
}
}
}
function moveright_knowledgecenter ()
{
$query = " SELECT * FROM knowledgecenter_category WHERE id = ' " . $_POST [ " input_knowledgecenter_id " ] . " ' LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$curr_knowledgecenter = @ mysqli_fetch_array ( $result );
}
$parent_query = ( $curr_knowledgecenter [ " parent_id " ] <> '' ) ? " parent_id = ' " . $curr_knowledgecenter [ " parent_id " ] . " ' " : " parent_id = 0 " ;
$query = " SELECT * FROM knowledgecenter_category WHERE " . $parent_query . " AND sorting < " . $curr_knowledgecenter [ " sorting " ] . " AND main_site_id = " . $GLOBALS [ " site " ][ " id " ] . " AND main_language_id = " . $GLOBALS [ " language " ][ " id " ] . " ORDER BY sorting DESC LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$pre_knowledgecenter = @ mysqli_fetch_array ( $result );
}
$query = " SELECT * FROM knowledgecenter_category WHERE parent_id = ' " . $pre_knowledgecenter [ " id " ] . " ' ORDER BY sorting DESC LIMIT 1 " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) == 1 ) {
$lastprechild_knowledgecenter = @ mysqli_fetch_array ( $result );
}
if (( $curr_knowledgecenter [ " id " ] <> '' ) && ( $pre_knowledgecenter [ " id " ] <> '' )) {
// Eigentlichen Menüeintrag aktualisieren
if ( $lastprechild_knowledgecenter [ " sorting " ] == '' ) {
$lastprechild_knowledgecenter [ " sorting " ] = 0 ;
}
$query = " UPDATE knowledgecenter_category SET parent_id = " . $pre_knowledgecenter [ " id " ] . " , level = " . ( $curr_knowledgecenter [ " level " ] + 1 ) . " , sorting = " . ( $lastprechild_knowledgecenter [ " sorting " ] + 1 ) . " WHERE id = " . $curr_knowledgecenter [ " id " ] . " AND main_site_id = " . $GLOBALS [ " site " ][ " id " ] . " AND main_language_id = " . $GLOBALS [ " language " ][ " id " ];
if ( @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query )) {
// Level der ursprünglichen Untermenüpunkte aktualisieren
update_knowledgecenter_children ( $curr_knowledgecenter [ " id " ], " + " );
// Sortierung der neuen Nachfolger aktualisieren
$new_sorting = $curr_knowledgecenter [ " sorting " ];
$parent_query = ( $curr_knowledgecenter [ " parent_id " ] <> '' ) ? " parent_id = " . $curr_knowledgecenter [ " parent_id " ] : " parent_id = 0 " ;
$query = " SELECT * FROM knowledgecenter_category WHERE " . $parent_query . " AND sorting >= " . $new_sorting . " AND main_site_id = " . $GLOBALS [ " site " ][ " id " ] . " AND main_language_id = " . $GLOBALS [ " language " ][ " id " ];
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) > 0 ) {
while ( $knowledgecenter = @ mysqli_fetch_array ( $result )) {
$query = " UPDATE knowledgecenter_category SET sorting = " . $new_sorting . " WHERE id = " . $knowledgecenter [ " id " ] . " LIMIT 1 " ;
$new_sorting ++ ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
}
}
}
}
}
function update_knowledgecenter_children ( $knowledgecenter_id , $way )
{
$query = " SELECT * FROM knowledgecenter_category WHERE parent_id = ' " . $knowledgecenter_id . " ' " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result ) > 0 ) {
while ( $knowledgecenter = @ mysqli_fetch_array ( $result )) {
$query = " UPDATE knowledgecenter_category SET level = level " . $way . " 1 WHERE id = " . $knowledgecenter [ " id " ] . " LIMIT 1 " ;
@ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
update_knowledgecenter_children ( $knowledgecenter [ " id " ], $way );
}
}
}
// function reorder_category() {
// global $parentSort;
// $list = $_POST['list'];
// if (!is_array($list) || count($list) == 0) {
// return;
// }
// $level = 1;
// foreach ($list as $site) {
// if (!array_key_exists(0, $parentSort)) {
// $parentSort[0] = 1;
// }
// $query = "UPDATE main_tickets_category SET parent_id = 0, level = 1, sorting = " . $parentSort[0] . " WHERE id = " . (int)$site['id'];
// mysqli_query($GLOBALS['mysql_con'], $query);
// $parentSort[0]++;
// if (isset($site['children']) && count($site['children'])) {
// update_children($site['id'], $site['children'], $level + 1);
// }
// }
// }
function reorder_category ()
{
global $parentSort ;
if ( ! is_array ( $parentSort )) {
$parentSort = [];
}
$list = $_POST [ 'list' ];
if ( ! is_array ( $list ) || count ( $list ) == 0 ) {
return ;
}
$level = 1 ;
foreach ( $list as $site ) {
if ( ! array_key_exists ( 0 , $parentSort )) {
$parentSort [ 0 ] = 1 ;
}
$query = " UPDATE main_tickets_category SET parent_id = 0, level = 1, sorting = " . $parentSort [ 0 ] . " WHERE id = " . ( int ) $site [ 'id' ];
mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
$parentSort [ 0 ] ++ ;
if ( isset ( $site [ 'children' ]) && count ( $site [ 'children' ])) {
update_children ( $site [ 'id' ], $site [ 'children' ], $level + 1 );
}
}
}
function update_children ( $_parentId , $_list , $_level )
{
global $parentSort ;
foreach ( $_list as $site ) {
if ( ! array_key_exists ( $_parentId , $parentSort )) {
$parentSort [ $_parentId ] = 1 ;
}
$query = " UPDATE main_tickets_category SET parent_id = " . $_parentId . " , level = " . $_level . " , sorting = " . $parentSort [ $_parentId ] . " WHERE id = " . ( int ) $site [ 'id' ];
mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
$parentSort [ $_parentId ] ++ ;
if ( isset ( $site [ 'children' ]) && count ( $site [ 'children' ])) {
update_children ( $site [ 'id' ], $site [ 'children' ], $_level + 1 );
}
}
}
function show_category ()
{
$translation = \DynCom\mysyde\common\classes\Registry :: get ( " translation " );
$result = mysqli_query ( $GLOBALS [ 'mysql_con' ], " SELECT * FROM main_tickets_category " );
$num_rows = mysqli_num_rows ( $result );
if ( $num_rows > 0 ) {
echo " <table border= \" 0 \" cellpadding= \" 0 \" cellspacing= \" 0 \" class= \" linklist \" ><tr> " ;
echo " <td><div> " . $translation -> get ( " description " ) . " </div></td> " ;
echo " <td width= \" 150 \" align= \" left \" ><div></div></td> " ;
echo " <td class= \" code \" width= \" 300 \" align= \" left \" ><div>Code</div></td> " ;
echo " </tr> " ;
echo " <tr> " ;
echo " <td class= \" linklist_seperator \" ></td> " ;
echo " <td class= \" linklist_seperator \" ></td> " ;
echo " <td class= \" linklist_seperator \" ></td> " ;
echo " </tr> " ;
echo " </table> " ;
show_category_rek ( 0 , 1 , 0 , $num_rows );
} else {
echo " <div class= \" infobox \" > " . $translation -> get ( " no_rows_found " ) . " </div> " ;
}
echo " \n " ;
return TRUE ;
}
function show_category_rek ( $parent_id , $level , $input_counter , $num_rows )
{
$translation = \DynCom\mysyde\common\classes\Registry :: get ( " translation " );
$parent_id_query = ( $parent_id == 0 ) ? " WHERE parent_id = 0 " : " WHERE parent_id = ' " . $parent_id . " ' " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], " SELECT * FROM main_tickets_category " . $parent_id_query . " ORDER BY sorting ASC " );
if ( @ mysqli_num_rows ( $result ) > 0 ) {
if ( $parent_id == 0 ) {
echo " <ol class= \" linklist sortable \" > " ;
} else {
echo " <ol> " ;
}
while ( $category = @ mysqli_fetch_array ( $result )) {
$parentclass = " " ;
if ( $level > 1 ) {
$parentclass = " data-tt-parent-id= \" { $category [ 'parent_id' ] } \" " ;
}
$checkedRow = " false " ;
if ( isset ( $_REQUEST [ 'input_category_id' ]) && $_REQUEST [ 'input_category_id' ] == $category [ 'id' ]) {
$checkedRow = " true " ;
}
echo " <li id= \" list_ { $category [ 'id' ] } \" > " ;
echo " <div data-inputid= \" " . $category [ 'id' ] . " \" data-action= \" edit_category \" data-inputname= \" input_category_id \" data-checked= \" " . $checkedRow . " \" class= \" linklist_content dd-handle \" ><span class= \" disclose \" ><span> </span></span> " . htmlentities ( $category [ " description " ], ENT_COMPAT , " UTF-8 " ) . " <div class= \" dd-icon \" ></div> " ;
echo " <div class= \" dd-code \" > " . $category [ 'code' ] . " </div></div> " ;
$input_counter ++ ;
$input_counter = show_category_rek ( $category [ " id " ], ( $level + 1 ), $input_counter , $num_rows );
echo " </li> " ;
}
echo " </ol> " ;
}
return $input_counter ;
}
function selectMandant ( $group_id )
{
$translation = \DynCom\mysyde\common\classes\Registry :: get ( " translation " );
$query = " SELECT * FROM main_mandant " ;
$result_mandant = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result_mandant ) == 0 ) {
return ;
}
$preselect = array ();
$query = " SELECT main_mandant.* FROM main_mandant INNER JOIN main_tickets_category_mandant ON main_mandant.id = main_tickets_category_mandant.main_mandant_id WHERE main_tickets_category_mandant.main_tickets_category_id = ' " . $group_id . " ' " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
while ( $row = @ mysqli_fetch_array ( $result )) {
array_push ( $preselect , $row [ 'description' ]);
}
$allselect = array ();
?>
< div class = " label " > Filiale auswählen </ div >
< div class = " mandants bc-select-ui ui fluid multiple search selection dropdown " style = " clear:both;display:inline-block; " >
< input type = " hidden " name = " select_mandant " >
< i class = " dropdown icon " ></ i >
< div class = " default text " >< ? php echo $translation -> get ( " top_mandant " ) ?> </div>
< div class = " menu " >
< ?
while ( $mandant = @ mysqli_fetch_array ( $result_mandant )) {
array_push ( $allselect , $mandant [ 'id' ]);
echo " <div class= \" item \" data-value= \" { $mandant [ 'id' ] } \" > " . $mandant [ " 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 ( '.mandants.ui.fluid.multiple.dropdown' ) . dropdown ( 'set selected' , < ? = json_encode ( $preselect ) ?> );
});
</ script >
< ? php
}
function selectDepartment ( $group_id )
{
$translation = \DynCom\mysyde\common\classes\Registry :: get ( " translation " );
$query = " SELECT * FROM main_department " ;
$result_department = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result_department ) == 0 ) {
return ;
}
$preselect = array ();
$query = " SELECT main_department.* FROM main_department INNER JOIN main_tickets_category_department ON main_department.id = main_tickets_category_department.main_department_id WHERE main_tickets_category_department.main_tickets_category_id = ' " . $group_id . " ' " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
while ( $row = @ mysqli_fetch_array ( $result )) {
array_push ( $preselect , $row [ 'description' ]);
}
$allselect = array ();
?>
< div class = " label " > Abteilungen auswählen </ div >
< div class = " departments bc-select-ui ui fluid multiple search selection dropdown "
style = " clear:both;display:inline-block; " >
< input type = " hidden " name = " select_department " >
< i class = " dropdown icon " ></ i >
< div class = " default text " >< ? php echo $translation -> get ( " top_department " ) ?> </div>
< div class = " menu " >
< ?
while ( $department = @ mysqli_fetch_array ( $result_department )) {
array_push ( $allselect , $department [ 'id' ]);
echo " <div class= \" item \" data-value= \" { $department [ 'id' ] } \" > " . $department [ " 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 ( '.departments.ui.fluid.multiple.dropdown' ) . dropdown ( 'set selected' , < ? = json_encode ( $preselect ) ?> );
});
</ script >
< ? php
}
function selectContact ( $group_id )
{
$translation = \DynCom\mysyde\common\classes\Registry :: get ( " translation " );
$query = " SELECT * FROM main_contact " ;
$result_contact = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result_contact ) == 0 ) {
return ;
}
$preselect = array ();
$query = " SELECT main_contact.* FROM main_contact INNER JOIN main_tickets_category_contact ON main_contact.id = main_tickets_category_contact.main_contact_id WHERE main_tickets_category_contact.main_tickets_category_id = ' " . $group_id . " ' " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
while ( $row = @ mysqli_fetch_array ( $result )) {
array_push ( $preselect , $row [ 'name' ]);
}
$allselect = array ();
?>
< div class = " label " > Zusätzlicher Benutzer auswählen </ div >
< div class = " contacts bc-select-ui ui fluid multiple search selection dropdown " style = " clear:both;display:inline-block; " >
< input type = " hidden " name = " select_user " >
< i class = " dropdown icon " ></ i >
< div class = " default text " >< ? php echo $translation -> get ( " top_user " ) ?> </div>
< div class = " menu " >
< ?
while ( $contact = @ mysqli_fetch_array ( $result_contact )) {
array_push ( $allselect , $contact [ 'id' ]);
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') ?> " >
< script >
var $y = jQuery . noConflict ();
$y ( document ) . ready ( function () {
$y ( '.contacts.ui.fluid.multiple.dropdown' ) . dropdown ( 'set selected' , < ? = json_encode ( $preselect ) ?> );
});
</ script >
< ? php
}
function selectProcess ( $group_id )
{
$translation = \DynCom\mysyde\common\classes\Registry :: get ( " translation " );
$query = " SELECT * FROM main_tickets_process " ;
$result_process = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
if ( @ mysqli_num_rows ( $result_process ) == 0 ) {
return ;
}
$preselect = array ();
$query = " SELECT main_tickets_process.* FROM main_tickets_process INNER JOIN main_tickets_category_process ON main_tickets_process.id = main_tickets_category_process.main_tickets_process_id WHERE main_tickets_category_process.main_tickets_category_id = ' " . $group_id . " ' " ;
$result = @ mysqli_query ( $GLOBALS [ 'mysql_con' ], $query );
while ( $row = @ mysqli_fetch_array ( $result )) {
array_push ( $preselect , $row [ 'id' ]);
}
$allselect = array ();
?>
< div class = " label " > Process auswählen </ div >
< div class = " processes bc-select-ui ui fluid search selection dropdown "
style = " clear:both;display:inline-block;width: 100%; " >
< input type = " hidden " name = " select_process " >
< i class = " dropdown icon " ></ i >
< div class = " default text " >< ? php echo $translation -> get ( " top_process " ) ?> </div>
< div class = " menu " >
< ?
while ( $process = @ mysqli_fetch_array ( $result_process )) {
array_push ( $allselect , $process [ 'id' ]);
echo " <div class= \" item \" data-value= \" { $process [ 'id' ] } \" > " . $process [ " 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 ( '.processes.ui.fluid.dropdown' ) . dropdown ( 'set selected' , < ? = json_encode ( $preselect ) ?> );
});
</ script >
< ? php
}
// $query_dep = "SELECT id FROM main_tickets_category";
// $result_dep = @mysqli_query($GLOBALS['mysql_con'], $query_dep);
// $all_categories = [];
// while ($row = @mysqli_fetch_array($result_dep)) {
// $all_categories[] = $row['id'];
// }
// foreach ($all_categories as $category_id) {
// $query_cat_dep = "INSERT INTO main_tickets_category_department (main_tickets_category_id, main_department_id) VALUES ($category_id, '1')";
// @mysqli_query($GLOBALS['mysql_con'], $query_cat_dep);
// $query_cat_dep = "INSERT INTO main_tickets_category_department (main_tickets_category_id, main_department_id) VALUES ($category_id, '3')";
// @mysqli_query($GLOBALS['mysql_con'], $query_cat_dep);
// $query_process = "INSERT INTO main_tickets_category_process (main_tickets_category_id, main_tickets_process_id) VALUES ($category_id, '1')";
// @mysqli_query($GLOBALS['mysql_con'], $query_process);
// // $query_esc = "UPDATE main_tickets_category SET escalation_state = '5' WHERE id = $category_id";
// // @mysqli_query($GLOBALS['mysql_con'], $query_esc);
// $query = "INSERT INTO main_tickets_category_contact (main_tickets_category_id, main_contact_id) VALUES ($category_id, '2')";
// @mysqli_query($GLOBALS['mysql_con'], $query);
// }