示例#1
0
 /**
  * editAction
  * Get a record and populate the application form 
  * @return unknown_type
  */
 public function editAction()
 {
     $form = $this->getForm('/admin/services/process');
     $service_domains = new OrdersItemsDomains();
     $id = $this->getRequest()->getParam('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/services/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/services/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     try {
         if (!empty($id) && is_numeric($id)) {
             $form->getElement('domains')->setMultiOptions(Domains::getFreeOrderDomainsList($id));
             $rs = $this->services->getAllInfo($id, null, true);
             if (!empty($rs)) {
                 $form->getElement('domains_selected')->setMultiOptions($service_domains->getList($id));
                 $rs['date_start'] = Shineisp_Commons_Utilities::formatDateOut($rs['date_start']);
                 $rs['date_end'] = Shineisp_Commons_Utilities::formatDateOut($rs['date_end']);
                 $rs['customer_id'] = $rs['Orders']['customer_id'];
                 $form->populate($rs);
                 $this->view->buttons[] = array("url" => "/admin/services/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null));
                 $this->view->buttons[] = array("url" => "/admin/orders/edit/id/" . $rs['Orders']['order_id'], "label" => $this->translator->translate('Order'), "params" => array('css' => null));
             }
             // Get all the messages attached to the ordersitems
             $this->view->messages = Messages::getbyServiceId($id);
             $this->view->owner_datagrid = $this->ownerGrid($rs['Orders']['customer_id']);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $this->view->title = $this->translator->translate("Service Details");
     $this->view->description = $this->translator->translate("Here you can see the details of the service subscribed by the customer.");
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->form = $form;
     $this->render('applicantform');
 }