Changeset 20211
- Timestamp:
- 2011/02/19 22:11:56 (13 years ago)
- Location:
- branches/version-2_5-dev
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/Smarty/templates/admin/mail/template_input.tpl
r20116 r20211 54 54 <form name="form1" id="form1" method="post" action="?" onSubmit="return lfnCheckSubmit();"> 55 55 <input type="hidden" name="mode" value="<!--{$mode}-->" /> 56 <input type="hidden" name="template_id" value="<!--{$arrForm.template_id }-->" />56 <input type="hidden" name="template_id" value="<!--{$arrForm.template_id|h}-->" /> 57 57 <div id="mail" class="contents-main"> 58 58 <table class="form"> -
branches/version-2_5-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail_TemplateInput.php
r20203 r20211 49 49 $this->tpl_subtitle = 'テンプレート設定'; 50 50 $this->tpl_subno = "template"; 51 $this->mode = "regist"; 51 52 $masterData = new SC_DB_MasterData_Ex(); 52 53 $this->arrMagazineType = $masterData->getMasterData("mtb_magazine_type"); 53 // arrMagazineTypAll ではないため, unset する.54 unset($this->arrMagazineType['3']);55 54 } 56 55 … … 71 70 */ 72 71 function action() { 73 $obj Query = new SC_Query();72 $objMailHelper = new SC_Helper_Mail_Ex(); 74 73 $objSess = new SC_Session(); 75 74 … … 77 76 SC_Utils_Ex::sfIsSuccess($objSess); 78 77 79 80 $this->mode = "regist";81 82 // idが指定されているときは「編集」表示83 if (!isset($_REQUEST['template_id'])) $_REQUEST['template_id'] = "";84 if ( $_REQUEST['template_id'] ){85 $this->title = "編集";86 } else {87 $this->title = "新規登録";88 }89 90 78 switch ($this->getMode()) { 91 79 case 'edit': 92 // モードによる処理分岐80 // 編集 93 81 if ( SC_Utils_Ex::sfIsInt($_GET['template_id'])===true ){ 94 // 編集 95 $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND del_flg = 0"; 96 $result = $objQuery->getAll($sql, array($_GET['template_id'])); 97 $this->arrForm = $result[0]; 82 $arrMail = $objMailHelper->sfGetMailTemplate($_GET['template_id']); 83 $this->arrForm = $arrMail[0]; 98 84 } 99 85 break; 100 86 case 'regist': 101 87 // 新規登録 102 $this->arrForm = $this->lfConvData( $_POST ); 103 $this->arrErr = $this->lfErrorCheck($this->arrForm); 104 105 if ( ! $this->arrErr ){ 88 $objFormParam = new SC_FormParam(); 89 90 $this->lfInitParam($objFormParam); 91 $objFormParam->setParam($_POST); 92 $this->arrErr = $objFormParam->checkError(); 93 $this->arrForm = $objFormParam->getHashArray(); 94 95 if (SC_Utils_Ex::isBlank($this->arrErr)) { 106 96 // エラーが無いときは登録・編集 107 $this->lfRegistData( $ this->arrForm, $_POST['template_id']);97 $this->lfRegistData( $objFormParam, $_POST['template_id']); 108 98 // 自分を再読込して、完了画面へ遷移 109 99 $this->objDisplay->reload(array("mode" => "complete")); 100 } else { 101 $this->arrForm['template_id'] = $_POST['template_id']; 110 102 } 111 103 break; … … 128 120 } 129 121 130 function lfRegistData( $arrVal, $id = null ){ 122 /** 123 * メルマガテンプレートデータの登録・更新を行う 124 * 125 * @param SC_FormParam $objFormParam SC_FormParam インスタンス 126 * @param integer template_id 更新時は指定 127 * @return void 128 */ 129 function lfRegistData( &$objFormParam, $template_id = null ){ 130 131 $objQuery =& SC_Query::getSingletonInstance(); 132 $sqlval = $objFormParam->getDbArray(); 131 133 132 $objQuery = new SC_Query();133 134 $sqlval['subject'] = $arrVal['subject'];135 $sqlval['mail_method'] = $arrVal['mail_method'];136 134 $sqlval['creator_id'] = $_SESSION['member_id']; 137 $sqlval['body'] = $arrVal['body'];138 135 $sqlval['update_date'] = "now()"; 139 136 140 if ( $id ){ 141 $objQuery->update("dtb_mailmaga_template", $sqlval, "template_id=".$id ); 137 if ( SC_Utils_Ex::sfIsInt($template_id) ){ 138 // 更新時 139 $objQuery->update("dtb_mailmaga_template", $sqlval, "template_id=".$template_id ); 142 140 } else { 141 // 新規登録時 143 142 $sqlval['create_date'] = "now()"; 144 143 $sqlval['template_id'] = $objQuery->nextVal('dtb_mailmaga_template_template_id'); … … 147 146 } 148 147 149 function lfConvData( $data ){ 150 151 // 文字列の変換(mb_convert_kanaの変換オプション) 152 $arrFlag = array( 153 "subject" => "KV" 154 ,"body" => "KV" 155 ); 156 157 if ( is_array($data) ){ 158 foreach ($arrFlag as $key=>$line) { 159 $data[$key] = mb_convert_kana($data[$key], $line); 160 } 161 } 162 163 return $data; 148 /** 149 * お問い合わせ入力時のパラメータ情報の初期化を行う. 150 * 151 * @param SC_FormParam $objFormParam SC_FormParam インスタンス 152 * @return void 153 */ 154 function lfInitParam(&$objFormParam) { 155 $objFormParam->addParam("メール形式", 'mail_method', INT_LEN, "n", array("EXIST_CHECK","ALNUM_CHECK")); 156 $objFormParam->addParam("Subject", 'subject', STEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK")); 157 $objFormParam->addParam("本文", 'body', LLTEXT_LEN, "KVCa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK")); 164 158 } 165 159 166 // 入力エラーチェック167 function lfErrorCheck() {168 $objErr = new SC_CheckError();169 170 $objErr->doFunc(array("メール形式", "mail_method"), array("EXIST_CHECK", "ALNUM_CHECK"));171 $objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));172 $objErr->doFunc(array("本文", 'body', LLTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));173 174 return $objErr->arrErr;175 }176 160 } 177 161 ?> -
branches/version-2_5-dev/html/install/sql/column_comment.sql
r20198 r20211 100 100 INSERT INTO dtb_table_comment (id, table_name, column_name, description) VALUES (414, 'dtb_order', 'deliv_pref', '都道府県'); 101 101 INSERT INTO dtb_table_comment (id, table_name, column_name, description) VALUES (100, 'dtb_mailmaga_template', 'subject', '件名'); 102 INSERT INTO dtb_table_comment (id, table_name, column_name, description) VALUES (102, 'dtb_mailmaga_template', 'mail_method', '1:テキストメール 2:HTMLメール 3:HTMLTEMPLATE');102 INSERT INTO dtb_table_comment (id, table_name, column_name, description) VALUES (102, 'dtb_mailmaga_template', 'mail_method', '1:テキストメール 2:HTMLメール'); 103 103 INSERT INTO dtb_table_comment (id, table_name, column_name, description) VALUES (103, 'dtb_mailmaga_template', 'header', 'ヘッダーテキスト'); 104 104 INSERT INTO dtb_table_comment (id, table_name, column_name, description) VALUES (104, 'dtb_mailmaga_template', 'body', '本文(テキスト登録用)'); -
branches/version-2_5-dev/html/install/sql/insert_data.sql
r20207 r20211 745 745 INSERT INTO mtb_magazine_type (id, name, rank) VALUES (1, 'HTML', 0); 746 746 INSERT INTO mtb_magazine_type (id, name, rank) VALUES (2, 'テキスト', 1); 747 INSERT INTO mtb_magazine_type (id, name, rank) VALUES (3, 'HTMLテンプレート', 2);748 747 749 748 INSERT INTO mtb_mail_magazine_type (id, name, rank) VALUES (1, 'HTMLメール', 0);
Note: See TracChangeset
for help on using the changeset viewer.