public function search($params)
 {
     $query = Diagnos::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'body', $this->body])->andFilterWhere(['like', 'intro', $this->intro]);
     return $dataProvider;
 }
 /**
  * Finds the Diagnos model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Diagnos the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Diagnos::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
 /**
  * Извлекаем список заболеваний для типов продуктов
  */
 public function getDiagnos()
 {
     $query = $this->hasMany(Diagnos::className(), ['id' => 'diagnos_id'])->viaTable('tbl_product_type_has_diagnos', ['product_type_id' => 'type_id']);
     if (is_numeric(Yii::$app->request->get('diagnos'))) {
         $query->where(['tbl_diagnos.id' => (int) Yii::$app->request->get('diagnos')]);
     }
     return $query;
 }
예제 #4
0
use common\models\Specialist;
use common\models\SpecialistType;
use common\models\Product;
use common\models\ProductType;
use common\models\ProductCat;
use common\models\Diagnos;
use common\models\Organization;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
//Заболевания диагноз parent_id > 0
$catList = ArrayHelper::index(ProductCat::find()->where(['>', 'parent_id', 0])->asArray()->all(), 'id');
//Список организаций
$orgList = ArrayHelper::index(Organization::find()->asArray()->all(), 'id');
$specList = ArrayHelper::index(Specialist::find()->asArray()->all(), 'id');
$specTypeList = ArrayHelper::index(SpecialistType::find()->asArray()->all(), 'id');
$diagnosList = ArrayHelper::index(Diagnos::find()->asArray()->all(), 'id');
$css = <<<CSS

select.search_select {
  border: 0 none;
  width: 100%; border-bottom: 1px solid #A52024;
  border-left: 1px solid #A52024;
  padding: 3px 10px;
}

.select2-container--krajee .select2-selection {
    -webkit-box-shadow: none;
    box-shadow: none;
    background-color: #fff;
    border: 0;
\tborder-bottom: 1px solid #A52024;
예제 #5
0
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
use common\widgets\edit\InputFile;
use common\widgets\edit\Redactor;
/**
 * @var yii\web\View $this
 * @var common\models\ProductType $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="product-type-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['cat_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\ProductCat::find()->where(['>', 'parent_id', '0'])->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Название типа продукта...', 'maxlength' => 255]], 'icon_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'image']], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Redactor::className(), 'options' => ['filemanager' => ['webpath' => '/'], 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Полное описание...', 'rows' => 6]]], 'type_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\ProductType())->getTypeIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'diagnoses_list' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(\common\models\Diagnos::find()->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...', 'multiple' => true], 'pluginOptions' => ['tags' => true, 'maximumInputLength' => 10]]]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>

</div>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDiagnoses()
 {
     return $this->hasMany(Diagnos::className(), ['id' => 'diagnos_id'])->viaTable('tbl_product_type_has_diagnos', ['product_type_id' => 'id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDiagnos()
 {
     return $this->hasOne(Diagnos::className(), ['id' => 'diagnos_id']);
 }