本文整理汇总了PHP中Controller::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::render方法的具体用法?PHP Controller::render怎么用?PHP Controller::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: signupAction
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");
}
}
}
示例2: startup
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'));
}
}
}
}
示例3: render
protected function render($template = null, $direct = false)
{
if ($template) {
$template = "admin/" . $template;
}
parent::render($template, $direct);
}
示例4: errorHandler
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;
}
示例5: update
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');
}
}
示例6: errorHandler
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('tony.jiang@yale.edu', 'qingyang.chen@gmail.com'), "info@sublite.net", '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;
}
示例7: ver_postulaciones
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);
}
示例8: render
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();
}
示例9: 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();
}
示例10: error
function error($message)
{
header("HTTP/1.0 404 Not Found");
$controller = new Controller($this->request);
$controller->set('message', $message);
$controller->render('/errors/404');
die;
}
示例11: renderView
private function renderView($template)
{
if (Front::$IS_OC2) {
return $this->load->view($template, $this->data);
}
$this->template = $template;
return parent::render();
}
示例12: renderJSON
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);
}
示例13: render
/**
* 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);
}
}
示例14: init
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');
}
}
示例15: renderView
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";
}