/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Types::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', 'name', $this->name]); return $dataProvider; }
/** * Updates an existing Devices model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $listparent = Devices::find()->all(); $listobject = Objects::find()->all(); $listbrend = Brends::find()->all(); $listinterface = Interfaces::find()->all(); $liststate = States::find()->all(); $listype = Types::find()->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'listparent' => $listparent, 'listobject' => $listobject, 'listbrend' => $listbrend, 'listinterface' => $listinterface, 'liststate' => $liststate, 'listype' => $listype]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Types::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['ID' => $this->ID, 'isReduced' => $this->isReduced]); $query->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
public function edit(Company $company) { $title = "Bewerk {$company->name}"; $types = Types::lists('title', 'id'); return view('admin.company.edit', compact('title', 'company', 'types')); }
public function addType($type) { $this->removeType(); $type = Types::findOrFail($type); $this->types()->attach($type); }
/** * @return \yii\db\ActiveQuery */ public function getCardType() { return $this->hasOne(Types::className(), ['id' => 'cardTypeID']); }
public static function getTypesList() { // Выбираем только те категории, у которых есть дочерние категории $parents = Types::find()->select(['id', 'name'])->all(); return ArrayHelper::map($parents, 'id', 'name'); }
use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model app\models\Cards */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="cards-form"> <?php $form = ActiveForm::begin(); ?> <?php $types = \app\models\Types::find()->all(); $items = ArrayHelper::map($types, 'id', 'name'); $params = ['prompt' => 'Выберите тип карты']; echo $form->field($model, 'cardTypeID')->dropDownList($items, $params); ?> <?php $clubs = \app\models\Clubs::find()->all(); $items = ArrayHelper::map($clubs, 'id', 'name'); $params = ['prompt' => 'Выберите клуб']; echo $form->field($model, 'clubID')->dropDownList($items, $params); ?> <?php echo $form->field($model, 'cost')->textInput(); ?>
<div class="row row-offcanvas row-offcanvas-right"> <div class="col-xs-12 col-sm-9"> <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>';
/** * @return \yii\db\ActiveQuery */ public function getTypes() { return $this->hasOne(Types::className(), ['id' => 'types_id']); }
public function getTypesVariants() { return $this->hasMany(Types::className(), ['cardTypeID' => 'id']); //xz }
public function assign_volume_type($From, $To, $VolumeType) { /* echo $From; echo $To; echo $VolumeType; */ $From_id = Pages::find(array('fields' => '_id'), array('conditions' => array('filename' => $From))); $To_id = Pages::find(array('fields' => '_id'), array('conditions' => array('_id' => $To))); $Types_id = Types::find(array('fields' => '_id'), array('conditions' => array('_id' => $VolumeType))); foreach ($Types_id as $t) { $type_id = $t['_id']; $type_name = $t['name']; $type_no = $t['no']; } foreach ($From_id as $t) { $from_sort_order = $t['sort_order']; $volume_number = $t['volume_number']; } foreach ($To_id as $t) { $to_sort_order = $t['sort_order']; } $data = array('type.no' => $type_no, 'type.id' => $type_id, 'type.name' => $type_name, 'ip' => $_SERVER['REMOTE_ADDR']); for ($i = $from_sort_order; $i <= $to_sort_order; $i++) { $new_page = Pages::find(array('fields' => '_id'), array('conditions' => array('sort_order' => $i, 'volume_number' => $volume_number)))->save($data); } // return $this->render(array('json' => $data = array($new_page), 'status'=> 200)); }
/** * @return \yii\db\ActiveQuery */ public function getNsType() { return $this->hasOne(Types::className(), ['ID' => 'ns_type']); }
/** * Update the specified resource in storage. * * @param Requests\CreateTypeRequest $request * @param Types $types * * @return \Illuminate\Http\Response */ public function update(Requests\UpdateTypeRequest $request, Types $types) { $types->update($request->all()); return redirect()->route('admin.types.edit', $types->id)->with('Success', 'Bedrijfstype is bijgewerkt'); }
public static function types($id) { return \App\Models\Types::find($id); }
?> <?php echo $form->field($model, 'email')->textInput(); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?> <?php echo $form->field($model, 'confirm_password')->passwordInput(); ?> <?php echo $form->field($model, 'type_id')->dropDownList(ArrayHelper::map(Types::getData(), 'id', 'name'), ['prompt' => 'Select Type']); ?> <div class="form-group"> <div class="col-lg-offset-1 col-lg-11"> <?php echo Html::submitButton('Save', ['class' => 'btn btn-primary', 'name' => 'login-button']); ?> </div> </div> <?php ActiveForm::end(); ?> </div>
?> <!--<?php echo $form->field($model, 'ns_nurseID')->textInput(); ?> --> <?php echo $form->field($model, 'ns_nurseID')->dropDownList(Nurse::dropdown()); ?> <?php echo $form->field($model, 'ns_shiftID')->textInput(); ?> <?php echo $form->field($model, 'ns_type')->dropDownList(Types::dropdown()); ?> <?php echo $form->field($model, 'ns_hours')->textInput(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
$nurseModel = new \app\models\Nurse(); ?> <div class="nurseshift-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create Nurseshift'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'ns_nurseID', 'label' => 'Όνομα Νοσηλευτή', 'value' => function ($model, $index, $dataColumn) { // more optimized than $model->role->name; $roleDropdown = \app\models\Nurse::dropdown(); return $roleDropdown[$model->ns_nurseID]; }, 'filter' => \app\models\Nurse::dropdown()], ['attribute' => 'ns_type', 'label' => 'Τύπος', 'value' => 'nsType.description', 'filter' => \app\models\Types::dropdown()], ['attribute' => 'ns_shiftID', 'label' => 'Ημερομηνία', 'value' => function ($model, $index, $dataColumn) { // more optimized than $model->role->name; $roleDropdown = \app\models\Shifts::dropdown(); return $roleDropdown[$model->ns_nurseID]; }, 'filter' => \yii\jui\DatePicker::widget(['language' => 'el', 'dateFormat' => 'dd-MM-yyyy']), 'format' => 'html'], 'ns_hours', ['class' => 'yii\\grid\\ActionColumn']], 'containerOptions' => ['style' => 'overflow: auto'], 'beforeHeader' => [['columns' => [['content' => 'Header Before 1', 'options' => ['colspan' => 3, 'class' => 'text-center warning']], ['content' => 'Header Before 2', 'options' => ['colspan' => 3, 'class' => 'text-center warning']], ['content' => 'Header Before 3', 'options' => ['colspan' => 1, 'class' => 'text-center warning']]], 'options' => ['class' => 'skip-export']]], 'toolbar' => [['content' => Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type' => 'button', 'title' => Yii::t('kvgrid', 'Add Book'), 'class' => 'btn btn-success', 'onclick' => 'alert("This will launch the book creation form.\\n\\nDisabled for this demo!");']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['grid-demo'], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')])], '{export}', '{toggleData}'], 'pjax' => true, 'bordered' => true, 'striped' => false, 'condensed' => false, 'responsive' => true, 'hover' => true, 'floatHeader' => true]); ?> </div>
/** * Finds the Types model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Types the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Types::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use app\models\States; use app\models\Types; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $searchModel app\models\DevicesSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Devices'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="devices-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('Create Devices', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'description:ntext', ['attribute' => 'type', 'label' => 'Тип', 'value' => 'types.name', 'filter' => ArrayHelper::map(Types::find()->all(), 'id', 'name')], ['attribute' => 'state', 'label' => 'state', 'value' => 'states.name', 'filter' => ArrayHelper::map(States::find()->all(), 'id', 'name')], ['attribute' => 'idobject', 'label' => 'Обьект', 'value' => 'objects.name', 'filter' => ArrayHelper::map(Objects::find()->all(), 'id', 'name')], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>