Update Call Broadcast
This commit is contained in:
@@ -59,19 +59,19 @@
|
||||
$filename=$_FILES["broadcast_phone_numbers_file"]["tmp_name"];
|
||||
$file_extension = array('application/octet-stream','application/vnd.ms-excel','text/plain','text/csv','text/tsv');
|
||||
if (in_array($_FILES['broadcast_phone_numbers_file']['type'],$file_extension)) {
|
||||
$file = fopen($filename, "r");
|
||||
$count = 0;
|
||||
while (($getData = fgetcsv($file, 0, "\n")) !== FALSE)
|
||||
{
|
||||
$count++;
|
||||
if ($count == 1) { continue; }
|
||||
$getData = preg_split('/[ ,|]/', $getData[0], null, PREG_SPLIT_NO_EMPTY);
|
||||
$separator = $getData[0];
|
||||
$separator .= (isset($getData[1]) && $getData[1] != '')? '|'.$getData[1] : '';
|
||||
$separator .= (isset($getData[2]) && $getData[2] != '')? ','.$getData[2] : '';
|
||||
$separator .= '\n';
|
||||
$upload_csv .= $separator;
|
||||
}
|
||||
$file = fopen($filename, "r");
|
||||
$count = 0;
|
||||
while (($getData = fgetcsv($file, 0, "\n")) !== FALSE)
|
||||
{
|
||||
$count++;
|
||||
if ($count == 1) { continue; }
|
||||
$getData = preg_split('/[ ,|]/', $getData[0], null, PREG_SPLIT_NO_EMPTY);
|
||||
$separator = $getData[0];
|
||||
$separator .= (isset($getData[1]) && $getData[1] != '')? '|'.$getData[1] : '';
|
||||
$separator .= (isset($getData[2]) && $getData[2] != '')? ','.$getData[2] : '';
|
||||
$separator .= '\n';
|
||||
$upload_csv .= $separator;
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
else {
|
||||
@@ -79,15 +79,13 @@
|
||||
}
|
||||
}
|
||||
if (!empty($broadcast_phone_numbers) && !empty($upload_csv)) {
|
||||
$sql .= "E'";
|
||||
$sql .= $broadcast_phone_numbers.'\n'.$upload_csv;
|
||||
$sql .= "',";
|
||||
}
|
||||
elseif (empty($broadcast_phone_numbers) && !empty($upload_csv)) {
|
||||
$sql .= "E'$upload_csv', ";
|
||||
$sql .= $upload_csv;
|
||||
}
|
||||
else {
|
||||
$sql .= "E'$broadcast_phone_numbers', ";
|
||||
$sql .= $broadcast_phone_numbers;
|
||||
}
|
||||
return array('code'=>true,'sql'=> $sql);
|
||||
}
|
||||
@@ -270,8 +268,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " <input type='button' class='btn' name='back' alt='".$text['button-back']."' onclick=\"window.location='call_broadcast.php'\" value='".$text['button-back']."'>\n";
|
||||
if ($action == "update") {
|
||||
echo "<input type='hidden' name='call_broadcast_uuid' value='".escape($call_broadcast_uuid)."'>\n";
|
||||
echo "<input type='button' class='btn' name='' alt='".$text['button-send']."' onclick=\"window.location='call_broadcast_send.php?id=".escape($call_broadcast_uuid)."'\" value='".$text['button-send']."'>\n";
|
||||
echo "<input type='button' class='btn' name='' alt='".$text['button-stop']."' onclick=\"window.location='call_broadcast_stop.php?id=".escape($call_broadcast_uuid)."'\" value='".$text['button-stop']."'>\n";
|
||||
echo "<input type='button' class='btn' name='' alt='".$text['button-send']."' onclick=\"window.location='call_broadcast_send.php?id=".urlencode($call_broadcast_uuid)."'\" value='".$text['button-send']."'>\n";
|
||||
echo "<input type='button' class='btn' name='' alt='".$text['button-stop']."' onclick=\"window.location='call_broadcast_stop.php?id=".urlencode($call_broadcast_uuid)."'\" value='".$text['button-stop']."'>\n";
|
||||
}
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-save']."'>\n";
|
||||
echo "</td>\n";
|
||||
@@ -455,16 +453,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
|
||||
echo " <textarea class='formfld' type='text' name='broadcast_phone_numbers' rows='10'>".$broadcast_phone_numbers."</textarea>";
|
||||
echo "<br>";
|
||||
echo " <span class='' style='margin-left: 37px;'>OR </span> ";
|
||||
echo "<br>";
|
||||
echo " <input type='file' name='broadcast_phone_numbers_file' accept='.csv,.txt' style=\"display:inline-block;\"><a href='sample.csv' download>Sample File <i class='fas fa-cloud-download-alt'></i></a>";
|
||||
echo "<br>";
|
||||
echo " (Upload TXT- Plain Text, CSV- Comma Separated Values file format only.)";
|
||||
echo "<br>";
|
||||
echo " <textarea class='formfld' style='width: 300px; height: 200px;' type='text' name='broadcast_phone_numbers' placeholder=\"".$text['label-list_example']."\">".str_replace('\n', "\n", $broadcast_phone_numbers)."</textarea>";
|
||||
echo "<br><br>";
|
||||
echo " <input type='file' name='broadcast_phone_numbers_file' accept='.csv,.txt' style=\"display:inline-block;\"><a href='sample.csv' download><i class='fas fa-cloud-download-alt' style='margin-right: 5px;'></i>".$text['label-sample_file']."</a>";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "<br />\n";
|
||||
echo "".$text['description-phone']." <br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
Reference in New Issue
Block a user