$search = themes_search($search_category, $base_url); $conditions = array('A.flag_deleted' => 0); $keywords = $search['dba_keywords']; $table = _DB_PREF_ . '_tblSMSOutgoing'; $join = "INNER JOIN " . _DB_PREF_ . "_tblUser AS B ON B.flag_deleted='0' AND A.uid=B.uid"; $list = dba_search($table . ' AS A', 'A.id', $conditions, $keywords, array('GROUP BY' => 'A.queue_code'), $join); $count = count($list); $nav = themes_nav($count, $search['url']); $extras = array('GROUP BY' => 'A.queue_code', 'ORDER BY' => 'A.smslog_id DESC', 'LIMIT' => $nav['limit'], 'OFFSET' => $nav['offset']); $list = dba_search($table . ' AS A', 'B.username, A.p_gateway, A.p_smsc, A.smslog_id, A.p_dst, A.p_sms_type, A.p_msg, A.p_footer, A.p_datetime, A.p_update, A.p_status, A.uid, A.queue_code, COUNT(*) AS queue_count', $conditions, $keywords, $extras, $join); } $content = "\n\t\t\t<h2>" . _('All sent messages') . "</h2>\n\t\t\t" . $queue_label . "\n\t\t\t<p>" . $search['form'] . "</p>\n\t\t\t<form id=fm_all_outgoing name=fm_all_outgoing action=\"index.php?app=main&inc=feature_report&route=all_outgoing&op=actions&queue_code=" . $queue_code . "\" method=POST>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=go value=delete>\n\t\t\t<div class=actions_box>\n\t\t\t\t<div class=pull-left>\n\t\t\t\t\t<a href=\"" . _u('index.php?app=main&inc=feature_report&route=all_outgoing&op=actions&go=export&queue_code=' . $queue_code) . "\">" . $icon_config['export'] . "</a>\n\t\t\t\t</div>\n\t\t\t\t<div class=pull-right>\n\t\t\t\t\t<a href='#' onClick=\"return SubmitConfirm('" . _('Are you sure you want to delete these items ?') . "', 'fm_all_outgoing');\">" . $icon_config['delete'] . "</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th width=20%>" . _('User') . "</th>\n\t\t\t\t<th width=15%>" . _('SMSC') . "</th>\n\t\t\t\t<th width=20%>" . _('To') . "</th>\n\t\t\t\t<th width=40%>" . _('Message') . "</th>\n\t\t\t\t<th width=5% class=\"sorttable_nosort\"><input type=checkbox onclick=CheckUncheckAll(document.fm_all_outgoing)></th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>"; $i = $nav['top']; $j = 0; for ($j = 0; $j < count($list); $j++) { $list[$j] = core_display_data($list[$j]); $p_username = $list[$j]['username']; $p_gateway = $list[$j]['p_gateway']; $p_smsc = $list[$j]['p_smsc']; $smslog_id = $list[$j]['smslog_id']; $p_uid = $list[$j]['uid']; $p_dst = $list[$j]['p_dst']; $current_p_dst = report_resolve_sender($p_uid, $p_dst); $p_sms_type = $list[$j]['p_sms_type']; if (($p_footer = $list[$j]['p_footer']) && ($p_sms_type == "text" || $p_sms_type == "flash")) { $p_msg = $p_msg . ' ' . $p_footer; } $p_datetime = core_display_datetime($list[$j]['p_datetime']); $p_update = $list[$j]['p_update']; $p_status = $list[$j]['p_status']; $c_queue_code = $list[$j]['queue_code'];
$search = themes_search($search_category, $base_url); $conditions = array('flag_deleted' => 0); // only if users if ($user_config['status'] == 3) { $conditions['parent_uid'] = $user_config['uid']; $conditions['status'] = 4; } $keywords = $search['dba_keywords']; $count = dba_count($db_table, $conditions, $keywords); $nav = themes_nav($count, $search['url']); $extras = array('ORDER BY' => 'id DESC', 'LIMIT' => $nav['limit'], 'OFFSET' => $nav['offset']); $list = dba_search($db_table, '*', $conditions, $keywords, $extras); $content = "\n\t\t\t<h2>" . _('Manage credit') . "</h2>\n\t\t\t<h3>" . _('List of transactions') . "</h3>\n\t\t\t<p>" . $search['form'] . "</p>\n\t\t\t<form id=fm_feature_credit name=fm_feature_credit action=\"" . _u('index.php?app=main&inc=feature_credit&op=actions') . "\" method=POST>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=go value=delete>\n\t\t\t<div class=actions_box>\n\t\t\t\t<div class=pull-left>\n\t\t\t\t\t<a href=\"" . _u('index.php?app=main&inc=feature_credit&op=credit_add') . "\">" . $icon_config['add'] . "</a>\n\t\t\t\t\t<a href=\"" . _u('index.php?app=main&inc=feature_credit&op=credit_reduce') . "\">" . $icon_config['reduce'] . "</a>\n\t\t\t\t\t<a href=\"" . _u('index.php?app=main&inc=feature_credit&op=actions&go=export') . "\">" . $icon_config['export'] . "</a>\n\t\t\t\t</div>\n\t\t\t\t<div class=pull-right>\n\t\t\t\t\t<a href='#' onClick=\"return SubmitConfirm('" . _('Are you sure you want to delete these transactions ?') . "', 'fm_feature_credit');\">" . $icon_config['delete'] . "</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th width=20%>" . _('User') . "</th>\n\t\t\t\t<th width=40%>" . _('Transaction datetime') . "</th>\n\t\t\t\t<th width=35%>" . _('Amount') . "</th>\n\t\t\t\t<th width=5% class=\"sorttable_nosort\"><input type=checkbox onclick=CheckUncheckAll(document.fm_feature_credit)></th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>"; $j = 0; foreach ($list as $row) { $row = core_display_data($row); $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . $row['username'] . "</td>\n\t\t\t\t\t<td>" . core_display_datetime($row['create_datetime']) . "</td>\n\t\t\t\t\t<td>" . $row['amount'] . "</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type=hidden name=itemid" . $j . " value=\"" . $row['id'] . "\">\n\t\t\t\t\t\t<input type=checkbox name=checkid" . $j . ">\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; $j++; } $content .= "\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class=pull-right>" . $nav['form'] . "</div>\n\t\t\t</form>"; if ($err = TRUE) { _p(_dialog()); } _p($content); break; case "credit_add": $select_user = credit_html_select_user(); $content = _dialog() . "\n\t\t\t<script language=\"javascript\" type=\"text/javascript\">\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\$(\"#playsms-credit-select-user\").select2({\n\t\t\t\t\t\tplaceholder: \"" . _('Select users') . "\",\n\t\t\t\t\t\twidth: \"resolve\",\n\t\t\t\t\t\tseparator: [','],\n\t\t\t\t\t\ttokenSeparators: [','],\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t</script>\n\t\t\t<h2>" . _('Manage credit') . "</h2>\n\t\t\t<h3>" . _('Add credit') . "</h3>\n\t\t\t<form id=fm_feature_credit_add name=id_feature_credit_add action=\"" . _u('index.php?app=main&inc=feature_credit&op=actions&go=add') . "\" method=POST>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=label-sizer>" . _('Add credit to users') . "</td>\n\t\t\t\t\t\t<td>" . $select_user . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . _('Amount') . "</td>\n\t\t\t\t\t\t<td><input type='text' maxlength=14 name=amount value=\"0.0\"></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type='submit' class='button' value='" . _('Add credit') . "'>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_credit&op=credit_list'); _p($content); break; case "credit_reduce":