?>
    <?php 
    if (Yii::app()->user->checkAccess("D2person.PpcnPersonContact.Create")) {
        $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'ajaxButton', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-plus', 'url' => array('//d2person/ppcnPersonContact/ajaxCreate', 'field' => 'ppcn_pprs_id', 'value' => $modelMain->primaryKey, 'ajax' => 'ppcn-person-contact-grid'), 'ajaxOptions' => array('success' => 'function (html) {$.fn.yiiGridView.update(\'ppcn-person-contact-grid\');}'), 'htmlOptions' => array('title' => Yii::t('D2personModule.crud_static', 'Add new record'), 'data-toggle' => 'tooltip')));
    }
    ?>
</div>

<?php 
    if (empty($modelMain->ppcnPersonContacts)) {
        $model = new PpcnPersonContact();
        $model->ppcn_pprs_id = $modelMain->primaryKey;
        $model->save();
        unset($model);
    }
    $model = new PpcnPersonContact();
    $model->ppcn_pprs_id = $modelMain->primaryKey;
    // render grid view
    $bft = !$can_edit_ppcn ? 'false' : 'true';
    $this->widget('TbGridView', array('id' => 'ppcn-person-contact-grid', 'dataProvider' => $model->search(), 'template' => '{summary}{items}', 'summaryText' => '&nbsp;', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'ppcn_pcnt_type', 'value' => '(!' . $bft . ' && !empty($data->ppcn_pcnt_type))?$data->ppcnPcntType->pcnt_name:""', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2person/ppcnPersonContact/editableSaver'), 'source' => CHtml::listData(PcntContactType::model()->findAll(array('limit' => 1000)), 'pcnt_id', 'itemLabel'), 'apply' => $can_edit_ppcn)), array('class' => 'editable.EditableColumn', 'name' => 'ppcn_value', 'editable' => array('url' => $this->createUrl('//d2person/ppcnPersonContact/editableSaver'), 'apply' => $can_edit_ppcn)), array('class' => 'editable.EditableColumn', 'name' => 'ppcn_notes', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2person/ppcnPersonContact/editableSaver'), 'apply' => $can_edit_ppcn)), array('name' => 'ppcn_modified'), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'TRUE')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/d2person/ppcnPersonContact/delete", array("ppcn_id" => $data->ppcn_id))', 'deleteConfirmation' => Yii::t('D2personModule.crud_static', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'), 'visible' => Yii::app()->user->checkAccess("D2person.PpcnPersonContact.Delete")))));
    Yii::endProfile('ppcn_pprs_id.view.grid');
}
if ((!$ajax || $ajax == 'ppxd-person-xdocument-grid') && Yii::app()->user->checkAccess("D2person.PpxdPersonXDocument.View")) {
    Yii::beginProfile('ppxd_pprs_id.view.grid');
    ?>

<div class="table-header">
    <?php 
    echo Yii::t('D2personModule.model', 'Ppxd Person Xdocument');
    ?>
    <?php 
 public function loadModel($id)
 {
     $m = PpcnPersonContact::model();
     // apply scope, if available
     $scopes = $m->scopes();
     if (isset($scopes[$this->scope])) {
         $m->{$this->scope}();
     }
     $model = $m->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('D2personModule.crud_static', 'The requested page does not exist.'));
     }
     return $model;
 }