/**
  * Update the record previously selected
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/domainsprofiles/process");
     $request = $this->getRequest();
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainsprofiles/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/domainsprofiles/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     try {
         // Check if we have a POST request
         if (!$request->isPost()) {
             return $this->_helper->redirector('list', 'domainsprofiles', 'admin');
         }
         if ($form->isValid($request->getPost())) {
             $params = $request->getPost();
             $area = intval($params['area']);
             if ($area != 0) {
                 $province = Provinces::find($area);
                 $area = $province->code;
                 $params['area'] = $area;
             }
             $id = DomainsProfiles::saveAll($params, $request->getParam('profile_id'));
             $this->_helper->redirector('edit', 'domainsprofiles', 'admin', array('id' => $id, 'mex' => $this->translator->translate('The task requested has been executed successfully.'), 'status' => 'success'));
         } else {
             $this->view->form = $form;
             $this->view->title = $this->translator->translate("Domain Profile details");
             $this->view->description = $this->translator->translate("Here you can edit the domains profile details.");
             return $this->render('applicantform');
         }
     } catch (Exception $e) {
         $this->_helper->redirector('edit', 'domainsprofiles', 'admin', array('id' => $id, 'mex' => $e->getMessage(), 'status' => 'danger'));
     }
 }
 /**
  * Save the domain profile data
  * @return unknown_type
  */
 public function saveprofileAction()
 {
     $request = $this->getRequest();
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('profile');
     }
     $form = new Default_Form_DomainsProfilesForm(array('action' => '/domains/profilesave/', 'method' => 'post'));
     $this->view->title = $this->translator->translate("Domain Profile");
     $this->view->description = $this->translator->translate("Here you can create or edit the domain profile.");
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->form = $form;
     if (!$form->isValid($request->getPost())) {
         return $this->_helper->viewRenderer('profile');
     }
     // Get the values posted
     $params = $form->getValues();
     // add the customer id reference
     $params['customer_id'] = $this->customer['customer_id'];
     $profileId = !empty($params['profile_id']) ? $params['profile_id'] : null;
     if (0 == DomainsNichandle::isUsed($profileId)) {
         $profileId = DomainsProfiles::saveAll($params, $profileId);
     } else {
         $this->_helper->redirector('profile', 'domains', 'default', array('id' => $profileId, 'mex' => 'You cannot edit the profile because it is connected to a domain.', 'status' => 'danger'));
     }
     $this->_helper->redirector('profile', 'domains', 'default', array('id' => $profileId, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
     $this->_helper->viewRenderer('profile');
 }