예제 #1
0
 /**
  * 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');
 }