示例#1
0
 $go = $_REQUEST['go'];
 switch ($go) {
     case 'export':
         $conditions = array('A.flag_deleted' => 0);
         if ($queue_code = trim($_REQUEST['queue_code'])) {
             $conditions['A.queue_code'] = $queue_code;
         }
         $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', 'B.username, A.p_gateway, A.p_smsc, A.p_datetime, A.p_dst, A.p_msg, A.p_footer, A.p_status', $conditions, $search['dba_keywords'], '', $join);
         $data[0] = array(_('User'), _('Gateway'), _('SMSC'), _('Time'), _('To'), _('Message'), _('Status'));
         for ($i = 0; $i < count($list); $i++) {
             $j = $i + 1;
             $data[$j] = array($list[$i]['username'], $list[$i]['p_gateway'], $list[$i]['p_smsc'], core_display_datetime($list[$i]['p_datetime']), $list[$i]['p_dst'], $list[$i]['p_msg'] . $list[$i]['p_footer'], $list[$i]['p_status']);
         }
         $content = core_csv_format($data);
         if ($queue_code) {
             $fn = 'all_outgoing-' . $core_config['datetime']['now_stamp'] . '-' . $queue_code . '.csv';
         } else {
             $fn = 'all_outgoing-' . $core_config['datetime']['now_stamp'] . '.csv';
         }
         core_download($content, $fn, 'text/csv');
         break;
     case 'delete':
         for ($i = 0; $i < $nav['limit']; $i++) {
             $checkid = $_POST['checkid' . $i];
             $itemid = $_POST['itemid' . $i];
             if ($checkid == "on" && $itemid) {
                 $up = array('c_timestamp' => mktime(), 'flag_deleted' => '1');
                 $conditions = array('smslog_id' => $itemid);
                 if ($queue_code = trim($_REQUEST['queue_code'])) {
示例#2
0
文件: fn.php 项目: yrahman/playSMS
function sms_poll_export_csv($poll_id, $poll_keyword)
{
    $ret = '';
    // header
    $items = array(array(_('SMS poll keyword'), $poll_keyword));
    $ret .= core_csv_format($items);
    unset($items);
    $ret .= "\n";
    // statistics
    $stat = sms_poll_statistics($poll_id);
    $items = array(array(_('Senders sent once'), $stat['once']), array(_('Senders sent multiple votes'), $stat['multi']), array(_('Grand total senders'), $stat['sender']), array(_('Total one time vote SMS'), $stat['once_sms']), array(_('Total multiple votes SMS'), $stat['multi_sms']), array(_('Total valid SMS'), $stat['valid']), array(_('Total invalid SMS'), $stat['invalid']), array(_('Grand total SMS'), $stat['all']));
    $ret .= core_csv_format($items);
    unset($items);
    $ret .= "\n";
    // choices
    $data = unserialize(sms_poll_output_serialize($poll_id, $poll_keyword));
    $items[0] = array(_('Choice keyword'), _('Description'), _('Number of votes'));
    $i = 1;
    foreach ($data['choices'] as $key => $val) {
        $items[$i] = array($key, $val, $data['results'][$key]);
        $i++;
    }
    $ret .= core_csv_format($items);
    unset($items);
    $ret .= "\n";
    return $ret;
}