function execute($requests) { if (!LOG_C_ACCESS_LOG) { admin_client_redirect('top', '指定されたページにはアクセスできません'); } //----------リクエスト変数-------------// $ktai_flag = $requests['ktai_flag']; $ymd = $requests['ymd']; $month_flag = $requests['month_flag']; $page_name = $requests['page_name']; $page = $requests['page']; $orderby = $requests['orderby']; $orderby1 = $requests['orderby1']; $orderby2 = $requests['orderby2']; //----------リクエスト変数-------------// $page_size = 10; if ($orderby1) { $orderby = $orderby1; } elseif ($orderby2) { $orderby = $orderby2; } $this->set("ktai_flag", $ktai_flag); $this->set("item_str", $ktai_flag ? "携帯版" : "PC版"); $this->set("ymd", $ymd); $this->set("month_flag", $month_flag); $this->set("page_name", $page_name); if ($orderby1) { $orderby1 *= -1; } else { $orderby1 = -1; } if ($orderby2) { $orderby2 *= -1; } else { $orderby2 = 2; } $this->set("orderby", $orderby); $this->set("orderby1", $orderby1); $this->set("orderby2", $orderby2); list($target_topic, $sum, $is_prev, $is_next, $total_num, $start_num, $end_num) = p_access_analysis_target_topic_target_topic4ym_page_name($ymd, $month_flag, $page_name, $ktai_flag, $page, $page_size, $orderby); $this->set("target_topic", $target_topic); $this->set("sum", $sum); $this->set("is_prev", $is_prev); $this->set("is_next", $is_next); $this->set("page", $page); $this->set("total_num", $total_num); $this->set('start_num', $start_num); $this->set('end_num', $end_num); $v = array(); $v['SNS_NAME'] = SNS_NAME; $v['OPENPNE_VERSION'] = OPENPNE_VERSION; $this->set($v); return 'success'; }
function execute($requests) { if (!LOG_C_ACCESS_LOG) { admin_client_redirect('top', '指定されたページにはアクセスできません'); } $ktai_flag = $requests['ktai_flag']; $ymd = $requests['ymd']; $month_flag = $requests['month_flag']; $page_name = $requests['page_name']; $orderby = $requests['orderby']; //IE以外の場合、キャッシュをさせないヘッダを出力 if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) { send_nocache_headers(true); } header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=access_analysis_target_topic.csv"); $out = fopen('php://output', 'w'); $csv_header = array('トピックID', 'トピック名', WORD_COMMUNITY . '名', 'アクセス数'); for ($i = 0; $i < sizeof($csv_header); $i++) { $csv_header[$i] = mb_convert_encoding($csv_header[$i], 'SJIS', 'UTF-8'); } fputcsv($out, $csv_header); $sum = 0; $page = 1; $page_size = -1; list($target_topic) = p_access_analysis_target_topic_target_topic4ym_page_name($ymd, $month_flag, $page_name, $ktai_flag, $page, $page_size, $orderby); foreach ($target_topic as $item) { if ($item['is_c_commu_topic_exists']) { $topic_name = mb_convert_encoding($item['topic_name'], 'SJIS', 'UTF-8'); $commu_name = mb_convert_encoding($item['commu_name'], 'SJIS', 'UTF-8'); } else { $msg = '(既に削除されたトピックです)'; $msg = mb_convert_encoding($msg, 'SJIS', 'UTF-8'); $topic_name = $msg; $commu_name = $msg; } $csv_line = array($item['target_c_commu_topic_id'], $topic_name, $commu_name, $item['count']); fputcsv($out, $csv_line); $sum += $item['count']; } fputcsv($out, array(mb_convert_encoding('合計', 'SJIS', 'UTF-8'), '', '', $sum)); exit; }