Beispiel #1
0
 /**
  * Returns an Redirect to the given url.
  * 
  * @param string $url
  * @return \Phalcon\Http\Response
  */
 protected function redirect($url, $extraParams = array())
 {
     $response = new Response();
     $response->redirect($url);
     $formReflectionManager = new FormReflectionManager($this->flash);
     $formReflectionManager->add($extraParams + $this->request->get());
     return $response;
 }
 /**
  * Shows the view to create a "new" product
  */
 public function newAction()
 {
     $reflection = new FormReflectionManager($this->flash);
     $this->view->name = $reflection->get('name');
     $this->view->urls = Url::find() ?: array();
     $this->view->proxies = Proxy::find() ?: array();
     $this->view->reflected_proxyId = explode(',', $reflection->get('proxyId'));
     $this->view->reflected_address = explode(',', $reflection->get('address'));
     #$this->view->disable();
 }
Beispiel #3
0
 /**
  * Shows the view to "edit" an existing product
  */
 public function editAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('url');
     }
     $url = Url::findFirst($id);
     if ($url) {
         $reflection = new FormReflectionManager($this->flash);
         $url->address = $reflection->get('address') ?: $url->address;
         $this->view->url = $url;
     } else {
         $this->flash->error('Identifier not found.');
         return parent::redirect('url');
     }
     #$this->view->disable();
 }
 /**
  * Shows the view to "edit" an existing product
  */
 public function editAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('country');
     }
     $country = Country::findFirst($id);
     if ($country) {
         $reflection = new FormReflectionManager($this->flash);
         $country->code = $reflection->get('code') ?: $country->code;
         $country->name = $reflection->get('name') ?: $country->name;
         $this->view->country = $country;
     } else {
         $this->flash->error('Identifier not found.');
         return parent::redirect('country');
     }
     #$this->view->disable();
 }
 /**
  * Shows the view to "edit" an existing product
  */
 public function editAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('proxy');
     }
     $proxy = Proxy::findFirst($id);
     if ($proxy) {
         $reflection = new FormReflectionManager($this->flash);
         $proxy->countryId = $reflection->get('countryId') ?: $proxy->countryId;
         $proxy->address = $reflection->get('address') ?: $proxy->address;
         $this->view->proxy = $proxy;
         $this->view->countries = Country::find();
     } else {
         $this->flash->error('Identifier not found.');
         return parent::redirect('proxy');
     }
     #$this->view->disable();
 }