Exemple #1
0
 public function bindCommandSendBack()
 {
     // send back to client status of station was changed
     $client = new Client();
     $command = $client->bindCommandStatus($this->request['id']);
     return $command;
 }
Exemple #2
0
 /**
  * Finds the Client model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Client the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Client::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #3
0
 public function unscheduled()
 {
     // Get a list of all ticket IDs scheduled in the next 2 weeks
     $scheduled = Schedule::find()->joinWith('labors.note', false)->select(Note::tableName() . '.ticket_id')->between(new Expression('NOW()'), date('Y-m-d', strtotime('+14 days')));
     // return tickets not in that list
     $this->andWhere(['not in', Ticket::tableName() . '.id', $scheduled])->joinWith('invoice.location.client')->orderBy([Client::tableName() . '.name' => SORT_ASC, Location::tableName() . '.name' => SORT_ASC, Ticket::tableName() . '.id' => SORT_ASC]);
     return $this;
 }
Exemple #4
0
 /**
  * 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;
 }
Exemple #5
0
 public function actionIndex()
 {
     $model = $this->findModel(Yii::$app->user->id);
     $laborTally = [];
     $laborTally['Hourly'] = Labor::find()->hourly()->tech($model->contact_id)->total();
     $laborTally['Proactive'] = Labor::find()->hourly(false)->tech($model->contact_id)->total();
     $openTickets = new ActiveDataProvider(['query' => Ticket::find()->active()->joinWith('invoice.location.client', false), 'pagination' => ['pageSize' => 10], 'sort' => ['defaultOrder' => ['status_id' => SORT_ASC, 'id' => SORT_ASC]]]);
     $openTickets->sort->attributes['location_id'] = ['asc' => [Client::tableName() . '.name' => SORT_ASC, Location::tableName() . '.name' => SORT_ASC], 'desc' => [Client::tableName() . '.name' => SORT_DESC, Location::tableName() . '.name' => SORT_DESC]];
     Url::remember();
     return $this->render('index', ['model' => $model, 'laborTally' => $laborTally, 'openTickets' => $openTickets]);
 }
Exemple #6
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Contact::find()->joinWith('client')->andWhere([Client::tableName() . '.active' => true]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 25], '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([Contact::tableName() . '.client_id' => $this->client_id, Contact::tableName() . '.active' => $this->active]);
     $query->andFilterWhere(['like', Contact::tableName() . '.name', $this->name])->andFilterWhere(['like', Contact::tableName() . '.email', $this->email])->andFilterWhere(['like', Contact::tableName() . '.phone', $this->phone]);
     return $dataProvider;
 }
Exemple #7
0
 /**
  * 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;
 }
Exemple #8
0
 /**
  * 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;
 }
Exemple #9
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Invoice::find()->andWhere(['not', ['status_id' => Invoice::STATUS_CURRENT]])->with('location.client');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => false, 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]]]);
     $dataProvider->sort->attributes['location_id'] = ['asc' => [Client::tableName() . '.name' => SORT_ASC, Location::tableName() . '.name' => SORT_ASC], 'desc' => [Client::tableName() . '.name' => SORT_DESC, Location::tableName() . '.name' => SORT_DESC]];
     $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([Invoice::tableName() . '.location_id' => $this->location_id, Invoice::tableName() . '.status_id' => $this->status_id]);
     $query->andFilterWhere(['like', Invoice::tableName() . '.id', (int) $this->id]);
     return $dataProvider;
 }
Exemple #10
0
 public function authenticate($user, $request, $response)
 {
     $accessToken = $request->get($this->tokenParam);
     if (is_string($accessToken)) {
         $identity = $user->loginByAccessToken($accessToken, get_class($this));
         if ($identity !== null) {
             return $identity;
         } elseif (Client::vAccessToken($accessToken)) {
             return true;
         }
     }
     if ($accessToken !== null) {
         $this->handleFailure($response);
     }
     return null;
 }
Exemple #11
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ticket::find()->current()->joinWith(['invoice.location', 'invoice.location.client']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 50], 'sort' => ['defaultOrder' => ['status_id' => SORT_ASC]]]);
     $dataProvider->sort->attributes['location_id'] = ['asc' => [Client::tableName() . '.name' => SORT_ASC, Location::tableName() . '.name' => SORT_ASC], 'desc' => [Client::tableName() . '.name' => SORT_DESC, Location::tableName() . '.name' => SORT_DESC]];
     $dataProvider->sort->attributes['status_id'] = ['asc' => [Ticket::tableName() . '.status_id' => SORT_DESC], 'desc' => [Ticket::tableName() . '.status_id' => 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([Location::tableName() . '.id' => $this->location_id, Ticket::tableName() . '.status_id' => $this->status_id, Ticket::tableName() . '.priority_id' => $this->priority_id, Ticket::tableName() . '.bill_type_id' => $this->bill_type_id]);
     $query->andFilterWhere(['like', Ticket::tableName() . '.id', $this->id]);
     return $dataProvider;
 }
Exemple #12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Location::find()->joinWith('client')->andWhere([Client::tableName() . '.active' => true]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => false, 'sort' => ['defaultOrder' => ['client_id' => SORT_ASC, 'name' => SORT_ASC]]]);
     $dataProvider->sort->attributes['client_id'] = ['asc' => [Client::tableName() . '.name' => SORT_ASC], 'desc' => [Client::tableName() . '.name' => SORT_DESC]];
     if (Yii::$app->user->can('Accounting')) {
         $query->joinWith('lastInvoice');
         $dataProvider->sort->attributes['lastInvoiceStatus'] = ['asc' => [Invoice::tableName() . '.status_id' => SORT_ASC], 'desc' => [Invoice::tableName() . '.status_id' => SORT_DESC]];
     }
     $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([self::tableName() . '.client_id' => $this->client_id, self::tableName() . '.proactive' => $this->proactive, self::tableName() . '.active' => $this->active]);
     if (Yii::$app->user->can('Accounting')) {
         $query->andFilterWhere([Invoice::tableName() . '.status_id' => $this->lastInvoiceStatus]);
     }
     $query->andFilterWhere(['or', ['like', self::tableName() . '.name', $this->name], ['like', Client::tableName() . '.name', $this->name]])->andFilterWhere(['like', 'phone', $this->phone]);
     return $dataProvider;
 }
Exemple #13
0
$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 
Exemple #14
0
/* @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>
Exemple #15
0
 public function getClient()
 {
     return $this->hasOne(Client::className(), ['id_user' => 'id_user']);
 }
Exemple #16
0
 /**
  * @return ClientQuery
  */
 public function getClient()
 {
     return $this->hasOne(Client::className(), ['id' => 'client_id'])->inverseOf('contacts');
 }
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>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClients()
 {
     return $this->hasMany(Client::className(), ['category_id' => 'id']);
 }
Exemple #19
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClient()
 {
     return $this->hasOne(Client::className(), ['id' => 'client_id']);
 }
 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.");
     }
 }
Exemple #21
0
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>
Exemple #22
0
 public function getInfo()
 {
     switch ($this->id_user_role) {
         case Dict::USER_ROLE_BETTERDEBT:
             return $this->hasOne(Betterdebt::classname(), ['id_user' => 'id_user']);
             break;
         case Dict::USER_ROLE_ADVISOR:
             return $this->hasOne(Advisor::classname(), ['id_user' => 'id_user']);
             break;
         case Dict::USER_ROLE_CLIENT:
             return $this->hasOne(Client::classname(), ['id_user' => 'id_user']);
             break;
         case Dict::USER_ROLE_BANK:
             return $this->hasOne(BankUser::classname(), ['id_user' => 'id_user']);
             break;
         default:
             return null;
             break;
     }
 }
 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 sendMessage()
 {
     if (Yii::$app->request->isAjax) {
         $post = Yii::$app->request->post();
         if (isset($post['id']) && $post['id'] > 0) {
             $station = Station::findOne($post['id']);
             $ip = $station['ip'];
             $port = $station['port'];
             if ($ip != '' && $port != '') {
                 $client = new Client();
                 $init = $client->init($ip, $port);
                 if ($init) {
                     $send = $client->send($post['message']);
                     if ($send) {
                         print $client->returnMessage;
                     } else {
                         print $client->error;
                     }
                 } else {
                     print $client->error;
                 }
             }
         }
     }
     print 'failed';
 }