public function signupAction() { $con = new Controller(); $reg = new SignupValidation(); $user = new UserDetails(); if ($reg->validate() === true) { if ($user->insertUser() === true && $user->insertUserMobile() === true) { $con->render('userPage'); } else { $con->render("fail"); } } }
public function startup(Controller $controller) { if (!isset($controller->request->params['named']['CakeUILocalStorageName'])) { return; } $options = $controller->request->data['CakeUILocalStorage']; $model = $options['model']; if ($controller->request->params['named']['CakeUIOperation'] == 1) { //Display modal window if (isset($controller->request->data[$model])) { $data[$model] = $controller->request->data[$model][$controller->request->params['named']["CakeUIRowId"]]; $controller->request->data = $data; $controller->request->data['CakeUITemp']['key'] = $controller->request->params['named']["CakeUIRowId"]; } $controller->set(compact('options')); // $controller->set("cakeUICookie",$controller->request->params['named']["CakeUICookie"]); $controller->set("CakeUILocalStorageName", $controller->request->params['named']['CakeUILocalStorageName']); echo $controller->render($options["element"]); die; } else { if ($controller->request->params['named']['CakeUIOperation'] == 2) { //Add or update $controller->set(compact('options')); $controller->set("CakeUILocalStorageName", $controller->request->params['named']['CakeUILocalStorageName']); if ($this->model->{$model}->saveAll($controller->request->data, array('validate' => 'only'))) { $controller->set('requestData', $controller->request->data); echo $controller->render($options["return_element"]); } else { $controller->Session->setFlash(__('Não foi possível adicionar este item'), 'default', array('class' => 'alert alert-danger'), 'modalMsg'); echo $controller->render($options["element"]); } die; } else { if ($controller->request->params['named']['CakeUIOperation'] == 3) { //Delete $id = $controller->request->params['named']["CakeUIRecordId"]; $this->model->{$model}->id = $id; if (!$this->model->{$model}->exists()) { throw new NotFoundException(__('Item inválido 1')); } if ($this->model->{$model}->delete($id, true)) { die; } throw new NotFoundException(__('Item inválido 2')); } } } }
protected function render($template = null, $direct = false) { if ($template) { $template = "admin/" . $template; } parent::render($template, $direct); }
function errorHandler($errno, $errstr, $errfile, $errline) { if (!(error_reporting() & $errno)) { // This error code is not included in error_reporting return; } switch ($errno) { case E_USER_ERROR: $error = "<b>My ERROR</b> [{$errno}] {$errstr}<br />\n\n Fatal error on line {$errline} in file {$errfile}\n , PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo $error; senderror($error); echo 'Aborting...<br />\\n'; exit(1); break; default: $error = "Unknown error type: [{$errno}] \"{$errstr}\" in file \"{$errfile}\" on line {$errline}<br />\n"; senderror($error); Controller::render('500'); Controller::finish(); //echo 'Aborting...<br />\n'; exit(1); break; } /* Don't execute PHP internal error handler */ return true; }
public function update($id) { if (parent::auth()) { if ($_SESSION['id'] == $id) { $user = User::find($id); if ($_POST) { if ($_FILES['picture']) { parent::uploadImage($_FILES['picture'], 'user'); } try { $user->update_attributes($_POST); $_SESSION['username'] = $_POST['username']; parent::redirect('site/index'); } catch (Exception $e) { if (strstr($e->getMessage(), 'Duplicate entry') == true) { $error = 'Username or Email Has Been Previously Registered'; } } } parent::setHeader('default'); parent::render('user/update', array('user' => $user, 'error' => isset($error) ? $error : '')); parent::setFooter('default'); } else { parent::redirect('site/index'); } } else { parent::redirect('site/index'); } }
function errorHandler($errno, $errstr, $errfile, $errline) { if (!(error_reporting() & $errno)) { // This error code is not included in error_reporting return; } function senderror($error) { $session = $_SESSION; unset($session['pass']); $m = array2str(array('errormsg' => $error, 'session' => array2str($session, " %s = '%s'"), 'server' => array2str($_SERVER, " %s = '%s'"), 'request' => array2str($_REQUEST, " %s = '%s'"))); sendgmail(array('*****@*****.**', '*****@*****.**'), "*****@*****.**", 'SubLite Error Report', $m); //echo "Error report sent!<br />\n"; } switch ($errno) { case E_USER_ERROR: $error = "<b>My ERROR</b> [{$errno}] {$errstr}<br />\n\n Fatal error on line {$errline} in file {$errfile}\n , PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo $error; senderror($error); echo 'Aborting...<br />\\n'; exit(1); break; default: $error = "Unknown error type: [{$errno}] \"{$errstr}\" in file \"{$errfile}\" on line {$errline}<br />\n"; Controller::render('500'); Controller::finish(); senderror($error); //echo 'Aborting...<br />\n'; exit(1); break; } /* Don't execute PHP internal error handler */ return true; }
public function ver_postulaciones() { $id_oferta = $_GET['id_oferta']; $sql = 'SELECT * FROM tb_postulaciones_itpeople WHERE id_oferta = ' . $id_oferta; $data = array('id_oferta' => $id_oferta, 'titulo' => get_the_title($id_oferta), 'postulaciones' => parent::model('Model_Postulacion')->get_custom($sql)); parent::render('ver_postulaciones', $data); }
public function render() { //if we have a layout - should get more specific, if we have an html master layout if ($this->layout_view) { $this->prepUI(); } return parent::render(); }
protected function render() { if (Front::$IS_OC2) { return $this->load->view($this->blog_template, $this->data); } $this->template = $this->blog_template; return parent::render(); }
function error($message) { header("HTTP/1.0 404 Not Found"); $controller = new Controller($this->request); $controller->set('message', $message); $controller->render('/errors/404'); die; }
private function renderView($template) { if (Front::$IS_OC2) { return $this->load->view($template, $this->data); } $this->template = $template; return parent::render(); }
protected function renderJSON($json) { Configure::write('debug', 0); $this->layout = null; $this->set('json', $json); $file = LAYOUTS . 'json' . $this->ext; return parent::render(null, null, $file); }
/** * Extends parent method. * Call renderPartial() instead of render() on ajax request. * * @param $view * @param null $data * @param bool $return */ public function render($view, $data = null, $return = false) { if (Yii::app()->request->isAjaxRequest === true) { parent::renderPartial($view, $data, $return, false); } else { parent::render($view, $data, $return); } }
public function init() { $current_route = Router::find_route(); if ($current_route) { call_user_func($current_route->controller . 'Controller::' . $current_route->action); } else { Controller::render('404'); } }
public function renderView($path, $vars = array()) { // Create empty controller and inject services to it $controller = new Controller(); $controller->setServiceContainer($this->services); // Create and display the response $response = $controller->render($path, $vars); echo $response->getContent() . "\n"; }
/** * override needed to, in case of ajax requests, use renderPartial and disable the jquery */ public function render($view, $data = array(), $return = false) { if (!Yii::app()->getRequest()->getIsAjaxRequest()) { return parent::render($view, $data, $return); } else { Yii::app()->getClientScript()->scriptMap = array('jquery.js' => false, 'jquery.min.js' => false, 'jquery.ui.js' => false, 'jquery.ui.min.js' => false); return parent::renderPartial($view, $data, false, true); } }
/** * invokes the controllers action via the invokeAction method in the controller class * @param Controller $controller current controller * @return Response response object created by the controller */ protected function _invoke(Controller $controller) { $response = $controller->invokeAction(); if (!$response && $controller->autorender) { $response = $controller->render(); } else { $response = $controller->response->send(); } return $response; }
public function testRender() { $params = array('param1' => 'value1'); $mock = $this->getMock('IResponsePresenter'); $mock->expects($this->once())->method('setViewName')->with($this->equalTo('some/view')); $mock->expects($this->once())->method('addVariables')->with($this->equalTo($params)); $this->container->expects($this->once())->method('getInstanceOfWith')->with($this->equalTo('response_presenter_service'))->will($this->returnValue($mock)); $presenter = $this->object->render('some/view', $params); $this->assertThat($presenter, $this->identicalTo($mock)); }
public function accessAdmin() { $con = new Controller(); $adm = new AdminLogin(); if ($adm->checkAdmin() === true) { $con->render("adminPage"); } else { echo "get last"; } }
/** * Enter description here... * * @return unknown */ function __scaffoldError() { if (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS . 'scaffold.error.thtml')) { return $this->controllerClass->render($this->actionView, '', APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS . 'scaffold.error.thtml'); } elseif (file_exists(APP . 'views' . DS . 'scaffold' . DS . 'scaffold.error.thtml')) { return $this->controllerClass->render($this->actionView, '', APP . 'views' . DS . 'scaffold' . DS . 'scaffold.error.thtml'); } else { return $this->controllerClass->render($this->actionView, '', LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . 'scaffold_error.thtml'); } }
function mvc_plugin_render() { $model = new Model($this->path); $controller = new Controller($model); $view = new View($model); if (isset($_REQUEST['mvc_view'])) { $controller->render($_REQUEST['mvc_view']); } $view->output(); }
function error($message) { if (!headers_sent()) { header("HTTP/1.0 404 Not Found"); } $controller = new Controller($this->request); $controller->getMenu = $controller->renderMenu('menu'); $controller->set('content_for_menu', $controller->getMenu); $controller->set('message', $message); $controller->render('/errors/404'); }
/** * A safer way to render error messages, replaces all helpers, with basics * and doesn't call component methods. * * @param string $template The template to render * @return void */ protected function _outputMessageSafe($template) { $this->controller->layoutPath = ''; $this->controller->subDir = ''; $this->controller->viewPath = 'Errors/'; $this->controller->viewClass = 'View'; $this->controller->helpers = array('Form', 'Html', 'Session'); $this->controller->render($template); $this->controller->response->type('html'); $this->controller->response->send(); }
public function createResponse($exception) { // Create empty controller and inject services to it $controller = new Controller(); $controller->setServiceContainer($this->services); // Create special response for exceptions $view = $this->getExceptionView(get_class($exception)); $message = $exception->getMessage(); $config = $this->get('config')->data; return $controller->render($view, compact('message', 'config'), 'html', array(), 500); }
public function render($t, $app = false, $base = 'base') { if ($t == 'fake') { CoOrgSmarty::fakeRender('extends:base.html.tpl|'.$t.'.html.tpl'); } else { parent::render($t, $app); } }
public function render($view, $data = null, $return = false) { switch (Yii::app()->user->getLevel()) { case 1: //Yii::app()->setTheme('backoffice'); break; case 2: Yii::app()->setTheme('classic'); break; } return parent::render($view, $data, $return); }
function flash($message, $url, $pause = 1) { $this->autoRender = false; $this->set('message', $message); $this->set('pause', $pause); $this->set('page_title', $message); if (isset($this->params['prefix'])) { $this->set('url', Router::url('/' . $this->params['prefix'] . $url)); return parent::render(false, 'm_flash'); } else { $this->set('url', Router::url($url)); $this->render(false, 'flash'); } }
public function render($tpl, $app = false, $base = 'base') { if ($base == 'base' && $app == false) { CoOrg::loadPluginInfo('admin'); $this->_adminTabs = Admin::tabs($this->_adminModule, $this->_adminTab); parent::render($tpl, false, 'base.html.tpl|'.Controller::getTemplatePath('admin.html.tpl', 'admin')); } else { parent::render($tpl, $app, $base); } }
/** * Toggle field status * * @param $model Model instance * @param $id integer Model id * @param $status integer current status * @param $field string field name to toggle * @throws CakeException */ public function fieldToggle(Model $model, $id, $status, $field = 'status') { if (empty($id) || $status === null) { throw new CakeException(__d('croogo', 'Invalid content')); } $model->id = $id; $status = (int) (!$status); $this->_controller->layout = 'ajax'; if ($model->saveField($field, $status)) { $this->_controller->set(compact('id', 'status')); $this->_controller->render('Common/admin_toggle'); } else { throw new CakeException(__d('croogo', 'Failed toggling field %s to %s', $field, $status)); } }
public function run() { if (ENV == 'development') { $this->_Timestamp = microtime(true); } Logger::info('', false); $protocol = empty($_SERVER['HTTPS']) ? 'http://' : 'https://'; Logger::debug($_SERVER['REQUEST_METHOD'] . " " . $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); Logger::info('App start...'); session_start(); // zistenie a spustenie daneho kontrolera $controllerName = CLASSES_PREFIX . "Controller" . Router::getControllerName(); if (class_exists($controllerName)) { Logger::debug("Loading controller {$controllerName}..."); $this->_Controller = new $controllerName(); $this->_Controller->run(); $this->_Controller->render(); } else { throw new Exception('Unknown controller: ' . $controllerName); } if (ENV == 'development') { Logger::debug("Generated in " . round((microtime(true) - $this->_Timestamp) * 1000) . " msec."); } }