Example #1
0
/**
 * lpo.php
 * @param string aid 案件ID
 * @param string pid パターンID
 */
try {
	// パラメータ取得
	$array = array_merge((array)$_POST, (array)$_GET);
	$code = 'nm240mbtst';
	$ankenId = $array['aid'];
	$patternId = $array['pid'];

	// 処理オブジェクト
	$core = new CampaignCore();

	$lpo = new LpoModel($core, $code, $ankenId);
	$lpo->selectedPattern($patternId);
	$html = $lpo->createHtml();
	echo $html;

} catch (Exception $e) {

	// ログ出力
	$core = new CampaignCore();
	$log =& $core->getLogger('index.' . $code);
	$msg = $e->__toString();
	$msg = 'query_string.' . $_SERVER['QUERY_STRING'] . ': ' . $msg;
	$log->fatal($msg);

	// 例外ページ表示
	$smarty =& $core->getSmarty();
Example #2
0
	/**
	 * 実行します
	 * @exception Index_AnkenNotFountException "案件情報を特定できない"
	 * @exception Index_MediaNotFountException "提携メディアテーブルがありません" "提携メディア特定できない"
	 * @exception Index_DeadLineException 実施期間外
	 * @exception Index_UnknownAnkenTypeException "未知の実施タイプです"
	 * @exception Index_UnknownDeviceTypeException "未知のデバイスタイプです"
	 * @exception Index_LandingPageNotFountException "未知のデバイスタイプです"
	 */
	public function main() {
$log =& $this->_core->getLogger($this->_code.".index");
$log->debug('index.main.begin');
		try {
			// パラメータ値
			$code = $this->_code;
			$mediaId = $this->_mediaId;
$log->debug('index.main.mediaid.'.$mediaId);

			/////////////////////////
			// 案件特定
			/////////////////////////

			$anken =& $this->getAnken($code);
			$this->_anken =& $anken;
$log->debug('index.main.get.anken');

			/////////////////////////
			// 提携メディア特定
			/////////////////////////

			$teikei =& $this->getTeikeiMedia($mediaId);
			$this->_teikeiMedia =& $teikei;
$log->debug('index.main.get.teikei');

$log->debug('index.main.check.kikan');
			// 期間チェック
			$this->checkKikan($anken, $teikei);
$log->debug('index.main.check.kikan,ok');


			/////////////////////////
			// クッキー処理
			/////////////////////////
			header("P3P: policyref'/w3c/p3p.xml', CP='UNI CUR OUR'");

			//---------------------------
			// lpo
			//---------------------------
			$lpo = new LpoModel($this->_core, $this->_code, $this->_anken['anken_id']);
			$patternId = $lpo->getSelectedPatternId();

			/////////////////////////
			// PVクッキーを取得
			/////////////////////////

			$pv = $this->getCookiePv();
			// PVクッキー情報がない場合は設定
			if (empty($pv) == true) {
$log->debug('index.main.set.cookiePv');
				// クッキーを設定
				$this->setCookiePv();
				// PVカウントアップ(DB)
				$this->countUpPv($teikei);
$log->debug('db.pv.countup');
				// LPO PVカウントアップ
				$this->countUpLpoPv($teikei, $patternId);
$log->debug('db.lpopv.countup');
			} else {
				$log->debug('cookie.pv.exist');
			}

			/////////////////////////
			// クッキーIDを更新
			// 訪問回数関係なくクッキー更新、DB更新
			/////////////////////////

			// 新しいクッキーIDを作成
			$cookieId = $this->createNewCookieId();
			// 新しいクッキーIDをクッキーに書き込む
			$this->setCookieId($cookieId);
			// 新しいクッキーIDでDBも更新
			$sessionId = $this->insertDbSeesion($cookieId, $teikei, $patternId);
$log->debug('db.session_id.' . $sessionId);

			/////////////////////////
			// 実施タイプ別に実行します。
			// 0:リダイレクト 1:ランディング
			/////////////////////////
			$type = $anken['type_cd'];
			if ($type == 1) {

$log->debug('index.main.type.redirect');
				// リダイレクト
				$url = $this->getRedirectUrl($anken, $teikei);
				if (empty($url) == true) {
					
					// 本番飛び先URLが未設定
					throw new Index_RealUrlException();
					
				} else {
					
					$this->redirect($url);
					
				}

			} else if ($type == 2) {

$log->debug('index.main.type.landing');
				// ランディングタイプ
				$page = $this->getLandingPagePath();
				$this->landing($page, $lpo);
				exit;

			} else {

$log->debug('index.main.type.unkown');
				// 未知の実施タイプ
				throw new Index_UnknownAnkenTypeException("未知の実施タイプです。type:".$type);
			}
$log->debug('index.main.end');

		} catch (CampaignException $e) {

			/////////////////////////
			// 例外処理
			// 表示用にパラメータを設定
			/////////////////////////

$log->debug('index.campaignexception');
			// 例外表示用
			$name = $anken['campaign_error_link_name'];
			$url = $anken['campaign_error_link_url'];
			if (empty($name) == false && empty($url) == false) {
				$e->assign('client_name', $name);
				$e->assign('client_url', $url);
			}

			// 例外ページを表示するため、上へスロー
			throw $e;

		} catch (Exception $e) {

			/////////////////////////
			// 想定外の例外処理
			/////////////////////////

$log->debug('index.exception');
			throw $e;
		}
	}
Example #3
0
	/**
	 * 実行します
	 */
	public function main() {

		try {
			//--------------------------
			// 案件特定
			// AnkenNotFountException
			//--------------------------
			$anken =& $this->getAnken($this->_code);
			$this->_anken =& $anken;
			$this->_log->debug('anken_id.' .  $this->_anken['anken_id'] . '.' . $this->_code);

			//--------------------------
			// 提携メディア特定
			// TeikeiMediaNotFountException
			//--------------------------
			$teikei =& $this->getTeikeiMedia($this->_mediaId);
			$this->_teikeiMedia =& $teikei;
			$this->_log->debug('media_id.' .  $this->_teikeiMedia['media_id']);

			//--------------------------
			// 休止期間チェック
			// SuspendException
			//--------------------------
			$this->checkSuspend($anken, $teikei);
			$this->_log->debug('suspend_check.ok');

			//--------------------------
			// 期間チェック
			// DeadLineException
			//--------------------------
			$this->checkKikan($anken, $teikei);
			$this->_log->debug('kikan_check.ok');

			//--------------------------
			// クッキー処理準備
			//--------------------------
			header("P3P: policyref'/w3c/p3p.xml', CP='UNI CUR OUR'");

			//---------------------------
			// lpo
			//---------------------------
			$lpo = new LpoModel($this->_core, $this->_code, $this->_anken['anken_id']);
			$patternId = $lpo->getSelectedPatternId();

			//--------------------------
			// PVクッキーを取得とカウントアップ
			// DBException
			//--------------------------
			$pv = $this->getCookiePv();
			// PVクッキー情報がない場合は設定
			if (empty($pv) == true) {
				// クッキーを設定
				$this->setCookiePv();
				// PVカウントアップ(DB)
				$this->countUpPv($teikei);
				$this->_log->debug('db.pv.countup');
				// LPO PVカウントアップ
				$this->countUpLpoPv($teikei, $patternId);
				$this->_log->debug('db.lpopv.countup');
			} else {
				$this->_log->debug('cookie.pv.exist');
			}

			//--------------------------
			// クッキーIDを更新
			// 訪問回数関係なくクッキー更新、DB追加
			// DBException
			//--------------------------
			// 新しいクッキーIDを作成
			$cookieId = $this->createNewCookieId();
			$this->_log->debug('cookie.id.new.' . $cookieId);
			// 新しいクッキーIDをクッキーに書き込む
			$this->setCookieId($cookieId);
			// 新しいクッキーIDでDB(セッションテーブル)に追加
			$sessionId = $this->insertDbSeesion($cookieId, $teikei, $patternId);
			$this->_log->debug('db.session_id.' . $sessionId);

			//--------------------------
			// 実施タイプ別に実行します
			// RedirectUrlException
			// Index_LandingPageNotFountException
			//--------------------------
			// 1:リダイレクト 2:ランディング
			$type = $anken['type_cd'];
			if ($type == 1) {
				// リダイレクト
				$this->_log->debug('db.redirect');
				// 飛び先取得しリダイレクト
				$url = $this->getRedirectUrl($anken, $teikei);
				$this->_log->debug('db.redirect.' . $url);
				$this->redirect($url);

			} else if ($type == 2) {
				// ランディングタイプ
				$this->_log->debug('db.landing');
				// ランディングページパス取得し、表示
				$path = $this->getLandingPagePath();
				$this->_log->debug('db.landing.' . $path);
				$this->landing($path, $lpo);

			} else {
				// 未知の実施タイプ
				throw new Index_UnknownAnkenTypeException($type);
			}
			exit;

		} catch (CampaignException $e) {

			//--------------------------
			// 例外処理
			//--------------------------
			// 例外表示用(企業名とリンク)
			$name = $anken['campaign_error_link_name'];
			$url = $anken['campaign_error_link_url'];
			if (empty($name) == false && empty($url) == false) {
				$e->assign('client_name', $name);
				$e->assign('client_url', $url);
			}
			throw $e;

		} catch (Exception $e) {

			//--------------------------
			// 想定外の例外処理
			//--------------------------
			$this->_log->fatal('unexpected: ' . get_class($e));
			throw $e;
		}
	}
Example #4
0
	/**
	 * 実行します
	 */
	public function main() {

		try {
			//--------------------------
			// 案件特定
			// AnkenNotFountException
			//--------------------------
			$anken =& $this->getAnken($this->_code);
			$this->_anken =& $anken;
			$this->_log->debug('anken_id.' .  $this->_anken['anken_id'] . '.' . $this->_code);

			//--------------------------
			// 提携メディア特定
			// TeikeiMediaNotFountException
			//--------------------------
			$teikei =& $this->getTeikeiMedia($this->_mediaId);
			$this->_teikeiMedia =& $teikei;
			$this->_log->debug('media_id.' .  $this->_teikeiMedia['media_id']);

			//--------------------------
			// 期間チェック
			// DeadLineException
			//--------------------------
			$this->checkKikan($anken, $teikei);
			$this->_log->debug('kikan_check.ok');

			//---------------------------
			// lpo
			//---------------------------
			$lpo = new LpoModel($this->_core, $this->_code, $this->_anken['anken_id']);
			$patternId = $lpo->getSelectedPatternId();

			//--------------------------
			//モバイル端末情報取得
			//--------------------------
			$mob = new MobileUserAgent();

			//--------------------------
			// PVクッキーを取得とカウントアップ
			// DBException
			//--------------------------
			$this->countUpPv($teikei);
			$this->_log->debug('db.pv.countup');
			$this->countUpPvMobile($teikei, $mob->_carrier);
			$this->_log->debug('db.pv.countupMobile');
			// LPO PVカウントアップ
			$this->countUpLpoPv($teikei, $patternId);
			$this->_log->debug('db.lpopv.countup');

			//--------------------------
			// 新しいクッキーIDでDB(セッションテーブル)に追加
			//--------------------------
			// モバイルの場合セッションはnull
			$cookieId = null;
			$sessionId = $this->insertDbSeesion($cookieId, $teikei, $mob, $patternId);
			$this->_log->debug('db.session_id.' . $sessionId);

			//--------------------------
			// 実施タイプ別に実行します
			// RedirectUrlException
			// IndexMobile_LandingPageNotFountException
			//--------------------------
			// 1:リダイレクト 2:ランディング
			$type = $anken['type_cd'];
			if ($type == 1) {
				// リダイレクト
				$this->_log->debug('db.redirect');
				
				// 飛び先取得しリダイレクト
				$url = $this->getRedirectUrl($anken, $teikei, $sessionId);
				$this->_log->debug('db.redirect.' . $url);
				$this->redirect($url);

			} else if ($type == 2) {
				// ランディングタイプ
				$this->_log->debug('db.landing');
				// ランディングページパス取得し、表示
				$path = $this->getLandingPagePath();
				$this->_log->debug('db.landing.' . $path);
				$this->landing($path, $sessionId, $lpo);

			} else {
				// 未知の実施タイプ
				throw new IndexMobile_UnknownAnkenTypeException($type);
			}
			exit;
			
		} catch (CampaignException $e) {

			//--------------------------
			// 例外処理
			//--------------------------
			// 例外表示用(企業名とリンク)
			$name = $anken['campaign_error_link_name'];
			$url = $anken['campaign_error_link_url'];
			if (empty($name) == false && empty($url) == false) {
				$e->assign('client_name', $name);
				$e->assign('client_url', $url);
			}
			throw $e;

		} catch (Exception $e) {

			//--------------------------
			// 想定外の例外処理
			//--------------------------
			$this->_log->fatal('unexpected: ' . get_class($e));
			throw $e;
		}
	}