Example #1
0
	/**
	 * 実施期間の終了日をチェックします。
	 * 終了日を超えた場合は、DeadLineExceptionをスローします。
	 * @attention ただしメディアIDが 99 の場合はチェックしない
	 * @param array $naken 案件情報の配列
	 * @param array $teikei 提携情報の配列
	 */
	public function checkKikan (&$anken, &$teikei) {
		$mediaId = $teikei['media_id'];
		if ($mediaId != self::TEST_MEDIA_ID) {
			// 案件期間を取得します。
			$to = $anken['campaign_to'];
			// 提携メディアを取得します。
			$teikeiTo = $teikei['teikei_to'];
			if (empty($teikeiTo) == false && $teikeiTo != "0000-00-00")	{
				$to = $teikeiTo;
			}
			// 期間チェック
			$now = date('Y-m-d');
			if ($to < $now) {
				$e = new IndexMobile_DeadLineException();
				$e->setDeadLine($to);
				throw $e;
			}
		}
	}
Example #2
0
 /**
  * Index用:実施期間の終了日をチェックします。
  * 広告掲載期間のチェックも行います。
  * 終了日を超えた場合は、IndexMobile_DeadLineExceptionをスローします。
  * @attention ただしメディアIDが 99 の場合はチェックしない
  * @param array $naken 案件情報の配列
  * @param array $teikei 提携情報の配列
  */
 public function checkIndexKikan(&$anken, &$teikei)
 {
     $mediaId = $teikei['media_id'];
     if ($mediaId != self::TEST_MEDIA_ID) {
         // 案件期間を取得します。
         $from = $anken['campaign_from'];
         $to = $anken['campaign_to'];
         // 提携メディアの提携期間を取得します。
         $teikeiFrom = $teikei['teikei_from'];
         $teikeiTo = $teikei['teikei_to'];
         // 提携メディアの広告掲載期間を取得します。
         $advertiseFrom = $teikei['advertise_from'];
         $advertiseTo = $teikei['advertise_to'];
         // 設定期間(提携メディア>案件掲載)
         if (empty($teikeiFrom) == false && $teikeiFrom != "0000-00-00") {
             $from = $teikeiFrom;
         }
         if (empty($teikeiTo) == false && $teikeiTo != "0000-00-00") {
             $to = $teikeiTo;
         }
         // 設定タイプが広告有効期限の場合
         $type = $teikei['expire_type'];
         if ($type == 2) {
             if (empty($advertiseFrom) == false && $advertiseFrom != "0000-00-00") {
                 $from = $advertiseFrom;
             } else {
                 throw new IndexMobile_AdvertiseKikanNotSetException();
             }
             if (empty($advertiseTo) == false && $advertiseTo != "0000-00-00") {
                 $to = $advertiseTo;
             } else {
                 throw new IndexMobile_AdvertiseKikanNotSetException();
             }
         }
         // 期間チェック
         $now = date('Y-m-d');
         if ($to < $now) {
             $e = new IndexMobile_DeadLineException();
             $e->setDeadLine($to);
             // 終了メッセージを取得します。
             $message = $anken['dead_line_message'];
             // 案件開始日、案件終了日の置換
             $message = $this->getDateReplacedDeadLineMessage($message, $from, $to);
             $e->setDeadLineMessage($message);
             throw $e;
         }
     }
 }