Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Duration::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
Exemplo n.º 2
0
Arquivo: _form.php Projeto: arsik/xfit
echo $form->field($model, 'header')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'description')->textArea(['maxlength' => true]);
?>

    <?php 
$vizitings = \app\models\Viziting::find()->all();
$items = ArrayHelper::map($vizitings, 'id', 'title');
$params = ['prompt' => 'Выберите время'];
echo $form->field($model, 'vizitingID')->dropDownList($items, $params);
?>

    <?php 
$durations = \app\models\Duration::find()->all();
$items = ArrayHelper::map($durations, 'id', 'title');
$params = ['prompt' => 'Выберите срок'];
echo $form->field($model, 'durationID')->dropDownList($items, $params);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Добавить' : 'Изменить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Exemplo n.º 3
0
 /**
  * Finds the Duration model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Duration the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Duration::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
 public function actionDuration()
 {
     if (Yii::$app->request->isAjax) {
         $durationID = Yii::$app->request->get('duration');
         if ($durations = Duration::find()->where(['id' => $durationID])->asArray()->one()) {
             return json_encode($durations, JSON_UNESCAPED_UNICODE);
         } else {
             return 'Duration is not found';
         }
     }
     return $this->redirect('index');
 }
Exemplo n.º 5
0
Arquivo: index.php Projeto: arsik/xfit
  <p class="pull-right visible-xs">
    <button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">Меню</button>
  </p>
  <div class="row">

  </div><!--/row-->
</div><!--/span-->

  <?php 
$cities = \app\models\City::find()->count();
$clubs = \app\models\Clubs::find()->count();
$cards = \app\models\Cards::find()->count();
$types = \app\models\Types::find()->count();
$orders = \app\models\Order::find()->count();
$viziting = \app\models\Viziting::find()->count();
$duration = \app\models\Duration::find()->count();
?>

<div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar" role="navigation">
  <div class="list-group">
    <?php 
if (Yii::$app->user->identity->username == "admin") {
    echo '<a href="/city" class="list-group-item">Города (' . $cities . ')</a>
      <a href="/clubs" class="list-group-item">Клубы (' . $clubs . ')</a>
      <a href="/cards" class="list-group-item">Карты (' . $cards . ')</a>
      <a href="/types" class="list-group-item">Типы карт (' . $types . ')</a>
      <a href="/viziting" class="list-group-item">Время посещений (' . $viziting . ')</a>
      <a href="/duration" class="list-group-item">Сроки действия карт (' . $duration . ')</a>';
}
?>
    <a href="/order" class="list-group-item">Заказы (<?php