Update conference_control_detail_edit.php
This commit is contained in:
parent
0c67dafb52
commit
b15a8a21c8
|
|
@ -33,79 +33,80 @@
|
|||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
if (count($_POST) > 0) {
|
||||
$control_digits = $_POST["control_digits"];
|
||||
$control_action = $_POST["control_action"];
|
||||
$control_data = $_POST["control_data"];
|
||||
$control_enabled = $_POST["control_enabled"];
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the http post
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//get the uuid
|
||||
if ($action == "update") {
|
||||
$conference_control_detail_uuid = $_POST["conference_control_detail_uuid"];
|
||||
}
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: conference_controls.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($control_digits) == 0) { $msg .= $text['message-required']." ".$text['label-control_digits']."<br>\n"; }
|
||||
if (strlen($control_action) == 0) { $msg .= $text['message-required']." ".$text['label-control_action']."<br>\n"; }
|
||||
//if (strlen($control_data) == 0) { $msg .= $text['message-required']." ".$text['label-control_data']."<br>\n"; }
|
||||
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
$array['conference_control_details'][0]['conference_control_uuid'] = $conference_control_uuid;
|
||||
$array['conference_control_details'][0]['control_digits'] = $control_digits;
|
||||
$array['conference_control_details'][0]['control_action'] = $control_action;
|
||||
$array['conference_control_details'][0]['control_data'] = $control_data;
|
||||
$array['conference_control_details'][0]['control_enabled'] = $control_enabled;
|
||||
|
||||
if ($action == "add" && permission_exists('conference_control_detail_add')) {
|
||||
$array['conference_control_details'][0]['conference_control_detail_uuid'] = uuid();
|
||||
message::add($text['message-add']);
|
||||
//get the uuid
|
||||
if ($action == "update") {
|
||||
$conference_control_detail_uuid = $_POST["conference_control_detail_uuid"];
|
||||
}
|
||||
|
||||
if ($action == "update" && permission_exists('conference_control_detail_edit')) {
|
||||
$array['conference_control_details'][0]['conference_control_detail_uuid'] = $conference_control_detail_uuid;
|
||||
message::add($text['message-update']);
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: conference_controls.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (is_uuid($array['conference_control_details'][0]['conference_control_detail_uuid'])) {
|
||||
$database = new database;
|
||||
$database->app_name = 'conference_controls';
|
||||
$database->app_uuid = 'e1ad84a2-79e1-450c-a5b1-7507a043e048';
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($control_digits) == 0) { $msg .= $text['message-required']." ".$text['label-control_digits']."<br>\n"; }
|
||||
if (strlen($control_action) == 0) { $msg .= $text['message-required']." ".$text['label-control_action']."<br>\n"; }
|
||||
//if (strlen($control_data) == 0) { $msg .= $text['message-required']." ".$text['label-control_data']."<br>\n"; }
|
||||
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
header('Location: conference_control_edit.php?id='.$conference_control_uuid);
|
||||
exit;
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
}
|
||||
}
|
||||
$array['conference_control_details'][0]['conference_control_uuid'] = $conference_control_uuid;
|
||||
$array['conference_control_details'][0]['control_digits'] = $control_digits;
|
||||
$array['conference_control_details'][0]['control_action'] = $control_action;
|
||||
$array['conference_control_details'][0]['control_data'] = $control_data;
|
||||
$array['conference_control_details'][0]['control_enabled'] = $control_enabled;
|
||||
|
||||
if ($action == "add" && permission_exists('conference_control_detail_add')) {
|
||||
$array['conference_control_details'][0]['conference_control_detail_uuid'] = uuid();
|
||||
message::add($text['message-add']);
|
||||
}
|
||||
|
||||
if ($action == "update" && permission_exists('conference_control_detail_edit')) {
|
||||
$array['conference_control_details'][0]['conference_control_detail_uuid'] = $conference_control_detail_uuid;
|
||||
message::add($text['message-update']);
|
||||
}
|
||||
|
||||
if (is_uuid($array['conference_control_details'][0]['conference_control_detail_uuid'])) {
|
||||
$database = new database;
|
||||
$database->app_name = 'conference_controls';
|
||||
$database->app_uuid = 'e1ad84a2-79e1-450c-a5b1-7507a043e048';
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
}
|
||||
|
||||
header('Location: conference_control_edit.php?id='.$conference_control_uuid);
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue