source: branches/beta/html/admin/mail/template_input.php @ 17

Revision 17, 2.8 KB checked in by uehara, 16 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   
11    var $arrSession;
12    var $site_info;
13    var $objDate;
14    var $arrForm;
15    var $mode;
16    var $arrMagazineType;
17    var $title;
18   
19    function LC_Page() {
20        $this->tpl_mainpage = 'mail/template_input.tpl';
21        $this->tpl_mainno = 'mail';
22        $this->tpl_subnavi = 'mail/subnavi.tpl';
23        $this->tpl_subno = "template";
24    }
25}
26
27$conn = new SC_DBConn();
28$objPage = new LC_Page();
29$objView = new SC_AdminView();
30$objSess = new SC_Session();
31
32// ǧ¾Ú²ÄÈݤÎȽÄê
33sfIsSuccess($objSess);
34
35$objPage->arrMagazineType = $arrMagazineType;
36$objPage->mode = "regist";
37
38// id¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤È¤­¤Ï¡ÖÊÔ½¸¡×ɽ¼¨
39if ( $_REQUEST['template_id'] ){
40    $objPage->title = "ÊÔ½¸";
41} else {
42    $objPage->title = "¿·µ¬ÅÐÏ¿";
43}
44
45// ¥â¡¼¥É¤Ë¤è¤ë½èÍýʬ´ô
46if ( $_GET['mode'] == 'edit' && sfCheckNumLength($_GET['template_id'])===true ){
47   
48    // ÊÔ½¸
49    $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND del_flg = 0";
50    $result = $conn->getAll($sql, array($_GET['template_id']));
51    $objPage->arrForm = $result[0];
52   
53       
54} elseif ( $_POST['mode'] == 'regist' ) {
55   
56    // ¿·µ¬ÅÐÏ¿
57    $objPage->arrForm = lfConvData( $_POST );
58    $objPage->arrErr = lfErrorCheck($objPage->arrForm);
59   
60    if ( ! $objPage->arrErr ){
61        // ¥¨¥é¡¼¤¬Ìµ¤¤¤È¤­¤ÏÅÐÏ¿¡¦ÊÔ½¸
62        lfRegistData( $objPage->arrForm, $_POST['template_id']);   
63        sfReload("mode=complete");  // ¼«Ê¬¤òºÆÆɹþ¤·¤Æ¡¢´°Î»²èÌ̤ØÁ«°Ü
64    }
65   
66} elseif ( $_GET['mode'] == 'complete' ) {     
67   
68    // ´°Î»²èÌÌɽ¼¨
69    $objPage->tpl_mainpage = 'mail/template_complete.tpl';
70   
71}
72
73
74
75
76
77
78$objView->assignobj($objPage);
79$objView->display(MAIN_FRAME);
80
81
82function lfRegistData( $arrVal, $id = null ){
83   
84    $query = new SC_Query();
85   
86    $sqlval['subject'] = $arrVal['subject'];
87    $sqlval['mail_method'] = $arrVal['mail_method'];
88    $sqlval['creator_id'] = $_SESSION['member_id'];
89    $sqlval['body'] = $arrVal['body'];
90    $sqlval['update_date'] = "now()";
91
92    if ( $id ){
93        $query->update("dtb_mailmaga_template", $sqlval, "template_id=".$id );
94    } else {
95        $sqlval['create_date'] = "now()";
96        $query->insert("dtb_mailmaga_template", $sqlval);
97    }
98}
99
100function lfConvData( $data ){
101   
102     // ʸ»úÎó¤ÎÊÑ´¹¡Êmb_convert_kana¤ÎÊÑ´¹¥ª¥×¥·¥ç¥ó¡Ë                         
103    $arrFlag = array(
104                      "subject" => "KV"
105                     ,"body" => "KV"
106                    );
107       
108    if ( is_array($data) ){
109        foreach ($arrFlag as $key=>$line) {
110            $data[$key] = mb_convert_kana($data[$key], $line);
111        }
112    }
113
114    return $data;
115}
116
117// ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
118function lfErrorCheck() {
119    $objErr = new SC_CheckError();
120   
121    $objErr->doFunc(array("¥á¡¼¥ë·Á¼°", "mail_method"), array("EXIST_CHECK", "ALNUM_CHECK"));
122    $objErr->doFunc(array("Subject", "subject", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
123    $objErr->doFunc(array("ËÜʸ", 'body', LLTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
124
125    return $objErr->arrErr;
126}
127
128
129
130?>
Note: See TracBrowser for help on using the repository browser.