diff --git a/CSS/style.css b/CSS/style.css new file mode 100644 index 0000000..39f584f --- /dev/null +++ b/CSS/style.css @@ -0,0 +1,145 @@ +/* + Created on : 04.01.2018, 15:39:10 + Author : reich +*/ + +*, *:before, *:after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + } + + body { + font-size: 18px; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + } + + .wrapper { + max-width: 1000px; + margin: 0 auto; + } + + /*** Allgemeine Definitionen ***/ + h1 { + /* margin: 10px; */ + color: #F2F2F2; + font-size: 48px; + font-weight: 100; + text-align: center; + } + + h1 span { + margin-left: -2px; + color: #FDBD02; + font-size: 24px; + font-weight: 600; + } + + h2 { + padding: 10px 0 10px 0; + text-align: center; + color: #011448; + font-size: 36px; + font-weight: 100; + } + + main { + background-color: #e6e6e6; + color: #000; + padding-bottom: 20px; + } + + /*** Standard-Button ***/ + + .button { + text-align: right; + } + + .button a { + display: inline-block; + background: #FDBD02; + color:#303E64; + border: none; + width: 100px; + margin: 5px; + padding: 2px; + border-radius: 5px; + cursor:pointer; + font-size: 12px; + text-decoration: none; + text-align: center; + } + + .button a:hover { + color:#fff; + } + + .clear { + clear: both; + } + + /*** Header-Bereich mit Navigationsleiste ***/ + header { + width: 100%; + background-color: #303E64; + } + + nav { + text-align: center; + position: sticky; + top: 0; + background-color: #303E64; + } + + nav ul { + list-style-type: none; + padding: 0; + display: inline-block; + } + + nav li { + float: left; + text-align: center; + } + + nav li a { + display: block; + width: 120px; + height: 35px; + border: 1px solid #000; + background-color: #e6e6e6; + color: #000; + text-decoration: none; + margin: 5px; + text-align: center; + line-height: 35px; + } + + nav li a:hover { + background-color: #F2C608; + } + + + #metanavi { + color: lightskyblue; + font-weight: bold; + margin-bottom: 5px; + } + +.container { + display: flex; + flex-wrap: wrap; +} + +.item-4-12 { + flex: 0 0 33.3333333333%; +} + +img { + width: 100%; +} + +[class*="item-"] { + padding: 0 10px 0 10px; +} \ No newline at end of file diff --git a/Controller/GalleryController.php b/Controller/GalleryController.php new file mode 100644 index 0000000..4fba4bb --- /dev/null +++ b/Controller/GalleryController.php @@ -0,0 +1,27 @@ +galleryModel = new GalleryModel(); + $this->view = $view; + } + + public function showPhotos() + { + $this->view->setVars([ + "photos" => $this->galleryModel->selectPhotos() + ]); + + } + +} \ No newline at end of file diff --git a/Controller/WelcomeController.php b/Controller/WelcomeController.php new file mode 100644 index 0000000..79997cd --- /dev/null +++ b/Controller/WelcomeController.php @@ -0,0 +1,20 @@ +view = $view; + } + + function showWelcome() + { + } +} diff --git a/Library/ErrorMsg.php b/Library/ErrorMsg.php new file mode 100644 index 0000000..901263e --- /dev/null +++ b/Library/ErrorMsg.php @@ -0,0 +1,25 @@ +view = new \ppa\Library\View(dirname(__DIR__).DIRECTORY_SEPARATOR.'Views' + , 'Error', 'showErrMsg'); + $this->view->setVars([ + 'error' => $msg, + 'debug' => $ex + + ]); + $this->view->render(); + } + + + +} \ No newline at end of file diff --git a/Library/View.php b/Library/View.php new file mode 100644 index 0000000..188b45d --- /dev/null +++ b/Library/View.php @@ -0,0 +1,58 @@ +path = $path; + $this->controller = $controllerName; + $this->do = $doMethodName; + } + + /** + * Set view vars. The keys will be added, to existing keys. + * + * @param array $vars + */ + public function setVars(array $vars) + { + foreach ($vars as $key => $val) { + $this->vars[$key] = $val; + } + } + + public function setDoMethodName($doMethodName) + { + $this->do = $doMethodName; + } + + /** + * Render the view. + * + * @throws NotFoundException + */ + public function render() + { + $filename = $this->path.DIRECTORY_SEPARATOR.$this->controller.DIRECTORY_SEPARATOR.$this->do.'.phtml'; + + if (!file_exists($filename)) { + new \ppa\Library\ErrorMsg("View not found: $filename"); + exit(); + } + + // spare the view the bloat of using "$this->vars[]" for every variable + foreach ($this->vars as $key => $val) { + $$key = $val; + } + + include $filename; + } +} \ No newline at end of file diff --git a/Model/Database.php b/Model/Database.php new file mode 100644 index 0000000..94241c4 --- /dev/null +++ b/Model/Database.php @@ -0,0 +1,45 @@ +dbName;host=$this->linkName" + , $this->user + , $this->pw + , array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); + return $pdo; + } catch (\PDOException $e) { + new \ppa\Library\ErrorMsg("Verbindung konnte nicht aufgebaut werden.", $e); + die; + } + } + + /** + * Zum serverseitigen generieren einer UUID + * + * @return string Liefert eine UUID + */ + public function createUUID() + { + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr(ord($data[6]) & 0x0f | 0x40); + $data[8] = chr(ord($data[8]) & 0x3f | 0x80); + return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); + } +} \ No newline at end of file diff --git a/Model/GalleryModel.php b/Model/GalleryModel.php new file mode 100644 index 0000000..c9aa084 --- /dev/null +++ b/Model/GalleryModel.php @@ -0,0 +1,28 @@ +linkDB(); + + try { + $res = $pdo->query($sql); + } catch (\PDOException $e) { + new \ppa\Library\ErrorMsg("Ihre Anfrage konnte nicht verarbeitet werden", $e); + die; + } + + return $res->fetchAll(\PDO::FETCH_ASSOC); + } +} \ No newline at end of file diff --git a/Views/Error/showErrMsg.phtml b/Views/Error/showErrMsg.phtml new file mode 100644 index 0000000..024862b --- /dev/null +++ b/Views/Error/showErrMsg.phtml @@ -0,0 +1,9 @@ + + +
=$debug?>
+ + + + + diff --git a/Views/Gallery/showPhotos.phtml b/Views/Gallery/showPhotos.phtml new file mode 100644 index 0000000..958fbf0 --- /dev/null +++ b/Views/Gallery/showPhotos.phtml @@ -0,0 +1,17 @@ + + +