Exemple #1
0
function lfGetCSVData()
{
    global $arrAUTHORITY;
    global $arrWORK;
    $oquery = new SC_Query();
    $cols = "authority,name,department,login_id,work";
    $oquery->setwhere("del_flg <> 1");
    $oquery->andwhere("member_id <> " . ADMIN_ID);
    $oquery->setoption("ORDER BY rank DESC");
    $list_data = $oquery->select($cols, "dtb_member");
    $max = count($list_data);
    for ($i = 0; $i < $max; $i++) {
        $line = "";
        $line .= "\"" . $arrAUTHORITY[$list_data[$i]['authority']] . "\",";
        $tmp = ereg_replace("\"", "\"\"", $list_data[$i]['name']);
        $line .= "\"" . $tmp . "\",";
        $tmp = ereg_replace("\"", "\"\"", $list_data[$i]['department']);
        $line .= "\"" . $tmp . "\",";
        $tmp = ereg_replace("\"", "\"\"", $list_data[$i]['login_id']);
        $line .= "\"" . $tmp . "\",";
        $line .= "\"" . $arrWORK[$list_data[$i]['work']] . "\"\n";
        $data .= $line;
    }
    $header = "\"権限\",\"名前\",\"所属\",\"ログインID\",\"稼働状況\"\n";
    return $header . $data;
}
    /**
     * SC_Queryインスタンスに設定された検索条件を元に並び替え済みの検索結果商品IDの配列を取得する。
     *
     * 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります.
     *
     * @param SC_Query $objQuery SC_Query インスタンス
     * @param array $arrVal 検索パラメーターの配列
     * @return array 商品IDの配列
     */
    public function findProductIdsOrder(&$objQuery, $arrVal = array())
    {
        $table = <<<__EOS__
           dtb_products AS alldtl JOIN dtb_products_class AS P
                    ON  P.product_id = alldtl.product_id
                    LEFT JOIN dtb_class AS A
                    ON P.classcategory_id1 = A.class_id
                    LEFT JOIN dtb_class AS B
                    ON P.classcategory_id2 = B.class_id
__EOS__;
        $objQuery->setGroupBy('alldtl.product_id');
        if (is_array($this->arrOrderData) and $objQuery->order == '') {
            $o_col = $this->arrOrderData['col'];
            $o_table = $this->arrOrderData['table'];
            $o_order = $this->arrOrderData['order'];
            $order = <<<__EOS__
                    (
                        SELECT {$o_col}
                        FROM
                            {$o_table} as T2
                        WHERE T2.product_id = alldtl.product_id
                        ORDER BY T2.{$o_col} {$o_order}
                        LIMIT 1
                    ) {$o_order}, product_id
__EOS__;
            $objQuery->setOrder($order);
        }
        $results = $objQuery->select('alldtl.product_id', $table, '', $arrVal, MDB2_FETCHMODE_ORDERED);
        $resultValues = array();
        foreach ($results as $val) {
            $resultValues[] = $val[0];
        }
        return $resultValues;
    }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     global $objCampaignSess;
     $objView = new SC_SiteView();
     $objQuery = new SC_Query();
     $objCampaignSess = new SC_CampaignSession();
     // キャンペーンからの登録の場合の処理
     if ($_GET["cp"] != "") {
         $arrCampaign = $objQuery->select("directory_name", "dtb_campaign", "campaign_id = ?", array($_GET["cp"]));
         // キャンペーンディレクトリ名を保持
         $dir_name = $arrCampaign[0]['directory_name'];
     } else {
         $dir_name = "";
     }
     // レイアウトデザインを取得
     $helper = new SC_Helper_PageLayout_Ex();
     $helper->sfGetPageLayout($this, false, DEF_LAYOUT);
     $objView->assignobj($this);
     // フレームを選択(キャンペーンページから遷移なら変更)
     if ($this->dir_name != "") {
         $objView->display(CAMPAIGN_TEMPLATE_PATH . $dir_name . "/active/site_frame.tpl");
         $objCampaignSess->delCampaign();
     } else {
         $objView->display(SITE_FRAME);
     }
 }
 function getRanking()
 {
     $objQuery = new SC_Query();
     $col = "T1.product_id, T1.product_name as name,COUNT(*) AS order_count ";
     $from = "dtb_order_detail AS T1\r\n             INNER JOIN dtb_order AS T2 ON T1.order_id = T2.order_id\r\n             INNER JOIN dtb_products AS T3 ON T1.product_id = T3.product_id";
     $objQuery->setgroupby("T1.product_id,T1.product_name");
     $objQuery->setorder("order_count DESC");
     $objQuery->setlimit(10);
     //var_dump($objQuery->setorder("order_count DESC"));
     return $objQuery->select($col, $from, 'T2.status = ?', array('5'));
 }
 /**
  * セッションのデータををDBから読み込む.
  *
  * @param string $id セッションID
  * @return string セッションデータの値
  */
 function sfSessRead($id)
 {
     if (!$this->objDb->sfTabaleExists("dtb_session")) {
         return '';
     }
     $objQuery = new SC_Query();
     $arrRet = $objQuery->select("sess_data", "dtb_session", "sess_id = ?", array($id));
     if (empty($arrRet)) {
         return '';
     } else {
         return $arrRet[0]['sess_data'];
     }
 }
 /**
  * SC_DB_MasterData::getMasterData() のテストケース
  */
 function testGetMasterData()
 {
     $columns = array('id', 'name', 'rank');
     $masterData = new SC_DB_MasterData_Ex();
     $actual = $masterData->getMasterData('mtb_pref', $columns);
     $objQuery = new SC_Query();
     $objQuery->setorder($columns[2]);
     $results = $objQuery->select($columns[0] . ", " . $columns[1], 'mtb_pref');
     $expected = array();
     foreach ($results as $result) {
         $expected[$result[$columns[0]]] = $result[$columns[1]];
     }
     $this->assertEquals($expected, $actual);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
         $objQuery = new SC_Query();
         $col = "subject, mail_body";
         $where = "send_id = ?";
         $arrRet = $objQuery->select($col, "dtb_mail_history", $where, array($_GET['send_id']));
         $this->tpl_subject = $arrRet[0]['subject'];
         $this->tpl_body = $arrRet[0]['mail_body'];
     }
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_SiteView();
     $objCartSess = new SC_CartSession("", false);
     $objDb = new SC_Helper_DB_Ex();
     // 管理ページからの確認の場合は、非公開の商品も表示する。
     if (isset($_GET['admim']) && $_GET['admin'] == 'on') {
         $where = "del_flg = 0";
     } else {
         $where = "del_flg = 0 AND status = 1";
     }
     // 値の正当性チェック
     if (!SC_Utils_Ex::sfIsInt($_GET['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_GET['product_id'], $where)) {
         SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
     }
     $image_key = $_GET['image'];
     $objQuery = new SC_Query();
     // カラムが存在していなければエラー画面を表示
     if (!$objDb->sfColumnExists("dtb_products", $image_key)) {
         SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
     }
     $col = "name, {$image_key}";
     $arrRet = $objQuery->select($col, "dtb_products", "product_id = ?", array($_GET['product_id']));
     $image_path = IMAGE_SAVE_DIR . $arrRet[0][$image_key];
     if (file_exists($image_path)) {
         list($width, $height) = getimagesize($image_path);
     } else {
         $width = 0;
         $height = 0;
     }
     $this->tpl_width = $width;
     $this->tpl_height = $height;
     $this->tpl_table_width = $this->tpl_width + 20;
     $this->tpl_table_height = $this->tpl_height + 20;
     $this->tpl_image = $arrRet[0][$image_key];
     $this->tpl_name = $arrRet[0]['name'];
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 /**
  * 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);
 }
 function lfSetNewAddr($uniqid, $customer_id)
 {
     $objQuery = new SC_Query();
     $diff = false;
     $find_same = false;
     $col = "deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
     $where = "order_temp_id = ?";
     $arrRet = $objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
     // 要素名のdeliv_を削除する。
     foreach ($arrRet[0] as $key => $val) {
         $keyname = ereg_replace("^deliv_", "", $key);
         $arrNew[$keyname] = $val;
     }
     // 会員情報テーブルとの比較
     $col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
     $where = "customer_id = ?";
     $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
     // 会員情報の住所と異なる場合
     if ($arrNew != $arrCustomerAddr[0]) {
         // 別のお届け先テーブルの住所と比較する
         $col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
         $where = "customer_id = ?";
         $arrOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
         foreach ($arrOtherAddr as $arrval) {
             if ($arrNew == $arrval) {
                 // すでに同じ住所が登録されている
                 $find_same = true;
             }
         }
         if (!$find_same) {
             $diff = true;
         }
     }
     // 新しいお届け先が登録済みのものと異なる場合は別のお届け先テーブルに登録する
     if ($diff) {
         $sqlval = $arrNew;
         $sqlval['customer_id'] = $customer_id;
         $objQuery->insert("dtb_other_deliv", $sqlval);
     }
 }
 function getPublicKey()
 {
     $objQuery = new SC_Query();
     $arrRet = $objQuery->select('*', 'dtb_ownersstore_settings');
     return isset($arrRet[0]['public_key']) ? $arrRet[0]['public_key'] : null;
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     //---- ページ初期設定
     $objQuery = new SC_Query();
     $objView = new SC_AdminView();
     $objDate = new SC_Date(1901);
     $objDb = new SC_Helper_DB_Ex();
     $this->arrYear = $objDate->getYear();
     // 日付プルダウン設定
     $this->arrMonth = $objDate->getMonth();
     $this->arrDay = $objDate->getDay();
     $this->objDate = $objDate;
     // 認証可否の判定
     $objSess = new SC_Session();
     SC_Utils_Ex::sfIsSuccess($objSess);
     // POST値の引き継ぎ
     $this->arrForm = $_POST;
     // ページ送り用
     $this->arrHidden['search_pageno'] = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
     // 検索ワードの引き継ぎ
     foreach ($_POST as $key => $val) {
         switch ($key) {
             case 'sex':
             case 'status':
                 $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
                 if (!is_array($val)) {
                     $this->arrForm[$key] = split("-", $val);
                 }
                 break;
             default:
                 $this->arrHidden[$key] = $val;
                 break;
         }
     }
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     // 顧客削除
     if ($_POST['mode'] == "delete") {
         $sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
         $result_customer = $objQuery->conn->getAll($sql, array($_POST["edit_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["edit_customer_id"]));
         } elseif ($result_customer[0]["status"] == 1) {
             //仮会員削除
             $sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
             $objQuery->conn->query($sql, array($_POST["edit_customer_id"]));
         }
     }
     //if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
     // 登録メール再送
     if ($_POST['mode'] == "resend_mail") {
         $arrRet = $objQuery->select("name01, name02, secret_key, email", "dtb_customer", "customer_id = ? AND del_flg <> 1 AND status = 1", array($_POST["edit_customer_id"]));
         if (is_array($arrRet) === true && count($arrRet) > 0) {
             $CONF = $objDb->sf_getBasisData();
             $this->CONF = $CONF;
             $objMailText = new SC_SiteView();
             $objMailText->assignobj($this);
             $mailHelper = new SC_Helper_Mail_Ex();
             $this->name01 = $arrRet[0]['name01'];
             $this->name02 = $arrRet[0]['name02'];
             $this->uniqid = $arrRet[0]['secret_key'];
             $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご確認');
             $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
             $objMail = new SC_SendMail();
             $objMail->setItem('', $subject, $toCustomerMail, $CONF["email03"], $CONF["shop_name"], $CONF["email03"], $CONF["email04"], $CONF["email04"]);
             // 宛先の設定
             $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);
 }
Exemple #13
0
 /**
  * 新着情報を取得する
  *
  * @param SC_Query $objQuery DB操作クラス
  * @return array $arrNews 取得結果を配列で返す
  */
 function lfGetNews(&$objQuery)
 {
     $col = "";
     $col .= "news_id ";
     // 新着情報ID
     $col .= ",news_title ";
     // 新着情報タイトル
     $col .= ",news_comment ";
     // 新着情報本文
     $col .= ",news_date ";
     // 日付
     $col .= ",news_url ";
     // 新着情報URL
     $col .= ",news_select ";
     // 新着情報の区分(1:URL、2:本文)
     $col .= ",(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";
     // 店名
     $col .= ",(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";
     // 代表Emailアドレス
     $from = "dtb_news";
     $where = "del_flg = '0'";
     $order = "rank DESC";
     $objQuery->setOrder($order);
     $arrNews = $objQuery->select($col, $from, $where);
     // RSS用に変換
     foreach (array_keys($arrNews) as $key) {
         $netUrlHttpUrl = new Net_URL(HTTP_URL);
         $row =& $arrNews[$key];
         // 日付
         $row['news_date'] = date('r', strtotime($row['news_date']));
         // 新着情報URL
         if (SC_Utils_Ex::isBlank($row['news_url'])) {
             $row['news_url'] = HTTP_URL;
         } elseif ($row['news_url'][0] == '/') {
             // 変換(絶対パス→URL)
             $netUrl = new Net_URL($row['news_url']);
             $netUrl->protocol = $netUrlHttpUrl->protocol;
             $netUrl->user = $netUrlHttpUrl->user;
             $netUrl->pass = $netUrlHttpUrl->pass;
             $netUrl->host = $netUrlHttpUrl->host;
             $netUrl->port = $netUrlHttpUrl->port;
             $row['news_url'] = $netUrl->getUrl();
         }
     }
     return $arrNews;
 }
 function lfGetData($payment_id)
 {
     $objQuery = new SC_Query();
     $where = "payment_id = ?";
     $arrRet = $objQuery->select("*", "dtb_payment", $where, array($payment_id));
     return $arrRet[0];
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objDb = new SC_Helper_DB_Ex();
     $objSess = new SC_Session();
     // パラメータ管理クラス
     $this->objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam();
     $this->objFormParam->setParam($_POST);
     $this->objFormParam->splitParamCheckBoxes('search_order_sex');
     $this->objFormParam->splitParamCheckBoxes('search_payment_id');
     // 検索ワードの引き継ぎ
     foreach ($_POST as $key => $val) {
         if (ereg("^search_", $key)) {
             switch ($key) {
                 case 'search_order_sex':
                 case 'search_payment_id':
                     $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
                     break;
                 default:
                     $this->arrHidden[$key] = $val;
                     break;
             }
         }
     }
     // ページ送り用
     $this->arrHidden['search_pageno'] = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if (!isset($arrRet)) {
         $arrRet = array();
     }
     if ($_POST['mode'] == 'delete') {
         if (SC_Utils_Ex::sfIsInt($_POST['order_id'])) {
             $objQuery = new SC_Query();
             $where = "order_id = ?";
             $sqlval['del_flg'] = '1';
             $objQuery->update("dtb_order", $sqlval, $where, array($_POST['order_id']));
         }
     }
     switch ($_POST['mode']) {
         case 'delete':
         case 'csv':
         case 'pdf':
         case 'delete_all':
         case 'search':
             // 入力値の変換
             $this->objFormParam->convParam();
             $this->arrErr = $this->lfCheckError($arrRet);
             $arrRet = $this->objFormParam->getHashArray();
             // 入力なし
             if (count($this->arrErr) == 0) {
                 $where = "del_flg = 0";
                 foreach ($arrRet as $key => $val) {
                     if ($val == "") {
                         continue;
                     }
                     $val = SC_Utils_Ex::sfManualEscape($val);
                     switch ($key) {
                         case 'search_order_name':
                             if (DB_TYPE == "pgsql") {
                                 $where .= " AND order_name01||order_name02 ILIKE ?";
                             } elseif (DB_TYPE == "mysql") {
                                 $where .= " AND concat(order_name01,order_name02) ILIKE ?";
                             }
                             $nonsp_val = mb_ereg_replace("[  ]+", "", $val);
                             $arrval[] = "%{$nonsp_val}%";
                             break;
                         case 'search_order_kana':
                             if (DB_TYPE == "pgsql") {
                                 $where .= " AND order_kana01||order_kana02 ILIKE ?";
                             } elseif (DB_TYPE == "mysql") {
                                 $where .= " AND concat(order_kana01,order_kana02) ILIKE ?";
                             }
                             $nonsp_val = mb_ereg_replace("[  ]+", "", $val);
                             $arrval[] = "%{$nonsp_val}%";
                             break;
                         case 'search_order_id1':
                             $where .= " AND order_id >= ?";
                             $arrval[] = $val;
                             break;
                         case 'search_order_id2':
                             $where .= " AND order_id <= ?";
                             $arrval[] = $val;
                             break;
                         case 'search_order_sex':
                             $tmp_where = "";
                             foreach ($val as $element) {
                                 if ($element != "") {
                                     if ($tmp_where == "") {
                                         $tmp_where .= " AND (order_sex = ?";
                                     } else {
                                         $tmp_where .= " OR order_sex = ?";
                                     }
                                     $arrval[] = $element;
                                 }
                             }
                             if ($tmp_where != "") {
                                 $tmp_where .= ")";
                                 $where .= " {$tmp_where} ";
                             }
                             break;
                         case 'search_order_tel':
                             if (DB_TYPE == "pgsql") {
                                 $where .= " AND (order_tel01 || order_tel02 || order_tel03) LIKE ?";
                             } elseif (DB_TYPE == "mysql") {
                                 $where .= " AND concat(order_tel01,order_tel02,order_tel03) LIKE ?";
                             }
                             $nonmark_val = ereg_replace("[()-]+", "", $val);
                             $arrval[] = "%{$nonmark_val}%";
                             break;
                         case 'search_order_email':
                             $where .= " AND order_email ILIKE ?";
                             $arrval[] = "%{$val}%";
                             break;
                         case 'search_payment_id':
                             $tmp_where = "";
                             foreach ($val as $element) {
                                 if ($element != "") {
                                     if ($tmp_where == "") {
                                         $tmp_where .= " AND (payment_id = ?";
                                     } else {
                                         $tmp_where .= " OR payment_id = ?";
                                     }
                                     $arrval[] = $element;
                                 }
                             }
                             if ($tmp_where != "") {
                                 $tmp_where .= ")";
                                 $where .= " {$tmp_where} ";
                             }
                             break;
                         case 'search_total1':
                             $where .= " AND total >= ?";
                             $arrval[] = $val;
                             break;
                         case 'search_total2':
                             $where .= " AND total <= ?";
                             $arrval[] = $val;
                             break;
                         case 'search_sorderyear':
                             $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sorderyear'], $_POST['search_sordermonth'], $_POST['search_sorderday']);
                             $where .= " AND create_date >= ?";
                             $arrval[] = $date;
                             break;
                         case 'search_eorderyear':
                             $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eorderyear'], $_POST['search_eordermonth'], $_POST['search_eorderday'], true);
                             $where .= " AND create_date <= ?";
                             $arrval[] = $date;
                             break;
                         case 'search_supdateyear':
                             $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_supdateyear'], $_POST['search_supdatemonth'], $_POST['search_supdateday']);
                             $where .= " AND update_date >= ?";
                             $arrval[] = $date;
                             break;
                         case 'search_eupdateyear':
                             $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eupdateyear'], $_POST['search_eupdatemonth'], $_POST['search_eupdateday'], true);
                             $where .= " AND update_date <= ?";
                             $arrval[] = $date;
                             break;
                         case 'search_sbirthyear':
                             $date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sbirthyear'], $_POST['search_sbirthmonth'], $_POST['search_sbirthday']);
                             $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;
                         }
                         // ページ送りの取得
                         $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);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objQuery = new SC_Query();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     // パラメータ管理クラス
     $this->objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam();
     // POST値の取得
     $this->objFormParam->setParam($_POST);
     $cnt = $objQuery->count("dtb_baseinfo");
     if ($cnt > 0) {
         $this->tpl_mode = "update";
     } else {
         $this->tpl_mode = "insert";
     }
     if (isset($_POST['mode']) && !empty($_POST['mode'])) {
         // 入力値の変換
         $this->objFormParam->convParam();
         $this->arrErr = $this->lfCheckError();
         if (count($this->arrErr) == 0) {
             switch ($_POST['mode']) {
                 case 'update':
                     $this->lfUpdateData();
                     // 既存編集
                     break;
                 case 'insert':
                     $this->lfInsertData();
                     // 新規作成
                     break;
                 default:
                     break;
             }
             // 再表示
             //sfReload();
             $this->tpl_onload = "window.alert('特定商取引法の登録が完了しました。');";
         }
     } else {
         $arrCol = $this->objFormParam->getKeyList();
         // キー名一覧を取得
         $col = SC_Utils_Ex::sfGetCommaList($arrCol);
         $arrRet = $objQuery->select($col, "dtb_baseinfo");
         // DB値の取得
         $this->objFormParam->setParam($arrRet[0]);
     }
     $this->arrForm = $this->objFormParam->getFormParamList();
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_SiteView(false);
     $objQuery = new SC_Query();
     $objCustomer = new SC_Customer();
     $ParentPage = MYPAGE_DELIVADDR_URL;
     // GETでページを指定されている場合には指定ページに戻す
     if (isset($_GET['page'])) {
         $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES);
     } else {
         if (isset($_POST['ParentPage'])) {
             $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES);
         }
     }
     $this->ParentPage = $ParentPage;
     //ログイン判定
     if (!$objCustomer->isLoginSuccess()) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     if (!isset($_GET['other_deliv_id'])) {
         $_GET['other_deliv_id'] = "";
     }
     if ($_POST['mode'] == "") {
         $_SESSION['other_deliv_id'] = $_GET['other_deliv_id'];
     }
     if ($_GET['other_deliv_id'] != "") {
         //不正アクセス判定
         $flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id']));
         if (!$objCustomer->isLoginSuccess() || $flag == 0) {
             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
         }
     }
     //別のお届け先DB登録用カラム配列
     $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n"));
     if ($_GET['other_deliv_id'] != "") {
         //別のお届け先情報取得
         $arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id=? ", array($_SESSION['other_deliv_id']));
         $this->arrForm = $arrOtherDeliv[0];
     }
     switch ($_POST['mode']) {
         case 'edit':
             $_POST = $this->lfConvertParam($_POST, $arrRegistColumn);
             $this->arrErr = $this->lfErrorCheck($_POST);
             if ($this->arrErr) {
                 foreach ($_POST as $key => $val) {
                     if ($val != "") {
                         $this->arrForm[$key] = $val;
                     }
                 }
             } else {
                 //別のお届け先登録数の取得
                 $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id')));
                 if ($deliv_count < DELIV_ADDR_MAX or isset($_POST['other_deliv_id'])) {
                     if (strlen($_POST['other_deliv_id'] != 0)) {
                         $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=? and other_deliv_id = ?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id']));
                         if ($deliv_count == 0) {
                             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                         } else {
                             $this->lfRegistData($_POST, $arrRegistColumn, $objCustomer);
                         }
                     } else {
                         $this->lfRegistData($_POST, $arrRegistColumn, $objCustomer);
                     }
                 }
                 if ($_POST['ParentPage'] == MYPAGE_DELIVADDR_URL || $_POST['ParentPage'] == URL_DELIV_TOP) {
                     $this->tpl_onload = "fnUpdateParent('" . $this->getLocation($_POST['ParentPage']) . "'); window.close();";
                 } else {
                     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
                 }
             }
             break;
     }
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 function lfGetPayment()
 {
     $objQuery = new SC_Query();
     $col = "payment_id, rule, payment_method";
     $from = "dtb_payment";
     $where = "del_flg = 0";
     $order = "payment_id";
     $objQuery->setorder($order);
     $arrRet = $objQuery->select($col, $from, $where);
     return $arrRet;
 }
    /**
     * SC_Query インスタンスに設定された検索条件を使用して商品規格を取得する.
     *
     * @param SC_Query $objQuery SC_Queryインスタンス
     * @param array $params 検索パラメーターの配列
     * @return array 商品規格の配列
     */
    function getProductsClassByQuery(&$objQuery, $params)
    {
        // 末端の規格を取得
        $col = <<<__EOS__
            T1.product_id,
            T1.stock,
            T1.stock_unlimited,
            T1.sale_limit,
            T1.price01,
            T1.price02,
            T1.point_rate,
            T1.product_code,
            T1.product_class_id,
            T1.del_flg,
            T1.product_type_id,
            T1.down_filename,
            T1.down_realfilename,
            T3.name AS classcategory_name1,
            T3.rank AS rank1,
            T4.name AS class_name1,
            T4.class_id AS class_id1,
            T1.classcategory_id1,
            T1.classcategory_id2,
            dtb_classcategory2.name AS classcategory_name2,
            dtb_classcategory2.rank AS rank2,
            dtb_class2.name AS class_name2,
            dtb_class2.class_id AS class_id2
__EOS__;
        $table = <<<__EOS__
            dtb_products_class T1
            LEFT JOIN dtb_classcategory T3
                ON T1.classcategory_id1 = T3.classcategory_id
            LEFT JOIN dtb_class T4
                ON T3.class_id = T4.class_id
            LEFT JOIN dtb_classcategory dtb_classcategory2
                ON T1.classcategory_id2 = dtb_classcategory2.classcategory_id
            LEFT JOIN dtb_class dtb_class2
                ON dtb_classcategory2.class_id = dtb_class2.class_id
__EOS__;
        $objQuery->setOrder('T3.rank DESC, dtb_classcategory2.rank DESC');
        // XXX
        $arrRet = $objQuery->select($col, $table, '', $params);
        return $arrRet;
    }
Exemple #20
0
 /**
  * 親IDの配列を元に特定のカラムを取得する.
  *
  * @param  SC_Query $objQuery SC_Query インスタンス
  * @param  string   $table    テーブル名
  * @param  string   $id_name  ID名
  * @param  string   $col_name カラム名
  * @param  array    $arrId    IDの配列
  * @return array    特定のカラムの配列
  */
 public function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId)
 {
     $col = $col_name;
     $len = count($arrId);
     $where = '';
     for ($cnt = 0; $cnt < $len; $cnt++) {
         if ($where == '') {
             $where = "{$id_name} = ?";
         } else {
             $where .= " OR {$id_name} = ?";
         }
     }
     $objQuery->setOrder('level');
     $arrRet = $objQuery->select($col, $table, $where, $arrId);
     return $arrRet;
 }
 /**
  * 動画プレイヤー設定情報取得
  *
  * @return array
  */
 function lfGetVideoPlayer()
 {
     $objQuery = new SC_Query();
     $col = '*';
     //カラム
     $table = 'dtb_videoplayer';
     //テーブル名
     $arrVideos = $objQuery->select($col, $table);
     // youtube検索パターン
     $youtube_pattern1 = '/^https?.*youtu.*v=([\\d\\w-]{11}).*/';
     $youtube_pattern2 = '/.*\\.be.([\\d\\w-]{11})/';
     $youtube_pattern3 = '/.*.embed.([\\d\\w-]{11}).*/';
     // niconico検索パターン
     $niconico_pattern = '/^https?.*nicovideo.*([s|n]m[\\d]+)/';
     /* yotubeURL判別 */
     if (preg_match('/youtu/', $this->arrVideo['video_url'])) {
         if (preg_match('/\\?v=/', $this->arrVideo['video_url'])) {
             $this->view_id = 'youtube';
             $this->youtube_id = preg_replace($youtube_pattern1, '$1', $this->arrVideo['video_url']);
         }
         if (preg_match('/\\.be/', $this->arrVideo['video_url'])) {
             $this->view_id = 'youtube';
             $this->youtube_id = preg_replace($youtube_pattern2, '$1', $this->arrVideo['video_url']);
         }
         if (preg_match('/embed/', $this->arrVideo['video_url'])) {
             $this->view_id = 'youtube';
             $this->youtube_id = preg_replace($youtube_pattern3, '$1', $this->arrVideo['video_url']);
         } else {
             $this->view_id = 'get url failed';
         }
     } else {
         if (preg_match('/nico/', $this->arrVideo['video_url'])) {
             $this->niconico_id = preg_replace($niconico_pattern, '$1', $this->arrVideo['video_url']);
             $this->view_id = 'niconico';
         } else {
             $this->view_id = 'get url failed';
         }
     }
     return $arrVideoPlayer;
 }
Exemple #22
0
 /**
  * 新着情報を取得する
  *
  * @param SC_Query $objQuery DB操作クラス
  * @return array $arrNews 取得結果を配列で返す
  */
 function lfGetNews(&$objQuery)
 {
     $col = "";
     $col .= "     news_id ";
     //新着情報ID
     $col .= "     ,news_title ";
     //新着情報タイトル
     $col .= "     ,news_comment ";
     //新着情報本文
     if (DB_TYPE == "pgsql") {
         $col .= "     ,to_char(news_date, 'YYYY') AS YEAR ";
         //日付(年)
         $col .= "     ,to_char(news_date, 'MM') AS MONTH ";
         //日付(月)
         $col .= "     ,to_char(news_date, 'DD') AS DAY ";
         //日付(日)
         $col .= "     ,to_char(news_date, 'HH24') AS HOUR ";
         //日付(時間)
         $col .= "     ,to_char(news_date, 'MI') AS MINUTE ";
         //日付(分)
         $col .= "     ,to_char(news_date, 'SS') AS SECOND ";
         //日付(秒)
     } else {
         if (DB_TYPE == "mysql") {
             $col .= "     ,DATE_FORMAT(news_date, '%Y') AS YEAR ";
             //日付(年)
             $col .= "     ,DATE_FORMAT(news_date, '%m') AS MONTH ";
             //日付(月)
             $col .= "     ,DATE_FORMAT(news_date, '%d') AS DAY ";
             //日付(日)
             $col .= "     ,DATE_FORMAT(news_date, '%H') AS HOUR ";
             //日付(時間)
             $col .= "     ,DATE_FORMAT(news_date, '%i') AS MINUTE ";
             //日付(分)
             $col .= "     ,DATE_FORMAT(news_date, '%s') AS SECOND ";
             //日付(秒)
         }
     }
     $col .= "     ,news_url ";
     //新着情報URL
     $col .= "     ,news_select ";
     //新着情報の区分(1:URL、2:本文)
     $col .= "     ,(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";
     //店名
     $col .= "     ,(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";
     //代表Emailアドレス
     $from = "dtb_news";
     $where = "del_flg = '0'";
     $order = "rank DESC";
     $objQuery->setorder($order);
     $arrNews = $objQuery->select($col, $from, $where);
     return $arrNews;
 }
 /**
  * 現在適用しているテンプレートパッケージ名を取得する.
  *
  * @param void
  * @return string テンプレートパッケージ名
  */
 function lfGetNowTemplate()
 {
     $objQuery = new SC_Query();
     $arrRet = $objQuery->select('top_tpl', 'dtb_baseinfo');
     if (isset($arrRet[0]['top_tpl'])) {
         return $arrRet[0]['top_tpl'];
     }
     return null;
 }
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'require.php';
// 認証可否の判定
SC_Utils::sfIsSuccess(new SC_Session());
$module_id = isset($_GET['module_id']) ? $_GET['module_id'] : null;
if (!empty($module_id) && is_numeric($module_id)) {
    GC_Utils::gfPrintLog("loading module ====> module_id = " . $module_id);
    $objQuery = new SC_Query();
    $arrRet = $objQuery->select("module_code", "dtb_module", "module_id = ?", array($module_id));
    if (isset($arrRet[0]['module_code'])) {
        $config_path = MODULE_PATH . $arrRet[0]['module_code'] . '/config.php';
        if (file_exists($config_path)) {
            require_once $config_path;
            exit;
        } else {
            die("モジュールの取得に失敗しました: {$config_path}");
        }
    } else {
        die("モジュールが存在しません: module_id => {$module_id}");
    }
}
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_AdminView();
     // 認証可否の判定
     $objSess = new SC_Session();
     SC_Utils_Ex::sfIsSuccess($objSess);
     // 検索パラメータの引き継ぎ
     foreach ($_POST as $key => $val) {
         if (ereg("^search_", $key)) {
             $this->arrSearchHidden[$key] = $val;
         }
     }
     $this->tpl_product_id = isset($_POST['product_id']) ? $_POST['product_id'] : "";
     $this->tpl_pageno = isset($_POST['pageno']) ? $_POST['pageno'] : "";
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         // 規格削除要求
         case 'delete':
             $objQuery = new SC_Query();
             $objQuery->setLimitOffset(1);
             $where = "product_id = ? AND NOT (classcategory_id1 = 0 AND classcategory_id2 = 0)";
             $objQuery->setOrder("rank1 DESC, rank2 DESC");
             $arrRet = $objQuery->select("*", "vw_cross_products_class AS crs_prd", $where, array($_POST['product_id']));
             if (count($arrRet) > 0) {
                 $sqlval['product_id'] = $arrRet[0]['product_id'];
                 $sqlval['classcategory_id1'] = '0';
                 $sqlval['classcategory_id2'] = '0';
                 $sqlval['product_code'] = $arrRet[0]['product_code'];
                 $sqlval['stock'] = $arrRet[0]['stock'];
                 $sqlval['price01'] = $arrRet[0]['price01'];
                 $sqlval['price02'] = $arrRet[0]['price02'];
                 $sqlval['creator_id'] = $_SESSION['member_id'];
                 $sqlval['create_date'] = "now()";
                 $sqlval['update_date'] = "now()";
                 $objQuery->begin();
                 $where = "product_id = ?";
                 $objQuery->delete("dtb_products_class", $where, array($_POST['product_id']));
                 $objQuery->insert("dtb_products_class", $sqlval);
                 $objQuery->commit();
             }
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
             // 編集要求
         // 編集要求
         case 'pre_edit':
             $objQuery = new SC_Query();
             $where = "product_id = ? AND NOT(classcategory_id1 = 0 AND classcategory_id2 = 0) ";
             $ret = $objQuery->count("dtb_products_class", $where, array($_POST['product_id']));
             if ($ret > 0) {
                 // 規格組み合わせ一覧の取得(DBの値を優先する。)
                 $this->arrClassCat = $this->lfGetClassCatListEdit($_POST['product_id']);
             }
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
             // 規格組み合わせ表示
         // 規格組み合わせ表示
         case 'disp':
             $this->arrForm['select_class_id1'] = $_POST['select_class_id1'];
             $this->arrForm['select_class_id2'] = $_POST['select_class_id2'];
             $this->arrErr = $this->lfClassError();
             if (count($this->arrErr) == 0) {
                 // 規格組み合わせ一覧の取得
                 $this->arrClassCat = $this->lfGetClassCatListDisp($_POST['select_class_id1'], $_POST['select_class_id2']);
             }
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
             // 規格登録要求
         // 規格登録要求
         case 'edit':
             // 入力値の変換
             $this->arrForm = $this->lfConvertParam($_POST);
             // エラーチェック
             $this->arrErr = $this->lfProductClassError($this->arrForm);
             if (count($this->arrErr) == 0) {
                 // 確認ページ設定
                 $this->tpl_mainpage = 'products/product_class_confirm.tpl';
                 $this->lfProductConfirmPage();
                 // 確認ページ表示
             } else {
                 // 規格組み合わせ一覧の取得
                 $this->arrClassCat = $this->lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
                 $this->lfProductClassPage();
                 // 規格登録ページ
             }
             break;
             // 確認ページからの戻り
         // 確認ページからの戻り
         case 'confirm_return':
             // フォームパラメータの引き継ぎ
             $this->arrForm = $_POST;
             // 規格の選択情報は引き継がない。
             $this->arrForm['select_class_id1'] = "";
             $this->arrForm['select_class_id2'] = "";
             // 規格組み合わせ一覧の取得(デフォルト値は出力しない)
             $this->arrClassCat = $this->lfGetClassCatListDisp($_POST['class_id1'], $_POST['class_id2'], false);
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
         case 'complete':
             // 完了ページ設定
             $this->tpl_mainpage = 'products/product_class_complete.tpl';
             // 商品規格の登録
             $this->lfInsertProductClass($_POST, $_POST['product_id']);
             break;
         default:
             $this->lfProductClassPage();
             // 規格登録ページ
             break;
     }
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
Exemple #26
0
 function lfRealTimeDailyTotal($sdate, $edate)
 {
     $pass = strtotime($edate) - strtotime($sdate);
     $loop = intval($pass / 86400);
     for ($i = 0; $i <= $loop; $i++) {
         $tmp_time = strtotime($sdate) + $i * 86400;
         $batch_date = date("Y/m/d H:i:s", $tmp_time);
         $objQuery = new SC_Query();
         $arrRet = $objQuery->select("order_date, create_date", "dtb_bat_order_daily", "order_date = ?", array($batch_date));
         // すでにバッチ処理が終了しているかチェックする。
         $count = count($arrRet);
         if ($count > 0) {
             list($create_date) = split("\\.", $arrRet[0]['create_date']);
             list($order_date) = split("\\.", $arrRet[0]['order_date']);
             $create_time = strtotime($create_date);
             $order_time = strtotime($order_date);
             // オーダー開始日より一日以上後に集計されている場合は集計しなおさない
             if ($order_time + 86400 < $create_time || $tmp_time > time()) {
                 GC_Utils_Ex::gfPrintLog("EXIT BATCH {$batch_date} {$tmp_time}" . " " . time());
                 continue;
             }
         }
         GC_Utils_Ex::gfPrintLog("LOADING BATCH {$batch_date}");
         $this->lfBatOrderDaily($tmp_time);
         $this->lfBatOrderDailyHour($tmp_time);
         $this->lfBatOrderAge($tmp_time);
     }
 }
 function lfGetOrderDetail($order_id)
 {
     $objQuery = new SC_Query();
     $col = "product_id, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
     $where = "order_id = ?";
     $objQuery->setorder("classcategory_id1, classcategory_id2");
     $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
     return $arrRet;
 }
 /**
  * 入力チェックを行う.
  *
  * @return void
  */
 function lfCheckError()
 {
     $arrRet = $this->objFormParam->getHashArray();
     $objQuery = new SC_Query();
     $objErr = new SC_CheckError($arrRet);
     $objErr->arrErr = $this->objFormParam->checkError(false);
     // 親カテゴリID設定
     if ($arrRet['parent_category_id'] == 0) {
         $parent_category_id = "0";
     } else {
         $parent_category_id = $arrRet['parent_category_id'];
     }
     // 存在する親カテゴリIDかチェック
     if (count($objErr->arrErr) == 0) {
         if ($parent_category_id != 0) {
             $count = $objQuery->count("dtb_category", "category_id = ?", array($parent_category_id));
             if ($count == 0) {
                 $objErr->arrErr['parent_category_id'] = "※ 指定の親カテゴリID(" . $parent_category_id . ")は、存在しません。";
             }
         }
     }
     // 階層チェック
     if (!isset($objErr->arrErr['category_name']) && !isset($objErr->arrErr['parent_category_id'])) {
         $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($parent_category_id));
         if ($level >= LEVEL_MAX) {
             $objErr->arrErr['category_name'] = "※ " . LEVEL_MAX . "階層以上の登録はできません。<br>";
         }
     }
     // 重複チェック
     if (!isset($objErr->arrErr['category_name']) && !isset($objErr->arrErr['parent_category_id'])) {
         $where = "parent_category_id = ? AND category_name = ?";
         $arrCat = $objQuery->select("category_id, category_name", "dtb_category", $where, array($parent_category_id, $arrRet['category_name']));
         if (empty($arrCat)) {
             $arrCat = array(array("category_id" => "", "category_name" => ""));
         }
         // 編集中のレコード以外に同じ名称が存在する場合
         if ($arrCat[0]['category_id'] != $arrRet['category_id'] && $arrCat[0]['category_name'] == $_POST['category_name']) {
             $objErr->arrErr['category_name'] = "※ 既に同じ内容の登録が存在します。<br>";
         }
     }
     return $objErr->arrErr;
 }
 /**
  * Page のプロセス(モバイル).
  *
  * @return void
  */
 function mobileProcess()
 {
     $objView = new SC_MobileView();
     $objCustomer = new SC_Customer();
     $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
     $next = $offset;
     // レイアウトデザインを取得
     $objLayout = new SC_Helper_PageLayout_Ex();
     $objLayout->sfGetPageLayout($this, false, DEF_LAYOUT);
     // 規約内容の取得
     $objQuery = new SC_Query();
     $count = $objQuery->count("dtb_kiyaku", "del_flg <> 1");
     $objQuery->setorder("rank DESC");
     $objQuery->setlimitoffset(1, $offset);
     $arrRet = $objQuery->select("kiyaku_title, kiyaku_text", "dtb_kiyaku", "del_flg <> 1");
     if ($count > $offset + 1) {
         $next++;
     } else {
         $next = -1;
     }
     $max = count($arrRet);
     $this->tpl_kiyaku_text = "";
     for ($i = 0; $i < $max; $i++) {
         $this->tpl_kiyaku_text .= $arrRet[$i]['kiyaku_title'] . "\n\n";
         $this->tpl_kiyaku_text .= $arrRet[$i]['kiyaku_text'] . "\n\n";
     }
     $objView->assign("offset", $next);
     $objView->assignobj($this);
     $objView->display(SITE_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     //---- ページ初期設定
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objDate = new SC_Date();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_GET['send_id'])) {
         $_GET['send_id'] = "";
     }
     if (!isset($_GET['mode'])) {
         $_GET['mode'] = "";
     }
     if (!isset($_POST['search_pageno'])) {
         $_POST['search_pageno'] = "";
     }
     // 削除時
     if (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) && $_GET['mode'] == 'delete') {
         $sql = "UPDATE dtb_send_history SET del_flg = 1 WHERE send_id = ?";
         $conn->query($sql, array($_GET['send_id']));
         $_SERVER['QUERY_STRING'] = "";
         $this->reload();
     }
     $col = "*";
     $from = "dtb_send_history";
     $where = " del_flg = ?";
     $arrval[] = "0";
     $objQuery = new SC_Query();
     // 行数の取得
     $linemax = $objQuery->count($from, $where, $arrval);
     $this->tpl_linemax = $linemax;
     // 何件が該当しました。表示用
     // ページ送りの取得
     $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, SEARCH_PMAX, "fnNaviSearchPage", NAVI_PMAX);
     $this->tpl_strnavi = $objNavi->strnavi;
     // 表示文字列
     $startno = $objNavi->start_row;
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
     // 表示順序
     $order = "start_date DESC, send_id DESC";
     $objQuery->setorder($order);
     // 検索結果の取得
     $this->arrDataList = $objQuery->select($col, $from, $where, $arrval);
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }