/** * Set the view response format * * @return \Voodoo\Core\Controller\Rest */ protected function setJsonResponse() { $this->renderFormat = Core\View\Rest::FORMAT_JSON; Core\Http\Response::setHeader('Content-type: application/json'); return $this; }
/** * To redirect the page to a new page * @param string $path * @param int $httpCode */ public function redirect($url = "", $httpCode = 302) { if (!$url) { $url = $this->getControllerUrl(); } if (preg_match("/^http/", $url)) { // http://xyz $url = $url; } else { if (preg_match("/^\\//", $url)) { // we'll add the ? if possible $url = $this->getBaseUrl() . $url; } else { // go to the current module $url = $this->getModuleUrl() . "/{$url}"; } } $this->abort(); return Http\Response::redirect($url, $httpCode); }