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

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

$this->pageTitle = $model->Researchers->fullname;
?>

<?php
echo $this->renderPartial('_form_update', array('model' => $model, 'dataMember' => $dataMember));
?>

<?php if ($model->status == 1) : ?>
    <?php if (YII::app()->user->record->level == 1 || YII::app()->user->record->level == 2) { ?>
        <BR>
        <BR>
        <BR>
        <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">
            <?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 pull-right', 'title' => 'Penilaian Video')
            // );
            ?>
        </div>

        <?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',
                array('header' => 'Penilai', 'value' => '$data->Evaluator == NULL ? "" : $data->Evaluator->fullname'),
                array('header' => 'Nilai', '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(); }'
                                ),
                            ),
                        ),
                    ),
                ),
            ),
        )); ?>

    <?php } ?>
<?php endif; ?>

</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>