Ejemplo n.º 1
0
 public function actionSyncSettings()
 {
     //        $parseMessage =  new ParseMessage(LoggerFactory::getFileLogger('parse_message'),'@DAWS01150429145700TP21005BV1133CH1s51560648206968071350008706527043570250700718PR109940TP1101561782E43$');
     //        echo "<pre>";
     //        print_r( $parseMessage->getStationIdCode());
     //        echo "</pre>";exit;
     $form = new SynchronizationForm();
     $synchronization = new Synchronization();
     if (Yii::app()->request->isPostRequest && isset($_POST['SynchronizationForm']) && isset($_POST['__save'])) {
         $form->attributes = $_POST['SynchronizationForm'];
         if ($form->validate()) {
             if ($form->process_status == 0) {
                 if ($form->flexibility_role == 1) {
                     $synchronization->setInMaster();
                 }
                 if ($form->flexibility_role == 2) {
                     $synchronization->setInSlave();
                 }
             }
             $form->save();
             It::memStatus('Setting up synchronization was updated');
         }
     }
     if (Yii::app()->request->isPostRequest && isset($_POST['process_start'])) {
         $synchronization->switchProcess();
         It::memStatus($synchronization->process_status == 'stopped' ? 'Process was stopped' : 'Process was started');
     }
     $disabled = '';
     if ($synchronization->process_status == 'processed') {
         $disabled = 'disabled';
     }
     $this->render('sync_settings', array('form' => $form, 'synchronization' => $synchronization, 'disabled' => $disabled));
 }