0) { $input_id = $_id; } else { $input_id = $_POST["input_id"]; } if ($input_id <> '') { $pdoHost = getenv('MAIN_MYSQL_DB_HOST'); $pdoPort = getenv('MAIN_MYSQL_DB_PORT'); $pdoUser = getenv('MAIN_MYSQL_DB_USER'); $pdoPass = getenv('MAIN_MYSQL_DB_PASS'); $pdoSchema = getenv('MAIN_MYSQL_DB_SCHEMA'); $pdo = new \DynCom\mysyde\common\classes\PDOQueryWrapper($pdoHost, $pdoPort, $pdoSchema, $pdoUser, $pdoPass); $prepStatement = " SELECT * FROM main_department WHERE id = :id LIMIT 1 "; $params = [ [':id', $input_id, PDO::PARAM_STR], ]; $pdo->setQuery($prepStatement); $pdo->prepareQuery(); $pdo->bindParameters($params); $pdo->executePreparedStatement(); $result = $pdo->getResultArray(); if (count($result) == 1) { $input_department = $result[0]; $input_department["password"] = "nochange"; require_once("edit_department_cardform.inc.php"); } } else { $input_department = array(); require_once("edit_department_cardform.inc.php"); } } function delete_department($curr_department_id) { $translation = \DynCom\mysyde\common\classes\Registry::get("translation"); if ($_POST["input_id"] <> '') { if ($_POST["input_id"] <> $curr_department_id) { $query = "DELETE FROM main_department WHERE id = '" . $_POST["input_id"] . "' LIMIT 1"; @mysqli_query($GLOBALS['mysql_con'], $query); } else { header('EDIT_ERROR: 1'); $messages[] = "
" . $translation->get("department_error5") . "
"; edit_department($_POST["input_id"], $messages); } } require_once("edit_department_listform.inc.php"); } function save_department() { $messages = array(); $error = FALSE; $input_id = ""; $translation = \DynCom\mysyde\common\classes\Registry::get("translation"); if ($_POST["input_id"] <> '') { $inserted = FALSE; $input_id = $_POST["input_id"]; $query = "UPDATE main_department SET description = '" . $_POST['input_description'] . "' WHERE id = '" . $input_id . "' LIMIT 1"; } else { $query = "INSERT INTO main_department (id, description) VALUES ( NULL, '" . $_POST['input_description'] . "' )"; $inserted = TRUE; } if (!$error) { @mysqli_query($GLOBALS['mysql_con'], $query); if ($inserted == TRUE) { $input_id = mysqli_insert_id($GLOBALS['mysql_con']); $messages[] = '
' . $translation->get("department_msg_success1") . '
'; } else { $messages[] = '
' . $translation->get("department_msg_success2") . '
'; } saveMandantLink($input_id); saveFachbereichLink($input_id); edit_department($input_id, $messages); } else { header('EDIT_ERROR: 1'); // $input_department["id"] = $_POST["input_id"]; // $input_department["name"] = $_POST["input_name"]; // $input_department["email"] = $_POST["input_email"]; // $input_department["login"] = $_POST["input_login"]; require_once("edit_department_cardform.inc.php"); } } function saveMandantLink($department_id){ $mandant_id = $_POST['select_mandant']; $mandante = explode(',', $mandant_id); if(!empty($mandante) && gettype($mandante) == 'array') { $deleteLink = @mysqli_query($GLOBALS["mysql_con"], "DELETE FROM main_department_mandant_link WHERE main_department_id = ".$department_id); foreach($mandante as $key => $mandant){ $query = "INSERT INTO main_department_mandant_link (main_department_id, main_mandant_id) VALUES ( " . $department_id . ", '" . $mandant . "' )"; @mysqli_query($GLOBALS['mysql_con'], $query); } } } function selectMandant($department_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 * FROM main_department_mandant_link WHERE main_department_id = ".$department_id; $result = @mysqli_query($GLOBALS['mysql_con'], $query); while($row = @mysqli_fetch_array($result)){ array_push($preselect,$row['main_mandant_id']); } $allselect = array(); ?>
get("top_mandant")?>
get("all_mandate")?>
get("top_mandant")?>
get("all_mandate")?>
get("top_space")?>
get("all")?>
$mandant){ $query = "INSERT INTO main_department_fachbereich (department_id, fachbereich_id) VALUES ( " . $department_id . ", '" . $mandant . "' )"; @mysqli_query($GLOBALS['mysql_con'], $query); } } }