コード例 #1
0
 public function actionFeed()
 {
     if (isset($_GET['start']) && isset($_GET['end'])) {
         $model = new Workshop('search');
         $workshops = $model->searchWorkshopsForFeed($_GET['start'], $_GET['end']);
         if (!empty($workshops)) {
             $workshopSources = array();
             foreach ($workshops as $key => $workshop) {
                 $workshopSources[$key]['id'] = $workshop['post_item_id'];
                 $workshopSources[$key]['title'] = $workshop['title'];
                 $workshopSources[$key]['start'] = $workshop['start_date'] . ' ' . $workshop['start_time'];
                 $workshopSources[$key]['end'] = $workshop['end_date'] . ' ' . $workshop['end_time'];
                 $workshopSources[$key]['allDay'] = false;
                 $workshopSources[$key]['provider'] = 'Provider: ' . ($workshop['employer'] != null ? $workshop['employer'] : Yii::app()->name);
                 $workshopSources[$key]['url'] = $this->createAbsoluteUrl('view', array('id' => $workshop['post_item_id']));
             }
             echo CJSON::encode($workshopSources);
         }
     }
     Yii::app()->end();
 }