/** * editAction * Get a record and populate the application form * @return unknown_type */ public function editAction() { $form = $this->getForm('/domains/process'); $id = $this->getRequest()->getParam('id'); if (!empty($id) && is_numeric($id)) { if (!empty($this->customer['customer_id']) && is_numeric($this->customer['customer_id'])) { $customer_id = $this->customer['customer_id']; } // Get these fields before editing the form // the field autorenew has been aliased in order to create a flat array and not a multidimentional array as proposed by the Doctrine engine $fields = "domain_id, registrars_id, CONCAT('http://www.', d.domain, '.', ws.tld) as Domain, d.authinfocode as authinfocode, \n\t\t\tp.product_id as product_id, d.domain as domainame, ws.tld as tld, d.autorenew as autorenew, \n\t\t\tDATE_FORMAT(d.creation_date, '%d/%m/%Y') as Starting, (DATEDIFF(expiring_date, CURRENT_DATE)) as Days, \n\t\t\tDATE_FORMAT(d.expiring_date, '%d/%m/%Y') as Termination, s.status as Status"; $rs = $this->domains->getAllInfo($id, $customer_id, $fields, true); if (empty($rs)) { $this->_helper->redirector('index', 'domains', 'default', array('mex' => 'forbidden', 'status' => 'danger')); } $form->populate($rs[0]); if ($rs[0]['autorenew']) { $this->view->autorenew = true; } else { $this->view->autorenew = false; } // Some useful values $this->view->name = $rs[0]['domainame'] . "." . $rs[0]['tld']; $this->view->days = $rs[0]['Days']; $this->view->domain_id = $id; $this->view->productid = $rs[0]['product_id']; // Show the list of the messages attached to this domain $this->view->messages = Messages::getbyDomainId($id); $this->view->tags = Tags::findConnectionbyDomainID($id); $this->view->is_maintained = $rs[0]['registrars_id']; $this->view->customerid = $customer_id; $this->view->authinfocode = $rs[0]['authinfocode']; $this->view->id = $id; $this->view->orders = array('records' => domains::Orders($id), 'edit' => array('controller' => 'orders', 'action' => 'edit')); $this->view->services = array('records' => domains::Services($id), 'edit' => array('controller' => 'services', 'action' => 'edit')); $this->view->tasks = array('records' => DomainsTasks::getTasksbyDomainID($id)); // Hide these fields and values inside the vertical grid object unset($rs[0]['autorenew']); unset($rs[0]['authinfocode']); unset($rs[0]['note']); unset($rs[0]['domainame']); unset($rs[0]['tld']); // Sent the data to the datagrid $this->view->datagrid = array('records' => $rs); $this->view->dnsgrid = array('records' => Dns_Zones::getZones($id, true), 'delete' => array('controller' => 'domains', 'action' => 'deletednszone')); } $this->view->mex = $this->getRequest()->getParam('mex'); $this->view->mexstatus = $this->getRequest()->getParam('status'); $this->view->title = $this->translator->translate("Domain"); $this->view->description = $this->translator->translate("Here you can edit your own domain parameters."); $this->view->form = $form; $this->_helper->viewRenderer('customform'); }