/** Fetching the booths if the congress id coming */
 public function actionIndex()
 {
     $connection = Yii::$app->db;
     $congreid = (int) \Yii::$app->request->getQueryParam('congress');
     if ($congreid) {
         $sql = "SELECT * FROM booths where congress_id ={$congreid} order by date asc,from_time asc";
         $model = Booths::findBySql($sql)->all();
         $finalvalue = array();
         if ($model) {
             foreach ($model as $key => $value) {
                 $modelbooth = $connection->createCommand("SELECT DISTINCT ms.attendee_id,a.Name as Name, a.title as title, wc.function_value AS Funame, wc.costcenter_value AS Cost_Center, a.phone as phone, a.speciality as speciality,'sdaattendee' as type\n                                                                FROM  booth_schedules ms\n                                                                INNER JOIN amgen_contact_list a ON ms.attendee_id = a.id\n                                                                LEFT JOIN workforce_contacts wc ON wc.id = a.workforce_id\n                                                                WHERE ms.booth_id = {$value->id}\n                                                                ");
                 $attendee = $modelbooth->queryAll();
                 $finalvalue[$value->congress_id][$value->date][] = array('id' => $value->id, 'congress' => CongressDetails::findOne($value->congress_id)->name, 'title' => $value->booth_name, 'phone' => $value->phone, 'start_time' => date("g:i a", strtotime($value->from_time)), 'end_time' => date("g:i a", strtotime($value->to_time)), 'date' => $value->date, 'location' => $value->location, 'area' => $value->Area, 'attendee' => $attendee);
             }
             return $finalvalue;
         } else {
             echo "Not found any result";
         }
     }
 }
 public function getBooths()
 {
     return $this->hasMany(Booths::className(), ['id' => 'booth_id']);
 }
 /**
  * Finds the Booths model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Booths the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Booths::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #4
0
 public function Booths()
 {
     return $this->hasMany(Booths::className(), ['id' => status_id]);
 }