コード例 #1
0
ファイル: ServersController.php プロジェクト: kokkez/shineisp
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $request = $this->getRequest();
     $id = $this->getRequest()->getParam('server_id');
     $this->view->title = $this->translator->translate("Edit Server");
     $this->view->description = $this->translator->translate("Edit the server parameters.");
     // 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/servers/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/servers/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index');
     }
     // Get our form and validate it
     $form = $this->getForm('/admin/servers/process', $id);
     if (!$form->isValid($request->getPost())) {
         $this->view->form = $form;
         // Invalid entries
         return $this->render('applicantform');
         // re-render the login form
     }
     // Save the data
     $serverID = Servers::saveAll($form->getValues());
     #OrdersItemsServers::removeServer(89, $serverID);
     // Save the attributes
     $attributeValues = $form->getSubForm('attributes')->getValues();
     CustomAttributes::saveElementsValues($attributeValues, $serverID, "servers");
     return $this->_helper->redirector('edit', 'servers', 'admin', array('id' => $id));
 }