Created
March 1, 2012 12:01
-
-
Save thgh/1949379 to your computer and use it in GitHub Desktop.
NextUp - Mobile group scheduler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.event {border:none;border-top:1px solid #000;padding:5px;font-size:120%} | |
.detail {border:none;padding:5px;} | |
.now {font-size:10px;text-align:right;} | |
.today {background:#290;color:#fff;margin-top:5px;} | |
.option {background:#000;text-align:center;margin:5px} | |
.option a{padding:5px;margin:auto;background:#027;text-decoration:none;color:#ccc;width:100%;font-size:140%} | |
.later {background:#333;color:#999;} | |
.later hr{border-color:#666;} | |
html{padding:0;margin:0;background:#333;height:100%;width:100%} | |
body{border:6px solid #111;-moz-box-shadow: 1px 1px 15px 0px #000; background:#000;border-radius:10px;margin:100px auto;font: 11px 'Muli', sans-serif;color:#fff;width:240px;} | |
b{font-size:18px;} | |
html{ | |
background: -moz-linear-gradient(top, #556 0%, #000 100%); /* FF3.6+ */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- phpMyAdmin SQL Dump | |
-- version 3.3.0 | |
-- http://www.phpmyadmin.net | |
-- | |
-- Machine: localhost | |
-- Genereertijd: 01 Mar 2012 om 13:03 | |
-- Serverversie: 5.1.44 | |
-- PHP-Versie: 5.2.13 | |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; | |
/*!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: `nextup` | |
-- | |
-- -------------------------------------------------------- | |
-- | |
-- Tabelstructuur voor tabel `detail` | |
-- | |
CREATE TABLE IF NOT EXISTS `detail` ( | |
`d_id` int(11) NOT NULL AUTO_INCREMENT, | |
`d_event` int(11) NOT NULL, | |
`d_content` varchar(512) NOT NULL DEFAULT 'gefaild', | |
`d_dt` datetime NOT NULL DEFAULT '2012-02-29 15:08:00', | |
`d_vote` int(11) NOT NULL, | |
`d_creator` int(11) NOT NULL, | |
PRIMARY KEY (`d_id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; | |
-- | |
-- Gegevens worden uitgevoerd voor tabel `detail` | |
-- | |
INSERT INTO `detail` (`d_id`, `d_event`, `d_content`, `d_dt`, `d_vote`, `d_creator`) VALUES | |
(1, 1, 'Het zal waarschijnlijk gaan over C++', '2012-02-29 15:08:00', 20, 1), | |
(2, 1, 'We zijn geëindigd aan H4 p.134', '2012-02-29 15:08:00', 14, 1), | |
(3, 1, 'Dit is zever maar zullen later interessante details zijn', '2012-02-29 15:08:00', 24, 1); | |
-- -------------------------------------------------------- | |
-- | |
-- Tabelstructuur voor tabel `event` | |
-- | |
CREATE TABLE IF NOT EXISTS `event` ( | |
`e_id` int(11) NOT NULL AUTO_INCREMENT, | |
`e_title` varchar(64) CHARACTER SET latin1 NOT NULL, | |
`e_dt` datetime NOT NULL DEFAULT '2012-02-29 15:04:00', | |
`e_creator` int(11) NOT NULL DEFAULT '1', | |
`e_place` int(11) NOT NULL DEFAULT '1', | |
PRIMARY KEY (`e_id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=6 ; | |
-- | |
-- Gegevens worden uitgevoerd voor tabel `event` | |
-- | |
INSERT INTO `event` (`e_id`, `e_title`, `e_dt`, `e_creator`, `e_place`) VALUES | |
(1, 'Netwerken', '2012-03-01 08:10:00', 1, 1), | |
(2, 'Databanken', '2012-03-01 09:45:00', 1, 1), | |
(3, 'Systeemtheorie', '2012-03-01 11:20:00', 1, 1), | |
(4, 'Systeemtheorie werkcollege', '2012-03-01 13:30:00', 1, 1), | |
(5, 'Labo Analoge', '2012-03-02 09:45:00', 1, 2); | |
-- -------------------------------------------------------- | |
-- | |
-- Tabelstructuur voor tabel `place` | |
-- | |
CREATE TABLE IF NOT EXISTS `place` ( | |
`p_id` int(11) NOT NULL AUTO_INCREMENT, | |
`p_name` varchar(32) COLLATE latin1_german1_ci NOT NULL, | |
`p_detail` text COLLATE latin1_german1_ci NOT NULL, | |
PRIMARY KEY (`p_id`), | |
UNIQUE KEY `p_name` (`p_name`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci AUTO_INCREMENT=3 ; | |
-- | |
-- Gegevens worden uitgevoerd voor tabel `place` | |
-- | |
INSERT INTO `place` (`p_id`, `p_name`, `p_detail`) VALUES | |
(1, 'B207', 'Tweede verdieping\r\nB gebouw\r\nKaHo Sint-Lieven\r\nGebroeders Desmetstraat 94\r\n9000 Gent'), | |
(2, 'B227', 'Labolokaal analoge'); | |
-- -------------------------------------------------------- | |
-- | |
-- Tabelstructuur voor tabel `user` | |
-- | |
CREATE TABLE IF NOT EXISTS `user` ( | |
`u_id` int(11) NOT NULL AUTO_INCREMENT, | |
`u_nick` varchar(16) CHARACTER SET latin1 NOT NULL DEFAULT 'anon', | |
`u_hash` varchar(32) CHARACTER SET latin1 NOT NULL DEFAULT 'fail', | |
PRIMARY KEY (`u_id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ; | |
-- | |
-- Gegevens worden uitgevoerd voor tabel `user` | |
-- | |
INSERT INTO `user` (`u_id`, `u_nick`, `u_hash`) VALUES | |
(1, 'thgh', 'fail'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//todo: vote button | |
//todo: vote system | |
//todo: add page | |
//todo: registration/user | |
include("z_connect.php"); | |
$pResult=mysql_query("SELECT * FROM `place` LIMIT 0,99"); | |
while($place=mysql_fetch_array($pResult)){ | |
$places[$place['p_id']]=$place['p_name']; | |
} | |
?> | |
<html> | |
<head> | |
<title>NextUp</title> | |
<link rel='stylesheet' href='1.css' type='text/css' /> | |
<link href='http://fonts.googleapis.com/css?family=Muli:400,300italic' rel='stylesheet' type='text/css'> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script type="text/javascript"> | |
function toggleDiv(divId) { | |
$("#"+divId).toggle(); | |
} | |
</script> | |
</head> | |
<body> | |
<? | |
//todo: 10 or more or less events (afweging snelheid tov info) | |
//todo: starting from 20min/1h ago | |
$eResult=mysql_query("SELECT * FROM `event` ORDER BY `e_dt` ASC LIMIT 0,10"); | |
$eCount=mysql_num_rows($eResult);//Count selected events | |
if($eCount==0){echo "<b>Nothing here</b>";exit;}//Error | |
$eDisp=0;//Count displayed events | |
//First event in spotlight | |
$eNow=mysql_fetch_array($eResult); | |
$over=strtotime($eNow['e_dt'])-time(); | |
$printthis="<div class='now event'>Next up is <b>".$eNow['e_title']."</b><br />"; | |
//Langer dan 10u => print uren | |
//Langer dan 1 u => print uren+minuten | |
//Langer dan 10m => print minuten | |
//Minder dan 10m => print minuten & Hurry | |
//Minder dan 1 u geleden => print minuten & Hurry | |
//Langer dan 1 u geleden => print minuten & Hurry | |
if($over>36000){$printthis.="over <b> ".round($over/3600)." uur </b>";} | |
elseif($over>3600){ $printthis.="over <b> ".round($over/3600)." uur ".round($over/60%60)." min </b>";} | |
elseif($over>300){$printthis.="over <b> ".round($over/60%60)." min </b>";} | |
elseif($over>0){$printthis.="<b>Hurry!! ".round($over/60%60)." min </b>";} | |
elseif($over>-3600){$printthis.="nog maar<b> ".round($over/60%60)." min </b>";} | |
else{$printthis.="al<b> ".round((strtotime($eNow['e_dt'])-time())/60)." min </b>geleden";} | |
//Indien gegeven, locatie toevoegen | |
if(!empty($eNow['e_place'])){$printthis.="in<b> ".$places[$eNow['e_place']]."</b>";} | |
$printthis.="</div>"; | |
//Get details | |
//todo: decide to display name (of detailcreator) or not | |
//todo: decide to display votes (no votesystem yet) | |
$dResult=mysql_query("SELECT * FROM `detail` WHERE `d_event`=".$eNow['e_id']." ORDER BY `d_vote` DESC LIMIT 0,3"); | |
$first=mysql_fetch_array($dResult);$printthis.=$first['d_content']; | |
while($dRow=mysql_fetch_array($dResult)){ | |
$printthis.=" | ".$dRow['d_content']; | |
} | |
$eDisp++;//first event done | |
//List of todays events | |
//todo: solve bug when first event was just before midnight and time is just after midnight | |
$today=substr($eNow['e_dt'],0,10);//Strip date from first element | |
$eRow=mysql_fetch_array($eResult); | |
$printthis.="<div class='today'>"; | |
while($eDisp<$eCount && substr($eRow['e_dt'],0,10)==$today){ | |
//toggle show/hide works | |
$printthis.="<div class='event' onclick=\"toggleDiv('$eDisp');\"><b>"; | |
$printthis.=date("G\ui",strtotime($eRow['e_dt']))." </b>".$eRow['e_title']."</div>"; | |
//todo: fetch details | |
$printthis.="<div class='detail' id='$eDisp' style='display:none'>Blabla bla details en nog details</div>"; | |
$eDisp++; | |
$eRow=mysql_fetch_array($eResult); | |
} | |
echo $printthis."</div>"; | |
//todo: make new.php | |
?> | |
<div class=option> | |
<a href='new.php'>Voeg toe</a> | |
<a href='new.php'>Vandaag</a> | |
<a href='new.php'>Morgen</a> | |
</div> | |
<? | |
//List of later events | |
$printthis="<div class='later'>"; | |
while($eDisp<$eCount){ | |
//toggle show/hide works | |
$printthis.="<div class='event'><b>"; | |
$printthis.=date("D G\ui",strtotime($eRow['e_dt']))." </b>".$eRow['e_title']."</div>"; | |
//todo: fetch details | |
$eDisp++; | |
$eRow=mysql_fetch_array($eResult); | |
} | |
echo $printthis."</div>"; | |
?> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$hostname = "localhost"; | |
$username = "root"; | |
$password = "usbw"; | |
$database = "nextup"; | |
mysql_connect($hostname,$username,$password) or die(mysql_error()); | |
mysql_select_db($database); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment