<?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     [[package名]]
 * @author      Your Name <mail@example.com>
 * @access      public
 */
class Util_Droplabel
{
    var $label;
    
    var $makercd;
    var $dropid;   // レーベル名ドロップのID
    var $selid;   // レーベル名選択済みのID
    
    /**
     * [[機能説明]]
     *
     * @access  public
     */
    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Util_Droplabelが実行されました", "Util_Droplabel#execute");

        return "success";
    }
    
    //文字出力
    function getOutput()
    {
        $label_results = array();
        if (!empty($this->makercd)) 
            $label_results = $this->label->selectMakercd($this->makercd);

        /**************************
         * 出力フォーマットは以下の通り
         * 
         * ドロップのID
         * optionのname,optionのvalue,option.selected
         * optionのname,optionのvalue,option.selected
         * ...
         * 
         */

        $out = $this->dropid ."\n0,レーベル名,false";
        foreach ($label_results as $key => $val) {
            $out .= "\n". $val["labelcd"] .",". $val["labelnm"];
            if ($this->selid == $val["labelcd"]) {
                $out .= ",true";
            } else {
                $out .= ",false";
            }
        }
        return $out;
    }
}
?>
