<?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' => $model->team(),
	'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)',
		),

		array(
			'name' => 'type_member',
			'filter' => array('1' => 'Analis Kebijakan', '2' => 'Non Analis Kebijakan'),
			'value' => 'Users::model()->typeMember($data->type_member)',
		),


		// 'username',

		array(
			'name' => 'create_time',
			'filter' => false,
			'value' => '$data->create_time',
		),

			// 'create_time',
			// 'visit_time',

		array('header' => 'Nilai Akhir', 'value' => 'Review::model()->getTotalTeam($data->id_user,2)'),


			// array('header'=>'Nilai','value'=>'Review::model()->getTotal($data->id_user,1)'),

			// 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)',
						// ),

						// 'status',

		array(
			'header' => 'Status',
			'class' => 'CButtonColumn',
			'template' => '{Belum Aktif}{Aktif}{Reject}{Expired}',
			'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',
				),
				'Expired' =>
				array(
					'visible' => '$data->status==3',
									// 'url'=>'Yii::app()->createUrl("main/paper/verified", array("id"=>$data->id_user))',
					'imageUrl' => YII::app()->baseUrl . '/image/setting/expired.png',
				),
			),
		),


		array(
			'header' => 'File',
			'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/document.png',
					'options' => array('target' => '_new'),
				),
			),
		),

		array(
			'header' => 'Pernyataan',
			'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' => '{Aktivasi}',
			'htmlOptions' => array('width' => '70px', 'style' => 'text-align: center;'),
			'buttons' => array(
				'Aktivasi' =>
				array(
					'visible' => '$data->status==0 || $data->status==2',
					'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 || $data->status==3',
					'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',
				),
			),
		),

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

	),
)); ?>


