<div class="table-header">
    <i class="icon-user"></i>        
    <?php 
    echo Yii::t('D2tasksModule.model', 'Tprs Persons');
    ?>
    <?php 
    if (Yii::app()->user->checkAccess("D2tasks.TprsPersons.Create")) {
        $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'ajaxButton', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-plus', 'url' => array('//d2tasks/tprsPersons/ajaxCreate', 'field' => 'tprs_ttsk_id', 'value' => $modelMain->primaryKey, 'ajax' => 'tprs-persons-grid'), 'ajaxOptions' => array('success' => 'function(html) {$.fn.yiiGridView.update(\'tprs-persons-grid\');}'), 'htmlOptions' => array('title' => Yii::t('D2tasksModule.crud', 'Add new record'), 'data-toggle' => 'tooltip')));
    }
    ?>
</div>
 
<?php 
    if (empty($modelMain->tprsPersons)) {
        $model = new TprsPersons();
        $model->tprs_ttsk_id = $modelMain->primaryKey;
        $model->save();
        unset($model);
    }
    $model = new TprsPersons();
    $model->tprs_ttsk_id = $modelMain->primaryKey;
    // render grid view
    $can_edit_tprs = (bool) Yii::app()->user->checkAccess("D2tasks.TprsPersons.Update");
    $bft = !$can_edit_tprs ? 'false' : 'true';
    $this->widget('TbGridView', array('id' => 'tprs-persons-grid', 'dataProvider' => $model->search(), 'template' => '{summary}{items}', 'summaryText' => '&nbsp;', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'tprs_pprs_id', 'value' => '(!' . $bft . ' && !empty($data->tprs_pprs_id))?$data->tprsPprs->itemLabel:""', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2tasks/tprsPersons/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->getSysCompanyPersons(), 'pprs_id', 'itemLabel'), 'apply' => $can_edit_tprs), 'htmlOptions' => array('class' => 'span6')), array('class' => 'editable.EditableColumn', 'name' => 'tprs_notes', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2tasks/tprsPersons/editableSaver'), 'apply' => $can_edit_tprs), 'htmlOptions' => array('class' => 'span12')), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'TRUE')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/d2tasks/tprsPersons/delete", array("tprs_id" => $data->tprs_id))', 'deleteConfirmation' => Yii::t('D2tasksModule.crud', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'), 'htmlOptions' => array('class' => 'span1'), 'visible' => Yii::app()->user->checkAccess("D2person.TprsPersons.Delete")))));
    ?>

<?php 
    Yii::endProfile('tprs_ttsk_id.view.grid');
}