本文整理汇总了PHP中SC_Helper_DB_Ex::sfGetCategoryList方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Helper_DB_Ex::sfGetCategoryList方法的具体用法?PHP SC_Helper_DB_Ex::sfGetCategoryList怎么用?PHP SC_Helper_DB_Ex::sfGetCategoryList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Helper_DB_Ex
的用法示例。
在下文中一共展示了SC_Helper_DB_Ex::sfGetCategoryList方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Page を初期化する.
*
* @return void
*/
function init()
{
parent::init();
$this->tpl_mainpage = 'mail/index.tpl';
$this->tpl_mainno = 'mail';
$this->tpl_subno = 'index';
$this->tpl_pager = 'pager.tpl';
$this->tpl_maintitle = 'メルマガ管理';
$this->tpl_subtitle = '配信内容設定';
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData('mtb_pref');
$this->arrJob = $masterData->getMasterData('mtb_job');
$this->arrJob['不明'] = '不明';
$this->arrSex = $masterData->getMasterData('mtb_sex');
$this->arrPageRows = $masterData->getMasterData('mtb_page_max');
$this->arrHtmlmail = array('' => '両方', 1 => 'HTML', 2 => 'TEXT');
$this->arrMailType = $masterData->getMasterData('mtb_mail_type');
// 日付プルダウン設定
$objDate = new SC_Date_Ex(BIRTH_YEAR);
$this->arrBirthYear = $objDate->getYear();
$this->arrRegistYear = $objDate->getYear();
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
$this->objDate = $objDate;
// カテゴリ一覧設定
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList();
// テンプレート一覧設定
$this->arrTemplate = $this->lfGetMailTemplateList(SC_Helper_Mail_Ex::sfGetMailmagaTemplate());
$this->httpCacheControl('nocache');
}
示例2: init
/**
* Page を初期化する.
*
* @return void
*/
function init()
{
parent::init();
$this->tpl_mainpage = 'mail/index.tpl';
$this->tpl_mainno = 'mail';
$this->tpl_subno = 'index';
$this->tpl_pager = 'pager.tpl';
$this->tpl_maintitle = t('c_Mail magazine_02');
$this->tpl_subtitle = t('c_Delivery content settings_01');
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData('mtb_pref');
$this->arrJob = $masterData->getMasterData('mtb_job');
$this->arrJob[t('c_Unknown_01')] = t('c_Unknown_01');
$this->arrSex = $masterData->getMasterData('mtb_sex');
$this->arrPageRows = $masterData->getMasterData('mtb_page_max');
$this->arrHtmlmail = array('' => t('c_Both_01'), 1 => t('c_HTML_01'), 2 => t('c_TEXT_02'));
$this->arrMailType = $masterData->getMasterData('mtb_mail_type');
// 日付プルダウン設定
$objDate = new SC_Date_Ex(BIRTH_YEAR);
$this->arrBirthYear = $objDate->getYear();
$this->arrRegistYear = $objDate->getYear();
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
$this->objDate = $objDate;
// カテゴリ一覧設定
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList();
// テンプレート一覧設定
$this->arrTemplate = $this->lfGetMailTemplateList(SC_Helper_Mail_Ex::sfGetMailmagaTemplate());
$this->httpCacheControl('nocache');
}
示例3: init
/**
* Page を初期化する.
*
* @return void
*/
public function init()
{
parent::init();
$this->tpl_mainpage = 'customer/index.tpl';
$this->tpl_mainno = 'customer';
$this->tpl_subno = 'index';
$this->tpl_pager = 'pager.tpl';
$this->tpl_maintitle = '会員管理';
$this->tpl_subtitle = '会員マスター';
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData('mtb_pref');
$this->arrJob = $masterData->getMasterData('mtb_job');
$this->arrJob['不明'] = '不明';
$this->arrSex = $masterData->getMasterData('mtb_sex');
$this->arrPageMax = $masterData->getMasterData('mtb_page_max');
$this->arrStatus = $masterData->getMasterData('mtb_customer_status');
$this->arrMagazineType = $masterData->getMasterData('mtb_magazine_type');
// 日付プルダウン設定
$objDate = new SC_Date_Ex();
// 登録・更新日検索用
$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();
// カテゴリ一覧設定
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList();
$this->httpCacheControl('nocache');
}
示例4: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$arrSearch = array();
// 検索項目表示用
$objDb = new SC_Helper_DB_Ex();
// 選択中のカテゴリIDを判定する
$this->category_id = $objDb->sfGetCategoryId($_GET['product_id'], $_GET['category_id']);
// カテゴリ検索用選択リスト
$arrRet = $objDb->sfGetCategoryList('', true, ' ');
if (is_array($arrRet)) {
// 文字サイズを制限する
foreach ($arrRet as $key => $val) {
$arrRet[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
}
}
$this->arrCatList = $arrRet;
$objSubView = new SC_SiteView();
$objSubView->assignobj($this);
$objSubView->display($this->tpl_mainpage);
}
示例5: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$conn = new SC_DBConn();
$objView = new SC_AdminView();
$objSess = new SC_Session();
$objDb = new SC_Helper_DB_Ex();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
if ($_POST['mode'] == "search") {
// POST値の引き継ぎ
$this->arrForm = $_POST;
// 入力文字の強制変換
$this->lfConvertParam();
$where = "del_flg = 0 AND status = 1";
/* 入力エラーなし */
foreach ($this->arrForm as $key => $val) {
if ($val == "") {
continue;
}
switch ($key) {
case 'search_name':
$where .= " AND name ILIKE ?";
$arrval[] = "%{$val}%";
break;
case 'search_category_id':
list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val);
if ($tmp_where != "") {
$where .= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
$arrval = array_merge((array) $arrval, (array) $tmp_arrval);
}
break;
case 'search_product_code':
$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
$arrval[] = "{$val}%";
break;
default:
break;
}
}
$order = "update_date DESC, product_id DESC";
// 読み込む列とテーブルの指定
$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
$from = "vw_products_nonclass AS noncls ";
$objQuery = new SC_Query();
// 行数の取得
if (empty($arrval)) {
$arrval = array();
}
$linemax = $objQuery->count("dtb_products", $where, $arrval);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの処理
if (isset($_POST['search_page_max']) && is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
}
// ページ送りの取得
$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
$this->tpl_strnavi = $objNavi->strnavi;
// 表示文字列
$startno = $objNavi->start_row;
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset($page_max, $startno);
// 表示順序
$objQuery->setorder($order);
// 検索結果の取得
$this->arrProducts = $objQuery->select($col, $from, $where, $arrval);
}
// カテゴリ取得
$this->arrCatList = $objDb->sfGetCategoryList();
//---- ページ表示
$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}
示例6: lfGetCategoryList
/**
* カテゴリ検索用選択リストを取得する
*
* @return array $arrCategoryList カテゴリ検索用選択リスト
*/
function lfGetCategoryList()
{
$objDb = new SC_Helper_DB_Ex();
// カテゴリ検索用選択リスト
$arrCategoryList = $objDb->sfGetCategoryList('', true, ' ');
if (is_array($arrCategoryList)) {
// 文字サイズを制限する
foreach ($arrCategoryList as $key => $val) {
$truncate_str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
$arrCategoryList[$key] = preg_replace('/ /u', ' ', $truncate_str);
}
}
return $arrCategoryList;
}
示例7: action
/**
* Page のアクション.
*
* @return void
*/
function action()
{
$objFormParam = new SC_FormParam_Ex();
$this->lfInitParam($objFormParam);
$objFormParam->setParam($_POST);
$objFormParam->convParam();
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objDb = new SC_Helper_DB_Ex();
switch ($this->getMode()) {
case 'down':
//商品の並び替えをする。おすすめはデータベースの登録が昇順なので、Modeを逆にする。
$arrRet = $objQuery->select('best_id', 'dtb_best_products', 'rank = ?', array($_POST['rank']));
//おすすめidの取得
$best_id = $arrRet[0]['best_id'];
$objDb->sfRankUp('dtb_best_products', 'best_id', $best_id);
$arrPost = $objFormParam->getHashArray();
$arrItems = $this->getRecommendProducts();
break;
case 'up':
//商品の並び替えをする。おすすめのみデータベースの登録が昇順なので、Modeを逆にする。
$arrRet = $objQuery->select('best_id', 'dtb_best_products', 'rank = ?', array($_POST['rank']));
//おすすめidの取得
$best_id = $arrRet[0]['best_id'];
$objDb->sfRankDown('dtb_best_products', 'best_id', $best_id);
$arrPost = $objFormParam->getHashArray();
$arrItems = $this->getRecommendProducts();
break;
case 'regist':
// 商品を登録する。
$this->arrErr = $this->lfCheckError($objFormParam);
$arrPost = $objFormParam->getHashArray();
// 登録処理にエラーがあった場合は商品選択の時と同じ処理を行う。
if (SC_Utils_Ex::isBlank($this->arrErr)) {
$member_id = $_SESSION['member_id'];
$this->insertRecommendProduct($arrPost, $member_id);
$arrItems = $this->getRecommendProducts();
} else {
$arrItems = $this->setProducts($arrPost, $arrItems);
$this->checkRank = $arrPost['rank'];
}
$this->tpl_onload = "window.alert('編集が完了しました');";
break;
case 'delete':
// 商品を削除する。
$this->arrErr = $this->lfCheckError($objFormParam);
$arrPost = $objFormParam->getHashArray();
if (SC_Utils_Ex::isBlank($this->arrErr)) {
$this->deleteProduct($arrPost);
$arrItems = $this->getRecommendProducts();
}
$this->tpl_onload = "window.alert('削除しました');";
break;
case 'set_item':
// 商品を選択する。
$this->arrErr = $this->lfCheckError($objFormParam);
$arrPost = $objFormParam->getHashArray();
if (SC_Utils_Ex::isBlank($this->arrErr['rank']) && SC_Utils_Ex::isBlank($this->arrErr['product_id'])) {
$arrItems = $this->setProducts($arrPost, $this->getRecommendProducts());
$this->checkRank = $arrPost['rank'];
}
break;
default:
$arrItems = $this->getRecommendProducts();
break;
}
$this->category_id = intval($arrPost['category_id']);
$this->arrItems = $arrItems;
// カテゴリ取得
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList('level = 1');
}
示例8: 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);
}
示例9: action
/**
* Page のアクション.
*
* @return void
*/
function action()
{
$objFormParam = new SC_FormParam_Ex();
$this->lfInitParam($objFormParam);
$objFormParam->setParam($_POST);
$objFormParam->convParam();
switch ($this->getMode()) {
case 'regist':
// 商品を登録する。
$this->arrErr = $this->lfCheckError($objFormParam);
$arrPost = $objFormParam->getHashArray();
// 登録処理にエラーがあった場合は商品選択の時と同じ処理を行う。
if (SC_Utils_Ex::isBlank($this->arrErr)) {
$member_id = $_SESSION['member_id'];
$this->insertRecommendProduct($arrPost, $member_id);
$arrItems = $this->getRecommendProducts();
} else {
$arrItems = $this->setProducts($arrPost, $arrItems);
$this->checkRank = $arrPost['rank'];
}
$this->tpl_onload = "window.alert('編集が完了しました');";
break;
case 'delete':
// 商品を削除する。
$this->arrErr = $this->lfCheckError($objFormParam);
$arrPost = $objFormParam->getHashArray();
if (SC_Utils_Ex::isBlank($this->arrErr)) {
$this->deleteProduct($arrPost);
$arrItems = $this->getRecommendProducts();
}
$this->tpl_onload = "window.alert('削除しました');";
break;
case 'set_item':
// 商品を選択する。
$this->arrErr = $this->lfCheckError($objFormParam);
$arrPost = $objFormParam->getHashArray();
if (SC_Utils_Ex::isBlank($this->arrErr['rank']) && SC_Utils_Ex::isBlank($this->arrErr['product_id'])) {
$arrItems = $this->setProducts($arrPost, $this->getRecommendProducts());
$this->checkRank = $arrPost['rank'];
}
break;
default:
$arrItems = $this->getRecommendProducts();
break;
}
$this->category_id = intval($arrPost['category_id']);
$this->arrItems = $arrItems;
// カテゴリ取得
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList("level = 1");
}
示例10: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
//---- ページ初期設定
$conn = new SC_DBConn();
$objView = new SC_AdminView();
$objDate = new SC_Date();
$objQuery = new SC_Query();
$objDb = new SC_Helper_DB_Ex();
$this->objDate = $objDate;
$this->arrTemplate = $this->getTemplateList($conn);
$objSess = new SC_Session();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
/*
query:配信履歴「確認」
*/
if ($_GET["mode"] == "query" && SC_Utils_Ex::sfCheckNumLength($_GET["send_id"])) {
// 送信履歴より、送信条件確認画面
$sql = "SELECT search_data FROM dtb_send_history WHERE send_id = ?";
$result = $conn->getOne($sql, array($_GET["send_id"]));
$tpl_path = "mail/query.tpl";
$list_data = unserialize($result);
// 都道府県を変換
$list_data['pref_disp'] = $this->arrPref[$list_data['pref']];
// 配信形式
$list_data['htmlmail_disp'] = $this->arrHtmlmail[$list_data['htmlmail']];
// 性別の変換
if (count($list_data['sex']) > 0) {
foreach ($list_data['sex'] as $key => $val) {
$list_data['sex'][$key] = $this->arrSex[$val];
$sex_disp .= $list_data['sex'][$key] . " ";
}
$list_data['sex_disp'] = $sex_disp;
}
// 職業の変換
if (count($list_data['job']) > 0) {
foreach ($list_data['job'] as $key => $val) {
$list_data['job'][$key] = $this->arrJob[$val];
$job_disp .= $list_data['job'][$key] . " ";
}
$list_data['job_disp'] = $job_disp;
}
// カテゴリ変換
$arrCatList = $objDb->sfGetCategoryList();
$list_data['category_name'] = $arrCatList[$list_data['category_id']];
$this->list_data = $list_data;
$this->arrCampaignList = $this->lfGetCampaignList($objQuery);
$objView->assignobj($this);
$objView->display($tpl_path);
exit;
}
if ($_POST['mode'] == 'delete') {
}
switch ($_POST['mode']) {
/*
search:「検索」ボタン
back:検索結果画面「戻る」ボタン
*/
case 'delete':
case 'search':
case 'back':
//-- 入力値コンバート
$this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn);
//-- 入力エラーのチェック
$this->arrErr = $this->lfErrorCheck($this->list_data);
//-- 検索開始
if (!is_array($this->arrErr)) {
$this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : "";
// hidden要素作成
$this->arrHidden = $this->lfGetHidden($this->list_data);
//-- 検索データ取得
$objSelect = new SC_CustomerList($this->list_data, "magazine");
// 生成されたWHERE文を取得する
list($where, $arrval) = $objSelect->getWhere();
// 「WHERE」部分を削除する。
$where = ereg_replace("^WHERE", "", $where);
// 検索結果の取得
$from = "dtb_customer";
// 行数の取得
$linemax = $objQuery->count($from, $where, $arrval);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの取得
$objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnResultPageNavi", NAVI_PMAX);
$this->arrPagenavi = $objNavi->arrPagenavi;
$startno = $objNavi->start_row;
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset(SEARCH_PMAX, $startno);
// 表示順序
$objQuery->setorder("customer_id DESC");
// 検索結果の取得
$col = $objSelect->getMailMagazineColumn($this->lfGetIsMobile($_POST['mail_type']));
$this->arrResults = $objQuery->select($col, $from, $where, $arrval);
//現在時刻の取得
$this->arrNowDate = $this->lfGetNowDate();
//.........这里部分代码省略.........
示例11: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$conn = new SC_DBConn();
$objView = new SC_AdminView();
$objSess = new SC_Session();
$arrRegistColumn = array(array("column" => "product_id", "convert" => "n"), array("column" => "category_id", "convert" => "n"), array("column" => "rank", "convert" => "n"), array("column" => "title", "convert" => "aKV"), array("column" => "comment", "convert" => "aKV"));
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
//最大登録数の表示
$this->tpl_disp_max = RECOMMEND_NUM;
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
if (!isset($_POST['category_id'])) {
$_POST['category_id'] = "";
}
// 登録時
if ($_POST['mode'] == 'regist') {
// 入力文字の強制変換
$this->arrForm = $_POST;
$this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
// エラーチェック
$this->arrErr[$this->arrForm['rank']] = $this->lfErrorCheck();
if (!$this->arrErr[$this->arrForm['rank']]) {
// 古いのを消す
$sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
$conn->query($sql, array($this->arrForm['category_id'], $this->arrForm['rank']));
// DB登録
$this->arrForm['creator_id'] = $_SESSION['member_id'];
$this->arrForm['update_date'] = "NOW()";
$this->arrForm['create_date'] = "NOW()";
$objQuery = new SC_Query();
$objQuery->insert("dtb_best_products", $this->arrForm);
// $conn->autoExecute("dtb_best_products", $this->arrForm );
}
} elseif ($_POST['mode'] == 'delete') {
// 削除時
$sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
$conn->query($sql, array($_POST['category_id'], $_POST['rank']));
}
// カテゴリID取得 無いときはトップページ
if (SC_Utils_Ex::sfCheckNumLength($_POST['category_id'])) {
$this->category_id = $_POST['category_id'];
} else {
$this->category_id = 0;
}
// 既に登録されている内容を取得する
$sql = "SELECT B.name, B.main_list_image, A.* FROM dtb_best_products as A INNER JOIN dtb_products as B USING (product_id)\n\t\t WHERE A.del_flg = 0 ORDER BY rank";
$arrItems = $conn->getAll($sql);
foreach ($arrItems as $data) {
$this->arrItems[$data['rank']] = $data;
}
// 商品変更時は、選択された商品に一時的に置き換える
if ($_POST['mode'] == 'set_item') {
$sql = "SELECT product_id, name, main_list_image FROM dtb_products WHERE product_id = ? AND del_flg = 0";
$result = $conn->getAll($sql, array($_POST['product_id']));
if ($result) {
$data = $result[0];
foreach ($data as $key => $val) {
$this->arrItems[$_POST['rank']][$key] = $val;
}
$this->arrItems[$_POST['rank']]['rank'] = $_POST['rank'];
}
$this->checkRank = $_POST['rank'];
}
//各ページ共通
$this->cnt_question = 6;
$this->arrActive = isset($arrActive) ? $arrActive : "";
$this->arrQuestion = isset($arrQuestion) ? $arrQuestion : "";
// カテゴリ取得
$objDb = new SC_Helper_DB_Ex();
$this->arrCatList = $objDb->sfGetCategoryList("level = 1");
//---- ページ表示
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}
示例12: process
//.........这里部分代码省略.........
$objSess = new SC_Session();
$objDb = new SC_Helper_DB_Ex();
$objQuery = new SC_Query();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
if ($_GET['no'] != '') {
$this->tpl_no = strval($_GET['no']);
} elseif ($_POST['no'] != '') {
$this->tpl_no = strval($_POST['no']);
}
if ($_POST['mode'] == "search") {
// POST値の引き継ぎ
$this->arrForm = $_POST;
// 入力文字の強制変換
$this->lfConvertParam();
$where = "del_flg = 0";
/* 入力エラーなし */
foreach ($this->arrForm as $key => $val) {
if ($val == "") {
continue;
}
switch ($key) {
case 'search_name':
$where .= " AND name ILIKE ?";
$arrval[] = "%{$val}%";
break;
case 'search_category_id':
list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val);
if ($tmp_where != "") {
$where .= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
$arrval = array_merge((array) $arrval, (array) $tmp_arrval);
}
break;
case 'search_product_code':
$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
$arrval[] = "{$val}%";
break;
default:
break;
}
}
/*
$order = "update_date DESC, product_id DESC ";
// 読み込む列とテーブルの指定
$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
$from = "vw_products_nonclass AS noncls ";
*/
$col = "DISTINCT T1.product_id, product_code_min, product_code_max," . " price01_min, price01_max, price02_min, price02_max," . " stock_min, stock_max, stock_unlimited_min," . " stock_unlimited_max, del_flg, status, name, comment1," . " comment2, comment3, main_list_comment, main_image," . " main_list_image, product_flag, deliv_date_id, sale_limit," . " point_rate, sale_unlimited, create_date, deliv_fee, " . " T4.product_rank, T4.category_rank";
$from = "vw_products_allclass AS T1" . " JOIN (" . " SELECT max(T3.rank) AS category_rank," . " max(T2.rank) AS product_rank," . " T2.product_id" . " FROM dtb_product_categories T2" . " JOIN dtb_category T3 USING (category_id)" . " GROUP BY product_id) AS T4 USING (product_id)";
$order = "T4.category_rank DESC, T4.product_rank DESC";
$objQuery = new SC_Query();
// 行数の取得
if (empty($arrval)) {
$arrval = array();
}
$linemax = $objQuery->count("dtb_products", $where, $arrval);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの処理
if (isset($_POST['search_page_max']) && is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
}
// ページ送りの取得
$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
$this->tpl_strnavi = $objNavi->strnavi;
// 表示文字列
$startno = $objNavi->start_row;
// 取得範囲の指定(開始行番号、行数のセット)
if (DB_TYPE != "mysql") {
$objQuery->setlimitoffset($page_max, $startno);
}
// 表示順序
$objQuery->setorder($order);
// viewも絞込みをかける(mysql用)
//sfViewWhere("&&noncls_where&&", $where, $arrval, $objQuery->order . " " . $objQuery->setlimitoffset($page_max, $startno, true));
// 検索結果の取得
$this->arrProducts = $objQuery->select($col, $from, $where, $arrval);
// 規格名一覧
$arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
// 規格分類名一覧
$arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
// 規格セレクトボックス設定
for ($i = 0; $i < count($this->arrProducts); $i++) {
$this->lfMakeSelect($this->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);
// 購入制限数を取得
$this->lfGetSaleLimit($this->arrProducts[$i]);
}
}
// カテゴリ取得
$this->arrCatList = $objDb->sfGetCategoryList();
//---- ページ表示
$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}