Commit 5feab15e authored by Andreas Müller's avatar Andreas Müller

Initial commit

parents
# Created by https://www.gitignore.io/api/windows,linux,osx,vim,node,emacs
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Vim ###
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags
### Node ###
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
### PROJECT ###
php/config.php
*.db
\ No newline at end of file
[submodule "submodules/bootstrap-datepicker"]
path = submodules/bootstrap-datepicker
url = https://github.com/eternicode/bootstrap-datepicker.git
<Files "*.db">
Order Allow,Deny
Deny from all
</Files>
\ No newline at end of file
# Schulsanitätsdienst
## Kurzbeschreibung
Der Schulsanitätsdienst der Berufsschule Erlangen ist auf Grund von Tages- und Blockunterricht recht schwer zu organisieren.
Damit die Lehrer und das Sekretariat es leichter haben die Sanis zu koordinieren, existiert diese Seite.
Hier können die Sanitäter verwaltet und für den Dienst eingeteilt werden. Auf der Startseite kann dann der aktuelle Dienstplan dann eingesehen werden.
## Technologien / Frameworks
- PHP 5.6 (7.0 ready)
- CSS 3
- jQuery 2.2.3 (JavaScript)
- HTML 5
- Bootstrap 3.3.6
## Installation
- Den Quellcode in das Webverzeichnis legen (Nicht die submodules vergessen!)
- Die Schreibrechte auf `/sql/#ssd.db` prüfen und ggf. setzen
* Es ist bereits das Schuljahr 2015/16
* und ein Administrator (admin@example.com) angelegt. Passwort: `p@ssw0rd`
- Die Datenbankverbindung schreiben
* `config.php.example` kopiern/umbenennen in `config.php`
* Datei öffnen und Änderungen eintragen (soweit gewünscht)
- Seite aufrufen, einloggen und _mind._ das __Passwort und E-Mail Adresse ändern__
- In den Einstellungen das Schuljahr und die Ferien setzen
- __Fertig__
<?php
// Define the current directory as base directory
define('BASEDIR', str_replace('\\', '/', __DIR__));
$url = '';
if (file_exists(BASEDIR.'/url.txt'))
{
$url = trim(file_get_contents(BASEDIR.'/url.txt'));
}
if (empty($url))
{
// Corresponding to the current directory, define the url as base url
$url = str_replace($_SERVER['DOCUMENT_ROOT'], 'http://'.$_SERVER['HTTP_HOST'], BASEDIR);
}
define('ISHTTPS', (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ||
(isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] == 'https'));
if (ISHTTPS)
{
$url = str_replace("http", "https", $url);
}
define('BASEURL', $url);
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/**
* layout.css
* (c) Andreas Mueller <webmaster@am-wd.de>
*/
/**
* Theming the bootstrap framework with the colors of the
* website of Staatliche Berufsschule Erlangen.
*
* Created for Bootstrap 3.3.6
*
* @author Andreas Mueller <webmaster@am-wd.de>
* @copyright (c) 2016 Andreas Mueller
* @license MIT - http://am-wd.de/index.php?p=about#license
*/
/* --- General Styles
------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
padding-top: 70px;
padding-bottom: 55px;
color: #085573;
background: #fff;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
code {
font-size: .8em;
}
h1, h3, h5 {
color: #1ab7ea;
}
h2, h4, h6 {
color: #085573;
}
a {
color: #428bca;
}
a:focus,
a:hover {
color: #2a6496;
}
/* --- The Footer
------------------------------- */
.footer {
position: absolute;
bottom: 0;
width: 100%;
line-height: 40px;
font-size: .85em;
text-align: left;
background: #1ab7ea;
color: #fff;
}
.footer > .container,
.footer > .container-fluid {
padding: 0 15px;
}
.footer p {
margin: 0;
}
.footer a {
color: #fff;
}
.footer a:focus,
.footer a:hover {
color: #085573;
text-decoration: none;
}
/* --- The Navbar with Menu
------------------------------- */
.navbar-bs {
background: #fff;
border-bottom: 4px solid #cff1fc;
}
.navbar-bs .navbar-brand,
.navbar-bs .navbar-brand:focus,
.navbar-bs .navbar-brand:hover {
color: #000;
font-weight: bold;
}
.navbar-bs .navbar-nav > li > a {
color: #085573;
}
.navbar-bs .navbar-nav > li > a:focus,
.navbar-bs .navbar-nav > li > a:hover {
color: #1ab7ea;
background: transparent;
}
.navbar-bs .navbar-nav > .active > a,
.navbar-bs .navbar-nav > .active > a:focus,
.navbar-bs .navbar-nav > .active > a:hover {
color: #085573;
background: #cff1fc;
}
.navbar-bs .navbar-nav > .open > a,
.navbar-bs .navbar-nav > .open > a:focus,
.navbar-bs .navbar-nav > .open > a:hover {
color: #085573;
background: #cff1fc;
}
.navbar-bs .dropdown-menu > li > a {
color: #085573;
}
.navbar-bs .dropdown-menu > li > a:focus,
.navbar-bs .dropdown-menu > li > a:hover {
color: #1ab7ea;
background: transparent;
}
.navbar-bs .dropdown-menu > .active > a,
.navbar-bs .dropdown-menu > .active > a:focus,
.navbar-bs .dropdown-menu > .active > a:hover {
color: #085573;
background: #cff1fc;
}
@media (max-width: 767px) {
.navbar-bs .navbar-nav .open .dropdown-menu > .active > a,
.navbar-bs .navbar-nav .open .dropdown-menu > .active > a:focus,
.navbar-bs .navbar-nav .open .dropdown-menu > .active > a:hover {
color: #085573;
background: #cff1fc;
}
.navbar-bs .navbar-nav .open .dropdown-menu > li > a:focus,
.navbar-bs .navbar-nav .open .dropdown-menu > li > a:hover {
color: #1ab7ea;
background: transparent;
}
}
/* --- Buttons
------------------------------- */
.btn-bs {
color: #fff;
background: #1ab7ea;
}
.btn-bs:focus,
.btn-bs:hover {
color: #fff;
background: #085573;
}
.btn-bs-outline {
color: #1ab7ea;
background: transparent;
border: 2px solid #1ab7ea;
}
.btn-bs-outline:focus,
.btn-bs-outline:hover {
color: #fff;
background: #1ab7ea;
}
\ No newline at end of file
/**
* @author Andreas Mueller <webmaster@am-wd.de>
* @copyright (c) 2016 Andreas Mueller
* @license MIT - http://am-wd.de/index.php?p=about#license
*/
html{position:relative;min-height:100%}body{padding-top:70px;padding-bottom:55px;color:#085573;background:#fff;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif}code{font-size:.8em}h1,h3,h5{color:#1ab7ea}h2,h4,h6{color:#085573}a{color:#428bca}a:focus,a:hover{color:#2a6496}.footer{position:absolute;bottom:0;width:100%;line-height:40px;font-size:.85em;text-align:left;background:#1ab7ea;color:#fff}.footer>.container,.footer>.container-fluid{padding:0 15px}.footer p{margin:0}.footer a{color:#fff}.footer a:focus,.footer a:hover{color:#085573;text-decoration:none}.navbar-bs{background:#fff;border-bottom:4px solid #cff1fc}.navbar-bs .navbar-brand,.navbar-bs .navbar-brand:focus,.navbar-bs .navbar-brand:hover{color:#000;font-weight:bold}.navbar-bs .navbar-nav>li>a{color:#085573}.navbar-bs .navbar-nav>li>a:focus,.navbar-bs .navbar-nav>li>a:hover{color:#1ab7ea;background:transparent}.navbar-bs .navbar-nav>.active>a,.navbar-bs .navbar-nav>.active>a:focus,.navbar-bs .navbar-nav>.active>a:hover{color:#085573;background:#cff1fc}.navbar-bs .navbar-nav>.open>a,.navbar-bs .navbar-nav>.open>a:focus,.navbar-bs .navbar-nav>.open>a:hover{color:#085573;background:#cff1fc}.navbar-bs .dropdown-menu>li>a{color:#085573}.navbar-bs .dropdown-menu>li>a:focus,.navbar-bs .dropdown-menu>li>a:hover{color:#1ab7ea;background:transparent}.navbar-bs .dropdown-menu>.active>a,.navbar-bs .dropdown-menu>.active>a:focus,.navbar-bs .dropdown-menu>.active>a:hover{color:#085573;background:#cff1fc}@media(max-width:767px){.navbar-bs .navbar-nav .open .dropdown-menu>.active>a,.navbar-bs .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-bs .navbar-nav .open .dropdown-menu>.active>a:hover{color:#085573;background:#cff1fc}.navbar-bs .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-bs .navbar-nav .open .dropdown-menu>li>a:hover{color:#1ab7ea;background:transparent}}.btn-bs{color:#fff;background:#1ab7ea}.btn-bs:focus,.btn-bs:hover{color:#fff;background:#085573}.btn-bs-outline{color:#1ab7ea;background:transparent;border:2px solid #1ab7ea}.btn-bs-outline:focus,.btn-bs-outline:hover{color:#fff;background:#1ab7ea}
\ No newline at end of file
/**
* main.css
* (c) Andreas Mueller <webmaster@am-wd.de>
*/
/**
* Styling for the sites.
*
* @author Andreas Mueller <webmaster@am-wd.de>
* @copyright (c) 2016 Andreas Mueller
* @license MIT - http://am-wd.de/index.php?p=about#license
*/
.content {
text-align: justify;
}
.need-js {
display: none;
}
.required:after {
content: '*';
color: #f00;
margin-left: .1em;
}
.visible-xxs {
display: none;
}
.sick {
color: #f00;
}
@media (max-width: 479px) {
.visible-xxs {
display: block;
}
.hidden-xxs {
display: none;
}
.col-xxs-12 {
width: 100%;
}
.col-xxs-6 {
width: 50%;
}
}
@media (max-width: 990px) {
.navbar-nav > li > a > .fa {
display: none;
}
}
@media (max-width: 767px) {
.navbar-nav > li > a > .fa {
display: inline-block;
}
}
\ No newline at end of file
<?php
/**
* index.php
*
* @author Andreas Mueller <webmaster@am-wd.de>
* @copyright (c) 2016 Andreas Mueller
* @license MIT - http://am-wd.de/?p=about#license
*/
// Report everything just to be sure it's clean code
// But notices sucks some times
@error_reporting(E_ALL ^ E_NOTICE);
@ini_set('display_errors', 'on');
require_once('base.php');
// Define output content type
header('Content-Type: text/html; Charset=UTF-8');
// Load all needed stuff
require_once BASEDIR.'/php/includes/include.php';
// Enforce using TLS encrypted connection (HTTPS)
// Except: it is disabled in the config
if ($config['require_https'] && !ISHTTPS)
{
header('HTTP/1.1 302 Found');
header('Location: '.str_replace('http:', 'https:', BASEURL));
die('Please reload the page: <a href="'.str_replace('http:', 'https:', BASEURL).'">'.str_replace('http:', 'https:', BASEURL).'</a>');
}
// Prepare statics for the page
// Load the template
$page = new AMWD\Page(BASEDIR.'/php/layout.html');
// Set the brand (at the left of the navbar)
$page->setBrand('<span class="fa fa-heartbeat"></span> BS Erlangen');
// Set the title shown in the browsers head
$page->setTitle('SSD BS Erlangen');
// Set the footer with some information
$page->setFooter('&copy; '.date('Y').' BS Erlangen | <a href="'.BASEURL.'/?p=imprint">Impressum</a> - <a href="'.BASEURL.'/?p=privacy">Datenschutz</a>');
// Load CSS and JS files needed
$page->addCSS('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
$page->addCSS(BASEURL.'/css/bootstrap-outline.min.css');
$page->addCSS('https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css');
$page->addCSS(BASEURL.'/submodules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css');
$page->addCSS(BASEURL.'/css/layout.min.css');
$page->addCSS(BASEURL.'/css/main.css');
$page->addJS('https://code.jquery.com/jquery-2.2.3.min.js');
$page->addJS('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js');
$page->addJS(BASEURL.'/submodules/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js');
$page->addJS(BASEURL.'/submodules/bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js');
$page->addJS(BASEURL.'/js/api.js');
$page->addJS(BASEURL.'/js/main.js');
// Load the contents
require_once BASEDIR.'/php/contents/load.php';
echo $page;
?>
\ No newline at end of file
/**
* api.js
* (c) Andreas Mueller <webmaster@am-wd.de>
*/
if (typeof jQuery == 'undefined')
throw new Error('PHP-API requires jQuery');
/**
* api
*
* Sends a POST request to a defined PHP file used as backend
* and receives the result as JSON object.
*
* @param string func Function to call in backend.
* @param object obj Object with data to send to the backend.
* @param function callback Function to call if response is received.
* @param boolean async Perform request asynchonous or not. Default: true.
* @param boolean global Trigger the global ajax request event. Default: false.
*
* @return object Response object from jQuerys Ajax request.
*/
function api(func, obj, callback, async, global) {
if (async === undefined) async = true;
if (global === undefined) global = false;
var req = {};
req.func = func;
req.data = obj;
return $.ajax( {
url: 'php/ajax/api.php',
type: 'post',
data: JSON.stringify(req),
async: async,
global: global,
contentType: 'application/json',
success: function(response) {
if (typeof callback === 'function') {
callback(response);
} else {
console.log('PHP-API | callback function not set');
}
},
error: function(response) {
console.log('PHP-API | execution failed');
}
});
}
\ No newline at end of file
/**
* attendence.js
* (c) Andreas Mueller <webmaster@am-wd.de>
*/
if (typeof jQuery == 'undefined')
throw new Error('jQuery required');
$(function() {
// Select all checkboxes matching 'week_xx_*'
// Where xx is the calendar week
$('.set-week').click(function() {
var week = $(this).attr('week');
var days = ['mon', 'tue', 'wed', 'thu', 'fri'];
$.each(days, function(idx, day) {
if (!$('input[name="week_' + week + '_' + day + '"]').prop('disabled')) {
$('input[name="week_' + week + '_' + day + '"]').prop('checked', true);
}
});
});
// Deselect all checkboxes matching 'week_xx_*'
// Where xx is the calendar week
$('.unset-week').click(function() {
var week = $(this).attr('week');
var days = ['mon', 'tue', 'wed', 'thu', 'fri'];
$.each(days, function(idx, day) {
if (!$('input[name="week_' + week + '_' + day + '"]').prop('disabled')) {
$('input[name="week_' + week + '_' + day + '"]').prop('checked', false);
}
});
});
// Select all checkboxes matching 'week_*_xx'
// Where xx is the day of the week
$('.set-day').click(function() {
var day = $(this).attr('day');
$.each($('input[name*="_' + day + '"]'), function(idx, box) {
if (!$(box).prop('disabled'))
$(box).prop('checked', true);
});
});
// Deselect all checkboxes matching 'week_*_xx'
// Where xx is the day of the week
$('.unset-day').click(function() {
var day = $(this).attr('day');
$.each($('input[name*="_' + day + '"]'), function(idx, box) {
if (!$(box).prop('disabled'))
$(box).prop('checked', false);
});
});
// Deselect all checkboxes of the site
$('.unset').click(function() {
$.each($('input[type=checkbox]'), function(idx, box) {
$(box).prop('checked', false);
});
});
$('input[name*="week_"]').click(function() {
var name = $(this).attr('name');
var checked = $(this).is(':checked');
var tmp = name.split('_');
var week = parseInt(tmp[1]);
var day = tmp[2];
var req = { week: week, day: day, value: checked };
api('att_update', req, function(result) {
if (result.error === '')
{
if (!result.data)
$(this).prop('checked', !checked);
}
else
{
console.log("Error:\n" + result.error);
}
});
});
});
\ No newline at end of file
/**
* duty.js
* (c) Andreas Mueller <webmaster@am-wd.de>
*/
if (typeof jQuery == 'undefined')
throw new Error('jQuery required');
$(function() {
// Select all checkboxes of a user
$('.set-user').click(function() {
var user = $(this).attr('user');
var days = ['mon', 'tue', 'wed', 'thu', 'fri'];
$.each(days, function(idx, day) {
if (!$('input[name="usr_' + user + '_' + day + '"]').prop('disabled')) {
$('input[name="usr_' + user + '_' + day + '"]').prop('checked', true);
}
});
});
// Deselect all checkboxes of a user
$('.unset-user').click(function() {
var user = $(this).attr('user');
var days = ['mon', 'tue', 'wed', 'thu', 'fri'];
$.each(days, function(idx, day) {
if (!$('input[name="usr_' + user + '_' + day + '"]').prop('disabled')) {
$('input[name="usr_' + user + '_' + day + '"]').prop('checked', false);
}
});
});
});
\ No newline at end of file
/**
* mail.js
* (c) Andreas Mueller <webmaster@am-wd.de>
*/
if (typeof jQuery == 'undefined')
throw new Error('jQuery required');
$(function() {
// Set the controls correctly
if (!$('input[value=select]').is(':checked'))
$('