/** * Lists all Sot2 models. * @return mixed */ public function actionIndex() { if (Helper::checkRoute('index')) { /** * PLSQL ! Array Data Provider * @author ptrnov [piter@lukison.com] * @since 2.1 */ $plsql_so_1 = new ArrayDataProvider(['key' => 'ID', 'allModels' => $this->getScripts(), 'pagination' => ['pageSize' => 20]]); /** * PLSQL ! Column Label * @author ptrnov [piter@lukison.com] * @since 2.1 */ $attributeField = $plsql_so_1->allModels[0]; //get label Array 0 //print_r($attributeField); $searchModel = new Sot2Search(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'dataProviderX' => $plsql_so_1, 'attributeField' => $attributeField]); } else { Yii::$app->user->logout(); $this->redirect(array('/site/login')); // } }
/** * @inheritdoc */ public function beforeAction($action) { $actionId = $action->getUniqueId(); $user = $this->getUser(); if (Helper::checkRoute('/' . $actionId, Yii::$app->getRequest()->get(), $user)) { return true; } $this->denyAccess($user); }
public function actionIndex() { if (Helper::checkRoute('index')) { $searchModel = new ProvinceSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); if (Yii::$app->request->post('hasEditable')) { $ID = \Yii::$app->request->post('editableKey'); $model = Customers::findOne($ID); $out = Json::encode(['output' => '', 'message' => '']); // fetch the first entry in posted data (there should // only be one entry anyway in this array for an // editable submission) // - $posted is the posted data for Book without any indexes // - $post is the converted array for single model validation $post = []; $posted = current($_POST['Customers']); $post['Customers'] = $posted; // load model like any single model validation if ($model->load($post)) { // can save model or do something before saving model $model->save(); // custom output to return to be displayed as the editable grid cell // data. Normally this is empty - whereby whatever value is edited by // in the input by user is updated automatically. $output = ''; // specific use case where you need to validate a specific // editable column posted when you have more than one // EditableColumn in the grid view. We evaluate here a // check to see if buy_amount was posted for the Book model if (isset($posted['CUST_KD_ALIAS'])) { // $output = Yii::$app->formatter->asDecimal($model->EMP_NM, 2); $output = $model->CUST_KD_ALIAS; } // similarly you can check if the name attribute was posted as well // if (isset($posted['name'])) { // $output = ''; // process as you need // } $out = Json::encode(['output' => $output, 'message' => '']); // return ajax json encoded response and exit echo $out; return; } } return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } else { Yii::$app->user->logout(); $this->redirect(array('/site/login')); // } }
/** * Lists all Schedulegroup models. * @return mixed */ public function actionIndex() { if (Helper::checkRoute('index')) { $searchModel = new SchedulegroupSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $searchModelCustGrp = new CustomersSearch(); $dpListCustGrp = $searchModelCustGrp->searchCustGrp(Yii::$app->request->queryParams); $aryStt = [['STATUS' => 0, 'STT_NM' => 'DISABLE'], ['STATUS' => 1, 'STT_NM' => 'ENABLE']]; $valStt = ArrayHelper::map($aryStt, 'STATUS', 'STT_NM'); //query for select2 in schedule-group = index $query = Yii::$app->db_esm->createCommand("SELECT * FROM `c0007` c7 WHERE NOT EXISTS (SELECT SCDL_GROUP FROM `c0001` `c1` WHERE c1.SCDL_GROUP = c7.ID)")->queryAll(); $data = ArrayHelper::map($query, 'ID', 'SCDL_GROUP_NM'); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'dpListCustGrp' => $dpListCustGrp, 'data' => $data, 'valStt' => $valStt]); } else { Yii::$app->user->logout(); $this->redirect(array('/site/login')); // } }
<h1><?php echo Html::encode($this->title); ?> </h1> <p> <!--filter boton componet of yii2-admin--> <?php if (Helper::checkRoute('delete')) { echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); } ?> <!--filter boton componet of yii2-admin--> <?php if (Helper::checkRoute('delete')) { echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); } ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'username', 'auth_key', 'password', 'email:email', 'created_at', 'updated_at', 'firstName', 'lastName']]); ?> </div>
$button_add_group = tombolAddGroup(); } else { $button_add_group = ""; } function tombolAddCustomers() { $title1 = Yii::t('app', 'Add Customers'); $options1 = ['id' => 'schedule-group-crm-add-customers', 'data-toggle' => "modal", 'data-target' => "#modal-create", 'class' => 'btn btn-success btn-sm']; $icon1 = '<i class="glyphicon glyphicon-plus"></i>'; $label1 = $icon1 . ' ' . $title1; $url1 = Url::toRoute(['/salesman/schedule-group-crm/create-scdl']); //,'kd'=>$kd]); $content = Html::a($label1, $url1, $options1); return $content; } if (Helper::checkRoute('create-scdl')) { $button_create = tombolAddCustomers(); } else { $button_create = ""; } /* * GRIDVIEW Group CUSTOMER * @author ptrnov <*****@*****.**> * @since 1.1 */ $gvCustGroup = GridView::widget(['id' => 'gv-custgrp-id', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterRowOptions' => ['style' => 'background-color:rgba(97, 211, 96, 0.3); align:center'], 'rowOptions' => function ($model, $key, $index, $grid) { return ['id' => $model->ID, 'onclick' => '$.pjax.reload({ url: "' . Url::to(['/salesman/schedule-group-crm/index']) . '?CustomersSearch[SCDL_GROUP]="+this.id, container: "#gv-custgrp-list", timeout: 10, });'];
$this->title = $model->username; $this->params['breadcrumbs'][] = ['label' => Yii::t('rbac-admin', 'Users'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $controllerId = $this->context->uniqueId . '/'; ?> <div class="user-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php if ($model->status == 0 && Helper::checkRoute($controllerId . 'activate')) { echo Html::a(Yii::t('rbac-admin', 'Activate'), ['activate', 'id' => $model->id], ['class' => 'btn btn-primary', 'data' => ['confirm' => Yii::t('rbac-admin', 'Are you sure you want to activate this user?'), 'method' => 'post']]); } ?> <?php if (Helper::checkRoute($controllerId . 'delete')) { echo Html::a(Yii::t('rbac-admin', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'method' => 'post']]); } ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['username', 'email:email', 'created_at:date', 'status']]); ?> </div>
use yii\helpers\Html; use yii\grid\GridView; use mdm\admin\components\Helper; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Temas'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="tema-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <!--HELPER YII2-ADMIN--> <?php if (Helper::checkRoute('create')) { echo Html::a(Yii::t('app', 'Nuevo Tema'), ['create'], ['class' => 'btn btn-success']); } ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'nombre', ['class' => 'yii\\grid\\ActionColumn', 'template' => Helper::filterActionColumn('{view}{delete}{update}')]]]); ?> </div>
/** * IMPORT DATA EXCEL * @return mixed * @author piter [ptr.nov@gmail.com] */ public function actionIndex() { if (Helper::checkRoute('index')) { $paramFile = Yii::$app->getRequest()->getQueryParam('id'); //echo $paramCari; $model = new UserFile(); $username = Yii::$app->user->identity->username; $user_id = ['USER_ID' => $username]; /*IMPORT VALIDATION*/ $searchModel = new TempDataSearch($user_id); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); /*VIEW IMPORT*/ $searchModelViewImport = new ImportViewSearch(); $dataProviderViewImport = $searchModelViewImport->search(Yii::$app->request->queryParams); //echo $this->actionExport_format(); return $this->render('index', ['getArryFile' => $this->getArryFile($paramFile), 'fileName' => $paramFile, 'gvColumnAryFile' => $this->gvColumnAryFile(), 'gvValidateColumn' => $this->gvValidateColumn(), 'gvValidateArrayDataProvider' => $dataProvider, 'searchModelValidate' => $searchModel, 'modelFile' => $model, 'gvRows' => $this->gvRows(), 'searchModelViewImport' => $searchModelViewImport, 'dataProviderViewImport' => $dataProviderViewImport]); } else { Yii::$app->user->logout(); $this->redirect(array('/site/login')); // } }
//,'kd'=>$kd]); $content = Html::a($label1, $url1, $options1); return $content; } function tombolCreate() { $title1 = Yii::t('app', 'Customers'); $options1 = ['id' => 'modcus', 'data-toggle' => "modal", 'data-target' => "#createcus", 'class' => 'btn btn-success btn-sm']; $icon1 = '<i class="glyphicon glyphicon-plus"></i>'; $label1 = $icon1 . ' ' . $title1; $url1 = Url::toRoute(['/mastercrm/customers-crm/createcustomers']); //,'kd'=>$kd]); $content = Html::a($label1, $url1, $options1); return $content; } if (Helper::checkRoute('createcustomers')) { $button_create = tombolCreate(); } else { $button_create = ""; } /** * New|Change|Reset| Password Login * @author ptrnov <*****@*****.**> * @since 1.1 */ function tombolKota() { $title1 = Yii::t('app', 'Kota'); $options1 = ['id' => 'password']; $icon1 = '<span class="fa fa-shield fa-md"></span>'; $label1 = $icon1 . ' ' . $title1;
// $this->sideCorp = 'Customers'; /* Title Select Company pada header pasa sidemenu/menu samping kiri */ // $this->sideMenu = $sideMenu_control;//'umum_datamaster'; /* kd_menu untuk list menu pada sidemenu, get from table of database */ $this->title = Yii::t('app', 'Customers'); /* title pada header page */ function tombolCreate() { $title1 = Yii::t('app', 'Create'); $options1 = ['id' => 'modl', 'data-toggle' => "modal", 'data-target' => "#form2", 'class' => 'btn btn-success btn-sm']; $icon1 = '<i class="glyphicon glyphicon-plus"></i>'; $label1 = $icon1 . ' ' . $title1; $url1 = Url::toRoute(['/mastercrm/kota-customers-crm/createkota']); //,'kd'=>$kd]); $content = Html::a($label1, $url1, $options1); return $content; } if (Helper::checkRoute('createkota')) { $button_create = tombolCreate(); } else { $button_create = ""; } // grid kota $tabkota = \kartik\grid\GridView::widget(['id' => 'gv-kota', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'PROVINCE', 'TYPE', 'CITY_NAME', 'POSTAL_CODE', ['class' => 'kartik\\grid\\ActionColumn', 'template' => Helper::filterActionColumn('{viewkota}{updatekota}'), 'header' => 'Action', 'dropdown' => true, 'dropdownOptions' => ['class' => 'pull-right dropup'], 'dropdownButton' => ['class' => 'btn btn-default btn-xs'], 'buttons' => ['viewkota' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="glyphicon glyphicon-eye-open"></span>' . Yii::t('app', 'View'), ['viewkota', 'id' => $model->CITY_ID], ['data-toggle' => "modal", 'data-target' => "#view2", 'data-title' => $model->PROVINCE]) . '<li>'; }, 'updatekota' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="glyphicon glyphicon-pencil"></span>' . Yii::t('app', 'Update'), ['updatekota', 'id' => $model->CITY_ID], ['data-toggle' => "modal", 'data-target' => "#form2", 'data-title' => $model->PROVINCE]) . '</li>'; }]]], 'panel' => ['type' => GridView::TYPE_SUCCESS, 'before' => $button_create], 'pjax' => true, 'pjaxSettings' => ['options' => ['enablePushState' => false, 'id' => 'gv-kota'], 'hover' => true, 'responsive' => true, 'responsiveWrap' => true, 'bordered' => true, 'striped' => '4px', 'autoXlFormat' => true, 'export' => ['fontAwesome' => true, 'showConfirmAlert' => false, 'target' => GridView::TARGET_BLANK]]]); $navmenu = NavX::widget(['options' => ['class' => 'nav nav-tabs'], 'encodeLabels' => false, 'items' => [['label' => 'MENU', 'active' => true, 'items' => [['label' => '<span class="fa fa-user fa-md"></span>Customers', 'url' => '/mastercrm/customers-crm/index'], ['label' => '<span class="fa fa-cogs fa-md"></span>Alias Customers', 'url' => '/mastercrm/customers-crm/login-alias', 'linkOptions' => ['id' => 'performance', 'data-toggle' => 'modal', 'data-target' => '#formlogin']], '<li class="divider"></li>', ['label' => 'Properties', 'items' => [['label' => '<span class="fa fa-flag fa-md"></span>Kota', 'url' => '/mastercrm/kota-customers-crm/index'], ['label' => '<span class="fa fa-flag-o fa-md"></span>Province', 'url' => '/mastercrm/provinsi-customers-crm/index'], ['label' => '<span class="fa fa-table fa-md"></span>Category', 'url' => '/mastercrm/kategori-customers-crm/index'], '<li class="divider"></li>', ['label' => '<span class="fa fa-map-marker fa-md"></span>Customers Map', 'url' => '/mastercrm/customers-crm/crm-map']]]]]]]); ?> <div class="content"> <div class="row" style="padding-left:3px"> <div class="col-sm-12 col-md-12 col-lg-12" >
/** * Creates a new User Login. * If creation is successful, the browser will be redirected to the 'index' page. * quthor wawan */ public function actionCreateUser() { if (Helper::checkRoute('create-user')) { $model = new Userlogin(); $model->scenario = 'createuser'; if ($model->load(Yii::$app->request->post())) { $post = Yii::$app->request->post(); $datapostion = $post['Userlogin']['POSITION_LOGIN']; if ($datapostion == 1) { $auth = "SALESMAN"; // auth key untuk salesmen } else { $auth = "SALES PROMOTION"; // auth key untuk sales promotion } $model->POSITION_LOGIN = $datapostion; $model->POSITION_SITE = "CRM"; // untuk login crm $pass = $model->password_hash; $security = Yii::$app->security->generatePasswordHash($pass); $authkey = Yii::$app->security->generatePasswordHash($auth); $model->password_hash = $security; $model->auth_key = $authkey; $model->save(); return $this->redirect(['index']); } else { return $this->renderAjax('create', ['model' => $model]); } } else { return $this->renderAjax('_confirm_alert', []); } }
use crm\mastercrm\models\Province; use yii\bootstrap\Modal; use kartik\nav\NavX; use mdm\admin\components\Helper; function tombolCreate() { $title1 = Yii::t('app', 'Create'); $options1 = ['id' => 'modl22', 'data-toggle' => "modal", 'data-target' => "#form3", 'class' => 'btn btn-success btn-sm']; $icon1 = '<i class="glyphicon glyphicon-plus"></i>'; $label1 = $icon1 . ' ' . $title1; $url1 = Url::toRoute(['/mastercrm/provinsi-customers-crm/createprovnce']); //,'kd'=>$kd]); $content = Html::a($label1, $url1, $options1); return $content; } if (Helper::checkRoute('createprovnce')) { $button_create = tombolCreate(); } else { $button_create = ""; } ?> <?php // grid province $tabprovince = \kartik\grid\GridView::widget(['id' => 'gv-prov', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'PROVINCE', ['class' => 'kartik\\grid\\ActionColumn', 'template' => Helper::filterActionColumn('{viewpro}{updatepro}'), 'header' => 'Action', 'dropdown' => true, 'dropdownOptions' => ['class' => 'pull-right dropup'], 'dropdownButton' => ['class' => 'btn btn-default btn-xs'], 'buttons' => ['viewpro' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="glyphicon glyphicon-eye-open"></span>' . Yii::t('app', 'View'), ['viewpro', 'id' => $model->PROVINCE_ID], ['data-toggle' => "modal", 'data-target' => "#view3", 'data-title' => $model->PROVINCE]) . '</li>'; }, 'updatepro' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="glyphicon glyphicon-pencil"></span>' . Yii::t('app', 'Update'), ['updatepro', 'id' => $model->PROVINCE_ID], ['data-toggle' => "modal", 'data-target' => "#form3", 'data-title' => $model->PROVINCE]) . '</li>';
//,'kd'=>$kd]); $content = Html::a($label1, $url1, $options1); return $content; } function tombolCreate() { $title1 = Yii::t('app', 'Create Parent'); $options1 = ['id' => 'create-parent-kategori', 'data-toggle' => "modal", 'data-target' => "#formparent", 'class' => 'btn btn-success btn-sm']; $icon1 = '<i class="glyphicon glyphicon-plus"></i>'; $label1 = $icon1 . ' ' . $title1; $url1 = Url::toRoute(['/mastercrm/kategori-customers-crm/createparent']); //,'kd'=>$kd]); $content = Html::a($label1, $url1, $options1); return $content; } if (Helper::checkRoute('createparent')) { $button_create = tombolCreate(); } else { $button_create = ""; } ?> <div class="row"> <div class="col-sm-12"> <?php $kategori = \kartik\grid\GridView::widget(['id' => 'gv-kat-crm', 'dataProvider' => $dataProviderkat, 'filterModel' => $searchModel1, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'CUST_KTG_PARENT', 'width' => '310px', 'value' => function ($model, $key, $index, $widget) { $kategori = Kategoricus::find()->where(['CUST_KTG' => $model->CUST_KTG_PARENT])->one();