Esempio n. 1
0
 /**
  * Add or edit afaorgs
  * It also handles followings:
  * CODE: afaorg_create
  */
 public function executeUpdate(sfWebRequest $request)
 {
     # security
     if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
     slot('nav_menu', array('reference', ''));
     if ($request->getParameter('id')) {
         $afa = AfaOrgPeer::retrieveByPK($request->getParameter('id'));
         $this->forward404Unless($afa);
         $this->title = 'Edit Linking Organization';
         $success = 'Linking Organization information has been successfully changed!';
     } else {
         $afa = new AfaOrg();
         $this->title = 'Add Linking Organization';
         $success = 'Linking Organization information has been successfully created!';
     }
     $this->form = new AfaOrgForm($afa);
     if ($request->isMethod('post')) {
         $this->referer = $request->getReferer();
         $this->form->bind($request->getParameter('afa'));
         if ($this->form->isValid()) {
             $afa->setName($this->form->getValue('name'));
             $afa->setOrgPhone($this->form->getValue('org_phone'));
             $afa->setHomePageUrl($this->form->getValue('home_page_url'));
             $afa->setOrgFax($this->form->getValue('org_fax'));
             $afa->setRefContactName($this->form->getValue('ref_contact_name'));
             $afa->setRefContactEmail($this->form->getValue('ref_contact_email'));
             $afa->setVpoSoapServerUrl($this->form->getValue('vpo_soap_server_url'));
             $afa->setVpoRequestPostEmail($this->form->getValue('vpo_request_post_email'));
             $afa->setVpoUserId($this->form->getValue('vpo_user_id'));
             $afa->setVpoUserPassword($this->form->getValue('vpo_user_password'));
             $afa->setVpoOrgId($this->form->getValue('vpo_org_id'));
             $afa->setAfidsRequesterUserName($this->form->getValue('afids_requester_user_name'));
             $afa->setAfidsRequesterPassword($this->form->getValue('afids_requester_password'));
             $afa->setAfidsSoapServerUrl($this->form->getValue('afids_soap_server_url'));
             $afa->setAfidsRequestPostEmail($this->form->getValue('afids_request_post_email'));
             $afa->setPhoneNumber1($this->form->getValue('phone_number1'));
             $afa->setPhoneNumber2($this->form->getValue('phone_number2'));
             if ($afa->isNew()) {
                 $content = $this->getUser()->getName() . ' added Linking Organization: ' . $afa->getName();
                 ActivityPeer::log($content);
             }
             $afa->save();
             $this->getUser()->setFlash('success', $success);
             return $this->redirect('@afaOrg');
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@afaorg';
     }
     $this->afa = $afa;
 }
Esempio n. 2
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      AfaOrg $value A AfaOrg object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(AfaOrg $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Esempio n. 3
0
 /**
  * Declares an association between this object and a AfaOrg object.
  *
  * @param      AfaOrg $v
  * @return     AfaLeg The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setAfaOrg(AfaOrg $v = null)
 {
     if ($v === null) {
         $this->setAfaOrgId(NULL);
     } else {
         $this->setAfaOrgId($v->getId());
     }
     $this->aAfaOrg = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the AfaOrg object, it will not be re-added.
     if ($v !== null) {
         $v->addAfaLeg($this);
     }
     return $this;
 }