diff --git a/registration-system/admin/pages_overview.php b/registration-system/admin/pages_overview.php index 3d8aa105094bdec446512adfb5da5e8f14169252..b55e6874b7436371733195471d489a5c4a700cec 100644 --- a/registration-system/admin/pages_overview.php +++ b/registration-system/admin/pages_overview.php @@ -18,7 +18,7 @@ $mitfahrer['gesam'] = $admin_db->count("bachelor", ["AND"=> $mitfahrer['gesaa'] = $admin_db->count("bachelor", ["fahrt_id" => $config_current_fahrt_id]); $antag = $admin_db->query("SELECT date_format(von, '%j') as von FROM fahrten WHERE fahrt_id=$config_current_fahrt_id")->fetchAll()[0]['von']; -$abtag = date('z', DateTime::createFromFormat('Y-m-d',$admin_db->get("fahrten","bis", ["fahrt_id"=>$config_current_fahrt_id]))->getTimestamp()); +$abtag = $admin_db->query("SELECT date_format(bis, '%j') as von FROM fahrten WHERE fahrt_id=$config_current_fahrt_id")->fetchAll()[0]['bis']; $mitfahrer['erste'] = $admin_db->count("bachelor", ["AND"=> ["backstepped" => NULL, "fahrt_id" => $config_current_fahrt_id, diff --git a/registration-system/frameworks/commons.php b/registration-system/frameworks/commons.php index 535a9dcea30281817c2521e2e7109a959fb89a5b..ada48ed34f082e20dda390f0d43ca81328e45f2b 100644 --- a/registration-system/frameworks/commons.php +++ b/registration-system/frameworks/commons.php @@ -25,8 +25,20 @@ function comm_format_date($date){ return date('d.m.Y', strtotime($date)); } -function comm_get_possible_dates($fid){ - return array("12.03.2014","13.03.2014","14.03.2014"); // FIXME dynamisch machen! +function comm_get_possible_dates($db, $fid){ + $dates = $db->get("fahrten", ["von", "bis"], ["fahrt_id" => $fid]); + $end = new DateTime($dates['bis']); + $period = new DatePeriod( + new DateTime($dates['von']), + new DateInterval('P1D'), + $end->modify( '+1 day' ) + ); + $ret = []; + foreach($period as $d){ + array_push($ret, $d->format("d.m.Y")); + } + return $ret; + } function comm_isopen_fid($db_handle, $fid){ diff --git a/registration-system/index.php b/registration-system/index.php index c9ae6d151e9312f97d9b8d24dd21532f2e9d5bb1..7fe7b34552bcaa7f826030f7f43bdee466084965 100644 --- a/registration-system/index.php +++ b/registration-system/index.php @@ -207,7 +207,7 @@ function index_show_formular($fid, $bid = NULL, $bachelor = NULL){ if (!isset($_GET['noscript'])) echo '<noscript>'; - $possible_dates = comm_get_possible_dates($fid); + $possible_dates = comm_get_possible_dates($index_db, $fid); if(is_null($bachelor)) $bachelor = array('forname' => "", 'sirname' => "", 'anday' => $possible_dates[0], 'abday' => $possible_dates[count($possible_dates)-1], 'antyp' => "", 'abtyp' => "", 'pseudo' => "", 'mehl' => "", 'essen' => "", 'public' => "", 'virgin' => "", 'studityp' => "", 'comment'=>""); @@ -387,9 +387,9 @@ echo '<h2>Angemeldet</h2>'; echo '<tr> <!--td>'.$d["studityp"].'</td--> <td>'.$d["pseudo"].'</td> - <td>'.date('d.m.Y', $d["anday"]).'</td> + <td>'.comm_format_date($d["anday"]).'</td> <td>'.index_show_signupTable_destroyTypes($d["antyp"]).'</td> - <td>'.date('d.m.Y', $d["abday"]).'</td> + <td>'.comm_format_date($d["abday"]).'</td> <td>'.index_show_signupTable_destroyTypes($d["abtyp"]).'</td> <td>'.$d["comment"].'</td> </tr>'; diff --git a/registration-system/other/sqlDumps/fsfahrt_22092014.sql b/registration-system/other/sqlDumps/fsfahrt_22092014.sql new file mode 100644 index 0000000000000000000000000000000000000000..e3d8699f38a806a6b11e692deb3778c3256cd80b --- /dev/null +++ b/registration-system/other/sqlDumps/fsfahrt_22092014.sql @@ -0,0 +1,159 @@ +-- phpMyAdmin SQL Dump +-- version 4.2.5 +-- http://www.phpmyadmin.net +-- +-- Host: localhost:3306 +-- Generation Time: Sep 23, 2014 at 12:17 AM +-- Server version: 5.5.38-0ubuntu0.14.04.1 +-- PHP Version: 5.5.14 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `fsfahrt` +-- +CREATE DATABASE IF NOT EXISTS `fsfahrt` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +USE `fsfahrt`; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bachelor` +-- + +CREATE TABLE IF NOT EXISTS `bachelor` ( + `bachelor_id` varchar(15) NOT NULL, + `fahrt_id` int(11) NOT NULL, + `anm_time` int(11) NOT NULL, + `version` int(11) NOT NULL, + `forname` varchar(50) NOT NULL, + `sirname` varchar(50) NOT NULL, + `anday` date NOT NULL, + `abday` date NOT NULL, + `antyp` varchar(100) NOT NULL, + `abtyp` varchar(100) NOT NULL, + `pseudo` varchar(50) NOT NULL, + `mehl` varchar(100) NOT NULL, + `essen` varchar(50) NOT NULL, + `public` int(11) NOT NULL, + `virgin` int(11) NOT NULL, + `studityp` varchar(11) NOT NULL, + `comment` text NOT NULL, + `paid` int(10) DEFAULT NULL COMMENT 'zahlung erhalten am unix timestamp', + `repaid` int(10) DEFAULT NULL COMMENT 'rückzahlung abgeschickt am unix timestamp', + `backstepped` int(10) DEFAULT NULL COMMENT 'rücktritt als unix timestamp' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `bachelor` +-- + +INSERT INTO `bachelor` (`bachelor_id`, `fahrt_id`, `anm_time`, `version`, `forname`, `sirname`, `anday`, `abday`, `antyp`, `abtyp`, `pseudo`, `mehl`, `essen`, `public`, `virgin`, `studityp`, `comment`, `paid`, `repaid`, `backstepped`) VALUES +('5b61b92044983e1', 2, 0, 1, 'asd', 'ad', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'ffas', 'asdasd@asd.de', 'Alles', 1, 0, '0', 'dasd', NULL, NULL, 1411059051), +('f35f12ca7c55462', 2, 0, 1, 'fcacs', 'ads', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'fas', 'asd@asd.de', 'Alles', 0, 0, '0', 'adasdasda', NULL, NULL, NULL), +('068e4198f255a1e', 2, 0, 1, 'göll', 'asd', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'adsad', 'adskd@asdl.de', 'Alles', 1, 0, '0', 'adasd', 1409779206, NULL, NULL), +('d748d40c0d7e475', 2, 0, 1, 'ad', 'adsd', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'asdadl', 'asdas@asd.de', 'Vegan', 1, 0, '0', 'ad', NULL, NULL, NULL), +('ec2cac23f915bf9', 2, 0, 1, 'gbhg', 'ncvbx', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'cvxcvxsdfs', 'ads@asdl.de', 'Alles', 1, 0, '0', 'ycyxc', NULL, NULL, 1408205076), +('78a322842b66657', 2, 0, 1, 'lkblka', 'kbvnfj', '2013-10-18', '2013-10-20', 'individuell', 'gemeinsam mit Rad', 'kmkm', 'sdkk@ksad.de', 'Vegan', 1, 0, 'MasterErsti', 'asda', NULL, NULL, NULL), +('8d70b435d61c302', 2, 0, 1, 'gm', 'sdlkjflkj', '2013-10-18', '2013-10-20', 'gemeinsam mit Rad', 'individuell', 'skldfmlk', 'sfjdkl@dfjklj.de', 'Grießbrei', 1, 0, 'Hoersti', 'asddsa', NULL, NULL, NULL), +('c8c1d8a327fd88f', 2, 0, 1, 'lkdnl', 'sdkjfhnk', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Rad', 'adhsj', 'fsfahrt@byom.de', 'Frutarisch', 1, 0, 'Hoersti', 'adas', 1408205076, NULL, NULL), +('7f5609769cce5f1', 2, 0, 1, 'lkdnl', 'sdkjfhnk', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Rad', 'adhsj', 'fsfahrt@byom.de', 'Frutarisch', 1, 0, 'Hoersti', 'adas', 1408105076, 1408205076, NULL), +('61fd805b3bbe4b5', 2, 0, 1, 'rcsa', 'adas', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'gdsfa', 'asdas@deda-de.de', 'Extrawurst', 1, 0, 'Wechsli', '', NULL, NULL, 1411251707), +('9593abed7ec0b79', 2, 0, 1, 'adolf', 'hitler', '2013-10-18', '2013-10-20', 'mit Kamel', 'mit Kamel', 'ah', 'reichskanzlei@web.dr', 'Vegetarisch', 1, 0, 'Tutti', 'Mit Kamel!', NULL, NULL, NULL), +('4eb203cf14c7a4e', 2, 1409761827, 1, 'dlklödsa', 'adlökl', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Rad', 'dsaoif', 'daskdj@asdkj.de', 'Alles', 1, 0, 'Ersti', '', NULL, NULL, NULL), +('810789efb42264d', 2, 1409763812, 1, 'klalsd', 'ladköl', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'sdkfölk', 'alksd@aslkdj.de', 'Alles', 1, 0, 'Ersti', '', NULL, NULL, NULL), +('09ca2d98ea68524', 2, 1411224273, 1, 'ölmm', 'ölkö', '2013-10-18', '2013-10-20', 'gemeinsam mit Bus/Bahn', 'gemeinsam mit Bus/Bahn', 'lkkldslk', 'aksdllk@asdjk.de', 'Alles', 1, 0, 'Ersti', '', NULL, NULL, 1411251706), +('9de69c5684a4c28', 2, 1411249881, 1, 'random', 'so random', '2013-10-18', '2013-10-20', 'individuell', 'individuell', 'superrandom', 'ran@om.de', 'Alles', 1, 0, 'Ersti', 'randomtest', NULL, NULL, NULL); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `fahrten` +-- + +CREATE TABLE IF NOT EXISTS `fahrten` ( +`fahrt_id` int(11) NOT NULL, + `titel` varchar(200) NOT NULL, + `ziel` varchar(100) NOT NULL, + `von` date NOT NULL, + `bis` date NOT NULL, + `regopen` int(1) NOT NULL, + `beschreibung` text NOT NULL, + `leiter` varchar(100) NOT NULL, + `kontakt` varchar(100) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; + +-- +-- Dumping data for table `fahrten` +-- + +INSERT INTO `fahrten` (`fahrt_id`, `titel`, `ziel`, `von`, `bis`, `regopen`, `beschreibung`, `leiter`, `kontakt`) VALUES +(1, 'Porno laut im Flur Fahrt', 'Irgendwo', '2012-10-17', '2012-10-19', 0, 'irgendein Text', 'Willi', 'hans@wurst.de'), +(2, 'Vodka in Hand Fahrt', 'Halbinsel', '2013-10-18', '2013-10-20', 1, 'Mehr Text passt nicht!', 'Tim', 'wahr@gi.na'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `notes` +-- + +CREATE TABLE IF NOT EXISTS `notes` ( +`note_id` int(11) NOT NULL, + `fahrt_id` int(11) NOT NULL, + `note` text NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; + +-- +-- Dumping data for table `notes` +-- + +INSERT INTO `notes` (`note_id`, `fahrt_id`, `note`) VALUES +(1, 1, 'fahrt1 note'), +(2, 2, '<h1><b>Testnotiz 123<br></b></h1>hier kann man <i>notizen </i>hinterlassen test<br><br><h2><b>Dumme Bemerkung</b></h2>Notiz = no <span class="wysiwyg-color-red">tits!<br></span><b><br><br>aoisdkd<br>asdlji<br><br></b><b><br></b>'); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `bachelor` +-- +ALTER TABLE `bachelor` + ADD PRIMARY KEY (`bachelor_id`,`fahrt_id`); + +-- +-- Indexes for table `fahrten` +-- +ALTER TABLE `fahrten` + ADD PRIMARY KEY (`fahrt_id`); + +-- +-- Indexes for table `notes` +-- +ALTER TABLE `notes` + ADD PRIMARY KEY (`note_id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `fahrten` +-- +ALTER TABLE `fahrten` +MODIFY `fahrt_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; +-- +-- AUTO_INCREMENT for table `notes` +-- +ALTER TABLE `notes` +MODIFY `note_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;