コード例 #1
0
 /**
  * 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());
     }
 }
コード例 #2
0
 /**
  * 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;
 }