public function loadModel($id) { $m = VtdtTruckDocType::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('TrucksModule.crud_static', 'The requested page does not exist.')); } return $model; }
<div class="alert alert-error"><?php echo $grid_error; ?> </div> <?php } if (!empty($grid_warning)) { ?> <div class="alert alert-warning"><?php echo $grid_warning; ?> </div> <?php } $model = new VtrdTrailerDoc(); $model->vtrd_vtrl_id = $modelMain->primaryKey; // render grid view $this->widget('TbGridView', array('id' => 'vtrd-trailer-doc-grid', 'dataProvider' => $model->search(), 'template' => '{summary}{items}', 'summaryText' => ' ', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'vtrd_vtdt_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//trucks/vtrdTrailerDoc/editableSaver'), 'source' => CHtml::listData(VtdtTruckDocType::model()->findAll(array('limit' => 1000)), 'vtdt_id', 'itemLabel'))), array('header' => Yii::t('TrucksModule.model', 'Exp.Postion'), 'type' => 'raw', 'value' => '!empty($data->vtrd_fixr_id)? $data->vtrdFixr->fixrFiit->fiitFinv->finv_number. " ". CHtml::link( "<i class=\\"icon-external-link\\"></i>", array( "/d2fixr/FixrFiitXRef/viewFinv", "finv_id"=>$data->vtrdFixr->fixrFiit->fiit_finv_id ), array("target" => "_blank") ) :"-"'), array('class' => 'editable.EditableColumn', 'name' => 'vtrd_number', 'editable' => array('url' => $this->createUrl('//trucks/vtrdTrailerDoc/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'vtrd_issue_date', 'editable' => array('type' => 'date', 'url' => $this->createUrl('//trucks/vtrdTrailerDoc/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'vtrd_expire_date', 'editable' => array('type' => 'date', 'url' => $this->createUrl('//trucks/vtrdTrailerDoc/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'vtrd_notes', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//trucks/vtrdTrailerDoc/editableSaver'))), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'empty($data->vtrd_fixr_id) && Yii::app()->user->checkAccess("Trucks.VtrlTrailer.DeletevtrdTrailerDocs")')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/trucks/vtrdTrailerDoc/delete", array("vtrd_id" => $data->vtrd_id))', 'deleteConfirmation' => Yii::t('TrucksModule.crud', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'))))); Yii::endProfile('vtrd_vtrl_id.view.grid'); }
<div class="row"> <div class="span12"> <h2> <?php echo Yii::t('TrucksModule.crud_static', 'Data'); ?> <small> #<?php echo $model->vtdc_id; ?> </small> </h2> <?php $this->widget('TbDetailView', array('data' => $model, 'attributes' => array(array('name' => 'vtdc_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'vtdc_id', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver')), true)), array('name' => 'vtdc_vtrc_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver'), 'source' => CHtml::listData(VtrcTruck::model()->findAll(array('limit' => 1000)), 'vtrc_id', 'itemLabel'), 'attribute' => 'vtdc_vtrc_id'), true)), array('name' => 'vtdc_vtdt_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver'), 'source' => CHtml::listData(VtdtTruckDocType::model()->findAll(array('limit' => 1000)), 'vtdt_id', 'itemLabel'), 'attribute' => 'vtdc_vtdt_id'), true)), array('name' => 'vtdc_fixr_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver'), 'source' => CHtml::listData(FixrFiitXRef::model()->findAll(array('limit' => 1000)), 'fixr_id', 'itemLabel'), 'attribute' => 'vtdc_fixr_id'), true)), array('name' => 'vtdc_number', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'vtdc_number', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver')), true)), array('name' => 'vtdc_issue_date', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'date', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver'), 'attribute' => 'vtdc_issue_date'), true)), array('name' => 'vtdc_expire_date', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'date', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver'), 'attribute' => 'vtdc_expire_date'), true)), array('name' => 'vtdc_notes', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'vtdc_notes', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver')), true)), array('name' => 'vtdc_deleted', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'vtdc_deleted', 'url' => $this->createUrl('/trucks/vtdcTruckDoc/editableSaver')), true))))); ?> </div> </div> <div class="row"> <div class="span12"> <?php $this->renderPartial('_view-relations_grids', array('modelMain' => $model, 'ajax' => false)); ?> </div> </div> <?php echo $cancel_buton;