<?php
/* @var $this PaperController */
/* @var $model Paper */

$this->breadcrumbs = array(
	'Papers' => array('index'),
	$model->id_paper,
);

$this->pageTitle = 'Video - ' . $model->paper_name;
?>

<?php if (YII::app()->user->record->level == 1) { ?>



	<?php echo CHtml::link(
		'<i class="mdi mdi-upload"></i> Upload',
		$model->paper_file,
		array('class' => 'btn btn-info btn-flat', 'title' => 'Upload File Video')
	);
	?>


	<?php echo CHtml::link(
		'<i class="mdi mdi-upload"></i> Download Surat Pernyataan',
		YII::app()->baseUrl."/image/files/document/".$model->Researchers->image,
		array('class' => 'btn btn-info btn-flat', 'title' => 'Upload File Video')
	);
	?>


	<?php echo CHtml::link(
		'<i class="mdi mdi-edit"></i> Edit',
		array('update', 'id' => $model->id_paper,),
		array('class' => 'btn btn-info btn-flat', 'title' => 'Edit Video')
	);
	?>

	<?php echo CHtml::link(
		'Hapus',
		array('delete', 'id' => $model->id_paper,),
		array('class' => 'btn btn-danger pull-right', 'title' => 'Hapus Video')
	);
	?>


<?php } ?>


<?php if (YII::app()->user->record->level == 3) { ?>

	<?php echo CHtml::link(
		'<i class="mdi mdi-upload"></i> Upload',
		$model->paper_file,
		array('class' => 'btn btn-info btn-flat', 'title' => 'Upload File Video')
	);
	?>

<?php } ?>


<HR>


<div class="col-xs-12 col-lg-6 col-xl-6">
	<big style="font-size: 23px;"><?php echo $model->Researchers->fullname ?></big>
</div>


<div class="col-md-12">


	<div class="col-md-12 col-lg-6 col-xl-6">
		<div class="widget widget-tile">
			<div class="chart sparkline" id="spark2"></div>
			<div class="data-info">
				<div class="desc">Nilai Total</div>
				<div class="value"><span class="indicator indicator-positive mdi mdi-chevron-right"></span>
					<span class="number" data-toggle="counter" data-end="80" data-suffix="%"><?php echo Review::model()->getTotalList($model->id_paper, 1); ?></span>
				</div>
			</div>
		</div>
	</div>

	<div class="col-md-12 col-lg-6 col-xl-6">
		<div class="widget widget-tile">
			<div class="chart sparkline" id="spark2"></div>
			<div class="data-info">
				<div class="desc">Nilai Rata-Rata</div>
				<div class="value"><span class="indicator indicator-positive mdi mdi-chevron-right"></span>
					<span class="number" data-toggle="counter" data-end="80" data-suffix="%"><?php echo Review::model()->getTotalList($model->id_paper, 2); ?></span>
				</div>
			</div>
		</div>
	</div>

	<?php $this->widget('zii.widgets.CDetailView', array(
		'data' => $model,
		'htmlOptions' => array("class" => "table"),
		'attributes' => array(
			// 'id_paper',
			'created_date',
			// 'created_id',
			'update_date',
			array('name' => 'researchers_id', 'value' => $model->Researchers->fullname),
			// array('label' => 'Jenjang Peneliti', 'value' => $model->Researchers->description),
			// array('label' => 'Unit Kerja', 'value' => Department::model()->getName($model->Researchers->division)),

			// 'update_id',
			// 'researchers_id',
			// 'paper_name',
			// 'paper_image',
			// 'paper_file',
			// 'status',
		),
	)); ?>


	<div class="col-xs-12 col-lg-6 col-xl-6">
		<big style="font-size: 23px;">Anggota TIM</big>
	</div>

	<?php $this->widget('zii.widgets.grid.CGridView', array(
		'id'=>'users-grid',
		'dataProvider'=>$dataMember,
		// '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;')),
			'code',
			'fullname',
			'email',
			'phone',
		),
	)); ?>

	<div class="col-xs-12 col-lg-6 col-xl-6">
		<big style="font-size: 23px;">Penilaian</big>
	</div>

	<div class="col-xs-12 col-lg-6 col-xl-6">

	</div>

	<?php if (YII::app()->user->record->level == 2) { ?>
		<?php echo CHtml::link(
			'<i class="mdi mdi-edit"></i> Penilaian',
			array('main/review/add', 'id' => $model->id_paper,),
			array('class' => 'btn btn-info btn-flat', 'title' => 'Penilaian Video')
		);
		?>
	<?php } ?>

	<?php $this->widget('zii.widgets.grid.CGridView', array(
		'id' => 'review-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;')),

			'created_date',
			// 'update_date',
			array('header' => 'Penilai', 'value' => '$data->Evaluator->fullname'),
			// array('header' => 'Jenjang Penilai', 'value' => '$data->Evaluator->description'),
			// array('header'=>'Judul Video','value'=>'$data->Paper->paper_name'),
			array('header' => 'Nilai Tertimbang', 'value' => 'Review::model()->getTotal($data->id_rating,1)'),

			array(
				'class' => 'CButtonColumn',
				'template' => '{view}',
				'buttons' => array(
					'view' =>
					array(
						'url' => 'Yii::app()->createUrl("main/review/view", array("id"=>$data->id_rating))',
						'options' => array(
							'ajax' => array(
								'type' => 'POST',
								'url' => "js:$(this).attr('href')",
								'success' => 'function(data) { $("#viewModal .modal-body p").html(data); $("#viewModal").modal(); }'
							),
						),
					),
				),
			),
		),
	)); ?>

</div>


<!-- Modal -->
<div class="modal fade" id="viewModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<!-- Popup Header -->
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title"><strong>Detail</strong> Penilaian</h4>
			</div>
			<!-- Popup Content -->
			<div class="modal-body">
				<p>Data</p>
			</div>
		</div>
	</div>
</div>




<?php
//  $this->widget('zii.widgets.CListView', array(
// 	'dataProvider'=>$dataProvider,
// 	'itemView'=>'_view_review',
// ));
?>


<STYLE>
	th {
		width: 150px;
	}
</STYLE>