<?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 Seller_Itemexhibit_Valuation_List
{
    var $auth;
    var $c_valuation;

    var $averagevaluation;
    var $valuationlist;

    /**
     * [[機能説明]]
     *
     * @access  public
     */
    function execute()
    {
        $averagevaluation = 0;
        $membercd = $this->auth->getAuthData("membercd");
        $valuations = $this -> c_valuation -> selectByMembercd($membercd);

        foreach($valuations as $key => $item){
            $this -> valuationlist[] = $item;
            $this -> valuationlist[$key]["adddate"] = date('Y/m/d', strtotime($item["adddate"]));
            $averagevaluation += $item["valuation"];
        }
        
        // 0割り対応 
        if (count($this -> valuationlist)>0) {
            $averagevaluation /= count($this -> valuationlist);
        } else {
        	$averagevaluation = 0;
        }
        $this -> averagevaluation = round($averagevaluation, 1);

        $log =& LogFactory::getLog();
        $log->debug("Seller_Itemexhibit_Valuation_Listが実行されました", "Seller_Itemexhibit_Valuation_List#execute");
        return 'success';
    }
}
?>
