protected function setupDisplay($disp) { $disp->setValue('form_errors', FormErrors::all()); $disp->setValue('handler', $this->getClass()); $disp->setValue('state', $this->state); $disp->addView('system_setup', 'pilot.views.PilotSetupMain'); if ($this->state == 'main') { if (is_object($this->user_to_edit)) { $disp->setValue('user_id', $this->user_to_edit->id()); } $access_form = $this->accessForm($this->access_to_edit); $group_form = $this->groupForm($this->group_to_edit); $user_form = $this->userForm($this->user_to_edit); $sf_form = $this->siteFunctionForm($this->site_function_to_edit); $disp->addForm($access_form); $disp->addForm($group_form); $disp->addForm($user_form); $disp->addForm($sf_form); if ($this->saved || $this->cancel_edit) { if ($this->saved) { $disp->setValue('saved', $this->saved); } $access_form->clear(); $group_form->clear(); $user_form->clear(); $sf_form->clear(); } else { if ($this->failed) { $disp->setValue('failed', $this->failed); } } } else { if ($this->state == 'change_user_password' && $this->user_to_edit) { $form = Form::load('pilot.views.UserPassword'); $form->setInputValues($this->user_to_edit); $disp->addForm($form); $disp->setValue('user_name', $this->user_to_edit->toString()); } else { $disp->setValue('delete_class', $this->delete_class); $disp->setValue('delete_label', $this->delete_label); $disp->setValue('delete_command', $this->delete_command); if ($this->state == 'choose_delete') { $form = Form::load('pilot.views.ChooseObjects'); $form->setOptions('objects', $this->objects_to_choose); $form->setInputValue('delete_state', 'confirm'); } else { if ($this->state == 'confirm_delete') { $form = Form::load('pilot.views.ConfirmObjects'); $form->setOptions('objects', $this->objects_to_delete); $form->setInputValue('delete_state', 'delete'); } else { if ($this->state == 'delete') { $form = Form::load('pilot.views.DeleteObjects'); $form->setOptions('objects', $this->objects_to_delete); } else { throw new Exception('The PilotSetup Handler is in an unknown state: ' . $this->state); } } } $disp->addForm($form); } } }