public function index($ajax = null, $order_by = 'locatie', $order_by_sort = 'ASC', $tagnummer = null, $type = null, $component = null, $in_dienst_name = null, $locatie = null)
 {
     $login = Auth::check('member');
     $locations = Locations::find('all', array('order' => array('locatie' => 'ASC')));
     $this->request->data['actief'] = 'ja';
     return compact('login', 'location', 'locations');
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Locations::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(['cellar_loc_id' => $this->cellar_loc_id, 'cellar_id' => $this->cellar_id]);
     $query->andFilterWhere(['like', 'location', $this->location]);
     return $dataProvider;
 }
 public function edit($username)
 {
     $login = Auth::check('member');
     $user = Users::find('first', array('conditions' => array('username' => $username)));
     if ($login['rol'] != 'administrator' && $user->username != $login->username) {
         return $this->redirect('/');
     }
     if ($this->request->data) {
         $user->username = $this->request->data['username'];
         if (!empty($this->request->data['password'])) {
             $user->password = $this->request->data['password'];
         }
         $user->location = $this->request->data['location'];
         $user->voornaam = $this->request->data['voornaam'];
         $user->achternaam = $this->request->data['achternaam'];
         $user->rol = $this->request->data['rol'];
         if ($user->save()) {
             return $this->redirect('users/view/' . $username);
         }
     }
     $locations = Locations::find('all', array('order' => array('district' => 'ASC')));
     foreach ($locations as $key => $location) {
         $provincie = $locations[$key]['provincie'];
         $district = $locations[$key]['district'];
         if ($login['rol'] != 'administrator') {
             if ($provincie == $login['location']) {
                 $locaties[$district] = $district . ' (' . $locations[$key]['provincie'] . ')';
             }
         } else {
             $locaties[$district] = $district . ' (' . $locations[$key]['provincie'] . ')';
         }
     }
     $actief = self::$actief;
     $breadcrumb = self::$breadcrumb;
     $breadcrumb[] = array('naam' => 'Gebruiker bewerken');
     return compact('user', 'login', 'actief', 'breadcrumb', 'locaties');
 }
Exemplo n.º 4
0
<?php

use app\models\Cellars;
use app\models\Wines;
use app\models\Locations;
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use kartik\widgets\ActiveForm;
use kartik\widgets\Select2;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
/**
 * @var yii\web\View $this
 * @var app\models\Cellarwines $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="cellarwines-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['cellar_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Cellars::find()->orderBy('cellar_name')->asArray()->all(), 'id', 'cellar_name')], 'wine_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => Wines::getListing()], 'quantity' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Quantity...']], 'cellar_loc_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Locations::find()->orderBy('loc_name')->asArray()->all(), 'id', 'loc_name')], 'rating' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Rating...']], 'created_at' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Created At...']], 'updated_at' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Updated At...']], 'cost' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Cost...', 'maxlength' => 10]]]]);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
ActiveForm::end();
?>

</div>
 public function add_provincie()
 {
     $login = Auth::check('member');
     $lijsten = Lijsten::find('all');
     $locaties = '';
     foreach ($lijsten as $key => $lijst) {
         $locatie = Locations::find('first', array('conditions' => array('districtnummer' => $lijsten[$key]['districtscode'])));
         Lijsten::Update(array('$set' => array('provincie' => $locatie->provincie)), array('_id' => $lijsten[$key]['_id']));
         $locaties .= $lijsten[$key]['districtscode'] . ' => ' . $locatie->provincie . ' SET<br />';
     }
     $actief = self::$actief;
     $breadcrumb = self::$breadcrumb;
     $breadcrumb[] = array('naam' => 'Lijsten bekijken');
     return compact('login', 'actief', 'breadcrumb', 'locaties');
 }