<?php
/* @var $this UsersController */
/* @var $model Users */

$this->breadcrumbs = array(
	'Users' => array('admin'),
	'Kelola',
);

$this->pageTitle = 'Daftar Peserta';
?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id' => 'users-grid',
	'dataProvider' => $dataProvider,
	// 'filter'=>$model,
	'itemsCssClass' => 'table-responsive table table-striped table-hover table-vcenter',
	'columns' => array(

		array(
			'header' => 'No',
			'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1',
			'htmlOptions' => array(
				'width' => '10px',
				'style' => 'text-align: center;'
			)
		),


		'fullname',
		'email',
		'phone',
		array(
			'name' => 'type',
			'filter' => array('1' => 'Perseorangan', '2' => 'Kelompok'),
			'value' => 'Users::model()->type($data->type)',
		),

		'username',

		// array(
		// 	'filter'=>CHtml::listData(Department::model()->findAllByAttributes(array('status'=>1)),'id_department','name'),
		// 	'name'=>'division',
		// 	'value'=>'Department::model()->getName($data->division)',
		// ),

		// array(
		// 	'name'=>'level',
		// 	'filter'=>array('1'=>'Administrator','2'=>'Penilai','3'=>'Peserta'),
		// 	'value'=>'Users::model()->level($data->level)',
		// ),

		// array(
		// 	'name'=>'status',
		// 	'filter'=>array('0'=>'Belum di Verifikasi','1'=>'Sudah di Verifikasi'),
		// 	'value'=>'Users::model()->status($data->status)',
		// ),

		array(
			'header'=>'Status',
			'class'=>'CButtonColumn',
			'template'=>'{Belum Aktif}{Aktif}{Reject}',
			'htmlOptions'=>array('width'=>'70px', 'style' => 'text-align: center;'),
			'buttons'=>array(
				'Belum Aktif'=>
				array(
					'visible'=>'$data->status==0',
					// 'url'=>'Yii::app()->createUrl("main/paper/verified", array("id"=>$data->id_user))',
					'imageUrl'=>YII::app()->baseUrl.'/image/setting/warning.png',
				),
				'Aktif'=>
				array(
					'visible'=>'$data->status==1',
					// 'url'=>'Yii::app()->createUrl("main/paper/verified", array("id"=>$data->id_user))',
					'imageUrl'=>YII::app()->baseUrl.'/image/setting/verified.png',
				),
				'Reject'=>
				array(
					'visible'=>'$data->status==2',
					// 'url'=>'Yii::app()->createUrl("main/paper/verified", array("id"=>$data->id_user))',
					'imageUrl'=>YII::app()->baseUrl.'/image/setting/reject.png',
				),
			),
		),



		array(
			'header' => 'Link Video',
			'class' => 'CButtonColumn',
			'template' => '{Link Video}',
			'htmlOptions' => array('width' => '70px', 'style' => 'text-align: center;'),
			'buttons' => array(
				'Link Video' =>
				array(
					'visible' => '$data->status_video==1',
					'url' => 'Yii::app()->createUrl("main/paper/link", array("id"=>$data->id_user))',
					'imageUrl' => YII::app()->baseUrl . '/image/setting/youtube.png',
				),
			),
		),

		array(
			'header' => 'Pernyastaan',
			'class' => 'CButtonColumn',
			'template' => '{Download}',
			'htmlOptions' => array('width' => '70px', 'style' => 'text-align: center;'),
			'buttons' => array(
				'Download' =>
				array(
					'url' => 'Yii::app()->createUrl("main/paper/download", array("id"=>$data->id_user))',
					'imageUrl' => YII::app()->baseUrl . '/image/setting/document.png',
				),
			),
		),


		// array(
		// 	'header'=>'',
		// 	'class'=>'CButtonColumn',
		// 	'template'=>'{Unverified}',
		// 	'htmlOptions'=>array('width'=>'70px', 'style' => 'text-align: center;'),
		// 	'buttons'=>array(
		// 		'Unverified'=>
		// 		array(
		// 			'visible'=>'$data->status==0',
		// 			'url'=>'Yii::app()->createUrl("main/paper/verified", array("id"=>$data->id_user))',
		// 			'imageUrl'=>YII::app()->baseUrl.'/image/setting/check.png',
		// 		),
		// 	),
		// ),


		array(
			'header'=>'',
			'class'=>'CButtonColumn',
			'template'=>'{Detail}',
			'htmlOptions'=>array('width'=>'70px', 'style' => 'text-align: center;'),
			'buttons'=>array(
				'Detail'=>
				array(
					// 'visible'=>'$data->status==1',
					'url'=>'Yii::app()->createUrl("main/paper/update", array("id"=>$data->id_user))',
					// 'url'=>'Yii::app()->createUrl("main/paper/view", array("id"=>$data->id_user))',
					'imageUrl'=>YII::app()->baseUrl.'/image/setting/eye.png',
				),
			),
		),

	),
)); ?>


