Source for file LC_Page_Admin_Order_Pdf.php

Documentation is available at LC_Page_Admin_Order_Pdf.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once(CLASS_PATH . "pages/LC_Page.php");
  26. require_once(CLASS_PATH . "SC_Fpdf.php");
  27.  
  28. /**
  29.  * 帳票出力 のページクラス.
  30.  *
  31.  * @package Page
  32.  * @author LOCKON CO.,LTD.
  33.  * @version $Id$
  34.  */
  35. class LC_Page_Admin_Order_Pdf extends LC_Page {
  36.  
  37.     // }}}
  38.     // {{{ functions
  39.  
  40.     /**
  41.      * Page を初期化する.
  42.      *
  43.      * @return void 
  44.      */
  45.     function init() {
  46.         parent::init();
  47.         $this->tpl_mainpage = 'order/pdf_input.tpl';
  48.         $this->tpl_subnavi = 'order/subnavi.tpl';
  49.         $this->tpl_mainno = 'order';
  50.         $this->tpl_subno = 'pdf';
  51.         $this->tpl_subtitle = '帳票出力';
  52.  
  53.             $this->SHORTTEXT_MAX = STEXT_LEN;
  54.             $this->MIDDLETEXT_MAX = MTEXT_LEN;
  55.             $this->LONGTEXT_MAX = LTEXT_LEN;
  56.  
  57.             $this->arrType[0]  = "納品書";
  58.  
  59.             $this->arrDownload[0] = "ブラウザに開く";
  60.             $this->arrDownload[1] = "ファイルに保存";
  61.     }
  62.  
  63.     /**
  64.      * Page のプロセス.
  65.      *
  66.      * @return void 
  67.      */
  68.     function process() {
  69.         $conn = new SC_DBConn();
  70.         $objView = new SC_AdminView();
  71.         $objDb = new SC_Helper_DB_Ex();
  72.         $objSess = new SC_Session();
  73.  
  74.         $objDate = new SC_Date(1901);
  75.         $objDate->setStartYear(RELEASE_YEAR);
  76.         $this->arrYear = $objDate->getYear();
  77.         $this->arrMonth = $objDate->getMonth();
  78.         $this->arrDay = $objDate->getDay();
  79.  
  80.         // 認証可否の判定
  81.         SC_Utils_Ex::sfIsSuccess($objSess);
  82.  
  83.         // 画面遷移の正当性チェック用にuniqidを埋め込む
  84.         $objPage->tpl_uniqid = $objSess->getUniqId();
  85.  
  86.         // パラメータ管理クラス
  87.         $this->objFormParam = new SC_FormParam();
  88.         // パラメータ情報の初期化
  89.         $this->lfInitParam();
  90.         $this->objFormParam->setParam($_POST);
  91.  
  92.         if (!isset($_POST['mode'])) $_POST['mode'] = "";
  93.         if (!isset($arrRet)) $arrRet = array();
  94.  
  95.         switch($_POST['mode']) {
  96.         case "confirm":
  97.             // 入力値の変換
  98.             $this->objFormParam->convParam();
  99.             $this->arrErr = $this->lfCheckError($arrRet);
  100.             $arrRet = $this->objFormParam->getHashArray();
  101.             $this->arrForm = $arrRet;
  102.             // エラー入力なし
  103.             if (count($this->arrErr) == 0) {
  104.                 $i = 0;
  105.                 $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']);
  106.                 foreach ($arrRet['order_id'] AS $key=>$val) {
  107.                     $arrPdfData = $arrRet;
  108.                     $arrPdfData['order_id'] = $val;
  109.                     $objFpdf->setData($arrPdfData);
  110.                     ++$i;
  111.                 }
  112.                 $objFpdf->createPdf();
  113.             }
  114.             break;
  115.         default:
  116.             // タイトルをセット
  117.             $arrForm['title'] = "お買上げ明細書(納品書)";
  118.  
  119.             // 今日の日付をセット
  120.             $arrForm['year']  = date("Y");
  121.             $arrForm['month'] = date("m");
  122.             $arrForm['day']   = date("d");
  123.  
  124.             // メッセージ
  125.             $arrForm['msg1'] = 'このたびはお買上げいただきありがとうございます。';
  126.             $arrForm['msg2'] = '下記の内容にて納品させていただきます。';
  127.             $arrForm['msg3'] = 'ご確認いただきますよう、お願いいたします。';
  128.  
  129.             // 受注番号があったら、セットする
  130.             if(SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
  131.                   $arrForm['order_id'][0] = $_GET['order_id'];
  132.             } elseif (is_array($_POST['pdf_order_id'])) {
  133.                 sort($_POST['pdf_order_id']);
  134.                 foreach ($_POST['pdf_order_id'] AS $key=>$val) {
  135.                       $arrForm['order_id'][] = $val;
  136.                 }
  137.             }
  138.  
  139.             $this->arrForm = $arrForm;
  140.             break;
  141.         }
  142.  
  143.         $objView->assignobj($this);
  144.         $objView->display($this->tpl_mainpage);
  145.     }
  146.  
  147.     /**
  148.      * デストラクタ.
  149.      *
  150.      * @return void 
  151.      */
  152.     function destroy() {
  153.         parent::destroy();
  154.     }
  155.  
  156.     /* パラメータ情報の初期化 */
  157.     function lfInitParam() {
  158.         $this->objFormParam->addParam("受注番号", "order_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
  159.         $this->objFormParam->addParam("発行日", "year", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
  160.         $this->objFormParam->addParam("発行日", "month", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
  161.         $this->objFormParam->addParam("発行日", "day", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
  162.         $this->objFormParam->addParam("帳票の種類", "type", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
  163.         $this->objFormParam->addParam("ダウンロード方法", "download", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
  164.         $this->objFormParam->addParam("帳票タイトル", "title", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
  165.         $this->objFormParam->addParam("帳票メッセージ1行目", "msg1", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
  166.         $this->objFormParam->addParam("帳票メッセージ2行目", "msg2", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
  167.         $this->objFormParam->addParam("帳票メッセージ3行目", "msg3", STEXT_LEN*3/5, "KVa", array("MAX_LENGTH_CHECK"));
  168.         $this->objFormParam->addParam("備考1行目", "etc1", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
  169.         $this->objFormParam->addParam("備考2行目", "etc2", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
  170.         $this->objFormParam->addParam("備考3行目", "etc3", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
  171.         $this->objFormParam->addParam("ポイント表記", "disp_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
  172.     }
  173.  
  174.     /* 入力内容のチェック */
  175.     function lfCheckError() {
  176.         // 入力データを渡す。
  177.         $arrRet =  $this->objFormParam->getHashArray();
  178.         $objErr = new SC_CheckError($arrRet);
  179.         $objErr->arrErr = $this->objFormParam->checkError();
  180.  
  181.         // 特殊項目チェック
  182.         $objErr->doFunc(array("発行日", "year", "month", "day"), array("CHECK_DATE"));
  183.  
  184.         return $objErr->arrErr;
  185.     }
  186.  
  187.  
  188. }
  189.  
  190. ?>

Documentation generated on Tue, 28 Apr 2009 18:11:26 +0900 by phpDocumentor 1.4.2