本文整理汇总了PHP中core\View类的典型用法代码示例。如果您正苦于以下问题:PHP View类的具体用法?PHP View怎么用?PHP View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$data['title'] = "Sistema de Administración de Aerolíneas";
$data['page'] = "page3";
if (!is_null(filter_input(INPUT_POST, 'insertar'))) {
$matricula = $_POST['matricula'];
$asientos = $_POST['asientos'];
$id_aerolinea = $_POST['id_aerolinea'];
$datos = array('ASIENTOS' => $matricula, 'MATRICULA' => $asientos, 'AEROLINEA_ID' => $id_aerolinea);
$this->_model->insertar_avion($datos);
Url::redirect("aviones?aer=1");
} elseif (!is_null(filter_input(INPUT_POST, 'eliminar'))) {
$id_aerolinea = $_POST['id_avion'];
$where = array('avion_id' => $id_aerolinea);
$this->_model->eliminar_avion($where);
} elseif (!is_null(filter_input(INPUT_POST, 'editar'))) {
$matricula = $_POST['matricula'];
$asientos = $_POST['asientos'];
$id_aerolinea = $_POST['id_aerolinea'];
$id_avion = $_POST['id_avion'];
$datos = array('ASIENTOS' => $matricula, 'MATRICULA' => $asientos, 'AEROLINEA_ID' => $id_aerolinea);
$where = array('avion_id' => $id_avion);
$this->_model->actualizar_avion($datos, $where);
}
$data['aerolineas'] = $this->_model->obtener_aerolineas();
$data['aviones'] = $this->_model->obtener_aviones();
View::renderTemplate('header', $data);
View::render('aviones/aviones', $data);
View::renderTemplate('footer', $data);
}
示例2: login
public function login()
{
Hooks::addHook('js', 'Controllers\\auth@js');
Hooks::addHook('css', 'Controllers\\auth@css');
$error = 'hi';
$success = 'hi';
if (Session::get('loggedin')) {
Url::redirect();
}
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
//validation
if (Password::verify($password, $this->_model->getHash($username)) == false) {
$error[] = 'Wrong username or password';
}
//if validation has passed carry on
if (!$error) {
Session::set('loggedin', true);
Session::set('username', $username);
Session::set('memberID', $this->_model->getID($username));
$data = array('lastLogin' => date('Y-m-d G:i:s'));
$where = array('memberID' => $this->_model->getID($username));
$this->_model->update($data, $where);
$error = 'hi';
Url::redirect();
}
}
$data['title'] = 'Login';
View::rendertemplate('header', $data);
View::render('auth/login', $data, $error, $success);
View::rendertemplate('footer', $data);
}
示例3: login
public function login()
{
if (Session::get('loggedin')) {
Url::redirect('admin');
}
$model = new \Models\Admin\Auth();
$data['title'] = 'Login';
if (isset($_POST['submit'])) {
$username = $_POST['member_username'];
$password = $_POST['member_password'];
if (Password::verify($_POST['member_password'], $model->getHash($_POST['member_username'])) == 0) {
$error[] = 'Wrong username of password';
} else {
$data['user_infos'] = $model->get_user_infos($_POST['member_username']);
Session::set('member_id', $data['user_infos'][0]->member_id);
Session::set('member_username', $username);
Session::set('member_password', '' . $password . '');
Session::set('loggedin', true);
Url::redirect('admin');
}
}
View::renderadmintemplate('loginheader', $data);
View::render('admin/login', $data, $error);
View::renderadmintemplate('footer', $data);
}
示例4: index
public function index()
{
$data['title'] = $this->language->get('Voorwaarden');
View::renderTemplate('header', $data);
View::render('home/voorwaarden', $data);
View::renderTemplate('footer', $data);
}
示例5: index
public function index()
{
$data['title'] = 'Admin';
View::renderadmintemplate('header', $data);
View::render('admin/admin', $data);
View::renderadmintemplate('footer', $data);
}
示例6: index
public function index()
{
// editable if admin privileges
$admin_privilege = false;
if (isset($_SESSION['user_info'])) {
if ($_SESSION['user_info']->privilege >= 5) {
// admin privilege level
$admin_privilege = true;
}
}
// get parents
$parents = $this->db->getParents();
$data["info"] = array();
// get children
foreach ($parents as $parent) {
$buffer = array($parent);
// get title
$children = $this->db->getChildren($parent);
foreach ($children as $child) {
array_push($buffer, $child);
}
array_push($data["info"], $buffer);
}
// display information
$data['title'] = 'Task';
View::renderTemplate('header', $data);
View::render('task/task', $data);
View::renderTemplate('footer', $data);
}
示例7: admin
public function admin($name)
{
$users = Users::getAll();
View::set("users", $users);
View::set("title", "Custom MVC");
View::render("admin");
}
示例8: index
/**
* Define Index page title and load template files
*/
public function index()
{
$data['title'] = 'Creepers';
View::renderTemplate('header', $data);
View::render('home', $data);
View::renderTemplate('footer', $data);
}
示例9: indexAction
public function indexAction()
{
$page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
// Seo
$this->_seo['h1'] = 'Карта сайта';
$this->_seo['title'] = 'Карта сайта';
$this->_seo['keywords'] = 'Карта сайта';
$this->_seo['description'] = 'Карта сайта';
$this->setBreadcrumbs('Карта сайта');
// Get pages
$result = DB::select()->from('content')->where('status', '=', 1)->order_by('sort')->as_object()->execute();
$pages = array();
foreach ($result as $obj) {
$pages[$obj->parent_id][] = $obj;
}
// Get catalog groups
$result = DB::select()->from('catalog_tree')->where('status', '=', 1)->order_by('sort')->as_object()->execute();
$groups = array();
foreach ($result as $obj) {
$groups[$obj->parent_id][] = $obj;
}
// Get catalog groups
$brands = DB::select()->from('brands')->where('status', '=', 1)->order_by('sort')->as_object()->execute();
// Get news
$news = DB::select()->from('news')->where('status', '=', 1)->order_by('date', 'DESC')->as_object()->execute();
// Get articles
$articles = DB::select()->from('articles')->where('status', '=', 1)->order_by('id', 'DESC')->as_object()->execute();
// Render page
$this->_content = View::tpl(array('pages' => $pages, 'groups' => $groups, 'news' => $news, 'articles' => $articles, 'brands' => $brands), 'Sitemap/Index');
}
示例10: loadController
/**
* Load controller
*
* @param array $cmv array('controller' => '', 'method' => '', 'vars' => array())
*/
private function loadController($cmv)
{
//if we have nothing to do, then quit
if (empty($cmv) or empty($cmv['controller']) or empty($cmv['method'])) {
trigger_error('Not call controller->method', E_USER_ERROR);
exit;
}
if (!is_array($cmv['controller'])) {
$cmv['controller'] = array($cmv['controller']);
}
self::$controller = implode("\\", $cmv['controller']);
self::$method = $cmv['method'];
$this->view->setView(self::$controller . DS . self::$method);
//add controllers folder to begin and uppercase first letter class name
array_unshift($cmv['controller'], 'controllers');
end($cmv['controller']);
$cmv['controller'][key($cmv['controller'])] = ucfirst($cmv['controller'][key($cmv['controller'])]);
$cmv['controller'] = "\\" . implode("\\", $cmv['controller']);
$controller = new $cmv['controller']($this->config, $this->router, $this->view);
if (method_exists($controller, 'beforeMethod')) {
Debug::timer('beforeMethod');
$controller->beforeMethod();
Debug::timer('beforeMethod');
}
if (is_callable(array($controller, $cmv['method']), true)) {
Debug::timer('Controller logic');
call_user_func_array(array($controller, $cmv['method']), $cmv['vars']);
Debug::timer('Controller logic');
}
if (method_exists($controller, 'afterMethod')) {
Debug::timer('afterMethod');
$controller->afterMethod();
Debug::timer('afterMethod');
}
}
示例11: index
function index()
{
View::setHeaderTag('title', 'Home');
View::render('header');
View::render('index/index');
View::render('footer');
}
示例12: userLogin
/**
* User login
*/
public function userLogin($app_info)
{
$data['id'] = $app_info->app_id;
$data['version'] = $app_info->app_version;
$data['dir'] = DIR;
View::render('login', $data);
}
示例13: view
/**
* @param $view
* @param null $params
*
* @return View
*/
public function view($view, $params = null)
{
$params['Config'] = new Config();
$params['Date'] = new Carbon();
$params['Utils'] = new Utils();
View::render($view, $params);
}
示例14: file
public function file()
{
$fileID = array_keys($_GET);
$fileID = str_replace('files/', '', $fileID[0]);
$fileInfo = $this->_files->getFileInfo($fileID);
if (empty($fileInfo)) {
header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
$data['title'] = '404';
$data['error'] = "Страница не найдена.";
View::render('Error/404');
die;
}
$data['title'] = $fileInfo['file_name'];
$data['fileinfo'] = $fileInfo;
if ($data['fileinfo']['file_type'] == 'image/jpg' || $data['fileinfo']['file_type'] == 'image/gif' || $data['fileinfo']['file_type'] == 'image/png') {
$data['imageinfo'] = getimagesize($_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $data['fileinfo']['server_name']);
}
if ($data['fileinfo']['file_type'] == 'image/jpg' || $data['fileinfo']['file_type'] == 'image/tiff') {
$data['imageinfo']['saved'] = exif_read_data($_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $data['fileinfo']['server_name']);
}
$fileType = array_shift(explode('/', $data['fileinfo']['file_type']));
if ($fileType == 'video' || $fileType == 'audio') {
$getID3 = new GetId3();
$data['mediainfo'] = $getID3->setEncoding('UTF-8')->analyze($_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $data['fileinfo']['server_name']);
}
$data['comments'] = $this->_files->getAllComments($fileID);
$data['token'] = $this->makeToken();
View::renderTemplate('header', $data);
View::render('files/file', $data);
View::renderTemplate('footer', $data);
}
示例15: indexAction
public function indexAction()
{
$posts = new Posts();
$posts->getAll();
$view = View::init();
echo $view->render('pages/posts/all.twig', ['title' => 'Блог', 'posts' => $posts->getAll()]);
}