本文整理汇总了PHP中SC_Utils_Ex::sfCSVDownload方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Utils_Ex::sfCSVDownload方法的具体用法?PHP SC_Utils_Ex::sfCSVDownload怎么用?PHP SC_Utils_Ex::sfCSVDownload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Utils_Ex
的用法示例。
在下文中一共展示了SC_Utils_Ex::sfCSVDownload方法的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
//.........这里部分代码省略.........
$name = $this->name01 . $this->name02 . " 様";
$objMail->setTo($arrRet[0]["email"], $name);
$objMail->sendMail();
}
}
if ($_POST['mode'] == "search" || $_POST['mode'] == "csv" || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "resend_mail") {
// 入力文字の強制変換
$this->lfConvertParam();
// エラーチェック
$this->arrErr = $this->lfCheckError($this->arrForm);
$where = "del_flg = 0";
/* 入力エラーなし */
if (count($this->arrErr) == 0) {
//-- 検索データ取得
$objSelect = new SC_CustomerList($this->arrForm, "customer");
// 表示件数設定
$page_rows = $this->arrForm['page_rows'];
if (is_numeric($page_rows)) {
$page_max = $page_rows;
} else {
$page_max = SEARCH_PMAX;
}
if (!isset($this->arrForm['search_pageno'])) {
$this->arrForm['search_pageno'] = "";
}
if ($this->arrForm['search_pageno'] == 0) {
$this->arrForm['search_pageno'] = 1;
}
$offset = $page_max * ($this->arrForm['search_pageno'] - 1);
$objSelect->setLimitOffset($page_max, $offset);
if ($_POST["mode"] == 'csv') {
$searchSql = $objSelect->getListCSV($this->arrColumnCSV);
} else {
$searchSql = $objSelect->getList();
}
$this->search_data = $objQuery->conn->getAll($searchSql, $objSelect->arrVal);
switch ($_POST['mode']) {
case 'csv':
require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
$objCSV = new SC_Helper_CSV_Ex();
$i = 0;
$header = "";
// CSVカラム取得
$arrCsvOutput = $objCSV->sfgetCsvOutput(2, " WHERE csv_id = 2 AND status = 1");
if (count($arrCsvOutput) <= 0) {
break;
}
foreach ($arrCsvOutput as $data) {
$arrColumn[] = $data["col"];
if ($i != 0) {
$header .= ", ";
}
$header .= $data["disp_name"];
$i++;
}
$header .= "\n";
//- 都道府県/職業の変換
for ($i = 0; $i < count($this->search_data); $i++) {
$this->search_data[$i]["pref"] = $this->arrPref[$this->search_data[$i]["pref"]];
$this->search_data[$i]["job"] = $this->arrJob[$this->search_data[$i]["job"]];
}
//- CSV出力
$data = SC_Utils_Ex::getCSVData($this->search_data, $arrColumn);
SC_Utils_Ex::sfCSVDownload($header . $data);
exit;
break;
case 'delete_all':
// 検索結果をすべて削除
$where = "product_id IN (SELECT product_id FROM vw_products_nonclass AS noncls WHERE {$where})";
$sqlval['del_flg'] = 1;
$objQuery->update("dtb_products", $sqlval, $where, $arrval);
$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
$result_customer = $objQuery->conn->getAll($sql, array($_POST["del_customer_id"]));
if ($result_customer[0]["status"] == 2) {
//本会員削除
$arrDel = array("del_flg" => 1, "update_date" => "NOW()");
$objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " . SC_Utils_Ex::sfQuoteSmart($_POST["del_customer_id"]));
} elseif ($result_customer[0]["status"] == 1) {
//仮会員削除
$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
$objQuery->conn->query($sql, array($_POST["del_customer_id"]));
}
break;
default:
// 行数の取得
$linemax = $objQuery->conn->getOne($objSelect->getListCount(), $objSelect->arrVal);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの取得
$objNavi = new SC_PageNavi($this->arrHidden['search_pageno'], $linemax, $page_max, "fnCustomerPage", NAVI_PMAX);
$startno = $objNavi->start_row;
$this->arrPagenavi = $objNavi->arrPagenavi;
}
}
}
$this->arrCatList = $objDb->sfGetCategoryList();
//---- ページ表示
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例3: process
//.........这里部分代码省略.........
$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;
}
// ページ送りの取得
$objNavi = new SC_PageNavi($this->arrHidden['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
$startno = $objNavi->start_row;
$this->arrPagenavi = $objNavi->arrPagenavi;
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset($page_max, $startno);
// 表示順序
$objQuery->setorder($order);
// 検索結果の取得
$this->arrResults = $objQuery->select($col, $from, $where, $arrval);
}
}
break;
default:
break;
}
$objDate = new SC_Date();
// 登録・更新日検索用
$objDate->setStartYear(RELEASE_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrRegistYear = $objDate->getYear();
// 生年月日検索用
$objDate->setStartYear(BIRTH_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrBirthYear = $objDate->getYear();
// 月日の設定
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
// 入力値の取得
$this->arrForm = $this->objFormParam->getFormParamList();
// 支払い方法の取得
$arrRet = $objDb->sfGetPayment();
$this->arrPayment = SC_Utils_Ex::sfArrKeyValue($arrRet, 'payment_id', 'payment_method');
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例4: process
//.........这里部分代码省略.........
$type = 'all';
}
$this->tpl_page_type = "total/page_job.tpl";
// 未集計データの集計を行う
if (!DAILY_BATCH_MODE) {
$this->objBatch->lfRealTimeDailyTotal($sdate, $edate);
}
// 検索結果の取得
$this->lfGetOrderJob($type, $sdate, $edate, $this, $this->install_GD);
break;
// 会員別集計
// 会員別集計
case 'member':
if ($type == "") {
$type = 'all';
}
$this->tpl_page_type = "total/page_member.tpl";
// 未集計データの集計を行う
if (!DAILY_BATCH_MODE) {
$this->objBatch->lfRealTimeDailyTotal($sdate, $edate);
}
// 検索結果の取得
$this->lfGetOrderMember($type, $sdate, $edate, $this, $this->install_GD);
break;
// 年代別集計
// 年代別集計
case 'age':
if ($type == "") {
$type = 'all';
}
$this->tpl_page_type = "total/page_age.tpl";
// 未集計データの集計を行う
if (!DAILY_BATCH_MODE) {
$this->objBatch->lfRealTimeDailyTotal($sdate, $edate);
}
// 検索結果の取得
$this->lfGetOrderAge($type, $sdate, $edate, $this, $this->install_GD);
break;
// 期間別集計
// 期間別集計
default:
if (!isset($type)) {
$type = "";
}
if ($type == "") {
$type = 'day';
}
$this->tpl_page_type = "total/page_term.tpl";
// 未集計データの集計を行う
if (!DAILY_BATCH_MODE) {
$this->objBatch->lfRealTimeDailyTotal($sdate, $edate);
}
// 検索結果の取得
$this->lfGetOrderTerm($type, $sdate, $edate, $this, $this->install_GD);
break;
}
if ($mode == 'csv') {
// CSV出力タイトル行の取得
list($arrTitleCol, $arrDataCol) = $this->lfGetCSVColum($page, $this->keyname);
$head = SC_Utils_Ex::sfGetCSVList($arrTitleCol);
$data = $this->lfGetDataColCSV($this->arrResults, $arrDataCol);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data, $page . "_" . $type);
exit;
}
if ($mode == 'pdf') {
// CSV出力タイトル行の取得
list($arrTitleCol, $arrDataCol, $arrColSize, $arrAlign, $title) = $this->lfGetPDFColum($page, $type, $this->keyname);
$head = SC_Utils_Ex::sfGetPDFList($arrTitleCol);
$data = $this->lfGetDataColPDF($this->arrResults, $arrDataCol, 40);
// PDF出力用
$graph_name = basename($this->tpl_image);
$this->lfPDFDownload($graph_name, $head . $data, $arrColSize, $arrAlign, $sdate, $edate, $title, $page);
exit;
}
}
break;
default:
if (count($_GET) == 0) {
// バッチモードの場合のみ実行する(当日の集計を行うため)
if (DAILY_BATCH_MODE) {
// 3日前までの集計
$this->objBatch->lfStartDailyTotal(3, 0);
}
}
break;
}
// 登録・更新日検索用
$objDate = new SC_Date();
$objDate->setStartYear(RELEASE_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrYear = $objDate->getYear();
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
// 入力値の取得
$this->arrForm = $this->objFormParam->getFormParamList();
$this->tpl_subtitle = $this->arrTitle[$this->objFormParam->getValue('page')];
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例5: 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);
}
示例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
//.........这里部分代码省略.........
$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
AND dtb_question_result.question_id = ?
ORDER BY dtb_question_result.result_id ASC
__EOS__;
$list_data = $objQuery->getAll($sql, array($_GET['question_id']));
$data = "";
for ($i = 0; $i < count($list_data); $i++) {
// 各項目をCSV出力用に変換する。
$data .= $objCSV->lfMakeCSV($list_data[$i]);
}
// CSVを送信する
SC_Utils_Ex::sfCSVDownload($head . $data);
exit;
// 初回表示 or 編集ボタン押下時
} else {
if (!isset($_GET['question_id'])) {
$_GET['question_id'] = "";
}
if (is_numeric($_GET['question_id'])) {
$sql = "SELECT question FROM dtb_question WHERE question_id = ?";
$result = $objQuery->getOne($sql, array($_GET['question_id']));
if ($result) {
$_POST = unserialize($result);
$this->QUESTION_ID = $_GET['question_id'];
}
}
}
//各ページ共通
$this->cnt_question = 6;
$this->arrActive = $arrActive;
$this->arrQuestion = $arrQuestion;
//---- ページ表示
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例8: process
//.........这里部分代码省略.........
$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;
}
// ページ送りの取得
$objNavi = new SC_PageNavi($this->arrHidden['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
示例9: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$objView = new SC_AdminView();
$objDbFactory = SC_DB_DBFactory_Ex::getInstance();
$objCSV = new SC_Helper_CSV_Ex();
$this->arrSubnavi = $objCSV->arrSubnavi;
// 認証可否の判定
$objSess = new SC_Session();
SC_Utils_Ex::sfIsSuccess($objSess);
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
if (!isset($_POST['sql_id'])) {
$_POST['sql_id'] = "";
}
if (!isset($_GET['sql_id'])) {
$_GET['sql_id'] = "";
}
if (!isset($_POST['selectTable'])) {
$_POST['selectTable'] = "";
}
// SQL_IDの取得
if ($_POST['sql_id'] != "") {
$sql_id = $_POST['sql_id'];
} elseif ($_GET['sql_id'] != "") {
$sql_id = $_GET['sql_id'];
} else {
$sql_id = "";
}
$mode = $_POST['mode'];
switch ($_POST['mode']) {
// データの登録
case "confirm":
// エラーチェック
$this->arrErr = $this->lfCheckError($_POST);
if (count($this->arrErr) <= 0) {
// データの更新
$sql_id = $this->lfUpdData($sql_id, $_POST);
// 完了メッセージ表示
$this->tpl_onload = "alert('登録が完了しました。');";
}
break;
// 確認画面
// 確認画面
case "preview":
// SQL文表示
$sql = "SELECT \n" . $_POST['csv_sql'];
// FIXME
$this->sql = $sql;
// エラー表示
$objErrMsg = $this->lfCheckSQL($_POST);
if ($objErrMsg != "") {
$errMsg = $objErrMsg->message . "\n" . $objErrMsg->userinfo;
}
$this->sqlerr = isset($errMsg) ? $errMsg : "";
$this->objView = $objView;
// 画面の表示
$objView->assignobj($this);
$objView->display('contents/csv_sql_view.tpl');
exit;
break;
// 新規作成
// 新規作成
case "new_page":
$this->sendRedirect($this->getLocation("./csv_sql.php"));
exit;
break;
// データ削除
// データ削除
case "delete":
$this->lfDelData($sql_id);
$this->sendRedirect($this->getLocation("./csv_sql.php"));
exit;
break;
case "csv_output":
// CSV出力データ取得
$arrCsvData = $this->lfGetSqlList(" WHERE sql_id = ?", array($_POST['csv_output_id']));
$objQuery = new SC_Query();
$arrCsvOutputData = $objQuery->getall("SELECT " . $arrCsvData[0]['csv_sql']);
if (count($arrCsvOutputData) > 0) {
$arrKey = array_keys(SC_Utils_Ex::sfSwapArray($arrCsvOutputData));
$i = 0;
$header = "";
foreach ($arrKey as $data) {
if ($i != 0) {
$header .= ", ";
}
$header .= $data;
$i++;
}
$header .= "\r\n";
$data = SC_Utils_Ex::getCSVData($arrCsvOutputData, $arrKey);
// CSV出力
SC_Utils_Ex::sfCSVDownload($header . $data);
exit;
//.........这里部分代码省略.........
示例10: 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);
}