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


//JSONを扱うためのパーサ
//require_once(WEBAPP_DIR."/JSON.php");

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

/**
 * [[機能説明]]
 *
 * @package     [[package名]]
 * @author      Your Name <mail@example.com>
 * @access      public
 */
class Customer_Itemattribute_Tag_Complete
{
    var $c_tag;
    var $auth;

    var $ac;
    var $cd;
    var $tags;
    var $pagetype;
    var $buttonname;
    var $buttonurl;
	
    /**
     * [[機能説明]]
     *
     * @access  public
     */
    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Customer_Itemattribute_Tag_Completeが実行されました", "Customer_Itemattribute_Tag_Complete#execute");

        //すでにタグが登録されているか
        $this->itemmytag = $this->c_tag->getMyTag($this->auth->getAuthData("membercd"), $this->cd);
        if( count($this->itemmytag) == 0) {
            $this -> pagetype = "登録";
        } else {
            $this -> pagetype = "変更";
        }
        
        // tagsの文字列を全/半スペースで区切り、配列に
        $this->tags = str_replace("　", " ", $this->tags);
        $this->tags = trim($this->tags);
        $tag = split(" ",$this->tags);
        
        //タグ登録
        if( $this->c_tag->renewMyTag($this->cd, $this->auth->getAuthData("membercd"), $tag) ) {
            return 'success';
        }else{
            return 'failed';
        }
    }
/*
    function checkpagetype($value)
    {
        if($value == "変更"){
            $this -> buttonname = "一覧";
            $this -> buttonurl  = "customer_itemattribute_taglist";
        }else{
            $this -> buttonname = "詳細";
            $this -> buttonurl  = "";
        }
    }
*/    
}
?>
