Commit aea0dd12 authored by Martin Gregor's avatar Martin Gregor
Browse files

uprava layoutov a 404, pridanie DI databazy a priprava homepage presenteru a...

uprava layoutov a 404, pridanie DI databazy a priprava homepage presenteru a layoutu pre homepage presenter
parent eb34b9aa
......@@ -7,7 +7,7 @@ require __DIR__ . '/../vendor/autoload.php';
$configurator = new Nette\Config\Configurator;
// Enable Nette Debugger for error visualisation & logging
//$configurator->setDebugMode(TRUE);
//$configurator->setDebugMode(FALSE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Specify folder for cache
......
......@@ -5,5 +5,14 @@
*/
abstract class BasePresenter extends Nette\Application\UI\Presenter
{
/**
* @var Nette\Database\Connection
*/
protected $db;
public function __construct(Nette\Database\Connection $database)
{
$this->db = $database;
}
}
......@@ -5,10 +5,19 @@
*/
class HomepagePresenter extends BasePresenter
{
public function renderDefault()
{
$this->template->anyVariable = 'any value';
$count = $this->db->table('sentences')->count("*");
$next_sentence_id = (time() % $count) + 1;
$current_sentence_id = $next_sentence_id;
while ($current_sentence_id == $next_sentence_id)
{
$current_sentence_id = mt_rand(1, $count);
}
$this->template->sentence = $this->db->table('sentences')->get($current_sentence_id);
$this->template->next_sentence = $this->db->table('sentences')->get($next_sentence_id);
}
}
......@@ -7,21 +7,41 @@
*}
<!DOCTYPE html>
<html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta name="robots" content="{$robots}" n:ifset="$robots">
<title>{block title|striptags|upper}Nette Application Skeleton{/block}</title>
<title>{block title|striptags|upper}Annotations{/block}</title>
<link rel="stylesheet" media="screen,projection,tv" href="{$basePath}/css/screen.css">
<link rel="stylesheet" media="print" href="{$basePath}/css/print.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="shortcut icon" href="{$basePath}/favicon.ico">
{block head}{/block}
<style>
body {
padding-top: 50px;
padding-bottom: 20px;
}
</style>
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<link rel="stylesheet" href="css/main.css">
<!--[if lt IE 9]>
<script src="js/vendor/html5-3.6-respond-1.1.0.min.js"></script>
<![endif]-->
{block styles}{/block}
{block head}{/block}
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<script> document.documentElement.className+=' js' </script>
<div n:foreach="$flashes as $flash" class="flash {$flash->type}">{$flash->message}</div>
......@@ -29,7 +49,9 @@
{include #content}
{block scripts}
<script src="{$basePath}/js/jquery.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.1.min.js"><\/script>')</script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="{$basePath}/js/netteForms.js"></script>
<script src="{$basePath}/js/main.js"></script>
{/block}
......
{var $robots = noindex}
{block styles}
<style>
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
html {
padding: 30px 10px;
font-size: 20px;
line-height: 1.4;
color: #737373 !important;
background: #f0f0f0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px 50px;
border: 1px solid #b3b3b3;
border-radius: 4px;
margin: 0 auto;
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
background: #fcfcfc;
}
h1 {
margin: 0 10px;
font-size: 50px;
text-align: center;
}
h1 span {
color: #bbb !important;
}
h3 {
margin: 1.5em 0 0.5em;
}
p {
margin: 1em 0;
}
ul {
padding: 0 0 0 40px;
margin: 1em 0;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
/* google search */
#goog-fixurl ul {
list-style: none;
padding: 0;
margin: 0;
}
#goog-fixurl form {
margin: 0;
}
#goog-wm-qt,
#goog-wm-sb {
border: 1px solid #bbb;
font-size: 16px;
line-height: normal;
vertical-align: top;
color: #444;
border-radius: 2px;
}
#goog-wm-qt {
width: 220px;
height: 20px;
padding: 5px;
margin: 5px 10px 0 0;
box-shadow: inset 0 1px 1px #ccc;
}
#goog-wm-sb {
display: inline-block;
height: 32px;
padding: 0 10px;
margin: 5px 0 0;
white-space: nowrap;
cursor: pointer;
background-color: #f5f5f5;
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
*overflow: visible;
*display: inline;
*zoom: 1;
}
#goog-wm-sb:hover,
#goog-wm-sb:focus {
border-color: #aaa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8;
}
#goog-wm-qt:hover,
#goog-wm-qt:focus {
border-color: #105cb6;
outline: 0;
color: #222;
}
input::-moz-focus-inner {
padding: 0;
border: 0;
}
</style>
{/block}
{block scripts}
<script>
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
</script>
<script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
{/block}
{block content}
<h1 n:block=title>Page Not Found</h1>
<h1 n:block=title>Page Not Found<span>:(</span></h1>
<p>The page you requested could not be found. It is possible that the address is
incorrect, or that the page no longer exists. Please use a search engine to find
......
This diff is collapsed.
......@@ -13,7 +13,6 @@
"role": "[developer,architect,designer]"
}
],
"minimum-stability": "dev",
"require": {
"php": ">= 5.3.0",
"nette/nette": "~2.0.7",
......
......@@ -3,20 +3,20 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "9fcf185f4a04bede85c1d3d7db04f64a",
"hash": "96632008a37b376df45bfa454c7610e9",
"packages": [
{
"name": "nette/nette",
"version": "dev-release-2.0.x",
"version": "v2.0.13",
"source": {
"type": "git",
"url": "https://github.com/nette/nette.git",
"reference": "2fcf5c68c5a88cb496cde4c65b2cf3a36534a129"
"reference": "695f643c26c2326f08424fee138515fa286a0e07"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/nette/zipball/2fcf5c68c5a88cb496cde4c65b2cf3a36534a129",
"reference": "2fcf5c68c5a88cb496cde4c65b2cf3a36534a129",
"url": "https://api.github.com/repos/nette/nette/zipball/695f643c26c2326f08424fee138515fa286a0e07",
"reference": "695f643c26c2326f08424fee138515fa286a0e07",
"shasum": ""
},
"require": {
......@@ -31,12 +31,13 @@
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-mbstring": "*",
"ext-memcache": "*",
"ext-pdo": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-release-2.0.x": "2.0.x-dev"
"dev-master": "2.1-dev"
}
},
"autoload": {
......@@ -65,13 +66,18 @@
"keywords": [
"Forms",
"database",
"dbal",
"debugging",
"framework",
"images",
"latte",
"mailing",
"micro",
"mvc",
"neon",
"templating"
],
"time": "2013-12-21 14:42:49"
"time": "2013-11-05 18:47:49"
},
{
"name": "rych/phpass",
......@@ -128,7 +134,7 @@
"aliases": [
],
"minimum-stability": "dev",
"minimum-stability": "stable",
"stability-flags": {
"rych/phpass": 20
},
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule (adminer.css|static/.+) index.php?file=$1 [L,QSA]
</IfModule>
<?php
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !isset($_SERVER['REMOTE_ADDR']) ||
!in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
{
header('HTTP/1.1 403 Forbidden');
exit;
}
$root = __DIR__ . '/../../vendor/dg/adminer-custom';
if (!is_file($root . '/index.php')) {
echo "Install Adminer using `composer update`\n";
exit(1);
}
if (isset($_GET['file']) && preg_match('#^(?:static/)?[\w.-]+\.(\w+)$#', $_GET['file'], $m)
&& is_file("$root/$_GET[file]"))
{
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
header('HTTP/1.1 304 Not Modified');
exit;
}
header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('1 month')) . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if ($m[1] === 'css') {
header('Content-Type: text/css; charset=utf-8');
} elseif ($m[1] === 'js') {
header('Content-Type: text/javascript; charset=utf-8');
} elseif ($m[1] === 'gif' || $m[1] === 'png' ||$m[1] === 'jpg') {
header("Content-Type: image/$m[1]");
}
readfile("$root/$_GET[file]");
exit;
}
require $root . '/index.php';
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment