Exemplo n.º 1
0
 public static function getSignalSid()
 {
     $signal = Signal::select('id', 'name', 'signal_sid')->get();
     $result = array();
     foreach ($signal as $value) {
         $result[$value->id] = $value->signal_sid . ' - (' . $value->name . ')';
     }
     return $result;
 }
Exemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     Config::set('termId', 1);
     IncomeEvent::truncate();
     Event::truncate();
     Terminal::truncate();
     Rule::truncate();
     ResultSignal::truncate();
     Signal::truncate();
     Terminal::create(array('name' => 'test', 'url' => 'http://test', 'queue' => 'queueTest', 'key' => 'key'));
     Event::create(array('terminal_id' => 1, 'name' => 'Хочу есть', 'event_sid' => 'im_hungry'));
     Signal::create(array('terminal_id' => 1, 'name' => 'Иди кушай', 'signal_sid' => 'go_eat'));
     Signal::create(array('terminal_id' => 1, 'name' => 'Жди', 'signal_sid' => 'wait'));
     Signal::create(array('terminal_id' => 1, 'name' => 'Терпи до дома', 'signal_sid' => 'endure'));
     Rule::create(array('terminal_id' => 1, 'name' => 'Иди кушай', 'event_id' => 1, 'rule' => 'time >= 13.00 AND time <= 14.00 AND have_money === true', 'signal_id' => 1, 'flag_active' => true));
     Rule::create(array('terminal_id' => 1, 'name' => 'Жди', 'event_id' => 1, 'rule' => 'time < 13.00', 'signal_id' => 2, 'flag_active' => true));
     Rule::create(array('terminal_id' => 1, 'name' => 'Терпи до дома', 'event_id' => 1, 'rule' => 'time > 14.00', 'signal_id' => 3, 'flag_active' => true));
 }
Exemplo n.º 3
0
						<?php 
echo Form::input('text', 'rule', '', array('placeholder' => 'rule', 'class' => 'form-control', 'id' => 'inputRuleAdd'));
?>
					</div>
					<div id="errorRuleAdd" class="text-danger text-center"></div>
				</div>


				<div class="form-group row">
					<?php 
echo Form::label('inputSignalSidAdd', 'signal_sid', array('class' => 'col-sm-3 control-label'));
?>
					<div class="col-sm-9">
						<div class="SignalSid">
							<?php 
echo Form::select('SignalSid', Signal::getSignalSid(), '', array('class' => 'form-control inputSignalSidAdd', 'id' => 'inputSignalSidAdd', 'required' => 'required'));
?>
						</div>
					</div>
					<div id="errorSignalSidAdd" class="text-danger text-center"></div>
				</div>
				<div class="addSignal">
					<?php 
echo Form::button('Добавить сигнал', array('id' => 'addSignalInput', 'class' => 'btn btn-success'));
?>

					<button id="removeLastSignal" type="button" class="btn btn-danger">Удалить сигнал</button>

				</div>

			</div>
Exemplo n.º 4
0
 public function postAddDataSignals()
 {
     $input = Input::only('name', 'signal_sid');
     $input['name'] = e($input['name']);
     $input['terminal_id'] = $this->getTerminalId();
     //проверяем данные
     $errors = Signals::add($input);
     if ($errors) {
         return $errors;
     }
     $signal = new Signal();
     $signal->newSignal($input);
     $message = 'Данные изменены';
     return array('message' => $message);
 }