function print_form($post_data, $errors) { $sub = new Subscriber(); try { $msisdn = $_GET['id']; $sub->get($msisdn); } catch (SubscriberException $e) { echo "<img src='img/false.png' width='200' height='170' /><br/><br/>"; echo "<span style='font-size: 20px; color: red;'>" . _("ERROR GETTING SUBSCRIBER INFO!") . "<br/> " . $e->getMessage() . " </span><br/><br/><br/><br/>"; echo "<a href='#' onclick=\"parent.jQuery.fancybox.close()\"><button class='b1'>" . _("Close") . "</button></a>"; } ?> <br/> <div id="stylized" class="myform"> <form id="form" name="form" method="post" action="subscriber_delete.php"> <h1><?php echo _("Delete Subscriber"); ?> </h1><br/> <input type="hidden" name="msisdn" value="<?php echo $sub->msisdn; ?> " /> <?php echo _("Confirm deletion of"); ?> <?php echo $sub->name; ?> <?php echo $sub->msisdn; ?> <button type="submit" name="delete_subscriber"><?php echo _("Delete"); ?> </button> <div class="spacer"></div> </form> </div> <?php }
$number = $_POST['number']; $bulk_send = $_POST['bulk_send']; if ($message == "") { $error_txt .= _("SMS text is empty") . "<br/>"; } if ($number == "" && !isset($bulk_send)) { $error_txt .= _("SMS number is empty") . "<br/>"; } } if (isset($_POST['send_sms']) && $error_txt != "") { print_form(1, $error_txt); } elseif (isset($_POST['send_sms']) && $error_txt == "") { $sub = new Subscriber(); $ret = 0; try { $sub->get($_POST['number']); } catch (SubscriberException $e) { echo "<img src='img/false.png' width='200' height='170' /><br/><br/>"; echo "<span style='font-size: 20px; color: red;'>" . _("ERROR SENDING SMS!") . "</br>" . $e->getMessage() . " </span><br/><br/><br/><br/>"; echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>"; $ret = 1; } if ($ret == 0) { if (isset($_POST['bulk_send'])) { try { $sms = new SMS(); $sms->send_broadcast($_POST['message'], $_POST['bulk_send']); echo "<img src='img/true.png' width='150' height='150' /><br/><br/>"; echo "<span style='font-size: 20px;'>" . _("BROADCAST MESSAGE IS BEING SENT!") . "</span><br/><br/><br/><br/>"; echo "<a href='send_sms.php'><button class='b1'>" . _("Go Back") . "</button></a>"; } catch (SMSException $e) {
public function export_csv($num) { $subscribers = Subscriber::get(); if ($num == 1) { $file_name = date('Y_m_d_H_i') . '_subscribers' . '.csv'; $file = fopen('exports/' . $file_name, 'w'); $field_names = false; foreach ($subscribers as $row) { if (!$field_names) { fputcsv($file, array_keys($row->toArray())); $field_names = true; } fputcsv($file, $row->toArray()); } fclose($file); $path = asset('exports/' . $file_name); return Response::json(array('file' => $path)); } }
'type' : 'iframe', 'onClosed' : function() { parent.location.reload(true); } }); }, "sAjaxSource": "subscribers_processing.php" } ); }); </script><br/> <?php try { $sub = new Subscriber(); $unpaid_subscribers = $sub->get('unpaid_subscription'); $unauthorized_subscribers = $sub->get('unauthorized'); $paid_subscribers = $sub->get('paid_subscription'); $online = $sub->get('online'); $offline = $sub->get('offline'); echo "<div>"; echo "<div class='left_box' style='margin-left:10px;'>" . _("Unpaid subscription") . ": <b>{$unpaid_subscribers}</b></div>"; echo "<div class='left_box'>" . _("Unauthorized") . ": <b>{$unauthorized_subscribers}</b></div>"; echo "<div class='left_box'>" . _("Paid subscription") . ": <b>{$paid_subscribers}</b></div>"; echo "<div class='left_box'>" . _("Online") . ": <b>{$online}</b></div>"; echo "<div class='left_box'>" . _("Offline") . ": <b>{$offline}</b></div>"; echo "</div>"; } catch (SubscriberException $e) { } ?>
function print_form($post_data, $errors) { $firstname = $_POST['firstname'] != '' ? $_POST['firstname'] : ''; $callerid = $_POST['callerid'] != '' ? $_POST['callerid'] : ''; $sub = new Subscriber(); try { $msisdn = $_GET['id']; $sub->get($_GET['id']); $name = $_POST['firstname'] != '' ? $_POST['firstname'] : $sub->name; $callerid = $_POST['callerid'] != '' ? $_POST['callerid'] : $sub->msisdn; $location = $_POST['location'] != '' ? $_POST['location'] : $sub->location; } catch (PDOException $e) { echo "<img src='img/false.png' width='200' height='170' /><br/><br/>"; echo "<span style='font-size: 20px; color: red;'>" . _("ERROR GETTING SUBSCRIBER INFO!") . $e->getMessage() . " </span><br/><br/><br/><br/>"; echo "<a href='provisioning.php'><button class='b1'>Go Back</button></a>"; } try { $loc = new Configuration(); $locations = $loc->getLocations(); } catch (ConfigurationException $e) { echo " Error getting locations"; } ?> <br/> <div id="stylized" class="myform"> <form id="form" name="form" method="post" action="subscriber_edit.php"> <h1><?php echo _("Edit Subscriber"); ?> </h1><br/> <input type="hidden" name="sip_id" value="<?php echo $msisdn; ?> " /> <span style='color: red; font-size: 12px;'><?php echo $errors; ?> </span><br/> <label><?php echo _("Name"); ?> <span class="small"><?php echo _("Subscriber Name"); ?> </span> </label> <input type="text" name="firstname" id="firstname" value="<?php echo $name; ?> "/> <label><?php echo _("Subscriber number"); ?> <span class="small"><?php echo _("Subscriber number"); ?> </span> </label> <input type="text" name="callerid" id="callerid" value="<?php echo $callerid; ?> "/> <?php if (count($locations) > 1) { ?> <label><?php echo _("Location"); ?> <span class="small"><?php echo _("Subscriber location"); ?> </span> </label> <?php echo "<select name='location' id='location'>"; foreach ($locations as $rloc) { if ($location == $rloc->name) { echo "<option value='" . $rloc->name . "' selected='selected'>" . $rloc->name . "</option>"; } else { echo "<option value='" . $rloc->name . "'>" . $rloc->name . "</option>"; } } echo "</select>"; } ?> <label><?php echo _("Subscription Paid"); ?> <span class="small"><?php echo _("Check for yes uncheck for no"); ?> </span> </label><br/><br/> <?php $checked = $sub->subscription_status == 0 ? '' : 'checked=checked'; ?> <input type="checkbox" name="subscription_status" id="subscription_status" value="1" <?php echo $checked; ?> /><br/> <label><?php echo _("Authorized"); ?> <span class="small"><?php echo _("Check for yes uncheck for no"); ?> </span> </label> <?php $checked = $sub->authorized == 0 ? '' : 'checked=checked'; ?> <input type="checkbox" name="authorized" id="authorized" value="1" <?php echo $checked; ?> /><br/> <button type="submit" name="edit_subscriber"><?php echo _("Save"); ?> </button> <div class="spacer"></div> </form> </div> <?php }