<?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.Complete
 * @author      netnee <mail@example.com>
 * @access      public
 */
class Admin_Imguploader_Complete
{
    var $view;
    
    var $imgtypedivlist;
    var $nmtypedivlist;
    var $title;
    var $pagename;
    var $div;
    
    var $imgtypediv;
    var $generalcd;
    var $generalsub;
    var $imgcd;
    var $imgintotitle;
    var $fromaction;
    
    var $mode_s;
    var $mode_m;
    var $mode_l;
    var $mode_logo;
    var $mode_main;
    var $mode_mov;

    
    var $upduser;
    
    // マスタメンテ部関連
    var $srcword;
    var $srcrecommenddiv;
    var $srcdispnum;
    var $srccastdiv;
    var $from;
    
    
    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Admin_Imguploader_Completeが実行されました", "Admin_Imguploader_Complete#execute");
        
        
        $this->imgcd  = $this->generalcd;
        $this->imgcd .= (!empty($this->generalsub)) ? "-".$this->generalsub : "";

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

        if (!empty($this->mode_l)){
            if (!$this->view->setItemImage($this->mode_l, $this->generalcd, $this->generalsub, $this->imgtypediv, 'L', $this->upduser)){
                $log->error("debug : image_L failed", "Admin_Imguploader_Complete#execute");
                return 'failed';
            }
        }

        if (!empty($this->mode_m)){
            if (!$this->view->setItemImage($this->mode_m, $this->generalcd, $this->generalsub, $this->imgtypediv, 'M', $this->upduser)){
                $log->error("debug : image_M failed", "Admin_Imguploader_Complete#execute");
                return 'failed';
            }
        }

        if (!empty($this->mode_s)){
            if (!$this->view->setItemImage($this->mode_s, $this->generalcd, $this->generalsub, $this->imgtypediv, 'S', $this->upduser)){
                $log->error("debug : image_S failed", "Admin_Imguploader_Complete#execute");
                return 'failed';
            }
        }
        
        if (!empty($this->mode_logo)){
            if (!$this->view->setItemImage($this->mode_logo, $this->generalcd, $this->generalsub, $this->imgtypediv, 'logo', $this->upduser)){
                $log->error("debug : image_logo failed", "Admin_Imguploader_Complete#execute");
                return 'failed';
            }
        }
        
        if (!empty($this->mode_main)){
            if (!$this->view->setItemImage($this->mode_main, $this->generalcd, $this->generalsub, $this->imgtypediv, 'main', $this->upduser)){
                $log->error("debug : image_main failed", "Admin_Imguploader_Complete#execute");
                return 'failed';
            }
        }
        
        if (!empty($this->mode_mov)){
            if (!$this->view->setItemMovie($this->mode_mov, $this->generalcd, $this->generalsub, $this->upduser)){
                $log->error("debug : item_movie failed", "Admin_Imguploader_Complete#execute");
                return 'failed';
            }
        }

        
        $this->view->delWorkImage($this->imgcd);
        $this->view->delCacheImage($this->imgcd, $this->imgtypediv);
        
        $log->debug("debug : success", "Admin_Imguploader_Complete#execute");
        return 'success';
    }

}
?>
