Exemplo n.º 1
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/domains/process');
     $this->view->title = $this->translator->translate("Domain Edit");
     $this->view->description = $this->translator->translate("Here you can edit your own domain parameters.");
     $id = $this->getRequest()->getParam('id');
     if (!empty($id) && is_numeric($id)) {
         // 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/domains/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null)), array("url" => "/admin/domains/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/domains/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)), array("url" => "/admin/domains/newevent/id/{$id}", "label" => $this->translator->translate('Calendar Event'), "params" => array('css' => null)));
         try {
             $rs = $this->domains->find($id, null);
             if (!empty($rs[0])) {
                 $rs[0]['creation_date'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['creation_date']);
                 $rs[0]['expiring_date'] = Shineisp_Commons_Utilities::formatDateOut($rs[0]['expiring_date']);
                 $rs[0]['status_id'] = $rs[0]['Statuses']['status_id'];
                 // Domains NicHandles
                 $rs[0]['owner'] = DomainsNichandle::getProfile($id);
                 $rs[0]['admin'] = DomainsNichandle::getProfile($id, "admin");
                 $rs[0]['tech'] = DomainsNichandle::getProfile($id, "tech");
                 $rs[0]['billing'] = DomainsNichandle::getProfile($id, "billing");
                 $form->populate($rs[0]);
                 if (!empty($rs[0]['DomainsTlds']['WhoisServers'])) {
                     $this->view->title = $rs[0]['domain'] . "." . $rs[0]['DomainsTlds']['WhoisServers']['tld'];
                     $this->view->titlelink = "http://" . $rs[0]['domain'] . "." . $rs[0]['DomainsTlds']['WhoisServers']['tld'];
                     $this->view->icon = "fa fa-globe";
                 }
                 $this->view->owner_datagrid = domains::ownerGrid($id);
                 $this->view->actions = Registrars::getActions($rs[0]['registrars_id']);
             }
         } catch (Exception $e) {
             die($e->getMessage());
         }
         $this->view->id = $id;
         // Get all the messages attached to the domain
         $this->view->messages = Messages::getbyDomainId($id);
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->dns_datagrid = Domains::dnsGrid();
     $this->view->form = $form;
     $this->view->services_datagrid = array('records' => domains::Services($id), 'edit' => array('controller' => 'services', 'action' => 'edit'));
     $this->view->orders_datagrid = array('records' => domains::Orders($id), 'edit' => array('controller' => 'orders', 'action' => 'edit'));
     $this->render('applicantform');
 }