<?php
/* @var $this DepartmentController */
/* @var $model Department */

$this->breadcrumbs = array(
    yii::t('default', 'Configurations') => array('/dashboardLayout/configuration'),
    yii::t('default', 'System Configurations') => array('/dashboardLayout/systemConfiguration'),
    yii::t('default', 'Backups') => array('index'),
    yii::t('default', 'View Backup Files')
);
?>

<div id="flash-msg">
    <br>
    <?php $this->widget('bootstrap.widgets.TbAlert'); ?>
</div>


<?php
    $this->widget('yiiwheels.widgets.grid.WhGridView', array(
	'id' => 'backup-grid',	
	'dataProvider' => $dataProvider,
	'template' => '{pager}{summary}{items}',
	'columns' => array(
	    array(
		'name' => 'name',
		'value' => 'CHtml::link($data["name"], Yii::app()->createUrl("backup/download", array("file"=>$data["name"],"path"=>$data["path"])))',
		'type' => 'raw',
		'header' => yii::t('default', 'Name'),
	    ),
	    array(
		'name' => 'size',
		'header' => yii::t('default', 'File Size')),
	    array(
		'name' => 'create_time',
		'header' => yii::t('default', 'Created Time')),
	    array(
		'class' => 'CButtonColumn',
		'template' => '{download}{delete}',
		'afterDelete' => 'function(link,success,data){ if(success) $("#flash-msg").html(data); }',
		'buttons' => array
		    (
		    'delete' => array
			(
			'url' => 'Yii::app()->createUrl("backup/delete", array("file"=>$data["name"]))',
		    ),
		    'download' => array(
			'label' => Yii::t('default', 'Download'),
			'url' => 'array("backup/download","file"=>$data["name"],"path"=>$data["path"])', //A PHP expression for generating the URL of the button.
			'imageUrl' => Yii::app()->request->baseUrl . '/css/flags/download.png',),
		),
	    ),
	),
    )); ?>