本文整理汇总了PHP中UserController::show方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::show方法的具体用法?PHP UserController::show怎么用?PHP UserController::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserController
的用法示例。
在下文中一共展示了UserController::show方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$webuser = new WebUser($_POST);
if ($webuser->getErrorCount() == 0) {
if (!empty(WebUserDB::getUsersBy('hockName', $webuser->getHockName()))) {
$webuser->setError('hockName', 'HOCKUSER_NAMECLAIMED');
SignupView::show($webuser);
} else {
//create a webuser in db
$id = WebUserDB::addUser($webuser);
if ($id != 0) {
$base = array_key_exists('base', $_SESSION) ? $_SESSION['base'] : "";
//find the hockuser related to this dude
//$hockusers = HockUserDB::getUsersBy('name', $webuser->getHockName());
header("Location: /" . $base . "/user/show/" . $webuser->getHockName());
UserController::show();
//ProfileView::show($webuser, $hockusers[0]);//HomeView::show();
} else {
$webuser->setError('userName', 'DBERROR_ADDWEBUSER');
SignupView::show($webuser);
}
}
} else {
SignupView::show($webuser);
}
} else {
// Initial link
SignupView::show(null);
}
}
示例2: run
public static function run()
{
// Perform actions related to a user
$action = array_key_exists('action', $_SESSION) ? $_SESSION['action'] : "";
$arguments = $_SESSION['arguments'];
switch ($action) {
case "leaderboard":
$_SESSION['users'] = HockUserDB::getAllUsers();
$_SESSION['headertitle'] = "Hock League Leaderboard";
UserView::showall();
break;
default:
//Find the specified user
$webuser = null;
$hockusers = HockUserDB::getUsersBy('name', $action);
if (empty($hockusers)) {
$hockusers = HockUserDB::getUsersBy('alias', $action);
if (empty($hockusers)) {
$hockuser = null;
} else {
$hockuser = $hockusers[0];
}
} else {
$hockuser = $hockusers[0];
}
if (!is_null($hockuser)) {
//Find webuser associated with hockuser?
$webusers = WebUserDB::getUsersBy('hockName', $hockuser->getUserName());
if (!empty($webusers)) {
$webuser = $webusers[0];
}
}
$_SESSION['hockuser'] = $hockuser;
$_SESSION['webuser'] = $webuser;
UserController::show();
}
}
示例3: function
SessionController::create();
});
$routes->get('/logout', function () {
SessionController::destroy();
});
$routes->get('/signup', function () {
UserController::create();
});
$routes->post('/signup', function () {
UserController::store();
});
$routes->get('/user', function () {
UserController::index();
});
$routes->get('/user/:id', function ($id) {
UserController::show($id);
});
$routes->post('/user/:id', function ($id) {
UserController::update($id);
});
$routes->get('/user/:id/edit', function ($id) {
UserController::edit($id);
});
$routes->get('/user/:id/destroy', function ($id) {
UserController::destroy($id);
});
$routes->get('/group', function () {
GroupController::index();
});
$routes->post('/group', function () {
GroupController::store();
示例4: function
});
$routes->post('/register/', function () {
UserController::handle_register();
});
$routes->post('/user/:user_id/delete', function ($item_id) {
UserController::destroy($item_id);
});
$routes->get('/user/:user_id/edit', function ($user_id) {
UserController::edit($user_id);
});
$routes->post('/user/:user_id/edit', function ($user_id) {
UserController::update($user_id);
});
// Vaatteen esittelysivu
$routes->get('/user/:item_id', function ($user_id) {
UserController::show($user_id);
});
// Vaatteet
// Vaatteiden indeksisivu
$routes->get('/items/', function () {
ItemController::index();
});
// Vaatteen lisäyssivu
$routes->get('/items/new', function () {
ItemController::create();
});
// Vaatteen esittelysivu
$routes->get('/items/:item_id', function ($item_id) {
ItemController::show($item_id);
});
// Vaatteen muokkaussivu - esittäminen
示例5: execute
class LogToFile implements Logger
{
public function execute($message)
{
var_dump('log the message to a file:' . $message);
}
}
class LogToDatabase implements Logger
{
public function execute($message)
{
var_dump('log the message to a DataBase:' . $message);
}
}
//...
class UserController
{
protected $logger;
public function __construct(Logger $logger)
{
$this->logger = $logger;
}
public function show()
{
$user = 'John Doe';
$this->logger->execute($user);
}
}
$controller = new UserController(new LogToDatabase());
$controller->show();