/**
  * 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);
     }
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objView = new SC_SiteView(false);
     $objQuery = new SC_Query();
     // 正しく値が取得できない場合はキャンペーンTOPへ
     if ($_GET['campaign_id'] == "" || $_GET['status'] == "") {
         $this->sendRedirect($this->getLocation(URL_CAMPAIGN_TOP));
         exit;
     }
     // statusの判別
     switch ($_GET['status']) {
         case 'active':
             $status = CAMPAIGN_TEMPLATE_ACTIVE;
             break;
         case 'end':
             $status = CAMPAIGN_TEMPLATE_END;
             break;
         default:
             $status = CAMPAIGN_TEMPLATE_ACTIVE;
             break;
     }
     // ディレクトリ名を取得名
     $directory_name = $objQuery->get("dtb_campaign", "directory_name", "campaign_id = ?", array($_GET['campaign_id']));
     $template_dir = CAMPAIGN_TEMPLATE_PATH . $directory_name . "/" . $status . "preview.tpl";
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display($template_dir);
 }
Example #3
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;
}
 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'));
 }
 /**
  * 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);
 }
 function install(array $arrPlugin, SC_Plugin_Installer $installer)
 {
     $plugin_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     $upload_plugin_dir = PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"] . DIRECTORY_SEPARATOR;
     $backup_plugin_dir = PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"] . "_" . date("Ymd") . DIRECTORY_SEPARATOR;
     if (!is_dir($backup_plugin_dir)) {
         SC_Utils_Ex::sfCopyDir($upload_plugin_dir, $backup_plugin_dir);
     }
     SC_Helper_FileManager_Ex::deleteFile($upload_plugin_dir, false);
     SC_Utils_Ex::sfCopyDir($plugin_dir . "/", $upload_plugin_dir);
     SC_Utils_Ex::sfCopyDir($plugin_dir . "/copy/Smarty/templates/admin/", TEMPLATE_ADMIN_REALDIR);
     SC_Utils_Ex::sfCopyDir($plugin_dir . "/copy/modules/", DATA_REALDIR . "module/");
     // logo コピー
     $installer->copyDirectory("copy/plugin_dir/", "");
     $table = "dtb_products";
     $fields = array('auto_display_status' => $this->intColumn('自動公開'), 'auto_display_start_date' => $this->timestampColumn('公開開始日'), 'auto_display_end_date' => $this->timestampColumn('公開終了日'));
     $type = "timestamp";
     $definition = compact("type");
     foreach ($fields as $name => $define) {
         $this->objDb->sfColumnExists($table, $name, $define["type"], "", true);
         $this->fieldComment($installer, $table, $name, $define["comment"]);
         switch ($define["type"]) {
             case "timestamp":
                 break;
             default:
                 continue;
         }
         $change = array();
         $change[$name] = compact('definition');
         $this->objManager->alterTable($table, compact("change"), false);
     }
     $this->objQuery->update("dtb_products", array(), "auto_display_start_date IS NULL", array(), array("auto_display_start_date" => "create_date"));
     $masterfields = array("id" => $this->intColumn("ID"), "name" => $this->textColumn("NAME"), "rank" => $this->intColumn("RANK"));
     $table = "atd_mtb_auto_display_status";
     if ($this->objDb->sfColumnExists($table, "id") == false) {
         $this->objManager->createTable($table, $masterfields);
     }
     foreach ($masterfields as $name => $define) {
         $this->objDb->sfColumnExists($table, $name, $define["type"], "", true);
         $this->fieldComment($installer, $table, $name, $define["comment"]);
     }
     $this->masterdata->deleteMasterData($table);
     $this->masterdata->clearCache($table);
     $this->masterdata->registMasterData($table, array(), explode(",", "常時公開,時限公開"));
     // $this->insertMasterData ( "PRODUCTS_RESULT_ROWSPAN", 1, '管理画面/商品管理一覧 行結合数' );
     // $this->insertMasterData ( "PRODUCTS_RESULT_COLUMN", 5, '管理画面/商品管理一覧 列位置' );
     // $this->insertMasterData ( "PRODUCTS_SEARCH_AUTO_DISPLAY", 1, '検索画面表示設定(1: ON/ 0:OFF)' );
     // $this->insertMasterData ( "PRODUCTS_DETAIL_AUTO_DISPLAY", 1, '検索画面表示設定(1: ON/ 0:OFF)' );
 }
    /**
     * デストラクタ.
     *
     * @return void
     */
    function lfGetRecommendProducts($product_id)
    {
        $objQuery = new SC_Query();
        $cols = '*, (SELECT COUNT(*) FROM dtb_order_detail WHERE product_id = alldtl.product_id) AS cnt';
        $from = 'vw_products_allclass_detail AS alldtl';
        $where = <<<__EOS__
            del_flg = 0
            AND status = 1
            AND product_id IN (
                SELECT product_id
                FROM
                    dtb_order_detail
                    INNER JOIN dtb_order
                        ON dtb_order_detail.order_id = dtb_order.order_id
                WHERE 0=0
                    AND dtb_order.del_flg = 0
                    AND dtb_order.order_id IN (
                        SELECT order_id
                        FROM dtb_order_detail
                        WHERE 0=0
                            AND product_id = ?
                    )
                    AND dtb_order_detail.product_id <> ?
            )
__EOS__;
        $objQuery->setorder('cnt DESC, RANDOM()');
        $objQuery->setlimit($this->max);
        $recommendProducts = $objQuery->select($cols, $from, $where, array($product_id, $product_id));
        return $recommendProducts;
    }
 /**
  * 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);
 }
 function setUp()
 {
     $this->objQuery =& SC_Query::getSingletonInstance();
     $this->objQuery->begin();
     $this->objPage = new LC_Page_Admin_Products_ProductClass_Mock();
     $this->objPage->init();
     $this->now = "2010-01-01 00:00:00";
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->objQuery =& SC_Query::getSingletonInstance();
     $this->objQuery->begin();
     $arrRet = $this->objQuery->getOne('SELECT MAX(customer_id) FROM dtb_customer');
     $this->customer_id = $arrRet;
     $this->objAddress = new SC_Helper_Address_Ex();
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objSubView = new SC_SiteView();
     $objCart = new SC_CartSession();
     $objSiteInfo = new SC_SiteInfo();
     if (count($_SESSION[$objCart->key]) > 0) {
         // カート情報を取得
         $arrCartList = $objCart->getCartList();
         // カート内の商品ID一覧を取得
         $arrAllProductID = $objCart->getAllProductID();
         // 商品が1つ以上入っている場合には商品名称を取得
         if (count($arrAllProductID) > 0) {
             $objQuery = new SC_Query();
             $arrVal = array();
             $sql = "";
             $sql = "SELECT name FROM dtb_products WHERE product_id IN ( ?";
             $arrVal = array($arrAllProductID[0]);
             for ($i = 1; $i < count($arrAllProductID); $i++) {
                 $sql .= " ,? ";
                 array_push($arrVal, $arrAllProductID[$i]);
             }
             $sql .= " )";
             $arrProduct_name = $objQuery->getAll($sql, $arrVal);
             foreach ($arrProduct_name as $key => $val) {
                 $arrCartList[$key]['product_name'] = $val['name'];
             }
         }
         // 店舗情報の取得
         $arrInfo = $objSiteInfo->data;
         // 購入金額合計
         $ProductsTotal = $objCart->getAllProductsTotal($arrInfo);
         // 合計個数
         $TotalQuantity = $objCart->getTotalQuantity();
         // 送料無料までの金額
         $arrCartList[0]['ProductsTotal'] = $ProductsTotal;
         $arrCartList[0]['TotalQuantity'] = $TotalQuantity;
         $deliv_free = $arrInfo['free_rule'] - $ProductsTotal;
         $arrCartList[0]['free_rule'] = $arrInfo['free_rule'];
         $arrCartList[0]['deliv_free'] = $deliv_free;
         $this->arrCartList = $arrCartList;
     }
     $objSubView->assignobj($this);
     $objSubView->display($this->tpl_mainpage);
 }
    /**
     * SC_Queryインスタンスに設定された検索条件をもとに対象商品数を取得する.
     *
     * 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります.
     *
     * @param SC_Query $objQuery SC_Query インスタンス
     * @param array $arrVal 検索パラメーターの配列
     * @return array 対象商品ID数
     */
    public function findProductCount(&$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('P.product_id, A.name, B.name');
        return $objQuery->get('COUNT(DISTINCT(alldtl.product_id))', $table, '', $arrVal);
    }
 /**
  * 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();
     $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);
 }
 /**
  * dtb_module に WebPay のエントリを挿入する
  *
  * 初期化用。インストール時に実行する
  * @return boolean テーブルを更新したときは true
  */
 public static function insert()
 {
     $objQuery = SC_Query::getSingletonInstance();
     $objQuery->setLimit(1);
     $arrModule = $objQuery->select('module_id, sub_data', 'dtb_module', 'module_code = ?', array(MDL_WEBPAY_CODE));
     if ($arrModule !== NULL && !empty($arrModule)) {
         return false;
     }
     $arrVal = array('module_id' => MDL_WEBPAY_ID, 'module_code' => MDL_WEBPAY_CODE, 'module_name' => 'WebPay決済モジュール', 'auto_update_flg' => 0, 'del_flg' => 0, 'create_date' => 'CURRENT_TIMESTAMP', 'update_date' => 'CURRENT_TIMESTAMP');
     if ($objQuery->insert('dtb_module', $arrVal) !== 1) {
         die('WebPayモジュールの初期化に失敗しました');
     }
     return true;
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objSess = new SC_Session();
     $objQuery = new SC_Query();
     $objDb = new SC_Helper_DB_Ex();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         case 'delete':
             // ランク付きレコードの削除
             $objDb->sfDeleteRankRecord("dtb_deliv", "deliv_id", $_POST['deliv_id']);
             // 再表示
             SC_Utils_Ex::sfReload();
             break;
         case 'up':
             $objDb->sfRankUp("dtb_deliv", "deliv_id", $_POST['deliv_id']);
             // 再表示
             SC_Utils_Ex::sfReload();
             break;
         case 'down':
             $objDb->sfRankDown("dtb_deliv", "deliv_id", $_POST['deliv_id']);
             // 再表示
             SC_Utils_Ex::sfReload();
             break;
         default:
             break;
     }
     // 配送業者一覧の取得
     $col = "deliv_id, name, service_name";
     $where = "del_flg = 0";
     $table = "dtb_deliv";
     $objQuery->setorder("rank DESC");
     $this->arrDelivList = $objQuery->select($col, $table, $where);
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * 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 = 'dtb_products AS alldtl';
     if (is_array($this->arrOrderData) and $objQuery->order == '') {
         $o_col = $this->arrOrderData['col'];
         $o_table = $this->arrOrderData['table'];
         $o_order = $this->arrOrderData['order'];
         $objQuery->setOrder("T2.{$o_col} {$o_order}");
         $objQuery->setLimit(1);
         $sub_sql = $objQuery->getSqlWithLimit($o_col, "{$o_table} AS T2", 'T2.product_id = alldtl.product_id');
         $objQuery->setOrder("({$sub_sql}) {$o_order}, product_id");
     }
     $arrReturn = $objQuery->getCol('alldtl.product_id', $table, '', $arrVal);
     return $arrReturn;
 }
 function getPublicKey()
 {
     $objQuery = new SC_Query();
     $arrRet = $objQuery->select('*', 'dtb_ownersstore_settings');
     return isset($arrRet[0]['public_key']) ? $arrRet[0]['public_key'] : null;
 }
 function lfRegistData($payment_id = "")
 {
     $objQuery = new SC_Query();
     $sqlval = $this->objFormParam->getHashArray();
     $arrRet = $this->objUpFile->getDBFileList();
     // ファイル名の取得
     $sqlval = array_merge($sqlval, $arrRet);
     $sqlval['update_date'] = 'Now()';
     if ($sqlval['fix'] != '1') {
         $sqlval['fix'] = 2;
         // 自由設定
     }
     // 新規登録
     if ($payment_id == "") {
         // INSERTの実行
         $sqlval['creator_id'] = $_SESSION['member_id'];
         $sqlval['rank'] = $objQuery->max("dtb_payment", "rank") + 1;
         $sqlval['create_date'] = 'Now()';
         $objQuery->insert("dtb_payment", $sqlval);
         // 既存編集
     } else {
         $where = "payment_id = ?";
         $objQuery->update("dtb_payment", $sqlval, $where, array($payment_id));
     }
 }
 function lfInsertProductClass($arrList, $product_id)
 {
     $objQuery = new SC_Query();
     $objQuery->begin();
     // 既存規格の削除
     $where = "product_id = ?";
     $objQuery->delete("dtb_products_class", $where, array($product_id));
     $cnt = 1;
     // すべての規格を登録する。
     while ($arrList["classcategory_id1:" . $cnt] != "") {
         if ($arrList["check:" . $cnt] == 1) {
             $sqlval = array();
             $sqlval['product_id'] = $product_id;
             $sqlval['classcategory_id1'] = $arrList["classcategory_id1:" . $cnt];
             $sqlval['classcategory_id2'] = $arrList["classcategory_id2:" . $cnt];
             if (strlen($arrList["product_class_id:" . $cnt]) > 0) {
                 $sqlval['product_class_id'] = $arrList["product_class_id:" . $cnt];
             }
             $sqlval['product_code'] = $arrList["product_code:" . $cnt];
             $sqlval['stock'] = $arrList["stock:" . $cnt];
             $sqlval['stock_unlimited'] = $arrList["stock_unlimited:" . $cnt];
             $sqlval['price01'] = $arrList['price01:' . $cnt];
             $sqlval['price02'] = $arrList['price02:' . $cnt];
             $sqlval['creator_id'] = $_SESSION['member_id'];
             $sqlval['create_date'] = "now()";
             $sqlval['update_date'] = "now()";
             // INSERTの実行
             $objQuery->insert("dtb_products_class", $sqlval);
         }
         $cnt++;
     }
     $objQuery->commit();
 }
Example #21
0
 /**
  * ガーベジコレクションを実行する.
  *
  * 引数 $maxlifetime の代りに 定数 MAX_LIFETIME を使用する.
  *
  * @param integer $maxlifetime セッションの有効期限(使用しない)
  */
 function sfSessGc($maxlifetime)
 {
     // MAX_LIFETIME以上更新されていないセッションを削除する。
     if (!$this->objDb->sfTabaleExists("dtb_session")) {
         return false;
     }
     $objQuery = new SC_Query();
     $where = "update_date < current_timestamp + '-" . MAX_LIFETIME . " secs'";
     $objQuery->delete("dtb_session", $where);
     return true;
 }
 /**
  * 商品情報を取得する(vw_products_allclass使用)
  *
  * @param SC_Query $objQuery DB操作クラス
  * @return array $arrProduct 取得結果を配列で返す
  */
 function lfGetProductsAllclass(&$objQuery)
 {
     // --- 商品一覧の取得
     $objQuery->setWhere('del_flg = 0 AND status = 1');
     $objQuery->setOrder('product_id');
     $objProduct = new SC_Product_Ex();
     $arrProductLsit = $objProduct->lists($objQuery);
     // 各商品のカテゴリIDとランクの取得
     $arrProducts = array();
     foreach ($arrProductLsit as $key => $val) {
         $sql = '';
         $sql .= ' SELECT';
         $sql .= '   T1.category_id,';
         $sql .= '   T1.rank AS product_rank,';
         $sql .= '   T2.rank AS category_rank';
         $sql .= ' FROM';
         $sql .= '   dtb_product_categories AS T1';
         $sql .= ' LEFT JOIN';
         $sql .= '   dtb_category AS T2';
         $sql .= ' ON';
         $sql .= '   T1.category_id = T2.category_id';
         $sql .= ' WHERE';
         $sql .= '   product_id = ?';
         $arrCategory = $objQuery->getAll($sql, array($val['product_id']));
         if (!empty($arrCategory)) {
             $arrProducts[$key] = array_merge($val, $arrCategory[0]);
         }
     }
     // 税込金額を設定する
     SC_Product_Ex::setIncTaxToProducts($arrProducts);
     return $arrProducts;
 }
 /**
  * ページレイアウトテーブルにデータ更新を行う.
  *
  * @param array $arrUpdData 更新データ
  * @return integer 更新結果
  */
 function lfUpdPageData($arrUpdData = array())
 {
     $objQuery = new SC_Query();
     $sql = "";
     // SQL生成
     $sql .= " UPDATE ";
     $sql .= "     dtb_pagelayout ";
     $sql .= " SET ";
     $sql .= "     author = ? , ";
     $sql .= "     description = ? , ";
     $sql .= "     keyword = ? ";
     $sql .= " WHERE ";
     $sql .= "     page_id = ? ";
     $sql .= " ";
     // SQL実行
     $ret = $objQuery->query($sql, $arrUpdData);
     return $ret;
 }
 /**
  * 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);
 }
 private function updateModuleSetting($arrSetting)
 {
     $objQuery = SC_Query::getSingletonInstance();
     if ($objQuery->begin() !== MDB2_OK) {
         die('WebPayモジュールの初期化に失敗しました');
     }
     $arrVal = array('sub_data' => serialize($arrSetting), 'update_date' => 'CURRENT_TIMESTAMP');
     $objQuery->update('dtb_module', $arrVal, 'module_code = ?', array(MDL_WEBPAY_CODE));
     if ($objQuery->commit() !== MDB2_OK) {
         die('WebPayモジュールの初期化に失敗しました');
     }
 }
 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);
     }
 }
Example #27
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;
 }
Example #28
0
    /**
     * 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;
    }
 /**
  * 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);
 }
Example #30
0
 function lfBatOrderAgeSub($sql, $start, $end, $start_age, $end_age, $member)
 {
     $objQuery = new SC_Query();
     $arrRet = $objQuery->getall($sql, array($start, $end));
     $sqlval = $arrRet[0];
     // 空文字を"0"に変換
     foreach ($sqlval as $key => $val) {
         if ($val == "") {
             $sqlval[$key] = "0";
         }
     }
     $sqlval['create_date'] = "now()";
     $sqlval['order_date'] = $start;
     $sqlval['start_age'] = "{$start_age}";
     $sqlval['end_age'] = "{$end_age}";
     $sqlval['member'] = "{$member}";
     $objQuery->insert("dtb_bat_order_daily_age", $sqlval);
 }