Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Status::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, 'permissions' => $this->permissions, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'message', $this->message]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Status::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, 'status_value' => $this->status_value]);
     $query->andFilterWhere(['like', 'status_name', $this->status_name]);
     return $dataProvider;
 }
Example #3
0
 /**
  *   @getStatusList
  */
 public function getStatusList()
 {
     $droptions = Status::find()->asArray()->all();
     return Arrayhelper::map($droptions, 'status_value', 'status_name');
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStatusgroup()
 {
     return $this->hasOne(Status::className(), ['id' => 'status']);
 }
 /**
  * Finds the Status model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Status the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Status::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #6
0
 public static function getStatusId($status_name)
 {
     $status = Status::find('id')->where(['status_name' => $status_name])->one();
     return isset($status->id) ? $status->id : false;
 }
Example #7
0
echo $form->field($model, 'name_post')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'content')->widget(CKEditor::className(), ['options' => ['rows' => 6], 'preset' => 'full']);
?>

    <?php 
echo $form->field($model, 'create_day')->textInput();
?>

    <?php 
echo $form->field($model, 'status')->textInput();
?>
    
    <?php 
echo $form->field($model, 'status')->dropDownList(ArrayHelper::map(Status::find()->all(), 'id', 'name'), []);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Example #8
0
 /**
  * get user type relationship
  * 
  */
 public function getUserType()
 {
     return $this->hasOne(Status::classname(), ['id' => 'user_type_id']);
 }
 /**
  * Import booth data using spreadsheet
  * @return mixed
  */
 public function actionExcel()
 {
     $model = new Booths();
     if ($model->load(Yii::$app->request->post())) {
         $congid = $_POST['Booths']['id'];
         $model->fileName = UploadedFile::getInstance($model, 'fileName');
         $time = time();
         $model->fileName->saveAs('csv/' . $time . '.' . $model->fileName->extension);
         $model->fileName = 'csv/' . $time . '.' . $model->fileName->extension;
         $handle = fopen($model->fileName, "r");
         $row = 1;
         while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
             $row++;
             if ($row == 2) {
                 //Ignoring row 2
             } else {
                 //Parsing Time
                 $time = $data[2];
                 $exp = explode('-', $time);
                 $starttime = $exp[0];
                 $endtime = $exp[1];
                 //Getting User ID
                 $userData = AmgenContactList::find()->where(['Name' => $data[6]])->one();
                 $userid = $userData['id'];
                 $title = $data[7];
                 $departmentData = Functions::find()->where(['Name' => $data[8]])->one();
                 $department_id = $departmentData['ID'];
                 $group = CostCenter::find()->where(['Group_name' => $data[9]])->one();
                 $group_id = $group['id'];
                 //Getting Status  ID
                 $statusInfo = Status::find()->where(['status' => $data[10]])->one();
                 $status_id = $statusInfo['id'];
                 $sql = "INSERT into booths(congress_id,booth_name,from_time,to_time,date,location) values('{$congid}','{$data['1']}','{$starttime}','{$endtime}','{$data['3']}','{$data['4']}')";
                 $query = Yii::$app->db->createCommand($sql)->execute();
                 $booth_id = Yii::$app->db->getLastInsertID();
                 $sql_booth_schedule = "INSERT into booth_schedules(booth_id,attendee_id,title,function_id,cost_center_id,status_id) values('{$booth_id}','{$userid}','{$title}','{$department_id}','{$group_id}','{$status_id}')";
                 Yii::$app->db->createCommand($sql_booth_schedule)->execute();
             }
         }
         fclose($handle);
         print "Import done";
     }
     return $this->render('excel', ['model' => $model]);
 }
    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>


    <?php 
echo $form->field($model, 'department_id')->dropDownList(ArrayHelper::map(Departments::find()->asArray()->all(), 'ID', 'Name'), ['ID' => 'Name']);
?>
    <?php 
echo $form->field($model, 'meeting_group_id')->dropDownList(ArrayHelper::map(MeetingGroups::find()->asArray()->all(), 'id', 'Group_name'), ['id' => 'Group_name']);
?>
  

    <?php 
echo $form->field($model, 'status_id')->dropDownList(ArrayHelper::map(Status::find()->asArray()->all(), 'id', 'status'), ['id' => 'status']);
?>
  


   

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
 /**
  * Finds the Status model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Status the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Status::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Запрашиваемая страница не найдена.');
     }
 }