コード例 #1
0
 function execute($requests)
 {
     //----------リクエスト変数-------------//
     $date = $requests['date'];
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     $analysis_date_day = get_analysis_date_day($date);
     $this->set("date", get_analysis_date_day_d($date));
     $this->set("analysis_date_day", $analysis_date_day);
     $this->set("analysis_date_day_sum", array_sum($analysis_date_day));
     return 'success';
 }
コード例 #2
0
 function execute($requests)
 {
     $date = $requests['date'];
     list($year, $month, $day) = explode('-', $date);
     $date = mb_substr($date, 0, 7);
     $csv = '"年月日","人数"' . "\n";
     $csv = mb_convert_encoding($csv, 'SJIS', 'UTF-8');
     $analysis_date_day = get_analysis_date_day($date);
     foreach ($analysis_date_day as $key => $value) {
         $csv .= sprintf("\"%d/%d/%d\",%d\n", $year, $month, $key, $value);
     }
     $csv_analysis_sum = '合計';
     $csv_analysis_sum = mb_convert_encoding($csv_analysis_sum, 'SJIS', 'UTF-8');
     $analysis_date_day_sum = array_sum($analysis_date_day);
     $csv .= sprintf("\"%s\",%d\n", $csv_analysis_sum, $analysis_date_day_sum);
     //IE以外の場合、キャッシュをさせないヘッダを出力
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) {
         send_nocache_headers(true);
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=user_analysis_date_day.csv");
     echo $csv;
     exit;
 }