本文整理汇总了PHP中Flight::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::render方法的具体用法?PHP Flight::render怎么用?PHP Flight::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runQueryWithView
private static function runQueryWithView($query, $fields, $printArray)
{
$_SESSION['tableData'] = array();
$exec_time_row = array();
$records = '';
try {
// turn on query profiling
Flight::get('db')->query('SET profiling = 1;');
$stmt = Flight::get('db')->query($query);
// find out time above query was ran for
$exec_time_result = Flight::get('db')->query('SELECT query_id, SUM(duration) FROM information_schema.profiling GROUP BY query_id ORDER BY query_id DESC LIMIT 1;');
$exec_time_row = $exec_time_result->fetchAll(PDO::FETCH_NUM);
// run query and fetch array
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
// store table fields/columns + data rows in session for exporting later
$_SESSION['tableData'] = array_merge($fields, $data);
$records = Presenter::listTableData($data);
} catch (PDOException $e) {
setFlashMessage('Error: ' . $e->getMessage());
}
Flight::render('table', array('title' => Flight::get('lastSegment'), 'icon' => self::$icon, 'table_data' => $records, 'fields' => getOptions($fields), 'query' => SqlFormatter::format($query), 'printArray' => $printArray, 'timetaken' => $exec_time_row[0][1]));
}
示例2: index
/**
* Login page
*/
public function index()
{
if (isset($_SESSION['admin'])) {
F::redirect('/');
}
F::render('Admin/login.html');
}
示例3: recommended
public static function recommended()
{
$dbname = 'predictionio_appdata';
$mdb = Flight::mdb();
$db = $mdb->{$dbname};
$items = $db->items;
$client = Flight::prediction_client();
$recommended_movies = array();
try {
$user_id = $_SESSION['user_id'];
$client = new EngineClient('http://localhost:8000');
$recommended_movies_raw = $client->sendQuery(array('user' => $user_id, 'num' => 9));
$movie_iids = array_map(function ($item) {
return $item['item'];
}, $recommended_movies_raw['itemScores']);
$cursor = $items->find(array('itypes' => '1', '_id' => array('$in' => $movie_iids)));
$recommended_movies = array_values(iterator_to_array($cursor));
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
$_SESSION['movies_viewed'] = 0;
$_SESSION['user_id'] = '';
Flight::render('recommended', array('recommended_movies' => $recommended_movies), 'content');
Flight::render('layout', array('title' => 'Recommended', 'base_path' => '/movie_recommender'));
}
示例4: render_frame
/**
* render_frame
* 渲染
*
* @var string
*/
public static function render_frame($title = '')
{
$sidebar = self::get_conf_data();
Flight::render('header', array('title' => $title), 'header_content');
Flight::render('navbar', array(), 'navbar_content');
Flight::render('sidebar', array('sidebar' => $sidebar), 'sidebar_content');
}
示例5: recommended
public static function recommended()
{
$dbname = 'predictionio_appdata';
$mdb = Flight::mdb();
$db = $mdb->{$dbname};
$items = $db->items;
$client = Flight::prediction_client();
$recommended_movies = array();
try {
$user_id = $_SESSION['user_id'];
$client->identify($user_id);
$command = $client->getCommand('itemrec_get_top_n', array('pio_engine' => 'movie-recommender', 'pio_n' => 9));
$recommended_movies_raw = $client->execute($command);
$movie_iids = $recommended_movies_raw['pio_iids'];
array_walk($movie_iids, function (&$movie_iid) {
$movie_iid = '4_' . $movie_iid;
});
$cursor = $items->find(array('itypes' => '1', '_id' => array('$in' => $movie_iids)));
$recommended_movies = array_values(iterator_to_array($cursor));
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
$_SESSION['movies_viewed'] = 0;
$_SESSION['user_id'] = '';
Flight::render('recommended', array('recommended_movies' => $recommended_movies), 'content');
Flight::render('layout', array('title' => 'Recommended', 'base_path' => '/movie_recommender'));
}
示例6: _manage_platoon
public static function _manage_platoon($div, $plt)
{
$division = Division::findByName(strtolower($div));
$platoonId = Platoon::getIdFromNumber($plt, $division->id);
if (!is_null($platoonId)) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
if ($member->platoon_id == $platoonId || $user->role > 2 || User::isDev()) {
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$platoon = Platoon::findById($platoonId);
$unassignedMembers = Platoon::unassignedMembers($platoonId, true);
$squads = Squad::findByPlatoonId($platoonId);
$memberCount = count((array) Platoon::members($platoonId));
$js = 'manage';
Flight::render('manage/platoon', compact('division', 'platoon', 'squads', 'unassignedMembers', 'memberCount'), 'content');
Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
} else {
// insufficient access
Flight::redirect('404/', 404);
}
} else {
// nonexistent platoon
Flight::redirect('404/', 404);
}
}
示例7: renderTemplate
function renderTemplate($templateName, $selectedTab, $subTitle = '', $pageType = '')
{
Flight::render('partials/head', array('title' => $subTitle ? " - {$subTitle}" : ''), 'headContent');
Flight::render('partials/contactDetails', array(), 'contactDetails');
Flight::render('partials/socialList', array(), 'socialList');
Flight::render('partials/navigation', array('selectedTab' => $selectedTab), 'navigation');
Flight::render('partials/footer', array(), 'footer');
Flight::render($templateName, array('title' => $subTitle !== '' ? " - {$subTitle}" : '', 'subTitle' => $subTitle, 'pageType' => $pageType));
}
示例8: majesteel
public static function majesteel()
{
$symfony = new Symfony();
$symfony->initRequirements();
$symfony->initOptionalRequirements();
$majesteel = new MajesTeel();
$majesteel->initRequirements();
$majesteel->initOptionalRequirements();
Flight::render('templates/majesteel.tpl', array('symfony' => $symfony, 'majesteel' => $majesteel));
}
示例9: _doDivisionThreadCheck
public static function _doDivisionThreadCheck()
{
if (!empty($_POST['player'])) {
$player = trim($_POST['player']);
$member = Member::find(intval($_SESSION['memberid']));
$gameThreads = DivisionThread::find_all($member->game_id);
$js = 'check_threads';
Flight::render('recruiting/thread_check', compact('js', 'gameThreads', 'player'));
} else {
echo "<span class='text-muted'>A valid player was not provided!</span>";
}
}
示例10: _authenticate
public static function _authenticate()
{
if (User::isLoggedIn()) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
Flight::render('layouts/auth', [], 'content');
Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
} else {
Flight::render('layouts/auth', [], 'content');
Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
}
}
示例11: _retentionNumbers
public static function _retentionNumbers()
{
$user = User::find(intval($_SESSION['userid']));
if ($user->role >= 3 || User::isDev()) {
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$recruited = Report::recruitedLast30days($member->game_id);
$removed = Report::removedLast30days($member->game_id);
$monthlyBreakdown = Report::recruitingWeekly($member->game_id);
$byTheMonth = Report::recruitingByTheMonth($member->game_id);
$js = 'report';
Flight::render('reports/retention', compact('recruited', 'removed', 'js', 'monthlyBreakdown', 'byTheMonth'), 'content');
Flight::render('layouts/application', array('user' => $user, 'member' => $member, 'tools' => $tools, 'divisions' => $divisions));
} else {
Flight::redirect('/404', 404);
}
}
示例12: _edit
public static function _edit()
{
$user = User::find(intval($_SESSION['userid']));
$member = Member::findByMemberId($_POST['member_id']);
$platoons = Platoon::find_all($member->game_id);
// if user role lower than plt ld, show only own platoon's squads
$platoon_id = $user->role >= 2 && !User::isDev() ? $member->platoon_id : false;
$squads = Squad::findAll($member->game_id, $platoon_id);
$positionsArray = Position::find_all();
$rolesArray = Role::find_all();
$memberGames = MemberGame::get($member->id);
if (User::isUser($member->id)) {
$userInfo = User::findByMemberId($member->id);
} else {
$userInfo = null;
}
Flight::render('modals/view_member', array('user' => $user, 'member' => $member, 'userInfo' => $userInfo, 'platoons' => $platoons, 'memberGames' => $memberGames, 'squads' => $squads, 'positionsArray' => $positionsArray, 'rolesArray' => $rolesArray));
}
示例13: page
/**
* Reading / Editing page
*/
public function page($params)
{
$mode = $params[0];
$pageinfos = F::get('pageinfos');
if (empty($pageinfos['cat'])) {
$pageTitle = F::get('config')['document'];
$url_view = '{$root}';
$url_edit = '{$root}.edit';
$path = 'docs/.home';
} else {
$pageTitle = Files::getPageTitle($pageinfos['cat'], $pageinfos['page']);
$url_view = '{$root}' . $pageinfos['cat'] . '/' . $pageinfos['page'];
$url_edit = '{$root}' . $pageinfos['cat'] . '/' . $pageinfos['page'] . '.edit';
$path = 'docs/' . $pageinfos['cat'] . '/' . $pageinfos['page'];
}
if (file_exists($path) && is_file($path) && is_readable($path)) {
$pageContent = file_get_contents($path);
# Edit mode
if ($mode == 'edit' && F::has('admin')) {
# Content submited
if (F::request()->method == 'POST') {
$pageContent = F::request()->data->pageContent;
file_put_contents($path, $pageContent);
$_SESSION['flashbag'] = '
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
The page has been saved
</div>';
F::redirect('/' . $pageinfos['cat'] . '/' . $pageinfos['page']);
} else {
$pageContent = file_get_contents($path);
F::render('Doc/page-edit.html', array('page_edit_url' => $url_edit, 'page_view_url' => $url_view, 'page_title' => $pageTitle, 'page_content' => $pageContent, 'edition_mode' => true));
}
} else {
F::render('Doc/page-view.html', array('page_edit_url' => $url_edit, 'page_title' => $pageTitle, 'page_content' => $pageContent, 'page_last_modif' => date('Y-m-d H:i:s', filemtime($path))));
}
} else {
F::render('Core/404.html');
}
}
示例14: msg
public static function msg($msg)
{
Flight::render("common/handle", array("msg" => $msg));
die;
}
示例15: function
});
Flight::route('/projects', function () {
Flight::render('projects' . PREFIX, array('active' => 'projects', 'lang' => 'en'));
});
Flight::route('/works', function () {
Flight::render('projects' . PREFIX, array('active' => 'projects', 'lang' => 'en'));
});
Flight::route('/attorneys', function () {
Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'en'));
});
Flight::route('/nuestrosabogados', function () {
Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'es'));
});
Flight::route('/equipo', function () {
Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'es'));
});
Flight::route('/team', function () {
Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'es'));
});
Flight::route('/contacto', function () {
Flight::render('contact' . PREFIX . '.es', array('active' => 'contact', 'lang' => 'es'));
});
Flight::route('/contact', function () {
Flight::render('contact' . PREFIX . '.en', array('active' => 'contact', 'lang' => 'en'));
});
Flight::route('/admin', function () {
Flight::render('admin', array('active' => '', 'lang' => 'en'));
});
//Config
//Flight::set('flight.views.path', '/path/to/views');
Flight::start();