/** * Post process hook for add and edit actions. * * This is called immediately after the initstantiation of the form object and, if * editing, includes the Doctrine2 entity `$object`. * * If you need to have, for example, edit values set in the form, then use the * `addPrepare()` hook rather than this one. * * @see addPrepare() * @param OSS_Form $form The form object * @param object $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True of we are editing an object, false otherwise * @param array $options Options passed onto Zend_Form * @param string $cancelLocation Where to redirect to if 'Cancal' is clicked */ protected function formPostProcess($form, $object, $isEdit, $options = null, $cancelLocation = null) { $form->setMultiIXP($this->multiIXP()); if ($isEdit) { $form->getElement('ixp')->setValue($object->getIXP()->getId()); } }
/** * Post process hook for add and edit actions. * * This is called immediately after the initstantiation of the form object and, if * editing, includes the Doctrine2 entity `$object`. * * If you need to have, for example, edit values set in the form, then use the * `addPrepare()` hook rather than this one. * * @see addPrepare() * @param OSS_Form $form The form object * @param object $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True of we are editing an object, false otherwise * @param array $options Options passed onto Zend_Form * @param string $cancelLocation Where to redirect to if 'Cancal' is clicked */ protected function formPostProcess($form, $object, $isEdit, $options = null, $cancelLocation = null) { if ($object->getIRRDB() instanceof \Entities\IRRDBConfig) { $form->getElement('irrdb')->setValue($object->getIRRDB()->getId()); } $form->enableResller($this->resellerMode()); $form->setMultiIXP($this->multiIXP(), $isEdit); if ($this->resellerMode()) { if ($object->getReseller() instanceof \Entities\Customer) { $form->getElement('isResold')->setValue(true); $form->getElement('reseller')->setValue($object->getReseller()->getId()); } } if ($isEdit) { $form->assignEntityToForm($object->getBillingDetails(), $this); $form->assignEntityToForm($object->getRegistrationDetails(), $this); $form->updateCancelLocation(OSS_Utils::genUrl('customer', 'overview', null, ['id' => $object->getId()])); } return true; }
/** * Post process hook that can be overridden by subclasses for add and edit actions. * * This is called immediately after the initstantiation of the form object and, if * editing, includes the Doctrine2 entity `$object`. * * If you need to have, for example, edit values set in the form, then use the * `addPrepare()` hook rather than this one. * * @see addPrepare() * @param OSS_Form $form The form object * @param \Entities\ContactGroup $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True of we are editing an object, false otherwise * @param array $options Options passed onto Zend_Form * @param string $cancelLocation Where to redirect to if 'Cancal' is clicked */ protected function formPostProcess($form, $object, $isEdit, $options = null, $cancelLocation = null) { $form->getElement('type')->setMultiOptions($this->_options['contact']['group']['types']); }
/** * Post process hook for add and edit actions. * * This is called immediately after the initstantiation of the form object and, if * editing, includes the Doctrine2 entity `$object`. * * If you need to have, for example, edit values set in the form, then use the * `addPrepare()` hook rather than this one. * * @see addPrepare() * @param OSS_Form $form The form object * @param \Entities\Vlan $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True of we are editing an object, false otherwise * @param array $options Options passed onto Zend_Form * @param string $cancelLocation Where to redirect to if 'Cancal' is clicked */ protected function formPostProcess($form, $object, $isEdit, $options = null, $cancelLocation = null) { if ($isEdit) { $form->getElement('infrastructure')->setValue($object->getInfrastructure()->getId()); } return true; }
/** * Prevalidation hook that can be overridden by subclasses for add and edit. * * This is called if the user POSTs a form just before the form is validated by Zend * * @param OSS_Form $form The Send form object * @param object $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True if we are editing, otherwise false * @return bool If false, the form is not validated or processed */ protected function addPreValidate($form, $object, $isEdit) { if (isset($_POST['login']) && $_POST['login'] == '1') { $form->getElement("username")->setRequired(true); if (!$isEdit && $this->getUser()->getPrivs() == \Entities\User::AUTH_SUPERUSER) { $form->getElement("password")->setRequired(true); $form->getElement("privs")->setRequired(true); } } else { $_POST['login'] = 0; } $this->view->contactGroups = $this->_postedGroupsToArray(); return true; }