<?php
 /* @var $this PersonTypeController */
 /* @var $model PersonType */

 $this->breadcrumbs = array(
     yii::t('default', 'Configurations') => array('/dashboard/configuration'),
     yii::t('default', 'Person Types') => array('index'),
 );
?>

<?php
 if ((Yii::app()->user->checkAccess('Facility Admin')) == false)
 {
     echo CHtml::link(Yii::t('default', 'Add'), array('create'), array('class' => 'btn btn-primary', 'data-dismiss' => 'modal'));
 }
?>



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


<?php
     $this->widget('ext.bootstrap.widgets.TbGridView', array(
         'id' => 'person-type-grid',
         'type' => 'striped',
         'dataProvider' => $model->search(),
         'filter' => $model,
         'columns' => array(
             'name',
             array(
                 'name' => 'is_ldap',
                 'value' => '($data->is_ldap == 1) ?  Yii::t("default","Yes") : Yii::t("default","No")',
                 'filter' => array('1' => Yii::t('default', 'Yes'), '0' => Yii::t('default', 'No')),
             ),
             'equivalent_ldap_type',
             array(
                 'name' => 'status',
                 'type' => 'html',
                 'value' => 'CHtml::link(CHtml::image(Yii::app()->request->baseUrl."/css/flags/".$data->status.".png", "img")  ,"#",array("rel"=>"tooltip","title"=>Yii::t(\'default\',$data->status)))',
                 'filter' => array('Active' => Yii::t('default', 'Active'), 'Inactive' => Yii::t('default', 'Inactive')),
                 'htmlOptions' => array('style' => 'text-align:center;'),
             ),
             array(
                 'class' => 'CButtonColumn',
                 'htmlOptions' => array('width' => '60'),
                 'afterDelete' => 'function(link,success,data){ if(success) $("#flash-msg").html(data); }',
                 'buttons' => array(
                     'update' => array(
                         'visible' => 'Yii::app()->user->checkAccess("Facility Admin")? false:true',
                     ),
                     'delete' => array(
                         'visible' => 'Yii::app()->user->checkAccess("Facility Admin")? false:true',
                     ),
                 ),
             ),
         ),
     ));
?>
