<?php $this->widget('admin.widgets.TableCover');?>
<h2>《<?php echo $book->bookname;?>》</h2>
<div class="wide form">
<?php echo CHtml::beginForm('','get');?>
<table class="widefat post">
<thead>
<tr>
	<th colspan=4>查询选项</th>
</tr>
</thead>
<tbody>
<tr>
	<td>CID：<?php echo Operate::int('chapterid');?></td>
	<td>章节名：<?php echo Operate::string('chaptername');?></td>
	<td>字数：<?php echo Operate::int('t-size');?></td>
	<td></td>
</tr>
<tr>
	<td>创建时间：<?php echo Operate::date('t-RangeStart_createdate');?>-<?php echo Operate::date('t-RangeEnd_createdate');?></td>
	<td></td>
	<td></td>
	<td></td>
</tr>

<tr><td colspan="4" style="text-align:center"><?php echo CHtml::submitButton('查询');?></td>
</tr>
</tbody>
</table>
<?php echo CHtml::endForm();?>
</div>
<br/>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'dataProvider'=>$dataProvider,
    'itemsCssClass' => 'widefat post',
    'ajaxUpdate' => true,
    'summaryText'=>'显示{start}-{end}条 总共{count}条',
    'id' => 'chapter_grid',
    'columns' => array(
        'chapterid',
        'chaptername',
        'createdate',
        'updatedate',
        'size',
        array(
            'name' => 'display',
            'value' => '$data->isDisplay()',
        ),
        array(
            'name' => 'isvip',
            'value' => '$data->isVip()',
        ),
    ),
));
?>
<?php
$this->widget('application.extensions.fancybox.EFancyBox', array(
    'target'=>'a.update,a.create',
    'config'=>array(
            'titleShow' => false,
            'scrolling' => false,
            'mouseEnabled' => false,
            'gallery' => false,    
        ),
    )
);
?>
<script type="text/javascript">
/*<![CDATA[*/
var getCheckbox = function() {
    var data = new Array();
    if(!confirm('确定要删除吗?')) return false;
    $("input:checkbox[name='chapters[]']").each(function () {
        if($(this).attr("checked") == true) {
        	data.push($(this).val());
        }
    });
    if(data.length > 0){
        $.post('<?php echo CHtml::normalizeUrl(array('/admin/chapters/delall/'));?>',{'chapters[]':data}, function (data) {
        var ret = $.parseJSON(data);
        if (ret != null && ret.success != null && ret.success) {
            $.fn.yiiGridView.update('chapter_grid');
        }
    });
    } else {
        alert("请选择要删除的章节!");
    }
}
/*]]>*/
</script>