<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * 竞拍的操作列
 *
 * @author yzxh24
 */
Yii::import('zii.widgets.grid.CButtonColumn');
class SaleList extends CButtonColumn
{
    public $header;

    public $buttons = array(
        'edit' => array(
            'label' => '修改',
            'url' => 'Yii::app()->controller->createUrl("/admin/sale/update",array("id"=>$data->id))',
            'type' => 'raw',
            'visible' => '$data->win_uid == 0'
        ),
        'complete' => array(
            'label' => '结束',
            'url' => 'Yii::app()->controller->createUrl("/admin/sale/complete",array("id"=>$data->id))',
            'type' => 'raw',
            'visible' => '$data->win_uid == 0',
            'class' => 'complete',
        ),
    );

    protected function initDefaultButtons()
    {
        parent::initDefaultButtons();

        $confirmation="if(!confirm(".CJavaScript::encode(Yii::t('zii','确定拍卖已经完成?')).")) return false;";
        $this->buttons['complete']['click']=<<<EOD
function() {
	$confirmation
	$.fn.yiiGridView.update('{$this->grid->id}', {
		type:'POST',
		url:$(this).attr('href'),
		success:function() {
			$.fn.yiiGridView.update('{$this->grid->id}');
		}
	});
	return false;
}
EOD;
    }
}
