本文整理汇总了PHP中DefaultController类的典型用法代码示例。如果您正苦于以下问题:PHP DefaultController类的具体用法?PHP DefaultController怎么用?PHP DefaultController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
public function handle($params)
{
if ($this->_cName == null) {
// above parseRoute() failed (controller not found) => run Default Controller (if specified)
global $app_i;
$def = trim($app_i['default_controller']);
if ($def != '' && file_exists(BASE . $def)) {
require_once BASE . $def;
$ctr = new DefaultController();
$ctr->handle(null);
$this->log->debug('Invalid URI. DefaultController called.');
return;
}
}
// URI parsed OK!
$fullpath = '/app/' . $this->_cPath . '/' . $this->_cName . '.php';
$this->log->debug('handle() route: ' . $fullpath);
$fullpath = BASE . $fullpath;
if (file_exists($fullpath)) {
// load parsed Controller
require_once $fullpath;
$ctr = new $this->_cName();
$ctr->handle($this->_cParams);
} else {
die('MainController: Error: Controller not found!');
}
$this->log->debug('handle() ended');
}
示例2: __construct
public function __construct()
{
$this->splitUrl();
if (!$this->url_controller) {
require APP . 'controller/DefaultController.php';
$page = new DefaultController();
$page->index();
} elseif (file_exists(APP . 'controller/' . ucfirst($this->url_controller) . 'Controller.php')) {
$this->url_controller = ucfirst($this->url_controller) . 'Controller';
require APP . 'controller/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
$this->url_controller->index();
} else {
header('location: ' . URL . 'error');
}
}
} else {
header('location: ' . URL . 'error');
}
}
示例3: testIndexAction
public function testIndexAction()
{
$view = $this->getServiceMockBuilder('FooView')->getMock();
$view->expects($this->once())->method('setTemplate')->with('FooBundle:Default:index.twig')->will($this->returnValue(null));
$view->expects($this->once())->method('handle')->with()->will($this->returnValue('success'));
$controller = new DefaultController($view);
$this->assertEquals('success', $controller->indexAction());
}
示例4: testHelloWorld
public function testHelloWorld()
{
/**
* @var \Waddle\Classes\App $app
*/
$app = $this->getMockBuilder('Waddle\\Classes\\App')->disableOriginalConstructor()->getMock();
$controller = new DefaultController($app);
$this->expectOutputRegex('/<h1>Hello, World!<\\/h1>/');
$controller->indexAction('World!');
}
示例5: socialLogin
public static function socialLogin($uid, $name, $email, $password, $hash)
{
$model = UsersModel::model()->where("`social_uid`='{$uid}' OR `email`='" . $email . "'")->findRow();
if (!$model) {
$random_password = rand(10000, 99999);
$model = new UsersModel();
$name = trim($name);
$email = trim($email);
$password = trim($password);
$model->name = $name;
$model->login = $email;
$model->password = md5($password);
$model->email = $email;
$model->is_admin = 0;
$model->status = 1;
$model->card_main_id = 1;
$model->card_main_new_id = 2;
$model->social_uid = $uid;
$model->hash = $hash;
$model->type = 2;
$model->save();
DefaultController::sendEmailToUser($model->email, $password, $model->hash, $model->password);
} else {
if ($model->status != 0) {
self::setFields($model);
} else {
header("Location: /deactivate");
exit;
}
header("Location: /");
}
self::setFields($model);
header("Location: /");
}
示例6: connectToController
/**
* Trigger a controller according the act param from the url
*
* @param string $act
*/
public function connectToController($act)
{
$act = ucfirst($act);
if (!empty($act)) {
$controllerName = __NAMESPACE__ . '\\' . $act . 'Controller';
if (!$controllerName && !class_exists($controllerName)) {
return;
}
// instantiate the view specific controller
$objController = new $controllerName($this->getSystemComponentController(), $this->cx);
} else {
// instantiate the default View Controller
$objController = new DefaultController($this->getSystemComponentController(), $this->cx);
}
$objController->parsePage($this->template);
}
示例7: confirmarSenha
public static function confirmarSenha($pwd1, $pwd2)
{
$pass = $pwd1 == $pwd2;
if (!$pass) {
DefaultController::defineException("senha", "Não foi possível confirmar sua senha!");
}
return $pass;
}
示例8: dispatch
public function dispatch()
{
$flag = false;
if (isset($_GET['ctrl'], $_GET['act'])) {
$ctrlName = "Imie\\Controllers\\" . ucfirst($_GET['ctrl']) . 'Controller';
if (class_exists($ctrlName)) {
$ctrl = new $ctrlName();
$actName = $_GET['act'] . 'Action';
if (method_exists($ctrl, $actName)) {
$ctrl->{$actName}();
$flag = true;
}
}
}
if (!$flag) {
$controller = new DefaultController();
$controller->indexAction();
}
}
示例9: display
/**
*
*/
function display()
{
if (!$this->site_template) {
return parent::display();
}
return parent::display($this->site_template);
}
示例10: error_404
public function error_404()
{
parent::setLayout('defaultLayout');
parent::setView('404');
$this->data['parameters'] = $this->parameters;
parent::renderLayout();
}
示例11: __construct
public function __construct()
{
parent::__construct();
# initialize the Perms controller
$this->_model = new Perms();
$this->activeSection = 'perms';
}
示例12: frmAction
public function frmAction($id = NULL)
{
$disque = $this->getInstance($id);
//TODO 4.4.1
$this->view->setVars(array("disque" => $disque, "siteUrl" => $this->url->getBaseUri(), "baseHref" => $this->dispatcher->getControllerName()));
parent::frmAction($id);
}
示例13: frmAction
public function frmAction($id = NULL)
{
$message = $this->getInstance($id);
$projects = Projet::find();
$users = User::find();
$this->view->setVars(array("message" => $message, "users" => $users, "projects" => $projects));
parent::frmAction($id);
}
示例14: display
function display()
{
if (!$this->print_preview) {
return parent::display();
}
$this->addStyleSheet('sheetgen/print.css');
return parent::display('sheet_template', SHEETGEN_TEMPLATES);
}
示例15: skate
public function skate()
{
parent::isAllowedToAccess();
parent::setLayout('defaultLayout');
parent::setView('skate');
$this->data['parameters'] = $this->parameters;
$this->data['orders'] = Statistics::getOrdersOverview(1, '2015-12-02', '2015-12-15');
parent::renderLayout();
}