<?php
/**
 * @copyright ONE/DEPO Project
 * @license   PHP License 3.01 <http://www.php.net/license/3_01.txt>
 */


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * メールマガジン更新完了
 *
 * @package     Admin.Mailmanage.Mailmagazine.Done
 * @author      netnee <mail@example.com>
 * @access      public
 */
class Admin_Mailmanage_Mailmagazine_Done
{
    var $session;
    
    var $d_mail;
    
    var $mailcd;
    var $mailtitle;
    var $mailbody;
    var $senddate;
    var $sendstate;
    var $target;
    var $updcnt;
    var $upduser;
    
    var $title;
    var $actionnm;
    var $pagename;
    
    function execute()
    {
        $data = $this->session->getParameter("mailmag");
        
        // 送信日・送信状態を固定
        $this->senddate = NULL;
        $this->sendstate = 0;
        
        if (empty($data["mailcd"])){
            // 新規登録
            $ret = $this->d_mail->insert($data["mailtitle"], 
                                            $data["mailbody"], 
//                                            $data["senddate"],
                                            $this->senddate,
//                                            $data["sendstate"],
                                            $this->sendstate,
                                            $data["target"],
                                            $this->upduser);
        } else {
            // 更新
            $ret = $this->d_mail->update($data["mailcd"],
                                            $data["mailtitle"], 
                                            $data["mailbody"], 
//                                            $data["senddate"],
                                            $this->senddate,
//                                            $data["sendstate"],
                                            $this->sendstate,
                                            $data["target"],
                                            $data["updcnt"],
                                            $this->upduser);
        }
        
        $this->session->removeParameter("mailmag");
        
        if (!$ret) return 'input';
        return 'success';
    }
}
?>
