本文整理汇总了PHP中SC_Utils_Ex::sfGetCSVList方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Utils_Ex::sfGetCSVList方法的具体用法?PHP SC_Utils_Ex::sfGetCSVList怎么用?PHP SC_Utils_Ex::sfGetCSVList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Utils_Ex
的用法示例。
在下文中一共展示了SC_Utils_Ex::sfGetCSVList方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
//---- 認証可否の判定
$objSess = new SC_Session();
SC_Utils_Ex::sfIsSuccess($objSess);
$objView = new SC_AdminView();
$objQuery = new SC_Query();
$objFormParam = new SC_FormParam();
$objCSV = new SC_Helper_CSV_Ex();
// パラメータ情報の初期化
$this->lfInitParam($objFormParam);
// フォームの値をセット
$objFormParam->setParam($_POST);
// 編集処理の場合は状態を保持
$this->is_update = isset($_POST['is_update']) ? $_POST['is_update'] : "";
// フォームの値をテンプレートへ渡す
$this->arrForm = $objFormParam->getHashArray();
$campaign_id = isset($_POST['campaign_id']) ? $_POST['campaign_id'] : "";
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
switch ($_POST['mode']) {
// 新規登録/編集登録
case 'regist':
// エラーチェック
$this->arrErr = $this->lfErrorCheck($campaign_id, $objQuery, $objFormParam);
if (count($this->arrErr) <= 0) {
// 登録
$this->lfRegistCampaign($campaign_id, $objQuery, $objFormParam);
// キャンペーンTOPへリダイレクト
$this->sendRedirect($this->getLocation(URL_CAMPAIGN_TOP));
exit;
}
break;
// 編集押下時
// 編集押下時
case 'update':
// キャンペーン情報を取得
$this->arrForm = $this->lfGetCampaign($campaign_id, $objQuery);
$this->is_update = true;
break;
// 削除押下時
// 削除押下時
case 'delete':
// 削除
$this->lfDeleteCampaign($campaign_id, $objQuery);
// キャンペーンTOPへリダイレクト
$this->sendRedirect($this->getLocation(URL_CAMPAIGN_TOP));
exit;
break;
// CSV出力
// CSV出力
case 'csv':
// オプションの指定
$option = "ORDER BY create_date DESC";
// CSV出力タイトル行の作成
$arrCsvOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(4, " WHERE csv_id = 4 AND status = 1"));
if (count($arrCsvOutput) <= 0) {
break;
}
$arrCsvOutputCols = $arrCsvOutput['col'];
$arrCsvOutputTitle = $arrCsvOutput['disp_name'];
$head = SC_Utils_Ex::sfGetCSVList($arrCsvOutputTitle);
$data = $objCSV->lfGetCSV("dtb_campaign_order", "campaign_id = ?", $option, array($campaign_id), $arrCsvOutputCols);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data);
exit;
break;
default:
break;
}
// キャンペーン一覧取得
$this->arrCampaign = $this->lfGetCampaignList($objQuery);
$this->campaign_id = $campaign_id;
// キャンペーン期間用
$objDate = new SC_Date();
$this->arrYear = $objDate->getYear(min(date('Y'), $this->arrForm['start_year']));
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
$this->arrHour = $objDate->getHour();
$this->arrMinutes = $objDate->getMinutes();
//---- ページ表示
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例2: process
//.........这里部分代码省略.........
}
break;
case 'pre_edit':
// 編集項目のカテゴリ名をDBより取得する。
$oquery = new SC_Query();
$where = "category_id = ?";
$cat_name = $oquery->get("dtb_category", "category_name", $where, array($_POST['category_id']));
$description = $oquery->get("dtb_category", "description", $where, array($_POST['category_id']));
// 入力項目にカテゴリ名を入力する。
$this->arrForm['category_name'] = $cat_name;
$this->arrForm['description'] = $description;
// POSTデータを引き継ぐ
$this->arrForm['category_id'] = $_POST['category_id'];
break;
case 'delete':
$objQuery = new SC_Query();
// 子カテゴリのチェック
$where = "parent_category_id = ? AND del_flg = 0";
$count = $objQuery->count("dtb_category", $where, array($_POST['category_id']));
if ($count != 0) {
$this->arrErr['category_name'] = "※ 子カテゴリが存在するため削除できません。<br>";
}
// 登録商品のチェック
$table = "dtb_product_categories AS T1 LEFT JOIN dtb_products AS T2 ON T1.product_id = T2.product_id";
$where = "T1.category_id = ? AND T2.del_flg = 0";
$count = $objQuery->count($table, $where, array($_POST['category_id']));
if ($count != 0) {
$this->arrErr['category_name'] = "※ カテゴリ内に商品が存在するため削除できません。<br>";
}
if (!isset($this->arrErr['category_name'])) {
// ランク付きレコードの削除(※処理負荷を考慮してレコードごと削除する。)
$objDb->sfDeleteRankRecord("dtb_category", "category_id", $_POST['category_id'], "", true);
}
break;
case 'up':
$objQuery = new SC_Query();
$objQuery->begin();
$up_id = $this->lfGetUpRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
if ($up_id != "") {
// 上のグループのrankから減算する数
$my_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
// 自分のグループのrankに加算する数
$up_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id);
if ($my_count > 0 && $up_count > 0) {
// 自分のグループに加算
$this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $up_count);
// 上のグループから減算
$this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $up_id, $my_count);
}
}
$objQuery->commit();
break;
case 'down':
$objQuery = new SC_Query();
$objQuery->begin();
$down_id = $this->lfGetDownRankID($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
if ($down_id != "") {
// 下のグループのrankに加算する数
$my_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id']);
// 自分のグループのrankから減算する数
$down_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id);
if ($my_count > 0 && $down_count > 0) {
// 自分のグループから減算
$this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $down_id, $my_count);
// 下のグループに加算
$this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $_POST['category_id'], $down_count);
}
}
$objQuery->commit();
break;
case 'tree':
break;
case 'csv':
require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
$objCSV = new SC_Helper_CSV_Ex();
// オプションの指定
$option = "ORDER BY rank DESC";
// CSV出力タイトル行の作成
$arrOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(5, " WHERE csv_id = 5 AND status = 1"));
if (count($arrOutput) <= 0) {
break;
}
$arrOutputCols = $arrOutput['col'];
$arrOutputTitle = $arrOutput['disp_name'];
$head = SC_Utils_Ex::sfGetCSVList($arrOutputTitle);
$where = "del_flg = 0";
$data = $objCSV->lfGetCategoryCSV($where, $option, $arrval, $arrOutputCols);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data, 'category');
exit;
break;
default:
$this->arrForm['parent_category_id'] = 0;
break;
}
$this->arrList = $this->lfGetCat($this->arrForm['parent_category_id']);
$this->arrTree = $objDb->sfGetCatTree($this->arrForm['parent_category_id']);
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例3: process
//.........这里部分代码省略.........
$where .= " AND order_birth >= ?";
$arrval[] = $date;
break;
case 'search_ebirthyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_ebirthyear'], $_POST['search_ebirthmonth'], $_POST['search_ebirthday'], true);
$where .= " AND order_birth <= ?";
$arrval[] = $date;
break;
case 'search_order_status':
$where .= " AND status = ?";
$arrval[] = $val;
break;
default:
if (!isset($arrval)) {
$arrval = array();
}
break;
}
}
$order = "update_date DESC";
switch ($_POST['mode']) {
case 'csv':
require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
$objCSV = new SC_Helper_CSV_Ex();
// オプションの指定
$option = "ORDER BY {$order}";
// CSV出力タイトル行の作成
$arrCsvOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(3, " WHERE csv_id = 3 AND status = 1"));
if (count($arrCsvOutput) <= 0) {
break;
}
$arrCsvOutputCols = $arrCsvOutput['col'];
$arrCsvOutputTitle = $arrCsvOutput['disp_name'];
$head = SC_Utils_Ex::sfGetCSVList($arrCsvOutputTitle);
$data = $objCSV->lfGetCSV("dtb_order", $where, $option, $arrval, $arrCsvOutputCols);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data);
exit;
break;
case 'pdf':
$objFpdf = new SC_Fpdf(1, '納品書');
$objFpdf->setData($arrRet);
$objFpdf->createPdf();
break;
case 'delete_all':
// 検索結果をすべて削除
$sqlval['del_flg'] = 1;
$objQuery = new SC_Query();
$objQuery->update("dtb_order", $sqlval, $where, $arrval);
break;
default:
// 読み込む列とテーブルの指定
$col = "*";
$from = "dtb_order";
$objQuery = new SC_Query();
// 行数の取得
$linemax = $objQuery->count($from, $where, $arrval);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの処理
if (is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
}
// ページ送りの取得
示例4: lfGetDataColCSV
function lfGetDataColCSV($arrData, $arrDataCol)
{
$max = count($arrData);
$csv_data = "";
for ($i = 0; $i < $max; $i++) {
foreach ($arrDataCol as $val) {
$arrRet[$i][$val] = $arrData[$i][$val];
}
$csv_data .= SC_Utils_Ex::sfGetCSVList($arrRet[$i]);
}
return $csv_data;
}
示例5: lfGetDataColCSV
function lfGetDataColCSV($arrData, $arrDataCol)
{
$max = count($arrData);
$csv_data = '';
for ($i = 0; $i < $max; $i++) {
foreach ($arrDataCol as $val) {
$arrRet[$i][$val] = $arrData[$i][$val];
}
// 期間別集計の合計行の「期間」項目に不要な値が表示されてしまわない様、'合計'と表示する
if ($i === $max - 1 && isset($arrRet[$i]['str_date'])) {
$arrRet[$i]['str_date'] = t('c_Total_01');
}
$csv_data .= SC_Utils_Ex::sfGetCSVList($arrRet[$i]);
}
return $csv_data;
}
示例6: process
//.........这里部分代码省略.........
$arrval[] = "%{$val}%";
break;
case 'search_reviewer_url':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND reviewer_url ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_name':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND name ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_product_code':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND A.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? )";
$arrval[] = "%{$val}%";
break;
case 'search_sex':
$tmp_where = "";
//$val=配列の中身,$element=各キーの値(1,2)
if (is_array($val)) {
foreach ($val as $element) {
if ($element != "") {
if ($tmp_where == "") {
$tmp_where .= " AND (sex = ?";
} else {
$tmp_where .= " OR sex = ?";
}
$arrval[] = $element;
}
}
if ($tmp_where != "") {
$tmp_where .= ")";
$where .= " {$tmp_where} ";
}
}
break;
case 'search_recommend_level':
$where .= " AND recommend_level = ? ";
$arrval[] = $val;
break;
case 'search_startyear':
if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
$where .= " AND A.create_date >= ? ";
$arrval[] = $date;
}
break;
case 'search_endyear':
if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
$end_date = date("Y/m/d", strtotime("1 day", strtotime($date)));
$where .= " AND A.create_date <= cast('{$end_date}' as date) ";
}
break;
}
}
}
$order = "A.create_date DESC";
// ページ送りの処理
if (is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
}
if (!isset($arrval)) {
$arrval = array();
}
$linemax = $objQuery->count($from, $where, $arrval);
$this->tpl_linemax = $linemax;
$this->tpl_pageno = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
// ページ送りの取得
$objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
$this->arrPagenavi = $objNavi->arrPagenavi;
$startno = $objNavi->start_row;
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset($page_max, $startno);
// 表示順序
$objQuery->setorder($order);
//検索結果の取得
$this->arrReview = $objQuery->select($select, $from, $where, $arrval);
//CSVダウンロード
if ($_POST['mode'] == 'csv') {
$objCSV = new SC_Helper_CSV_Ex();
// オプションの指定
$option = "ORDER BY review_id";
// CSV出力タイトル行の作成
$head = SC_Utils_Ex::sfGetCSVList($objCSV->arrREVIEW_CVSTITLE);
$data = $objCSV->lfGetReviewCSV($where, '', $arrval);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data);
exit;
}
}
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例7: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$objQuery = new SC_Query();
$objView = new SC_AdminView();
$objSess = new SC_Session();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
$arrActive = array("0" => "稼働", "1" => "非稼働");
$arrQuestion = array("0" => "使用しない", "1" => "テキストエリア", "2" => "テキストボックス", "3" => "チェックボックス", "4" => "ラジオボタン");
$result = $objQuery->select('*, cast(create_date as date) as disp_date', 'dtb_question', 'del_flg = 0 ORDER BY question_id');
$this->list_data = $result;
if (!isset($_GET['mode'])) {
$_GET['mode'] = "";
}
// アンケートを作成ボタン押下時
if ($_GET['mode'] == 'regist') {
for ($i = 0; $i < count($_POST["question"]); $i++) {
$_POST['question'][$i]['name'] = mb_convert_kana(trim($_POST['question'][$i]['name']), "K");
for ($j = 0; $j < count($_POST['question'][$i]['option']); $j++) {
$_POST['question'][$i]['option'][$j] = mb_convert_kana(trim($_POST['question'][$i]['option'][$j]));
}
}
$error = $this->lfErrCheck();
if (!$error) {
// 新規登録
if (!is_numeric($_POST['question_id'])) {
//登録
$value = serialize($_POST);
if (DB_TYPE == "pgsql") {
$question_id = $objQuery->nextval('dtb_question', 'question_id');
}
$sql_val = array('question' => $value, 'question_name' => $_POST['title'], 'question_id' => $question_id, 'create_date' => 'now()');
$objQuery->insert('dtb_question', $sql_val);
$this->MESSAGE = "登録が完了しました";
if (DB_TYPE == "mysql") {
$question_id = $objQuery->nextval('dtb_question', 'question_id');
}
$this->QUESTION_ID = $question_id;
$this->reload(null, true);
// 編集
} else {
//編集
$value = serialize($_POST);
$sql_val = array('question' => $value, 'question_name' => $_POST['title']);
$objQuery->update('dtb_question', $sql_val, 'question_id = ?', array($_POST['question_id']));
$this->MESSAGE = "編集が完了しました";
$this->QUESTION_ID = $_POST['question_id'];
$this->reload(null, true);
}
} else {
//エラー表示
$this->ERROR = $error;
$this->QUESTION_ID = $_REQUEST['question_id'];
$this->ERROR_COLOR = $this->lfGetErrColor($error, ERR_COLOR);
}
// 削除ボタン押下時
} elseif ($_GET['mode'] == 'delete' && SC_Utils_Ex::sfCheckNumLength($_GET['question_id'])) {
$sqlval = array('del_flg' => 1);
$objQuery->update('dtb_question', $sqlval, 'question_id = ?', array($_GET['question_id']));
$this->reload(null, true);
// CSVダウンロードボタン押下時
} elseif ($_GET['mode'] == 'csv' && SC_Utils_Ex::sfCheckNumLength($_GET['question_id'])) {
require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
$objCSV = new SC_Helper_CSV_Ex();
$head = SC_Utils_Ex::sfGetCSVList($this->arrCVSTITLE);
$sql = <<<__EOS__
SELECT
dtb_question_result.result_id
,dtb_question_result.question_id
,dtb_question_result.create_date
,dtb_question.question_name
,dtb_question_result.name01
,dtb_question_result.name02
,dtb_question_result.kana01
,dtb_question_result.kana02
,dtb_question_result.zip01
,dtb_question_result.zip02
,dtb_question_result.pref
,dtb_question_result.addr01
,dtb_question_result.addr02
,dtb_question_result.tel01
,dtb_question_result.tel02
,dtb_question_result.tel03
,dtb_question_result.mail01
,dtb_question_result.question01
,dtb_question_result.question02
,dtb_question_result.question03
,dtb_question_result.question04
,dtb_question_result.question05
,dtb_question_result.question06
FROM dtb_question_result
LEFT JOIN dtb_question
ON dtb_question_result.question_id = dtb_question.question_id
WHERE 0=0
AND dtb_question_result.del_flg = 0
//.........这里部分代码省略.........
示例8: process
//.........这里部分代码省略.........
if ($tmp_where == "") {
$tmp_where .= "AND (status = ? ";
} else {
$tmp_where .= "OR status = ? ";
}
$arrval[] = $element;
}
}
if ($tmp_where != "") {
$tmp_where .= ")";
$where .= " {$tmp_where}";
$view_where .= " {$tmp_where}";
}
break;
default:
break;
}
}
$order = "update_date DESC, product_id DESC";
$objQuery = new SC_Query();
switch ($_POST['mode']) {
case 'csv':
require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
$objCSV = new SC_Helper_CSV_Ex();
// オプションの指定
$option = "ORDER BY {$order}";
// CSV出力タイトル行の作成
$arrOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(1, " WHERE csv_id = 1 AND status = 1"));
if (count($arrOutput) <= 0) {
break;
}
$arrOutputCols = $arrOutput['col'];
$arrOutputTitle = $arrOutput['disp_name'];
$head = SC_Utils_Ex::sfGetCSVList($arrOutputTitle);
$data = $objCSV->lfGetProductsCSV($where, $option, $arrval, $arrOutputCols);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data);
exit;
break;
case 'delete_all':
// 検索結果の取得
$col = "product_id";
$from = "vw_products_nonclass AS noncls ";
$arrProducts = $objQuery->select($col, $from, $where, $arrval);
// 検索結果をすべて削除
$sqlval['del_flg'] = 1;
$where = "product_id = ?";
if (count($arrProducts) > 0) {
foreach ($arrProducts as $key => $val) {
$objQuery->update("dtb_products", $sqlval, $where, array($arrProducts[$key]["product_id"]));
}
}
break;
default:
// 読み込む列とテーブルの指定
$col = "product_id, name, category_id, main_list_image, status, product_code, price01, price02, stock, stock_unlimited";
$from = "vw_products_nonclass AS noncls ";
// 行数の取得
$linemax = $objQuery->count("dtb_products", $view_where, $arrval);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの処理
if (is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
示例9: process
//.........这里部分代码省略.........
$this->arrErr = $this->lfCheckError();
if (!$this->arrErr) {
foreach ($_POST as $key => $val) {
$val = SC_Utils_Ex::sfManualEscape($val);
if ($val == "") {
continue;
}
switch ($key) {
case 'search_blog_name':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND A.blog_name ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_blog_title':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND A.title ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_blog_url':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND A.url ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_status':
if (isset($_POST['search_status'])) {
$where .= " AND A.status = ? ";
$arrval[] = $val;
}
break;
case 'search_name':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND B.name ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_product_code':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND B.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? )";
$arrval[] = "%{$val}%";
break;
case 'search_startyear':
if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
$where .= " AND A.create_date >= ? ";
$arrval[] = $date;
}
break;
case 'search_endyear':
if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
$end_date = date("Y/m/d", strtotime("1 day", strtotime($date)));
$where .= " AND A.create_date <= cast('{$end_date}' as date) ";
}
break;
}
}
}
$order = "A.create_date DESC";
// ページ送りの処理
if (is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
}
if (!isset($arrval)) {
$arrval = array();
}
$linemax = $objQuery->count($from, $where, $arrval);
$this->tpl_linemax = $linemax;
$this->tpl_pageno = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
// ページ送りの取得
$objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
$this->arrPagenavi = $objNavi->arrPagenavi;
$startno = $objNavi->start_row;
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset($page_max, $startno);
// 表示順序
$objQuery->setorder($order);
//検索結果の取得
$this->arrTrackback = $objQuery->select($select, $from, $where, $arrval);
//CSVダウンロード
if ($_POST['mode'] == 'csv') {
$objCSV = new SC_Helper_CSV_Ex();
// オプションの指定
$option = "ORDER BY A.trackback_id";
// CSV出力タイトル行の作成
$head = SC_Utils_Ex::sfGetCSVList($objCSV->arrTRACKBACK_CVSTITLE);
$data = $objCSV->lfGetTrackbackCSV($where, '', $arrval);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data);
exit;
}
}
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例10: action
/**
* Page のアクション.
*
* @return void
*/
public function action()
{
if (isset($_GET['draw_image']) && $_GET['draw_image'] != '') {
define('DRAW_IMAGE', true);
} else {
define('DRAW_IMAGE', false);
}
// パラメーター管理クラス
$objFormParam = new SC_FormParam_Ex();
// パラメーター情報の初期化
$this->lfInitParam($objFormParam);
$objFormParam->setParam($_REQUEST);
$objFormParam->setValue("page", "PointHistory");
// 検索ワードの引き継ぎ
$this->arrHidden = $objFormParam->getSearchArray();
switch ($this->getMode()) {
case 'csv':
case 'search':
$this->arrErr = $this->lfCheckError($objFormParam);
if (empty($this->arrErr)) {
// 日付
list($sdate, $edate) = $this->lfSetStartEndDate($objFormParam);
// ページ
$page = "PointHistory";
if ($objFormParam->getValue("search_startyear") != $objFormParam->getValue("search_endyear")) {
// 集計種類 (年跨ぎの場合は月)
$type = $objFormParam->getValue("type", 'month');
} else {
if ($sdate == $edate) {
// 集計種類 (同一日の場合は時間)
$type = $objFormParam->getValue("type", 'hour');
} else {
$datetime1 = new DateTime($sdate);
$datetime2 = new DateTime($edate);
$interval = $datetime1->diff($datetime2);
$interval_m = intval($interval->format('%m'));
$interval_y = intval($interval->format('%y'));
$interval = intval($interval->format('%a'));
// 集計種類
if ($interval_y > 2) {
// 集計種類 (年跨ぎの場合は年)
$type = $objFormParam->getValue("type", 'year');
} elseif ($interval_m > 1) {
// 集計種類 (年跨ぎの場合は月)
$type = $objFormParam->getValue("type", 'month');
} else {
// 集計種類
$type = $objFormParam->getValue("type", 'day');
}
}
}
$objFormParam->setValue("type", $type);
$this->type = $type;
list($this->arrResults, $this->tpl_image, $this->arrCsvResults) = $this->lfGetCustmoerPointHistory($type, $sdate, $edate);
if ($this->getMode() == 'csv') {
// CSV出力タイトル行の取得
list($arrTitleCol, $arrDataCol) = $this->lfGetCSVColum($page);
$head = SC_Utils_Ex::sfGetCSVList($arrTitleCol);
$data = $this->lfGetDataColCSV($this->arrCsvResults, $arrDataCol);
// CSVを送信する。
list($fime_name, $data) = SC_Utils_Ex::sfGetCSVData($head . $data);
$this->sendResponseCSV($fime_name, $data);
SC_Response_Ex::actionExit();
}
}
break;
default:
break;
}
// 画面宣しても日付が保存される
$_SESSION = $this->lfSaveDateSession($_SESSION, $this->arrHidden);
$objFormParam->setParam($_SESSION['total']);
// 入力値の取得
$this->arrForm = $objFormParam->getFormParamList();
GC_Utils_Ex::gfDebugLog($this);
}