<?php
/* @var $this NewsletterController */
/* @var $model Newsletter */
$this->breadcrumbs = array(
    'Newsletters' => array('admin'),
    'Manage',
);
$this->menu = array(
    array('label' => 'List Newsletter', 'url' => array('admin')),
    array('label' => 'Create Newsletter', 'url' => array('create')),
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#newsletter-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<div class="page-header"><h1>Manage Newsletters</h1></div>

<?php $this->renderPartial('admin.components.actions.views.export'); ?>
<?php
$this->widget('ext.widgets.FGridView', array(
    'id' => 'newsletter-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        array(
            'name' => 'id',
            'htmlOptions' => array('style' => 'width:50px;'),
        ),
        array(
            'name' => 'title',
            'value' => 'CHtml::link($data->title,array("update","id"=>$data->id))',
            'type' => 'raw',
        ),
//	'content',
        array(
            'name' => 'create_datetime',
            'value' => 'Yii::app()->dateFormatter->formatDateTime($data->create_datetime)',
            'filter' => false,
        ),
        array(
            'name' => 'send_datetime',
            'value' => '$data->send_datetime==NULL?"<span class=\"dark-red-color\">-</span>" :Yii::app()->dateFormatter->formatDateTime($data->send_datetime)',
            'type' => 'raw',
        ),
        array(
            'value' => 'CHtml::link("Send!", array("send", "id" => $data->id),array("class"=>"btn btn-primary"))',
            'type' => 'raw',
        ),
        /*
          'status',
         */
        array(
            'class' => 'CButtonColumn',
            'template' => '{update}&nbsp;&nbsp;{delete}',
        ),
    ),
));
?>