Source for file LC_Page_CampaignApplication.php
Documentation is available at LC_Page_CampaignApplication.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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(CLASS_PATH . "pages/LC_Page.php");
* キャンペーンアプリケーション のページクラス.
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_CampaignApplication.php 18734 2010-06-22 08:45:33Z nanasess $
$this->tpl_mainpage = TEMPLATE_DIR . '/campaign/application.tpl';
$objLoginFormParam->setParam($_POST); // POST値の取得
$dir_name = dirname($_SERVER['PHP_SELF']);
$arrDir = split('/', $dir_name);
$dir_name = $arrDir[count($arrDir) - 1];
/* セッションにキャンペーンデータを書き込む */
$objCampaignSess->setIsCampaign();
$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);
$status = CAMPAIGN_TEMPLATE_ACTIVE;
$status = CAMPAIGN_TEMPLATE_END;
$this->is_active = false;
$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']);
$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']));
SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR);
SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR);
$orverlapping_flg = $objQuery->get("dtb_campaign", "orverlapping_flg", "campaign_id = ?", array($objCampaignSess->getCampaignId()));
if($this->lfOverlappingCheck($objCustomer->getValue('customer_id'), $objCampaignSess->getCampaignId(), $objQuery)) {
$this->arrErr['login_email'] = "※ 複数回ご応募することは出来ません。";
if(count($this->arrErr) == 0) {
$this->dir_name = $dir_name;
$this->tpl_dir_name = CAMPAIGN_TEMPLATE_PATH . $dir_name . "/" . $status;
$objView->assignobj($this);
* 関数名:lfInitLoginFormParam()
$objLoginFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
$objLoginFormParam->addParam("メールアドレス", "login_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$objLoginFormParam->addParam("パスワード", "login_pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
* 戻り値:キャンペーン中なら true 終了なら false
$col = "limit_count, total_count, start_date, end_date";
$arrRet = $objQuery->select($col, "dtb_campaign", "directory_name = ? AND del_flg = 0", array($directory_name));
$start_date = (date("YmdHis", strtotime($arrRet[0]['start_date'])));
$now_date = (date("YmdHis"));
// キャンペーンが開催期間で、かつ申込制限内である
if($now_date > $start_date && $now_date < $end_date
&& ($arrRet[0]['limit_count'] > $arrRet[0]['total_count'] || $arrRet[0]['limit_count'] < 1)) {
* 関数名:lfRegistCampaignOrder()
$campaign_id = $objCampaignSess->getCampaignId();
$arrCustomer = $objQuery->select($cols, "dtb_customer", "customer_id = ?", array($customer_id));
$sqlval = $arrCustomer[0];
$sqlval['campaign_id'] = $campaign_id;
$sqlval['create_date'] = 'now()';
$objQuery->insert("dtb_campaign_order", $sqlval);
$total_count = $objQuery->get("dtb_campaign", "total_count", "campaign_id = ?", array($campaign_id));
$arrCampaign['total_count'] = $total_count += 1;
$objQuery->update("dtb_campaign", $arrCampaign, "campaign_id = ?", array($campaign_id));
* 関数名:lfOverlappingCheck()
* 戻り値:フラグ (重複があったら true 重複がなかったら false)
$count = $objQuery->count("dtb_campaign_order", "customer_id = ? AND campaign_id = ?", array($customer_id, $campaign_id));
Documentation generated on Fri, 24 Feb 2012 13:59:15 +0900 by Seasoft
|