本文整理汇总了PHP中SC_Utils_Ex::getCSVData方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Utils_Ex::getCSVData方法的具体用法?PHP SC_Utils_Ex::getCSVData怎么用?PHP SC_Utils_Ex::getCSVData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Utils_Ex
的用法示例。
在下文中一共展示了SC_Utils_Ex::getCSVData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lfMakeCsvData
function lfMakeCsvData(&$conn, $send_id)
{
$arrTitle = array('name01', 'email');
$sql = "SELECT name01,email FROM dtb_send_customer WHERE send_id = ? ORDER BY email";
$result = $conn->getAll($sql, array($send_id));
if ($result) {
$return = SC_Utils_Ex::getCSVData($result, $arrTitle);
}
return $return;
}
示例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
/**
* 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;
//.........这里部分代码省略.........