本文整理汇总了PHP中Flight::util方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::util方法的具体用法?PHP Flight::util怎么用?PHP Flight::util使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::util方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showNewAbsence
public function showNewAbsence($team, $event)
{
if ($event != null) {
$event = Flight::events()->getEventWithId($event);
}
$team = Flight::teams()->getTeamWithId($team);
Flight::util()->render('newAbsence', array('team' => $team, 'event' => $event));
}
示例2: saveNewEvent
public function saveNewEvent()
{
Flight::auth()->check();
$response = Flight::util()->validate('event', Flight::request()->data);
if (is_array($response)) {
Flight::util()->render('newEvent', array('team_id' => Flight::request()->data->team, 'error' => $response));
return;
}
$event = new event(Flight::request()->data);
$id = $event->store();
Flight::redirect('/event/' . $id);
}
示例3: author
public static function author($id = null)
{
if ($id == null) {
if (Flight::has('currentUser')) {
$user = Flight::get('currentUser');
} else {
Flight::redirect("/");
}
} else {
$user = Flight::users()->getUserWithId($id);
}
Flight::util()->render('profile', ['user' => $user]);
}
示例4: register
public function register()
{
Flight::auth()->check(20);
$response = Flight::util()->validate("user", Flight::request()->data);
if (is_array($response)) {
Flight::util()->render('newUser', array('error' => $response, "teams" => Flight::teams()->getAllTeams()));
return;
}
$data = Flight::request()->data;
$user = new user($data);
$user->teams = Flight::request()->data->teams;
$user->store();
Flight::redirect("/createUser");
}
示例5: login
/**
* Login with email and password
*/
public static function login()
{
$email = Flight::request()->data->email;
$password = Flight::request()->data->password;
$user = Flight::users()->getUserWithEmail($email);
if ($user == false) {
Flight::util()->render('login', ['error' => 'login']);
} else {
if (hash("sha256", $password) == $user->password) {
$_SESSION['user'] = $user;
Flight::redirect("/");
} else {
Flight::util()->render('login', ['error' => 'login']);
}
}
}
示例6:
<?php
if (isset($error['phone_home']['type'])) {
Flight::util()->error($error['phone_home']);
}
?>
<div class="input-group">
<span class="input-group-addon" id="phone_home">Phone Home</span>
<input type="tel" name="phone_home" value="<?php
echo $player->phone_home;
?>
" class="form-control" aria-describedby="phone_home">
</div>
</div>
<div class="row">
<?php
if (isset($error['team']['type'])) {
Flight::util()->error($error['team']);
}
?>
<select name="team" class="form-control" required>
<?php
foreach ($teams as $team) {
echo "<option " . ($team->id == $player->team ? "selected='selected'" : "") . " value='" . $team->id . "'>" . $team->name . "</option>";
}
?>
</select>
</div>
<button type="submit" class="btn btn-success">Update</button>
</div>
</form>
示例7: isset
<form method="post" action="createTeam" class="form-inline">
<?php
if (isset($error['name']['name'])) {
Flight::util()->error($error['name']);
}
?>
<div class="form-group">
<label for="name">Teamname</label>
<input type="text" class="form-control" value="<?php
echo isset($error['name']) ? $error['name']['value'] : '';
?>
" name="name" id="name" placeholder="Ea">
</div>
<button type="submit" class="btn btn-success">Create Team</button>
</form>
示例8: isset
Flight::util()->error($error['email']);
}
?>
<div class="input-group">
<span class="input-group-addon" id="email">Email</span>
<input type="email" name="email" value="<?php
echo isset(Flight::request()->data->email) ? Flight::request()->data->email : '';
?>
" class="form-control" aria-describedby="email">
</div>
</div>
<div class="col-lg-5">
<?php
if (isset($error['password']['type'])) {
Flight::util()->error($error['password']);
}
?>
<div class="input-group">
<span class="input-group-addon" id="password">password</span>
<input type="password" name="password" class="form-control" aria-describedby="password">
</div>
</div>
<div class="col-lg-2">
<div class="input-group">
<button type="submit" value="Send" class="btn btn-success" id="submit" >Login</button>
</div>
</div>
</div>
</form>
示例9: showNewTeam
public function showNewTeam()
{
Flight::auth()->check(20);
Flight::util()->render('newTeam');
}
示例10: isset
<span class="input-group-addon" id="end">To</span>
<input type="datetime-local" name="end" class="form-control" aria-describedby="to" required>
</div>
<?php
if (isset($error['type']['type'])) {
Flight::util()->error($error['type']);
}
?>
<div class="input-group">
<span class="input-group-addon" id="type">Type</span>
<select name="type" class="form-control" aria-describedby="type">
<option selected value="10">Match</option>
<option value="20">Training</option>
</select>
</div>
<?php
if (isset($error['text']['type'])) {
Flight::util()->error($error['text']);
}
?>
<div class="input-group">
<span class="input-group-addon" id="text">Text</span>
<textarea area-describedby="text" value="<?php
echo isset($error['text']) ? $error['text']['value'] : '';
?>
" class="form-control" name="text"></textarea>
</div>
<button type="submit" class="btn btn-success">Create</button>
</div>
</form>
示例11: function
<?php
Flight::route('/', function () {
if (Flight::auth()->online()) {
Flight::redirect('/teams');
}
Flight::util()->render('login');
});
Flight::route("POST /editUser", ['userController', 'saveUserSettings']);
Flight::route("GET /editUser(/@id)", ['userController', 'showUserSettings']);
Flight::route("GET /createUser", ['userController', 'showNewUser']);
Flight::route("POST /createPlayer", ['playerController', 'saveNewPlayer']);
Flight::route("GET /createPlayer", ['playerController', 'showNewPlayer']);
Flight::route("POST /player/@id/update", ['playerController', 'updatePlayer']);
Flight::route("GET /player/@id/delete", ['playerController', 'deletePlayer']);
Flight::route("GET /player/@id", ['playerController', 'showPlayer']);
Flight::route("GET /player/@id/update", ['playerController', 'showUpdatePlayer']);
Flight::route("GET /players", ['playerController', 'showAllPlayers']);
Flight::route('GET /teams', ['teamController', 'showTeamList']);
Flight::route('GET /team/@id', ['teamController', 'showTeam']);
Flight::route("POST /createTeam", ['teamController', 'saveNewTeam']);
Flight::route("GET /createTeam", ['teamController', 'showNewTeam']);
Flight::route("GET /deleteTeam/@id", ['teamController', 'deleteTeam']);
Flight::route('GET /createEvent/@team', ['eventController', 'showNewEvent']);
Flight::route('POST /createEvent', ['eventController', 'saveNewEvent']);
Flight::route("GET /event/@id", ['eventController', 'showEvent']);
Flight::route("GET /deleteEvent/@id", ['eventController', 'deleteEvent']);
Flight::route('GET /createAbsence/@team(/@event)', ['absenceController', 'showNewAbsence']);
Flight::route('POST /createAbsence/@team(/@event)', ['absenceController', 'saveNewAbsence']);
Flight::route("GET /deleteAbsence/@id", ['absenceController', 'deleteAbsence']);
Flight::route("POST /login", ["auth", "login"]);
示例12: showAllPlayers
public function showAllPlayers()
{
Flight::auth()->check(20);
Flight::util()->render('players', array("players" => Flight::players()->getAllPlayers()));
}
示例13: showNewUser
public function showNewUser()
{
Flight::auth()->check(20);
Flight::util()->render('newUser', array("teams" => Flight::teams()->getAllTeams()));
}
示例14: function
<?php
Flight::path("controllers/");
Flight::path("classes/");
Flight::register('db', 'mysqli', [$config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['databasename']]);
Flight::register('auth', 'auth');
Flight::register('util', 'util');
Flight::register('absence', 'absenceController');
Flight::register('events', 'eventController');
Flight::register('players', 'playerController');
Flight::register('teams', 'teamController');
Flight::register('users', 'userController');
Flight::set("flight.base_url", $config['web']['base_url']);
Flight::map('link', function ($url) {
echo Flight::get('flight.base_url') . $url;
});
Flight::map('noAccess', function () {
Flight::util()->render('noAccess');
die;
});
Flight::map('notFound', function () {
Flight::util()->render('404');
die;
});
Flight::map('notLogedIn', function () {
Flight::util()->render('notLogedIn');
die;
});