本文整理汇总了PHP中core\View类的典型用法代码示例。如果您正苦于以下问题:PHP View类的具体用法?PHP View怎么用?PHP View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了View类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:alejandrozepeda,项目名称:admin,代码行数:30,代码来源:Aviones.php
示例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);
}
开发者ID:pacozaa,项目名称:simple-mvc-framework-inventory,代码行数:33,代码来源:auth.php
示例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);
}
开发者ID:T-PHP,项目名称:Simple-MVC-Blog,代码行数:25,代码来源:Auth.php
示例4: index
public function index()
{
$data['title'] = $this->language->get('Voorwaarden');
View::renderTemplate('header', $data);
View::render('home/voorwaarden', $data);
View::renderTemplate('footer', $data);
}
开发者ID:Aukevanoost,项目名称:zeilschooldewaai,代码行数:7,代码来源:Voorwaarden.php
示例5: index
public function index()
{
$data['title'] = 'Admin';
View::renderadmintemplate('header', $data);
View::render('admin/admin', $data);
View::renderadmintemplate('footer', $data);
}
开发者ID:T-PHP,项目名称:Simple-MVC-Blog,代码行数:7,代码来源:Admin.php
示例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);
}
开发者ID:maksym-gryb,项目名称:portfolio,代码行数:29,代码来源:Task.php
示例7: admin
public function admin($name)
{
$users = Users::getAll();
View::set("users", $users);
View::set("title", "Custom MVC");
View::render("admin");
}
开发者ID:archibinario,项目名称:mvc-php,代码行数:7,代码来源:Home.php
示例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);
}
开发者ID:Lyman88,项目名称:Creepers,代码行数:10,代码来源:Home.php
示例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');
}
开发者ID:procivam,项目名称:hochu-bilet-v3,代码行数:30,代码来源:Sitemap.php
示例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');
}
}
开发者ID:stefanak-michal,项目名称:DragonMVC,代码行数:40,代码来源:Dragon.php
示例11: index
function index()
{
View::setHeaderTag('title', 'Home');
View::render('header');
View::render('index/index');
View::render('footer');
}
开发者ID:joaopauloti,项目名称:inmvc,代码行数:7,代码来源:index.php
示例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);
}
开发者ID:fabiensebban,项目名称:the-pic-contest,代码行数:10,代码来源:Login.php
示例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);
}
开发者ID:sikamy,项目名称:sephy-framework,代码行数:13,代码来源:Controller.php
示例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);
}
开发者ID:Nattpyre,项目名称:rocketfiles,代码行数:31,代码来源:Files.php
示例15: indexAction
public function indexAction()
{
$posts = new Posts();
$posts->getAll();
$view = View::init();
echo $view->render('pages/posts/all.twig', ['title' => 'Блог', 'posts' => $posts->getAll()]);
}
开发者ID:ntk-andr,项目名称:poligon,代码行数:7,代码来源:MainController.php
示例16: index
public function index()
{
$data['title'] = "Sistema de Administración de Aerolíneas";
$data['page'] = "page2";
if (!is_null(filter_input(INPUT_POST, 'insertar'))) {
$nombre = $_POST['nombre'];
$responsable = $_POST['responsable'];
$numero = $_POST['numero'];
$email = $_POST['correo'];
$datos = array('NOMBRE' => $nombre, 'NOMBRE_RESPONSABLE' => $responsable, 'AVIONES' => $numero, 'EMAIL' => $email);
$this->_model->insertar_aerolinea($datos);
Url::redirect("aerolineas?aer=1");
} elseif (!is_null(filter_input(INPUT_POST, 'eliminar'))) {
$id_aerolinea = $_POST['id_aerolinea'];
$where = array('aerolinea_id' => $id_aerolinea);
$this->_model->eliminar_aerolinea($where);
} elseif (!is_null(filter_input(INPUT_POST, 'editar'))) {
$nombre = $_POST['nombre'];
$responsable = $_POST['responsable'];
$numero = $_POST['numero'];
$email = $_POST['correo'];
$id_aerolinea = $_POST['id_aerolinea'];
$data = array('NOMBRE' => $nombre, 'NOMBRE_RESPONSABLE' => $responsable, 'AVIONES' => $numero, 'EMAIL' => $email);
$where = array('aerolinea_id' => $id_aerolinea);
$this->_model->actualizar_aerolinea($data, $where);
}
$data['aerolineas'] = $this->_model->obtener_aerolineas();
$data['aviones'] = $this->_model->obtener_aviones();
View::renderTemplate('header', $data);
View::render('aerolineas/aerolineas', $data);
View::renderTemplate('footer', $data);
}
开发者ID:alejandrozepeda,项目名称:admin,代码行数:32,代码来源:Aerolineas.php
示例17: login
public function login()
{
if (Session::get('loggedin')) {
Url::redirect('admin-panel');
}
$data['title'] = 'Login';
if (isset($_POST['submit'])) {
$correo = $_POST['correo'];
$password = $_POST['password'];
if ($correo == '' || !isset($correo)) {
$data['error'][0] = 'Correo es un campo obligatorio';
}
if ($password == '' || !isset($password)) {
$data['error'][1] = 'Password es un campo obligatorio';
}
if (Password::verify($password, $this->_model->getHash($correo)) == false) {
$data['error'][2] = 'Correo o password incorrectos';
}
if (!$data['error']) {
$data['usuario'] = $this->_model->getUsuario($correo);
Session::set('loggedin', true);
Session::set('idUsuario', $data[usuario][0]->idUsuario);
Session::set('nombre', $data[usuario][0]->nombre);
Session::set('apellidoPaterno', $data[usuario][0]->apellidoPaterno);
$dataUsuario = array('fechaConexion' => date("Y-m-d H:i:s"));
$where = array('correo' => $correo);
$this->_model->updateUsuario($dataUsuario, $where);
Url::redirect('admin-panel');
}
}
View::renderTemplate('header', $data);
View::render('Auth/Login', $data);
View::renderTemplate('footer', $data);
}
开发者ID:alejandrozepeda,项目名称:dcorrido,代码行数:34,代码来源:Auth.php
示例18: index
public function index()
{
$data['title'] = "Inicio";
View::renderTemplate('header', $data);
View::render('inicio/inicio', $data);
View::renderTemplate('footer', $data);
}
开发者ID:alejandrozepeda,项目名称:docstify,代码行数:7,代码来源:Inicio.php
示例19: innerAction
public function innerAction()
{
$this->_template = 'CatalogItemsWithoutFilter';
$page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
// Check for existance
$brand = DB::select()->from('brands')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->as_object()->execute()->current();
if (!$brand) {
return Config::error();
}
// Seo
$this->_seo['h1'] = $brand->h1;
$this->_seo['title'] = $brand->title;
$this->_seo['keywords'] = $brand->keywords;
$this->_seo['description'] = $brand->description;
$this->setBreadcrumbs($brand->name);
// Get count items per page
$limit = (int) Arr::get($_GET, 'per_page') ? (int) Arr::get($_GET, 'per_page') : Config::get('limit');
// Get sort type
$sort = in_array(Arr::get($_GET, 'sort'), array('name', 'created_at', 'cost')) ? Arr::get($_GET, 'sort') : 'sort';
$type = in_array(strtolower(Arr::get($_GET, 'type')), array('asc', 'desc')) ? strtoupper(Arr::get($_GET, 'type')) : 'ASC';
// Get popular items
$result = DB::select(array('catalog_images.image', 'image'), 'catalog.*')->from('catalog')->join('catalog_images', 'LEFT')->on('catalog_images.catalog_id', '=', 'catalog.id')->on('catalog_images.main', '=', DB::expr('1'))->where('catalog.brand_id', '=', $brand->id)->where('catalog.status', '=', 1)->order_by('catalog.' . $sort, $type)->limit($limit)->offset(($page - 1) * $limit)->as_object()->execute();
// Set description of the brand to show it above the sort part
Config::set('brand_description', View::tpl(array('brand' => $brand), 'Brands/Inner'));
// Count of parent groups
$count = DB::select(array(DB::expr('COUNT(catalog.id)'), 'count'))->from('catalog')->where('brand_id', '=', $brand->id)->where('status', '=', 1)->as_object()->execute()->current()->count;
// Generate pagination
$pager = Pager::factory($page, $count, $limit)->create();
// Render template
$this->_content = View::tpl(array('result' => $result, 'pager' => $pager), 'Catalog/ItemsList');
}
开发者ID:procivam,项目名称:hochu-bilet-v3,代码行数:31,代码来源:Brands.php
示例20: index
public function index()
{
if (!isset($_GET['code'])) {
header("Location: ../sign-in/index");
exit;
}
$testActivation = \Models\User::getUsernameByActivationCode($_GET['code']);
if (!isset($testActivation['username'])) {
echo \Core\View::make('header', ['title' => 'Activation unsuccessful']);
echo \Core\View::make('activation.bad');
echo \Core\View::make('footer');
} else {
$date = date('Y-m-d H:i:s');
$user = \Models\User::setUserActivatedAt($date, $_GET['code']);
if (isset($user['id'])) {
$subject = 'Welcome';
$body = "Congratulations. Your account is activated.";
$result = Mailer::send($user['email'], $subject, $body);
if ($result == 'Message has been sent') {
echo \Core\View::make('header');
echo \Core\View::make('activation.good', ['title' => 'Activation successful']);
echo \Core\View::make('footer');
}
}
}
}
开发者ID:kazak600,项目名称:Task-manager,代码行数:26,代码来源:activation.php
注:本文中的core\View类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论