/** * @route /form * @view /views/former.html */ function form() { global $request, $response; $form = new CreateForm('', 'post'); if (count($request->getParams()) && $form->validate($request->getParams())) { $nom = $form->nom; $famille = $form->famille; $pokemon = new $form->famille($form->nom); $pokemon->save(); return $response->redirect(array('detail', array('id' => $pokemon->id))); } return array('form' => $form); }
public function init() { parent::init(); $opportunity = new OpportunityModule($this->id); $opportunity = $account->fetchAsArray(); $this->setAction("/opportunity/edit/opportunity_id/{$this->id}"); $this->populate($opportunity); }
public function __construct($size, $role) { parent::__construct($size); for ($i = 0; $i < $size; $i++) { $this->add(['name' => $i . 'c', 'type' => 'Text', 'attributes' => ['class' => 'form-control']]); $this->add(['name' => $i . 'i', 'type' => 'Text', 'attributes' => ['class' => 'form-control']]); } if ($role < \Account\Model\Role::CO) { $this->get('strategy')->setAttribute('readonly', 'readonly'); } if ($role < \Account\Model\Role::ELDER) { for ($i = 0; $i < $size; $i++) { $this->get($i)->setAttribute('readonly', 'readonly'); } } $this->get('submit')->setAttribute('value', 'Update'); }