'', 'status' => 1, 'partnerID' => '', 'email' => '', 'type_1' => 1, 'type_2' => 1, 'type_3' => 1, 'created' => '', 'createdby' => '', 'salesID' => '', 'coms_type' => 1, 'send' => '' ]; if (isset($_GET['id'])) { // ID param exists, edit an existing communication //CALL TO API $api_url = '/v1/communications/rowID='.$_GET['id']; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;} $communication = json_decode(json_encode($responses[0]), true); 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/communications', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=communications&status=1&success_msg=2'); exit; } } } if ($delete_allowed === 1){ if (isset($_POST['delete'])) { //GET ALL POST DATA $data = json_encode($_POST, JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/communications', $payload); if ($responses === 'NOK'){ } else { // Redirect and delete communication header('Location: index.php?page=communications&status=1&success_msg=3'); exit; } } } } else { // Create a new communication if (isset($_POST['submit']) && $create_allowed === 1) { //GET ALL POST DATA $data = json_encode($_POST , JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/communications', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=communications&success_msg=1'); exit; } } } template_header('Communication', 'communication', 'manage'); $view ='

'.$communication_h2.'

'.$button_cancel.' '; if ($delete_allowed === 1){ $view .= ''; } if ($update_allowed === 1){ $view .= ''; } $view .= '
'; $view .= '
'.$tab1.' '.$tab3.'
'; //GET PARTNERID $view_partners = ''; if(isset($communication['partnerID']) && $communication['partnerID'] !=''){ $partner_ID = strtok($communication['partnerID'],'-'); $view_partners = ' '.$button_view.''; } $view .= '
'.$view_partners.'
'; $view .= '
'; $view .= '
'; //Output echo $view; template_footer()?>