Ejemplo n.º 1
0
 public function contactusAction()
 {
     $this->layout('layout/bags');
     $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array('action' => 'getuser'));
     // var_dump($getuser);
     $this->layout()->getuser = $getuser;
     $view = new ViewModel();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $data = array_merge_recursive($this->getRequest()->getPost()->toArray(), $this->getRequest()->getFiles()->toArray());
         if (!empty($data)) {
             $contactn = new Contactp();
             $contactn->exchangeArray($data);
             $checcontact = $this->getServiceLocator()->get('ContactpTable')->save($contactn);
             if ($checcontact) {
                 $check = $checcontact;
             } else {
                 $check = 10;
             }
         }
     }
     $view->check = $check;
     // settings
     $setting = $this->getServiceLocator()->get('SettingsTable')->fetchAll();
     $view->setting = $setting;
     return $view;
 }
 public function statusAction()
 {
     $view = new ViewModel();
     $id = $this->params()->fromRoute('id', 0);
     $status = $this->params()->fromRoute('status', 0);
     $ContactpTable = $this->getServiceLocator()->get('ContactpTable');
     if ($id == 0) {
         return $this->redirect()->toRoute('Contactp', array('controller' => 'contactp', 'action' => 'list'));
     } else {
         $exchange_data = array();
         $exchange_data['id'] = $id;
         $exchange_data['status'] = $status;
         $Contactp = new Contactp();
         $Contactp->exchangeArray($exchange_data);
         $checkupdate = $ContactpTable->savestatus($Contactp);
         $view->id = $id;
         $view->check = $checkupdate;
         return $view;
     }
 }