<?php print "<?php\n"; ?>

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

/**
 * モジュール操作時(move,copy,shortcut)に呼ばれるアクション
 *
 * @package     NetCommons
<?php include($this->getTemplate('maple/generate/skeleton/_doc-comment.txt')); ?>
 * @access      public
 */
class <?php print $skeleton->classname . " extends Action\n"; ?>
{
	var $mode = null;	//move or shortcut or copy
	// 移動元
	var $block_id = null;
	//var $page_id = null;
	//var $module_id = null;
	//var $unique_id = null;
	
	// 移動先
	var $move_page_id = null;
	var $move_room_id = null;
	var $move_block_id = null;
	
	// コンポーネントを受け取るため
	var $db = null;
	var $commonOperation = null;

    /**
     * モジュール操作時(move,copy,shortcut)に呼ばれるアクション
     *
     * @access  public
     */
    function execute()
    {
    	switch ($this->mode) {
    		case "move":
    			//更新
				$params = array(
					"block_id"=> intval($this->move_block_id),
					"room_id"=> intval($this->move_room_id)
				);
				$where_params = array(
					"block_id"=> intval($this->block_id)
				);
				$result = $this->db->updateExecute("<?php print $skeleton->dir_name; ?>", $params, $where_params, false);
				if($result === false) {
					return "false";
				}
				
    			//
    			// 添付ファイル更新処理
    			// WYSIWYG
    			//
    			$<?php print $skeleton->dir_name; ?> = $this->db->selectExecute("<?php print $skeleton->dir_name; ?>", $where_params);
				if($<?php print $skeleton->dir_name; ?> === false) {
					return "false";
				}
    			$upload_id_arr = $this->commonOperation->getWysiwygUploads("content,more_content", $<?php print $skeleton->dir_name; ?>);
    			$result = $this->commonOperation->updWysiwygUploads($upload_id_arr, $this->move_room_id);
    			if($result === false) {
					return "false";
				}
				break;
			default:
				return "false";
		}
		
		return "true";
    }
}
<?php print "?>\n"; ?>
