public function loadModel($id) { $model = CcntCountry::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('D1CompanyModule.crud', 'The requested page does not exist.')); } return $model; }
if (Yii::app()->user->checkAccess("audittrail") && isset(Yii::app()->getModule('d2company')->options['audittrail']) && Yii::app()->getModule('d2company')->options['audittrail']) { Yii::import('audittrail.*'); $this->widget("vendor.dbrisinajumi.audittrail.widgets.AudittrailViewTbButton", array('model_name' => get_class($model), 'model_id' => $model->getPrimaryKey())); } ?> </div> </div> </div> <div class="row"> <div class="span5"> <?php $this->widget('TbAceDetailView', array('data' => $model, 'label_width' => 150, 'attributes' => array(array('name' => 'ccmp_name', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_name', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true)), array('name' => 'ccmp_ccnt_id', 'type' => 'raw', 'value' => $can_edit ? $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'source' => CHtml::listData(CcntCountry::model()->findAll(array('limit' => 1000)), 'ccnt_id', 'itemLabel'), 'attribute' => 'ccmp_ccnt_id', 'apply' => $can_edit), true) : (!empty($model->ccmp_ccnt_id) ? $model->ccmpCcnt->itemLabel : '')), array('name' => 'ccmp_registrtion_no', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_registrtion_no', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_registrtion_no)), array('name' => 'ccmp_vat_registrtion_no', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_vat_registrtion_no', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_vat_registrtion_no)), array('name' => 'ccmp_registration_date', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'date', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'attribute' => 'ccmp_registration_date', 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_registration_date)), array('name' => 'ccmp_registration_address', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_registration_address', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_registration_address)), array('name' => 'ccmp_official_ccit_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'source' => CHtml::listData(CcitCity::model()->findAll(array('limit' => 1000)), 'ccit_id', 'itemLabel'), 'attribute' => 'ccmp_official_ccit_id', 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_official_ccit_id)), array('name' => 'ccmp_official_address', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_official_address', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_official_address)), array('name' => 'ccmp_official_zip_code', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_official_zip_code', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_official_zip_code)), array('name' => 'ccmp_office_ccit_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'source' => CHtml::listData(CcitCity::model()->findAll(array('limit' => 1000)), 'ccit_id', 'itemLabel'), 'attribute' => 'ccmp_office_ccit_id', 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_office_ccit_id)), array('name' => 'ccmp_office_address', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_office_address', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_office_address)), array('name' => 'ccmp_office_zip_code', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_office_zip_code', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_office_zip_code)), array('name' => 'ccmp_statuss', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'source' => $model->getEnumFieldLabels('ccmp_statuss'), 'attribute' => 'ccmp_statuss', 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_statuss)), array('name' => 'ccmp_description', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_description', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_description)), array('name' => 'ccmp_office_phone', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_office_phone', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_office_phone)), array('name' => 'ccmp_office_email', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ccmp_office_email', 'url' => $this->createUrl('/d2company/ccmpCompany/editableSaver'), 'apply' => $can_edit), true), 'visible' => $can_edit || !empty($model->ccmp_office_email))))); $ccd = $model->cccdCustomData; $rows = array(); foreach ($ccd->attributes as $attribute_name => $attribute_value) { if ($attribute_name == 'cccd_ccmp_id') { continue; } $rows[] = array('name' => $attribute_name); } $this->widget('TbAceDetailView', array('data' => $ccd, 'label_width' => 150, 'attributes' => $rows)); ?> </div> <div class="span7"> <?php
public function loadModel($id) { $m = CcntCountry::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('D2companyModule.crud_static', 'The requested page does not exist.')); } return $model; }
</div> <div class="export-form" style="display:none"> <?php //$this->renderPartial('_export', array('model' => $model,)); ?> </div> <?php $visible_columns = false; if (isset(Yii::app()->getModule('d2company')->options['admin_columns'])) { $visible_columns = Yii::app()->getModule('d2company')->options['admin_columns']; } $criteria = new CDbCriteria(); if (isset(Yii::app()->params['ccgr_group_sys_company'])) { $criteria->addNotInCondition('ccgr_id', array(Yii::app()->params['ccgr_group_sys_company'])); } $criteria->order = 'ccgr_name'; $group_filter = CHtml::listData(CcgrGroup::model()->findAll($criteria), 'ccgr_id', 'ccgr_name'); $grid_columns = array(array('name' => 'ccmp_name', 'header' => Yii::t('D2companyModule.crud', 'Name'), 'value' => '$data->ccmp_name', 'visible' => !$visible_columns || in_array('ccmp_name', $visible_columns)), array('name' => 'ccmp_ccnt_id', 'header' => Yii::t('D2companyModule.crud', 'Country'), 'value' => 'CHtml::value($data,\'ccmpCcnt.itemLabel\')', 'filter' => CHtml::listData(CcntCountry::model()->findAll(array('limit' => 1000)), 'ccnt_id', 'itemLabel'), 'htmlOptions' => array('style' => 'width:100px;'), 'visible' => !$visible_columns || in_array('ccmp_ccnt_id', $visible_columns)), array('name' => 'ccmp_office_ccit_id', 'header' => Yii::t('D2companyModule.crud', 'City'), 'value' => 'CHtml::value($data,\'ccmpOfficeCcit.itemLabel\')', 'filter' => CHtml::listData(CcitCity::model()->findAll(array('limit' => 1000)), 'ccit_id', 'itemLabel'), 'visible' => !$visible_columns || in_array('ccmp_office_ccit_id', $visible_columns)), array('name' => 'ccmp_registrtion_no', 'header' => Yii::t('D2companyModule.crud', 'Registration Nr'), 'visible' => !$visible_columns || in_array('ccmp_registrtion_no', $visible_columns)), array('name' => 'ccmp_registration_address', 'header' => Yii::t('D2companyModule.crud', 'Registration Address'), 'visible' => !$visible_columns || in_array('ccmp_registration_address', $visible_columns)), array('name' => 'ccmp_statuss', 'header' => Yii::t('D2companyModule.crud', 'State'), 'value' => '$data->getEnumColumnLabel(\'ccmp_statuss\')', 'visible' => !$visible_columns || in_array('ccmp_statuss', $visible_columns)), array('name' => 'ccxg_ccgr_id', 'header' => Yii::t('D2companyModule.crud', 'Group'), 'filter' => $group_filter, 'value' => '$data->ccgr_name', 'visible' => !$visible_columns || in_array('ccxg_ccgr_id', $visible_columns))); if (isset(Yii::app()->getModule('d2company')->options['admin_add_columns'])) { foreach (Yii::app()->getModule('d2company')->options['admin_add_columns'] as $add_column) { if (isset($add_column['header'])) { $add_column['header'] = Yii::t('D2companyModule.crud', $add_column['header']); } $grid_columns[] = $add_column; } } $grid_columns[] = array('class' => 'EButtonColumnWithClearFilters', 'buttons' => array('view' => array('visible' => 'Yii::app()->user->checkAccess("D2company.CcmpCompany.View") || Yii::app()->user->checkAccess("D2company.CcmpCompany.Update") || Yii::app()->user->checkAccess("Company.fullcontrol")'), 'update' => array('visible' => 'Yii::app()->user->checkAccess("Company.fullcontrol") ' . ' || Yii::app()->user->checkAccess("D2company.CcmpCompany.Update")'), 'delete' => array('visible' => 'FALSE')), 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("ccmp_id" => $data->ccmp_id))', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("updateExtended", array("ccmp_id" => $data->ccmp_id))', 'deleteButtonUrl' => null, 'viewButtonOptions' => array('data-toggle' => 'tooltip'), 'updateButtonOptions' => array('data-toggle' => 'tooltip')); $this->widget('TbGridView', array('id' => 'ccmp-company-grid', 'type' => 'bordered condensed', 'dataProvider' => $model->searchForList(), 'filter' => $model, 'template' => '{items}{summary}{pager}', 'rowCssClassExpression' => '$data->cssclass', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => $grid_columns));
<div class="row"> <?php echo $form->label($model, 'ccmp_name'); ?> <?php echo $form->textField($model, 'ccmp_name', array('size' => 60, 'maxlength' => 200)); ?> </div> <div class="row"> <?php echo $form->label($model, 'ccmp_ccnt_id'); ?> <?php echo $form->dropDownList($model, 'ccmp_ccnt_id', CHtml::listData(CcntCountry::model()->findAll(), 'ccnt_id', 'ccnt_name'), array('prompt' => 'all')); ?> </div> <div class="row"> <?php echo $form->label($model, 'ccmp_registrtion_no'); ?> <?php echo $form->textField($model, 'ccmp_registrtion_no', array('size' => 20, 'maxlength' => 20)); ?> </div> <div class="row"> <?php echo $form->label($model, 'ccmp_vat_registrtion_no');
<?php $this->breadcrumbs[] = Yii::t('D1CompanyModule.crud', 'Ccmp Companies'); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\$('.search-form').toggle();\nreturn false;\n});\n\$('.search-form form').submit(function(){\n\$.fn.yiiGridView.update('ccmp-company-grid', {\ndata: \$(this).serialize()\n});\nreturn false;\n});\n"); ?> <?php $this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs)); ?> <h1> <?php echo Yii::t('D1CompanyModule.crud', 'Ccmp Companies'); ?> <small><?php echo Yii::t('D1CompanyModule.crud', 'Manage'); ?> </small> </h1> <?php $this->renderPartial("_toolbar", array("model" => $model)); if (Yii::app()->user->checkAccess('D1CompanyEdit')) { $aGridButtons = array('class' => 'TbButtonColumn', 'viewButtonUrl' => "Yii::app()->controller->createUrl('view', array('ccmp_id' => \$data->ccmp_id))", 'updateButtonUrl' => "Yii::app()->controller->createUrl('update', array('ccmp_id' => \$data->ccmp_id))", 'deleteButtonUrl' => "Yii::app()->controller->createUrl('delete', array('ccmp_id' => \$data->ccmp_id))"); } else { $aGridButtons = array('class' => 'TbButtonColumn', 'viewButtonUrl' => "Yii::app()->controller->createUrl('view', array('ccmp_id' => \$data->ccmp_id))", 'buttons' => array('update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'FALSE'))); } $this->widget('TbGridView', array('id' => 'ccmp-company-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array('ccmp_name', array('name' => 'ccmp_ccnt_id', 'value' => 'CHtml::value($data,\'ccmpCcnt.ccnt_name\')', 'filter' => CHtml::listData(CcntCountry::model()->findAll(), 'ccnt_id', 'ccnt_name')), 'ccmp_registrtion_no', 'ccmp_vat_registrtion_no', 'ccmp_registration_address', 'ccmp_official_address', $aGridButtons)));