source: branches/beta/html/admin/basis/mail_edit.php @ 16803

Revision 16803, 3.2 KB checked in by satou, 15 years ago (diff)

文言修正

Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9class LC_Page {
10    var $arrSession;
11    var $tpl_mode;
12    function LC_Page() {
13        $this->tpl_mainpage = "basis/mail_edit.tpl";
14        $this->tpl_subnavi = "basis/subnavi.tpl";
15        $this->tpl_mainno = "basis";
16        $this->tpl_subno = "mail";
17        $this->tpl_subtitle = "¥á¡¼¥ëÀßÄê";
18    }
19}
20
21$objQuery = new SC_Query();
22$objPage = new LC_Page();
23$objView = new SC_AdminView();
24$objSess = new SC_Session();
25
26//ǧ¾Ú²ÄÈݤÎȽÄê
27sfIsSuccess($objSess);
28
29$objPage->arrMailTEMPLATE = $arrMAILTEMPLATE;
30$objPage->arrSendType = $arrMailType;
31
32// ÊÔ½¸/¿·µ¬
33if ($_POST['mode'] == "edit") {
34    if (sfCheckNumLength($_POST['template_id']) === true) {
35        $result = $objQuery->select("*", "dtb_mailtemplate", "template_id = ?", array($_POST['template_id']));
36        if ($result) {
37            $objPage->arrForm = $result[0];
38        } else {
39            $objPage->arrForm['template_id'] = $_POST['template_id'];
40        }
41    } else {
42        $objPage->arrForm['template_id'] = 0;
43    }
44
45// ÅÐÏ¿
46} elseif ($_POST['mode'] == "regist" && sfCheckNumLength($_POST['template_id']) === true) {
47    // POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
48    $objPage->arrForm = lfConvertParam($_POST);
49    $objPage->arrErr = fnErrorCheck($objPage->arrForm);
50    // ¥¨¥é¡¼
51    if ($objPage->arrErr) {
52        $objPage->tpl_msg = "¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿";
53    // Àµ¾ï
54    } else {
55        lfRegist($objQuery, $objPage->arrForm, $_POST['template_id']);
56        sfReload("mode=complete");
57    }
58
59// ´°Î»
60} elseif ($_GET['mode'] == 'complete') {
61    $objPage->tpl_mainpage = "basis/mail_complete.tpl";
62}
63
64$objView->assignobj($objPage);
65$objView->display(MAIN_FRAME);
66
67//-----------------------------------------------------------------------------------------------------------------------------------
68
69function lfRegist($objQuery, $arrVal, $id) {
70    $sqlval['template_name'] = $arrVal['template_name'];
71    $sqlval['subject'] = $arrVal['subject'];
72    $sqlval['creator_id'] = $_SESSION['member_id'];
73    $sqlval['body'] = $arrVal['body'];
74    $sqlval['send_type'] = $arrVal['send_type'];
75    $sqlval['update_date'] = "now()";
76   
77    $result = $objQuery->count("dtb_mailtemplate", "template_id=?", array($id));
78    if ($result > 0) {
79        $objQuery->update("dtb_mailtemplate", $sqlval, "template_id=?", array($id));
80    } else {
81        $sqlval['create_date'] = "now()";
82        $objQuery->insert("dtb_mailtemplate", $sqlval);
83    }
84}
85
86function lfConvertParam($array) {
87    $new_array["send_type"] = $array["send_type"];
88    $new_array["template_id"] = $array["template_id"];
89    $new_array["template_name"] = mb_convert_kana($array["template_name"],"KV");
90    $new_array["subject"] = mb_convert_kana($array["subject"] ,"KV");
91    $new_array["body"] = mb_convert_kana($array["body"] ,"KV");
92   
93    return $new_array;
94}
95
96/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
97function fnErrorCheck($array) {
98    $objErr = new SC_CheckError($array);
99    $objErr->doFunc(array("¥á¡¼¥ë¤Î¼ïÎà",'send_type'), array("EXIST_CHECK"));
100    $objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_id'), array("EXIST_CHECK"));
101    $objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_name'), array("EXIST_CHECK"));
102    $objErr->doFunc(array("¥á¡¼¥ë¥¿¥¤¥È¥ë",'subject',MTEXT_LEN,"BIG"), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
103    $objErr->doFunc(array("¥á¡¼¥ë¤ÎÆâÍÆ",'body',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK","EXIST_CHECK"));
104   
105    return $objErr->arrErr;
106}
107
108?>
Note: See TracBrowser for help on using the repository browser.