/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Style::find();
     $pageSize = Yii::$app->session->get('pageSize', 20);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize]]);
     $dataProvider->setSort(['attributes' => ['s_id', 's_b_id', 's_p_id', 'bankName' => ['asc' => ['{{%bank}}.bezeichnung' => SORT_ASC], 'desc' => ['{{%bank}}.bezeichnung' => SORT_DESC], 'label' => 'Bankenname'], 'groupName' => ['asc' => ['{{%personen}}.bezeichnung' => SORT_ASC], 'desc' => ['{{%personen}}.bezeichnung' => SORT_DESC], 'label' => 'Gruppenname'], 'style']]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'style', $this->style]);
     $query->joinWith(['bank' => function ($q) {
         $q->where('{{%bank}}.bezeichnung LIKE "%' . $this->bankName . '%"');
     }]);
     $query->joinWith(['group' => function ($q) {
         $q->where('{{%personen}}.bezeichnung LIKE "%' . $this->groupName . '%"');
     }]);
     return $dataProvider;
 }
 public function processCode($fullCode)
 {
     $code = $fullCode['code'];
     $original = $fullCode['original'];
     if ($this->isCodeActive($code)) {
         $group = Group::findOne($code->z_p_id)->toArray();
         $bank = Bank::findOne($code->z_b_id)->toArray();
         $form = Form::findOne(['f_klasse' => $bank['klasse'], 'f_p_id' => $group['p_id']]);
         $style = Style::findOne(['s_b_id' => $bank['b_id'], 's_p_id' => $group['p_id']]);
         if (!$style) {
             $style = Settings::getSetting('style');
         } else {
             $style = $style->style;
         }
         $label = Yii::$app->params['default_next_label'];
         $message = Yii::$app->params['default_next_message'];
         if ($this->language != "default") {
             $language = Language::findOne($this->language);
             if ($language != null) {
                 if ($language->label != '') {
                     $label = $language->label;
                 }
                 if ($language->message != '') {
                     $message = $language->message;
                 }
             }
         }
         Yii::$app->session['anketData'] = ['original' => $original, 'code' => $code->toArray(), 'group' => $group, 'bank' => $bank, 'form' => $form->f_id, 'status' => 0, 'lang' => $this->language, 'style' => $style, 'label' => $label, 'message' => $message];
         $meta = Meta::findOne(['m_z_id' => $code->z_id]);
         if (!$meta) {
             $meta = new Meta();
             $meta->m_z_id = $code->z_id;
             $meta->ip = $_SERVER['REMOTE_ADDR'];
             $meta->time_start = time();
         } else {
             $meta->ip = $_SERVER['REMOTE_ADDR'];
         }
         $meta->save();
         return true;
     }
     return false;
 }
 public function actionStyle()
 {
     $styles = Style::find()->all();
     return $this->render('style', ['model' => $styles]);
 }
 /**
  * Finds the Style model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Style the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Style::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 5
0
?>
:</th>
                    <td><?php 
echo $model->ip;
?>
</td>
                </tr>

                <tr>
                    <th><?php 
echo Yii::t('app', 'DESIGN');
?>
:</th>
                    <td>
                        <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'style', 'url' => $url, 'mode' => 'pop', 'type' => 'select2', 'clientOptions' => ['pk' => $model->id, 'autotext' => 'always', 'placement' => 'right', 'select2' => ['width' => '200px'], 'value' => $model->style, 'source' => \app\models\Style::getStyleArray()]]);
?>
                    </td>
                </tr>

                <tr>
                    <th><?php 
echo Yii::t('app', 'NICKNAME');
?>
</th>
                    <td>
                        <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'username', 'url' => $url, 'mode' => 'pop']);
?>
                    </td>
                </tr>
Esempio n. 6
0
 public function testExistDefault()
 {
     $style = Style::find()->where(['name' => 'default'])->one();
     expect('name should be like search', $style->name)->equals('default');
     expect('title should be like fixtures', $style->title)->equals('title-default');
 }
Esempio n. 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStyle()
 {
     return $this->hasOne(Style::className(), ['id' => 'style_id']);
 }