コード例 #1
0
 public function actionCreate()
 {
     $model = new Point();
     $model->unsetAttributes();
     if (isset($_POST['Point'])) {
         $model->attributes = $_POST['Point'];
         $model->tv_schedule_blocks = '';
         $TVshceduleFromDatetime = array();
         $TVshceduleToDatetime = array();
         if (isset($_POST['Point']['TVshceduleFromDatetime']) && isset($_POST['Point']['TVshceduleToDatetime'])) {
             $TVshceduleFromDatetime = $_POST['Point']['TVshceduleFromDatetime'];
             $TVshceduleToDatetime = $_POST['Point']['TVshceduleToDatetime'];
         }
         if ($model->save()) {
             $modelId = $model->getPrimaryKey();
             $this->CreateTVBlocks($modelId, $TVshceduleFromDatetime, $TVshceduleToDatetime);
             $model->SendRequestForUpdate($model->ip);
             $model->PrepareFilesForSync($model->getPrimaryKey());
             $model->CreateChannelsForWindows($model->screen_id, $model->id);
             $this->redirect(['point/update', 'id' => $model->id]);
         } else {
             $this->render('create', array('model' => $model));
         }
     } else {
         $this->render('create', array('model' => $model));
     }
 }