/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function searchMain($params) { $query = Sda::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->orFilterWhere(['like', 'title', $this->searchMain]); $query->andFilterWhere(['congress_id' => $this->congress_id]); $dataProvider->sort->attributes['sda_name'] = ['asc' => ['sda_types.sda_name' => SORT_ASC], 'desc' => ['sda_types.sda_name' => SORT_DESC]]; return $dataProvider; }
/** * Upload attachment for SDA * @param int $id * @return mixed */ public function actionUploadsda($id) { $id = (int) $id; $model1 = new SdaAttachments(); if ($model1->load(Yii::$app->request->post())) { //If request is post $model1->path = UploadedFile::getInstances($model1, 'path'); foreach ($model1->path as $files) { if ($files->saveAs('uploads/' . $files->baseName . '.' . $files->extension)) { $model1->congress_id = $id; $filesize = $files->size; $filetype = $files->extension; $path = "uploads/" . $files->name; $cong = Sda::find()->where(['id' => $id])->one(); $congressid = $cong['congress_id']; Yii::$app->db->createCommand("insert into sda_attachments(sda_id,path,congress_id,size,type)values('{$id}','{$path}','{$congressid}','{$filesize}','{$filetype}')")->execute(); } } return $this->redirect(array("sda/update", 'id' => $id)); } }
<?php use yii\helpers\Html; use backend\models\Sda; use backend\models\CongressDetails; use backend\models\FeedbackComments; $spaceString = " "; $this->title = 'SDA Feedback'; $this->params['breadcrumbs'][] = $this->title; //getting congress id for back functinility $getfid = $_REQUEST['id']; $userid = Sda::find()->where(['id' => $getfid])->one(); $congid = $userid['congress_id']; $congress = CongressDetails::findOne($congid); if ($congress) { $this->params['blueTitle'] = 'Congress Schedule:' . $congress->name; } else { $this->params['blueTitle'] = 'Congress Schedule'; } $array_elements = array(); $takeaway_summary = array(); $question_ans = array(); $ol_feedback = array(); $audiences_size = ''; $debrief = ''; $questions_anss = ''; $session = ''; $takeawaysd = ''; $images = ""; $allimages = ''; $userdetails = [];
/* @var $model backend\models\SdaFeedback */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="sda-feedback-form"> <?php $form = ActiveForm::begin(); ?> <?php $congress_ids = \backend\models\CongressDetails::find()->all(); $listData = ArrayHelper::map($congress_ids, 'id', 'name'); echo $form->field($model, 'congress_id')->dropDownList($listData, ['prompt' => 'Select...']); ?> <?php $sda_ids = \backend\models\Sda::find()->all(); $listDatas = ArrayHelper::map($sda_ids, 'id', 'title'); echo $form->field($model, 'sda_id')->dropDownList($listDatas, ['prompt' => 'Select...']); ?> <?php $listData = ArrayHelper::map($sda_ids, 'session_id', 'session_id'); echo $form->field($model, 'session_id')->dropDownList($listData, ['prompt' => 'Select...']); ?> <?php echo $form->field($model, 'audience_size')->textInput(); ?> <?php echo $form->field($model, 'additional_data')->textInput(['maxlength' => true]); ?> <?php