Exemple #1
0
 /**
  * 実行
  */
 protected function perform()
 {
     // 案件ID
     $ankenId = $this->_request['aid'];
     // モデル
     $m =& $this->_model;
     // 案件情報設定
     $anken =& $m->Anken_TeikeiEdit_getAnkenData($ankenId);
     $this->_dataFrom['anken'] =& $anken;
     // 処理振り分け
     if (isset($this->_request['submit']) == true) {
         /*****************************
          * 入力確認
          * 1.POSTから更新後のDataObjectを取得
          * 2.入力チェック
          * 3.キャンペーンコード重複チェック
          * 4.確認画面へ遷移
          *****************************/
         $this->inputCommit($m, $anken, $ankenId);
     } else {
         if (empty($ankenId) == false) {
             $init = array();
             // 入稿URL表示
             $init['media_id'] = '';
             // 案件の単価を引き継ぐ
             // メディアが確定していないため[メディアID]と表示します
             $init['price'] = $anken['price'];
             // 卸値
             $init['oroshi_price'] = '0';
             $init['extra_price'] = '0';
             $init['extra_oroshi'] = '0';
             // ダウンロードフラグ
             $init['download_flag'] = '1';
             // 案件ID
             $init['anken_id'] = $ankenId;
             // 初期値をテンプレートに渡す
             $this->_dataFrom['data'] = $init;
             // int型のメディアID
             $this->_dataFrom['int_media_id'] = '[メディアID]';
             /*******************************
              * 対象案件を表示
              * 1.表示
              *******************************/
             $this->_dataFrom['input_type'] = "input";
         } else {
             // 案件ID取得できない
             throw new RequestParamsException();
         }
     }
     ///////////////////////////////////////////
     // テンプレートに設定
     ///////////////////////////////////////////
     // 入稿URL表示
     $this->_dataFrom['domain_campaign'] = DOMAIN_CAMPAIGN;
     $e = new AnkenDeviceEnum();
     if ($anken['device_cd'] == $e->getKey('モバイル')) {
         $this->_dataFrom['url_lite'] = URL_CAMPAIGN_LITEM;
     } else {
         $this->_dataFrom['url_lite'] = URL_CAMPAIGN_LITE;
     }
     // モデル内の値をテンプレートに設定
     $d =& $m->getFormData();
     $this->appendDataFrom($d);
     // テンプレート変数追加
     $this->_dataFrom['form_action_url'] = "teikei_new.php?aid={$ankenId}";
     $this->_dataFrom['action'] = 'new';
     $this->_dataFrom['step'] = 'input';
     return 'anken/teikei_detail';
 }
Exemple #2
0
 /**
  * 実行
  */
 protected function perform()
 {
     // 案件ID
     $ankenId = $this->_request['aid'];
     // 提携メディアID
     $teikeiId = $this->_request['tmid'];
     // モデル
     $m =& $this->_model;
     // 案件情報設定
     $anken =& $m->Anken_TeikeiEdit_getAnkenData($ankenId);
     $this->_dataFrom['anken'] =& $anken;
     // 処理振り分け
     if (isset($this->_request['submit']) == true) {
         /*****************************
          * 入力確認
          * 1.POSTから更新後のDataObjectを取得
          * 2.入力チェック
          * 3.キャンペーンコード重複チェック
          * 4.確認画面へ遷移
          *****************************/
         $this->inputCommit($m, $anken, $ankenId, $teikeiId);
     } else {
         if (empty($ankenId) == false) {
             // 対象の案件を取得
             $o =& $m->getObjectByID($anken, $teikeiId);
             if ($o == null) {
                 throw new DataObjectNotFoundException('IDからデータを取得できません。');
             }
             // int型のメディアID
             $f =& $o->getField('media_id');
             if (empty($f) == false) {
                 $this->_dataFrom['int_media_id'] = intval($f->getValue());
             }
             /*******************************
              * 対象案件を表示
              * 1.案件IDから変更前のDataObjectを取得
              * 2.セッション変数に保存
              * 3.表示
              *******************************/
             $this->input($ankenId, $teikeiId, $m, $o);
         } else {
             // 案件ID取得できない
             throw new RequestParamsException();
         }
     }
     ///////////////////////////////////////////
     // テンプレートに設定
     ///////////////////////////////////////////
     // 入稿URL表示
     $this->_dataFrom['domain_campaign'] = DOMAIN_CAMPAIGN;
     $e = new AnkenDeviceEnum();
     if ($anken['device_cd'] == $e->getKey('モバイル')) {
         $this->_dataFrom['url_lite'] = URL_CAMPAIGN_LITEM;
     } else {
         $this->_dataFrom['url_lite'] = URL_CAMPAIGN_LITE;
     }
     // モデル内の値をテンプレートに設定
     $d =& $m->getFormData();
     $this->appendDataFrom($d);
     // テンプレート変数追加
     $this->_dataFrom['form_action_url'] = "teikei_edit.php?aid={$ankenId}&tmid={$teikeiId}";
     $this->_dataFrom['action'] = 'edit';
     $this->_dataFrom['step'] = 'input';
     return 'anken/teikei_detail';
 }
Exemple #3
0
 /**
  * メディア企業別原価集計DL
  *
  * @param string $targetMonth 対象年月
  * @param int $deviceSyubetsu デバイス種別
  * @param string $dir ダウンロード用ディレクトリ
  */
 public function downloadGenkahyoMedia($targetMonth, $deviceSyubetsu, $dir)
 {
     $device = new AnkenDeviceEnum();
     $deviceName = "";
     $genkahyoType = 0;
     $deviceCd = 0;
     if ($deviceSyubetsu == $device->getKey('PC')) {
         $deviceName = "mcpc";
         $genkahyoType = 1;
         $deviceCd = $device->getKey('PC');
     } else {
         if ($deviceSyubetsu == $device->getKey('モバイル')) {
             $deviceName = "mcmobile";
             $genkahyoType = 2;
             $deviceCd = $device->getKey('モバイル');
         }
     }
     // モデル
     $m =& $this->_model;
     $data['genka_list'] = $m->Result_AdminReportGenkaTotalDownload_getGenkaDataForMedia($targetMonth, $deviceCd);
     // ファイル保存
     $smarty =& $this->_core->getSmarty();
     $smarty->assign($data);
     $path = "csv_admin_report_genkahyo_media";
     $path = $this->_core->getTmplName("result/download/{$path}");
     $output = $smarty->fetch($path);
     $output = mb_convert_encoding($output, 'shift-jis', 'utf-8');
     $filename = sprintf("genka_summary_%s_%s_%s.csv", $targetMonth, $deviceName, date('YmdHis'));
     file_put_contents($dir . $filename, $output);
     $history = array("target_month" => $targetMonth, "genkahyo_type" => $genkahyoType, "genkahyo_file_name" => $filename);
     $histroyObject = $m->Result_AdminReportGenkaTotalDownload_getDownloadHistoryObject($history);
     $m->Result_AdminReportGenkaTotalDownload_insert($histroyObject);
     $this->downloadFileData($filename, $dir);
 }