<?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.Imguploader.Form
 * @author      netnee <>
 * @access      public
 */
class Admin_Imguploader_Form
{
    var $image;
    var $view;

    var $imgtypedivlist;
    var $nmtypedivlist;
    var $title;
    var $pagename;
    var $div;

    var $imgtypediv;
    var $generalcd;
    var $generalsub;
    var $imgintotitle;
    var $fromaction;

    var $tmpcd;

    var $imgurllist;
    var $item_mov;
    var $mode_s;
    var $mode_m;
    var $mode_l;
    var $mode_mov;


    // マスタメンテ部関連
    var $srcword;
    var $srcrecommenddiv;
    var $srcdispnum;
    var $srccastdiv;
    var $from;
    var $makeritemcd;


    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Admin_Imguploader_Formが実行されました", "Admin_Imguploader_Form#execute");
        $log->debug("imgtypediv : " . $this->imgtypediv, "Admin_Imguploader_Form#execute");

        $this->tmpcd  = $this->generalcd;
        $this->tmpcd .= (!empty($this->generalsub)) ? "-".$this->generalsub : "";

        if (!empty($this->imgtypediv)){
            // タイトル設定
            $this->pagename = $this->nmtypedivlist[$this->imgtypediv - 1];

            // 画像 URL 取得
            $this->imgurllist = $this->view->getImageUrl($this->imgtypediv, $this->imgtypedivlist[$this->imgtypediv - 1], $this->generalcd, $this->generalsub);
        }

        if (!empty($this->imgurllist[$this->tmpcd]['S'])){
            $this->mode_s = "upd";
        } else {
            $this->mode_s = "ins";
        }
        if (!empty($this->imgurllist[$this->tmpcd]['M'])){
            $this->mode_m = "upd";
        } else {
            $this->mode_m = "ins";
        }
        if (!empty($this->imgurllist[$this->tmpcd]['L'])){
            $this->mode_l = "upd";
        } else {
            $this->mode_l = "ins";
        }
        if (!empty($this->imgurllist[$this->tmpcd]['logo'])){
            $this->mode_logo = "upd";
        } else {
            $this->mode_logo = "ins";
        }
        if (!empty($this->imgurllist[$this->tmpcd]['main'])){
            $this->mode_main = "upd";
        } else {
            $this->mode_main = "ins";
        }

        if (!empty($this->generalcd) && !empty($this->generalsub)) {
            $this->mode_mov = "ins";
            $this->item_mov = $this->view->getMovieUrl($this->generalcd, $this->generalsub);
        }

        $this->view->delWorkImage($this->tmpcd);

        return 'success';
    }

    function getImageUrl($params)
    {
        return $this->imgurllist[$params["gencd"]][$params["size"]];
    }
}
?>
