public function actionAjaxCreate($field, $value, $no_ajax = 0)
 {
     $model = new VtrdTrailerDoc();
     $model->{$field} = $value;
     try {
         if ($model->save()) {
             if ($no_ajax) {
                 $this->redirect(Yii::app()->request->urlReferrer);
             }
             return TRUE;
         } else {
             return var_export($model->getErrors());
         }
     } catch (Exception $e) {
         throw new CHttpException(500, $e->getMessage());
     }
 }
예제 #2
0
                                            "finv_id"=>$data->vtlsFixr->fixrFiit->fiit_finv_id
                                        ),
                                        array("target" => "_blank")
                                    )
                                    :"-"'))));
    }
    Yii::endProfile('vtls_vtrl_id.view.grid');
}
if (!$ajax || $ajax == 'vtrd-trailer-doc-grid') {
    Yii::beginProfile('vtrd_vtrl_id.view.grid');
    $grid_error = '';
    $grid_warning = '';
    if (empty($modelMain->vtrdTrailerDocs)) {
        $model = new VtrdTrailerDoc();
        $model->vtrd_vtrl_id = $modelMain->primaryKey;
        if (!$model->save()) {
            $grid_error .= implode('<br/>', $model->errors);
        }
        unset($model);
    }
    ?>

    <div class="table-header">
    <?php 
    echo Yii::t('TrucksModule.model', 'Vtrd Trailer Doc');
    $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'ajaxButton', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-plus', 'url' => array('//trucks/vtrdTrailerDoc/ajaxCreate', 'field' => 'vtrd_vtrl_id', 'value' => $modelMain->primaryKey, 'ajax' => 'vtrd-trailer-doc-grid'), 'ajaxOptions' => array('success' => 'function(html) {$.fn.yiiGridView.update(\'vtrd-trailer-doc-grid\');}'), 'htmlOptions' => array('title' => Yii::t('TrucksModule.crud', 'Add new record'), 'data-toggle' => 'tooltip')));
    ?>
    </div>

        <?php 
    if (empty($modelMain->vtrdTrailerDocs)) {