/** * Lists all Client models. * @return mixed */ public function actionIndex() { $searchModel = new ClientSearch(); $query = Client::find(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $query); //$groups = Group::AllGroup(); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Creates data provider instance with search query applied * @return ActiveDataProvider */ public function search($params) { $query = Client::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'slug' => $this->slug, 'author_id' => $this->author_id, 'category_id' => $this->category_id, 'updater_id' => $this->updater_id, 'status' => $this->status, 'published_at' => $this->published_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'weight', $this->weight])->andFilterWhere(['like', 'body', $this->body]); return $dataProvider; }
public function actionEnum($domain_type) { $membersArray = Client::find()->published()->andWhere(['like', 'domain', Yii::getAlias('@frontendUrl_' . $domain_type)])->all(); $enum = []; $enumTitles = []; foreach ($membersArray as $k => $v) { $enum[] = $v->title . ' #' . $v->id; } //\yii\helpers\VarDumper::dump($members,11,1); die(); Yii::$app->response->data = ["items" => ["type" => "string", "enum" => $enum]]; Yii::$app->response->format = yii\web\Response::FORMAT_JSON; return Yii::$app->response; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Client::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => false, 'sort' => ['defaultOrder' => ['name' => SORT_ASC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'active' => $this->active]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * Creates data provider instance with search query applied * @return ActiveDataProvider */ public function search($params) { $query = Client::find(); if (!\Yii::$app->user->can('administrator')) { $query->forDomain(); } $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'slug' => $this->slug, 'author_id' => $this->author_id, 'category_id' => $this->category_id, 'updater_id' => $this->updater_id, 'status' => $this->status, 'published_at' => $this->published_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'domain_id' => $this->domain_id]); $query->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'weight', $this->weight])->andFilterWhere(['like', 'body', $this->body])->andFilterWhere(['like', 'before_body', $this->before_body])->andFilterWhere(['like', 'after_body', $this->after_body])->andFilterWhere(['like', 'on_scenario', $this->on_scenario]); return $dataProvider; }
$form = ActiveForm::begin(['layout' => 'horizontal']); ?> <div> <?php echo $form->errorSummary($model); ?> <?php $this->beginBlock('main'); ?> <p> <?php /*= $form->field($model, 'client_id')->dropDownList(\yii\helpers\ArrayHelper::map(\common\models\Client::find()->active()->all(), 'id', 'name'), ['prompt' => '']) */ ?> <?php echo $form->field($model, 'client_id')->widget(\kartik\select2\Select2::className(), ['data' => \yii\helpers\ArrayHelper::map(\common\models\Client::find()->active()->all(), 'id', 'name'), 'options' => ['prompt' => '']]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'email')->input('email', ['maxlength' => true]); ?> <?php echo $form->field($model, 'phone')->input('tel', ['maxlength' => true, 'placeholder' => '(10 digits only)']); ?> <?php
/* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Locations'; $this->params['breadcrumbs'][] = ['label' => 'Clients', 'url' => ['client/index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="location-index"> <p class="pull-right"> <?php echo Html::a('<span class="glyphicon glyphicon-plus"></span> New Location', ['create'], ['class' => 'btn btn-success btn-xs showModalButton']); ?> </p> <h3><?php echo Html::encode($this->title); ?> </h3> <?php Pjax::begin(['id' => 'locations-pjax', 'linkSelector' => '#locationss-pjax a[data-sort]', 'enablePushState' => !Yii::$app->request->isAjax]); ?> <?php echo GridView::widget(['id' => 'locations-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'client_id', 'value' => 'client.name', 'filter' => \yii\helpers\ArrayHelper::map(\common\models\Client::find()->active()->all(), 'id', 'name')], ['attribute' => 'name', 'format' => 'raw', 'value' => function ($m) { /** @var \common\models\Location $m */ return Html::a($m->name, ['view', 'id' => $m->id]); }, 'headerOptions' => ['class' => 'primary'], 'filterInputOptions' => ['class' => 'form-control', 'placeholder' => '(Client or Location name)']], ['attribute' => 'phone', 'format' => 'phone', 'filterInputOptions' => ['type' => 'tel', 'class' => 'form-control', 'placeholder' => '(digits only)']], ['attribute' => 'proactive', 'format' => 'boolean', 'filter' => Yii::$app->formatter->booleanFormat], ['attribute' => 'lastInvoice.idNum', 'label' => 'Last Invoice #', 'visible' => Yii::$app->user->can('view-invoices')], ['attribute' => 'lastInvoiceStatus', 'value' => 'lastInvoice.status', 'filter' => \common\models\Invoice::$STATUSES, 'visible' => Yii::$app->user->can('view-invoices')], ['attribute' => 'active', 'format' => 'boolean', 'filter' => Yii::$app->formatter->booleanFormat, 'visible' => Yii::$app->user->can('Admin')], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttonOptions' => ['class' => 'showModalButton']]]]); ?> <?php Pjax::end(); ?> </div>
use yii\widgets\Breadcrumbs; use common\models\Loan; use common\models\AppApplicant; use common\models\Application; use common\models\Client; $id_application = 0; //根据用户id查出是否有无数据 $applicant = AppApplicant::find()->where(['id_user' => Yii::$app->user->getIdentity()->id])->orderBy(['id_app_applicant' => SORT_DESC])->one(); $application = null; $loan = null; if (!is_null($applicant)) { $application = Application::findOne($applicant->id_application); $loan = Loan::find()->where(['id_application' => $applicant->id_application])->one(); } //根据id_user查找出client(用于profile方法的传值)$id_client $client = Client::find()->andWhere(['id_user' => Yii::$app->user->getIdentity()->id_user])->one(); ?> <nav class="navbar navbar-default navbar-fixed-top nav-ma"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand h60" href="#"><img src="<?php echo Url::to(['@web/images/BetterDebt_logo.svg']); ?> " width="190" alt="logo"></a> </div>
use yii\widgets\Pjax; /* @var $this yii\web\View */ /* @var $searchModel frontend\models\ContactSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Contacts'; $this->params['breadcrumbs'][] = ['label' => 'Clients', 'url' => ['client/index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="contact-index"> <p class="pull-right"> <?php echo Html::a('<span class="glyphicon glyphicon-plus"></span> New Contact', ['create'], ['class' => 'btn btn-success btn-xs showModalButton']); ?> </p> <h3><?php echo Html::encode($this->title); ?> </h3> <?php Pjax::begin(['id' => 'contacts-pjax', 'linkSelector' => '#contacts-pjax a[data-sort]', 'enablePushState' => !Yii::$app->request->isAjax]); ?> <?php echo GridView::widget(['id' => 'contacts-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'client_id', 'value' => 'client.name', 'filter' => \yii\helpers\ArrayHelper::map(\common\models\Client::find()->active()->all(), 'id', 'name')], ['attribute' => 'name', 'headerOptions' => ['class' => 'primary']], ['attribute' => 'email', 'format' => 'email', 'filterInputOptions' => ['type' => 'email', 'class' => 'form-control']], ['attribute' => 'phone', 'format' => 'phone', 'filterInputOptions' => ['type' => 'tel', 'class' => 'form-control', 'placeholder' => '(digits only)']], ['attribute' => 'active', 'format' => 'boolean', 'filter' => Yii::$app->formatter->booleanFormat, 'visible' => Yii::$app->user->can('Admin')], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttonOptions' => ['class' => 'showModalButton']]]]); ?> <?php Pjax::end(); ?> </div>
public function actionGetClientByIdGroup($selected = null) { if (isset($_POST['depdrop_all_params'])) { $id = $_POST['depdrop_all_params']['application-id_group']; $models = Client::find()->andWhere(['id_group' => $id])->all(); foreach ($models as $model) { //验证client是否无active application与loan $canAdd = true; if (Yii::$app->params['uniqueSelectClient']) { $applicants = AppApplicant::find()->andWhere(['id_user' => $model->id_user])->all(); foreach ($applicants as $applicant) { if (isset($applicant->application) && $applicant->application->id_application_status == 1 || isset($applicant->application->loan) && $applicant->application->loan->status == 1) { $canAdd = false; } } } if ($canAdd) { $output[] = ['id' => $model->id_user, 'name' => $model->user->first_name . ' ' . $model->user->last_name]; } } if (isset($output)) { echo json_encode(['output' => $output, 'selected' => $selected]); } else { echo json_encode(['output' => '', 'selected' => '']); } } }
public function actionPaymentFis() { $this->layout = '@app/views/layouts/loadfis/content.php'; $output = ""; if (Yii::$app->params['fistestuser']) { $client['client_id'] = 'testuser1'; } else { $id_user = Yii::$app->user->getIdentity()->id_user; $client = Client::find()->where(['id_user' => $id_user])->one(); } exec("cd /var/www/fis-sso-tokens/ && java -classpath bin:lib/AESCrypto.jar:lib/bcprov-jdk15-140.jar:lib/castor-0.9.3.19.jar:lib/commons-lang3-3.4.jar:lib/cryptix-jce-provider.jar:lib/cryptix32.jar:lib/gson-2.4.jar:lib/local_policy.jar:lib/US_export_policy.jar:lib/slapi_v3.1_client.jar:lib/log4j-1.2.8.jar com.betterdebt.fissso.GenSSOTokens " . $client['client_id'], $output); if (empty($output) || !is_array($output)) { throw new UnauthorizedHttpException("Sorry, authentication failed."); } $output = implode('', $output); $start = strpos($output, '{'); $output = substr($output, $start); $output = json_decode($output, 1); if (!is_array($output)) { throw new UnauthorizedHttpException("Sorry, authentication failed."); } if ($output['ResultCode'] > 0) { //执行成功,否则失败 return $this->render('paymentfis', ['fisurl' => Yii::$app->params['fisSSOURL'], 'authtoken' => $output['AuthToken'], 'keytoken' => $output['KeyToken']]); } else { throw new UnauthorizedHttpException("Sorry, authentication failed."); } }