init
This commit is contained in:
218
module/bewerber/process/edit_process.inc.php
Normal file
218
module/bewerber/process/edit_process.inc.php
Normal file
@@ -0,0 +1,218 @@
|
||||
<?
|
||||
|
||||
$messages = array();
|
||||
$error = FALSE;
|
||||
|
||||
|
||||
if (isset($custom_action)) {
|
||||
$action = $custom_action;
|
||||
|
||||
} else {
|
||||
$action = $_REQUEST["action"];
|
||||
}
|
||||
switch ($action) {
|
||||
case 'edit_processform':
|
||||
edit_processform();
|
||||
break;
|
||||
|
||||
case 'delete_processform':
|
||||
delete_processform();
|
||||
break;
|
||||
case 'new_processform':
|
||||
|
||||
require_once("edit_processform_cardform.inc.php");
|
||||
break;
|
||||
|
||||
case 'save_processform':
|
||||
save_processform();
|
||||
break;
|
||||
|
||||
case 'moveup_line_processform':
|
||||
moveup_line_processform();
|
||||
require_once("edit_process_listform.inc.php");
|
||||
break;
|
||||
case 'movedown_line_processform':
|
||||
movedown_line_processform();
|
||||
require_once("edit_process_listform.inc.php");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
require_once("edit_process_listform.inc.php");
|
||||
|
||||
break;
|
||||
}
|
||||
function save_processform() {
|
||||
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$input_id = "";
|
||||
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "UPDATE bewerber_process SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||||
short_text = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_short_text"]) . "',
|
||||
modified_date = " . time() . ",
|
||||
modified_user = " . (int)$GLOBALS["admin_user"]['id'] . ",
|
||||
code = '". mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_code"])."'
|
||||
|
||||
WHERE id = '" . $_REQUEST["input_id"] . "'
|
||||
LIMIT 1";
|
||||
$inserted = FALSE;
|
||||
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
|
||||
} else {
|
||||
|
||||
$query = "INSERT INTO bewerber_process
|
||||
(main_language_id, description, modified_date, modified_user, short_text, code)
|
||||
VALUES (
|
||||
" . (int)$GLOBALS["language"]['id'] . ",
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['input_description']) . "',
|
||||
" . time() . ",
|
||||
" . (int)$GLOBALS["admin_user"]['id'] . ",
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['input_short_text']) . "',
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST['input_code']) . "'
|
||||
)";
|
||||
|
||||
$inserted = TRUE;
|
||||
}
|
||||
|
||||
if (($_REQUEST["input_description"] == '')) {
|
||||
$messages[] = "<div class=\"errorbox\">" . $translation->get("error_description") . "</div>\n";
|
||||
$error = TRUE;
|
||||
}
|
||||
if ($_REQUEST["input_code"] <> urlencode($_REQUEST["input_code"])) {
|
||||
$messages[] = "<div class=\"errorbox\">" . $translation->get("error_textkey_encoding") . "</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("processform_msg_success1") . '</div>';
|
||||
} else {
|
||||
$messages[] = '<div class="successbox">' . $translation->get("processform_msg_success2") . '</div>';
|
||||
}
|
||||
|
||||
$stufe = array();
|
||||
$stufe_ids = $_POST['select_stufe'];
|
||||
if($stufe_ids != NULL && isset($_POST['select_stufe'])){
|
||||
|
||||
$stufe = explode(',', $stufe_ids);
|
||||
}
|
||||
|
||||
if(!empty($stufe) && gettype($stufe) == 'array') {
|
||||
$deleteOld = @mysqli_query($GLOBALS["mysql_con"], "DELETE FROM bewerber_process_stufe WHERE process_id='".$input_id."'");
|
||||
|
||||
foreach($stufe as $key => $val){
|
||||
$query = "INSERT INTO bewerber_process_stufe
|
||||
(stufe_id, process_id)
|
||||
VALUES (
|
||||
" . $val . ",
|
||||
'" . $input_id . "'
|
||||
)";
|
||||
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
edit_processform($input_id, $messages);
|
||||
|
||||
|
||||
} else {
|
||||
header('EDIT_ERROR: 1');
|
||||
$input_processform["description"] = $_REQUEST["input_description"];
|
||||
$input_processform["short_text"] = $_REQUEST["input_short_text"];
|
||||
$input_processform["id"] = $_REQUEST["input_id"];
|
||||
require_once("edit_processform_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
function edit_processform( $_id = "", $messages = array() ) {
|
||||
|
||||
$input_id = '';
|
||||
|
||||
if ((int)$_id > 0) {
|
||||
$input_id = $_id;
|
||||
} if(isset($_REQUEST['input_id']) && $_id == ''){
|
||||
$input_id = $_REQUEST["input_id"];
|
||||
}
|
||||
|
||||
|
||||
if ($input_id <> '') {
|
||||
$query = "SELECT * FROM bewerber_process WHERE id = '" . $input_id . "' LIMIT 1";
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 1) {
|
||||
$input_processform = @mysqli_fetch_array($result);
|
||||
|
||||
require_once("edit_processform_cardform.inc.php");
|
||||
|
||||
}
|
||||
} else {
|
||||
$input_processform = array();
|
||||
|
||||
require_once("edit_processform_cardform.inc.php");
|
||||
}
|
||||
}
|
||||
function delete_processform() {
|
||||
if ($_REQUEST["input_id"] <> '') {
|
||||
$query = "DELETE FROM bewerber_process WHERE id = '" . $_REQUEST["input_id"] . "' LIMIT 1";
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
require_once("edit_process_listform.inc.php");
|
||||
}
|
||||
function create_stufe_set($process_id){
|
||||
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
|
||||
|
||||
$query = "SELECT * FROM stufe WHERE main_language_id = '" . $GLOBALS["language"]['id'] . "'";
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
if (@mysqli_num_rows($result) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$preselect = array();
|
||||
$query2 = "SELECT * FROM bewerber_process_stufe WHERE process_id = '" . $process_id . "'";
|
||||
$result2 = mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
|
||||
while($row2 = @mysqli_fetch_array($result2)){
|
||||
array_push($preselect,$row2['stufe_id']);
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="label"><?php echo $translation->get("select_stufe"); ?></div>
|
||||
<div class="groups bc-select-ui ui fluid multiple search selection dropdown" style="clear:both;display:inline-block;">
|
||||
<input type="hidden" name="select_stufe">
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="default text"><?php echo $translation->get("select_stufe"); ?></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>
|
||||
<? }
|
||||
?>
|
||||
Reference in New Issue
Block a user