<?php $this->widget('admin.widgets.TableCover');?>
<h1>任务参与列表</h1>
<?php $this->renderPartial('_search');?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'dataProvider'=>$dataProvider,
    'itemsCssClass' => 'widefat post',
    'summaryText'=>'显示{start}-{end}条 总共{count}条',
    'columns' => array(
        'id',
        'task_id',
        array(
            'name' => '任务名',
            'value' => '$data->task->subject',
        ),
        array(
            'name' => '奖励',
            'value' => '$data->task->reward',
        ),
        'content',
        'uid',
        'username',
        array(
            'name' => 'status',
            'value' => '$data->getStatus()'
        ),
        'createdate',
        array(
            'header' => '操作',
            'class' => 'CButtonColumn',
            'template' => '{cancel} {reward}',
            'buttons' => array(
                'cancel' => array(
                    'label' => '取消',
                    'visible' => '!$data->status',
                    'url' => 'Yii::app()->controller->createUrl("/admin/tasker/cancel", array("id"=>$data->id))',
                ),
                'reward' => array(
                    'label' => '奖励',
                    'visible' => '!$data->status',
                    'url' => 'Yii::app()->controller->createUrl("/admin/tasker/reward", array("id"=>$data->id))',
                    'click' => "function () {
                                    if (!confirm('确定要奖励？')) return false;
                                    $.fn.yiiGridView.update('yw0', {type:'POST',url:$(this).attr('href'),
                                        success:function() {
                                            $.fn.yiiGridView.update('yw0');
                                        }
                                    });
                                    return false;
                                }",
                ),
            ),
        )
    ),
));