Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function createrobotAction()
- {
- $request = $this->getRequest();
- $form = new Setup_Form_Unit_Robot_Create();
- if ($this->getRequest()->isPost())
- {
- if ($form->isValid($request->getPost()))
- {
- echo 'valid';
- $machine = Doctrine::getTable('Do_Machine')->find($this->_session->machine_id);
- $robot = new Do_UnitRobot();
- $robot->description = $form->getValue('description');
- $robot->enabled = $form->getValue('enabled');
- $robot->station_id = $form->getValue('station');
- $robot->Machine = $machine;
- $positionRobot = new Do_Position();
- $positionRobot->description = 'Position ' . $robot->description;
- $positionRobot->available = true;
- $positionRobot->Machine = $machine;
- $robot->RobotPosition = $positionRobot;
- $robot->save();
- }
- }
- else
- {
- $machine = Doctrine::getTable('Do_Machine')->find($this->_session->machine_id);
- $stations = $machine->Stations;
- $stationArray = null;
- foreach($stations as $station)
- {
- if ($station->station_type == 'transporter')
- {
- $stationArray[$station->station_id] = $station->id_logic;
- }
- }
- $form->station->setMultiOptions($stationArray);
- $this->view->form = $form;
- }
- }
Add Comment
Please, Sign In to add comment