Example #1
0
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     global $objCampaignSess;
     $objView = new SC_SiteView(false);
     $objQuery = new SC_Query();
     $objCampaignSess = new SC_CampaignSession();
     // ディレクトリ名を取得
     $dir_name = dirname($_SERVER['PHP_SELF']);
     $arrDir = split('/', $dir_name);
     $dir_name = $arrDir[count($arrDir) - 1];
     /* セッションにキャンペーンデータを書き込む */
     // キャンペーンからの遷移という情報を保持
     $objCampaignSess->setIsCampaign();
     // キャンペーンIDを保持
     $campaign_id = $objQuery->get("dtb_campaign", "campaign_id", "directory_name = ? AND del_flg = 0", array($dir_name));
     $objCampaignSess->setCampaignId($campaign_id);
     // キャンペーンディレクトリ名を保持
     $objCampaignSess->setCampaignDir($dir_name);
     // カートに入れないページの場合のページ(申込のみページ)へリダイレクト
     $cart_flg = $objQuery->get("dtb_campaign", "cart_flg", "campaign_id = ?", array($campaign_id));
     if (!$cart_flg) {
         $this->sendRedirect($this->getLocation(CAMPAIGN_URL . "{$dir_name}/application.php"));
         exit;
     }
     // キャンペーンが開催中かをチェック
     if ($this->lfCheckActive($dir_name, $objQuery)) {
         $status = CAMPAIGN_TEMPLATE_ACTIVE;
     } else {
         $status = CAMPAIGN_TEMPLATE_END;
     }
     if ($_GET['init'] != "") {
         $this->tpl_init = 'false';
         $this->lfDispProductsList($_GET['ids'], $objQuery);
     } else {
         $this->tpl_init = 'true';
     }
     switch ($_POST['mode']) {
         case 'cart':
             $this->arrErr = $this->lfCheckError($_POST['product_id']);
             if (count($this->arrErr) == 0) {
                 $objCartSess = new SC_CartSession();
                 $classcategory_id = "classcategory_id" . $_POST['product_id'];
                 $classcategory_id1 = $_POST[$classcategory_id . '_1'];
                 $classcategory_id2 = $_POST[$classcategory_id . '_2'];
                 $quantity = "quantity" . $_POST['product_id'];
                 // 規格1が設定されていない場合
                 if (!$this->tpl_classcat_find1[$_POST['product_id']]) {
                     $classcategory_id1 = '0';
                 }
                 // 規格2が設定されていない場合
                 if (!$this->tpl_classcat_find2[$_POST['product_id']]) {
                     $classcategory_id2 = '0';
                 }
                 $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
                 $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity], $campaign_id);
                 $this->sendRedirect($this->getLocation(URL_CART_TOP));
                 exit;
             }
             break;
         default:
             break;
     }
     // 入力情報を渡す
     $this->arrForm = $_POST;
     $this->tpl_dir_name = CAMPAIGN_TEMPLATE_PATH . $dir_name . "/" . $status;
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     global $objCampaignSess;
     $objView = new SC_SiteView(false);
     $objQuery = new SC_Query();
     $objCustomer = new SC_Customer();
     $objCampaignSess = new SC_CampaignSession();
     // クッキー管理クラス
     $objCookie = new SC_Cookie(COOKIE_EXPIRE);
     $objLoginFormParam = new SC_FormParam();
     // ログインフォーム用
     $this->lfInitLoginFormParam($objLoginFormParam);
     // 初期設定
     $objLoginFormParam->setParam($_POST);
     // POST値の取得
     // ディレクトリ名を取得
     $dir_name = dirname($_SERVER['PHP_SELF']);
     $arrDir = split('/', $dir_name);
     $dir_name = $arrDir[count($arrDir) - 1];
     /* セッションにキャンペーンデータを書き込む */
     // キャンペーンからの遷移という情報を保持
     $objCampaignSess->setIsCampaign();
     // キャンペーンIDを保持
     $campaign_id = $objQuery->get("dtb_campaign", "campaign_id", "directory_name = ? AND del_flg = 0", array($dir_name));
     $objCampaignSess->setCampaignId($campaign_id);
     // キャンペーンディレクトリ名を保持
     $objCampaignSess->setCampaignDir($dir_name);
     // キャンペーンが開催中かをチェック
     if ($this->lfCheckActive($dir_name, $objQuery)) {
         $status = CAMPAIGN_TEMPLATE_ACTIVE;
         $this->is_active = true;
     } else {
         $status = CAMPAIGN_TEMPLATE_END;
         $this->is_active = false;
     }
     switch ($_POST['mode']) {
         // ログインチェック
         case 'login':
             $objLoginFormParam->toLower('login_email');
             $this->arrErr = $objLoginFormParam->checkError();
             $arrForm = $objLoginFormParam->getHashArray();
             // クッキー保存判定
             if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") {
                 $objCookie->setCookie('login_email', $_POST['login_email']);
             } else {
                 $objCookie->setCookie('login_email', '');
             }
             if (count($this->arrErr) == 0) {
                 // ログイン判定
                 if (!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) {
                     // 仮登録の判定
                     $where = "email = ? AND status = 1 AND del_flg = 0";
                     $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email']));
                     if ($ret > 0) {
                         SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
                     } else {
                         SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
                     }
                 } else {
                     // 重複申込チェック
                     $orverlapping_flg = $objQuery->get("dtb_campaign", "orverlapping_flg", "campaign_id = ?", array($objCampaignSess->getCampaignId()));
                     if ($orverlapping_flg) {
                         if ($this->lfOverlappingCheck($objCustomer->getValue('customer_id'), $objQuery)) {
                             $this->arrErr['login_email'] = "※ 複数回ご応募することは出来ません。";
                         }
                     }
                     if (count($this->arrErr) == 0) {
                         // 申込情報を登録
                         $this->lfRegistCampaignOrder($objCustomer->getValue('customer_id'), $objQuery);
                         // 完了ページへリダイレクト
                         $this->sendRedirect($this->getLocation(CAMPAIGN_URL . "{$dir_name}/complete.php"));
                         exit;
                     }
                 }
             }
             break;
         default:
             break;
     }
     // 入力情報を渡す
     $this->arrForm = $_POST;
     $this->dir_name = $dir_name;
     $this->tpl_dir_name = CAMPAIGN_TEMPLATE_PATH . $dir_name . "/" . $status;
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display($this->tpl_mainpage);
 }