Initial commit
This commit is contained in:
75
communication_send.php
Normal file
75
communication_send.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
defined(page_security_key) or exit;
|
||||
|
||||
$page = 'communication_send';
|
||||
//Check if allowed
|
||||
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
||||
header('location: index.php');
|
||||
exit;
|
||||
}
|
||||
//PAGE Security
|
||||
$update_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'U');
|
||||
$delete_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'D');
|
||||
$create_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'C');
|
||||
|
||||
$url = 'index.php?page=communications';
|
||||
|
||||
if ($update_allowed === 1){
|
||||
if (isset($_POST['submit'])) {
|
||||
//GET ALL POST DATA
|
||||
$data = json_encode($_POST, JSON_UNESCAPED_UNICODE);
|
||||
//Secure data
|
||||
$payload = generate_payload($data);
|
||||
//API call
|
||||
$responses = ioServer('/v1/application/firmwareCommunication', $payload);
|
||||
if ($responses === 'NOK'){
|
||||
|
||||
} else {
|
||||
header('Location: index.php?page=communications&success_msg=4');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template_header('Communication', 'communication', 'manage');
|
||||
|
||||
$view ='
|
||||
<form action="" method="post">
|
||||
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
|
||||
<h2 class="responsive-width-100">'.$communication_send_firmware_h2.'</h2>
|
||||
<a href="index.php?page=communications" class="btn alt mar-right-2">'.$button_cancel.'</a>
|
||||
';
|
||||
|
||||
if ($update_allowed === 1){
|
||||
$view .= '<input type="submit" name="submit" value="Save" onclick="return confirm(\'Are you sure you want to send firmware messages?\')" class="btn">';
|
||||
}
|
||||
|
||||
$view .= '</div>';
|
||||
|
||||
$view .= '<div class="tabs">
|
||||
<a href="#" class="active">'.$tab1 .'</a>
|
||||
</div>
|
||||
';
|
||||
|
||||
//Define Service and partner enabled
|
||||
$view .= '<div class="content-block tab-content active">
|
||||
<div class="form responsive-width-100">
|
||||
<label for="target">'.$communication_target.'</label>
|
||||
<select id="target" name="target">
|
||||
<option value="1" >'.$general_soldto .'</option>
|
||||
<option value="2" >'.$general_shipto .'</option>
|
||||
<option value="0" >'.$communication_target_both .'</option>
|
||||
</select>
|
||||
<label for="hw_version">'.$communication_hw_scope.'</label>
|
||||
<input id="hw_version" type="text" name="hw_version" placeholder="'.$communication_hw_scope.'" value="" required">
|
||||
';
|
||||
|
||||
$view .= '</div>
|
||||
</div>';
|
||||
|
||||
$view .= '</form>';
|
||||
|
||||
|
||||
//Output
|
||||
echo $view;
|
||||
template_footer()?>
|
||||
Reference in New Issue
Block a user