Skip to content

Commit 6ebcd17

Browse files
author
blacksmithgu
committed
More small fixes; registration immediately logs you on.
1 parent 22d3501 commit 6ebcd17

File tree

3 files changed

+25
-93
lines changed

3 files changed

+25
-93
lines changed

app/api/calls/UserManager.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@ public static function addRoutes($app) {
1111
$last = $_GET["last"];
1212
$school = $_GET["school"];
1313
$email = $_GET["email"];
14+
$groupID = $_GET["group"];
1415

1516
$type = isset($_GET["type"]) ? $_GET["type"] : 0;
1617

1718
$user = User::create($email,$pass, $first, $last, $school, $type);
18-
$user->insert();
19+
$user_res = User::id($user->insert());
20+
21+
User::loginCurrent($user_res);
22+
23+
$group = Group::id($groupID);
24+
if(!is_null($group))
25+
$group->addIndirect("Students", $user_res);
1926

20-
User::loginCurrent($user);
2127
header("Location: /");
2228
});
2329

schollab.sql

Lines changed: 15 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -17,79 +17,6 @@ USE `schollab`;
1717
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
1818
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
1919

20-
--
21-
-- Table structure for table `announcements`
22-
--
23-
24-
DROP TABLE IF EXISTS `announcements`;
25-
/*!40101 SET @saved_cs_client = @@character_set_client */;
26-
/*!40101 SET character_set_client = utf8 */;
27-
CREATE TABLE `announcements` (
28-
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
29-
`Title` varchar(50) NOT NULL DEFAULT 'Default',
30-
`Content` longtext NOT NULL,
31-
`UserID` int(11) NOT NULL,
32-
PRIMARY KEY (`ID`)
33-
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
34-
/*!40101 SET character_set_client = @saved_cs_client */;
35-
36-
--
37-
-- Dumping data for table `announcements`
38-
--
39-
40-
LOCK TABLES `announcements` WRITE;
41-
/*!40000 ALTER TABLE `announcements` DISABLE KEYS */;
42-
/*!40000 ALTER TABLE `announcements` ENABLE KEYS */;
43-
UNLOCK TABLES;
44-
45-
--
46-
-- Table structure for table `announcements_groups`
47-
--
48-
49-
DROP TABLE IF EXISTS `announcements_groups`;
50-
/*!40101 SET @saved_cs_client = @@character_set_client */;
51-
/*!40101 SET character_set_client = utf8 */;
52-
CREATE TABLE `announcements_groups` (
53-
`ID` int(11) NOT NULL AUTO_INCREMENT,
54-
`AnnouncementID` int(11) NOT NULL,
55-
`GroupID` int(11) NOT NULL,
56-
PRIMARY KEY (`ID`)
57-
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
58-
/*!40101 SET character_set_client = @saved_cs_client */;
59-
60-
--
61-
-- Dumping data for table `announcements_groups`
62-
--
63-
64-
LOCK TABLES `announcements_groups` WRITE;
65-
/*!40000 ALTER TABLE `announcements_groups` DISABLE KEYS */;
66-
/*!40000 ALTER TABLE `announcements_groups` ENABLE KEYS */;
67-
UNLOCK TABLES;
68-
69-
--
70-
-- Table structure for table `announcements_rooms`
71-
--
72-
73-
DROP TABLE IF EXISTS `announcements_rooms`;
74-
/*!40101 SET @saved_cs_client = @@character_set_client */;
75-
/*!40101 SET character_set_client = utf8 */;
76-
CREATE TABLE `announcements_rooms` (
77-
`ID` int(11) NOT NULL AUTO_INCREMENT,
78-
`AnnouncementID` int(11) NOT NULL,
79-
`RoomID` int(11) NOT NULL,
80-
PRIMARY KEY (`ID`)
81-
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
82-
/*!40101 SET character_set_client = @saved_cs_client */;
83-
84-
--
85-
-- Dumping data for table `announcements_rooms`
86-
--
87-
88-
LOCK TABLES `announcements_rooms` WRITE;
89-
/*!40000 ALTER TABLE `announcements_rooms` DISABLE KEYS */;
90-
/*!40000 ALTER TABLE `announcements_rooms` ENABLE KEYS */;
91-
UNLOCK TABLES;
92-
9320
--
9421
-- Table structure for table `assignments`
9522
--
@@ -100,12 +27,12 @@ DROP TABLE IF EXISTS `assignments`;
10027
CREATE TABLE `assignments` (
10128
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
10229
`Name` varchar(45) NOT NULL,
103-
`TeacherID` int(11) NOT NULL,
30+
`GroupID` int(11) NOT NULL,
10431
`CreationDate` datetime NOT NULL,
10532
`DueDate` datetime DEFAULT NULL,
10633
`Description` longtext NOT NULL,
10734
PRIMARY KEY (`ID`)
108-
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
35+
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
10936
/*!40101 SET character_set_client = @saved_cs_client */;
11037

11138
--
@@ -114,7 +41,7 @@ CREATE TABLE `assignments` (
11441

11542
LOCK TABLES `assignments` WRITE;
11643
/*!40000 ALTER TABLE `assignments` DISABLE KEYS */;
117-
INSERT INTO `assignments` VALUES (1,'Bobby',1,'2014-06-13 19:54:07','2014-06-13 19:54:07','Hello!'),(2,'Bobby',4,'2014-06-13 19:54:21','2014-06-13 19:54:21','Hello!'),(3,'Billy',21,'0000-00-00 00:00:00','0000-00-00 00:00:00','K.');
44+
INSERT INTO `assignments` VALUES (4,'Frederick Douglass Essay',9,'2014-06-14 16:12:26',NULL,'not implemented'),(5,'Lincoln Speech Analysis',9,'2014-06-14 16:13:04',NULL,'not implemented'),(6,'Hello',13,'2014-06-14 16:20:52',NULL,'not implemented');
11845
/*!40000 ALTER TABLE `assignments` ENABLE KEYS */;
11946
UNLOCK TABLES;
12047

@@ -130,7 +57,7 @@ CREATE TABLE `assignments_groups` (
13057
`GroupID` int(11) NOT NULL DEFAULT '-1',
13158
`AssignmentID` int(11) NOT NULL DEFAULT '-1',
13259
PRIMARY KEY (`ID`)
133-
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
60+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
13461
/*!40101 SET character_set_client = @saved_cs_client */;
13562

13663
--
@@ -139,7 +66,6 @@ CREATE TABLE `assignments_groups` (
13966

14067
LOCK TABLES `assignments_groups` WRITE;
14168
/*!40000 ALTER TABLE `assignments_groups` DISABLE KEYS */;
142-
INSERT INTO `assignments_groups` VALUES (1,2,1),(2,2,4),(3,2,6);
14369
/*!40000 ALTER TABLE `assignments_groups` ENABLE KEYS */;
14470
UNLOCK TABLES;
14571

@@ -180,7 +106,7 @@ CREATE TABLE `groups` (
180106
`Title` varchar(45) NOT NULL,
181107
`Description` text NOT NULL,
182108
PRIMARY KEY (`ID`)
183-
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
109+
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
184110
/*!40101 SET character_set_client = @saved_cs_client */;
185111

186112
--
@@ -189,7 +115,7 @@ CREATE TABLE `groups` (
189115

190116
LOCK TABLES `groups` WRITE;
191117
/*!40000 ALTER TABLE `groups` DISABLE KEYS */;
192-
INSERT INTO `groups` VALUES (2,'4','Some Project','Goodbye'),(3,'4','Other Project','Nope'),(7,'21','AP US History','Goodbye'),(8,'21','This is a Project','Yep');
118+
INSERT INTO `groups` VALUES (9,'24','English III','not implemented'),(10,'24','English IV','not implemented'),(11,'24','Geometry Pre-AP','not implemented'),(12,'24','AP Calculus AB','not implemented'),(13,'24','AP Calculus BC','not implemented'),(14,'24','AP Computer Science I','not implemented'),(15,'24','Computer Science II PreAP','not implemented'),(16,'24','Computer Science Independent Study','not implemented');
193119
/*!40000 ALTER TABLE `groups` ENABLE KEYS */;
194120
UNLOCK TABLES;
195121

@@ -206,7 +132,7 @@ CREATE TABLE `groups_users` (
206132
`UserID` int(11) NOT NULL,
207133
`Approved` tinyint(4) NOT NULL DEFAULT '0',
208134
PRIMARY KEY (`ID`)
209-
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
135+
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
210136
/*!40101 SET character_set_client = @saved_cs_client */;
211137

212138
--
@@ -215,7 +141,7 @@ CREATE TABLE `groups_users` (
215141

216142
LOCK TABLES `groups_users` WRITE;
217143
/*!40000 ALTER TABLE `groups_users` DISABLE KEYS */;
218-
INSERT INTO `groups_users` VALUES (8,3,2,0),(10,3,4,0),(11,5,2,0);
144+
INSERT INTO `groups_users` VALUES (16,9,25,0),(17,9,26,0),(18,9,27,0),(19,10,27,0),(20,14,28,0);
219145
/*!40000 ALTER TABLE `groups_users` ENABLE KEYS */;
220146
UNLOCK TABLES;
221147

@@ -231,7 +157,7 @@ CREATE TABLE `rooms` (
231157
`Name` varchar(45) NOT NULL DEFAULT '[Not Named]',
232158
`AssignmentID` int(11) NOT NULL,
233159
PRIMARY KEY (`ID`)
234-
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
160+
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
235161
/*!40101 SET character_set_client = @saved_cs_client */;
236162

237163
--
@@ -240,7 +166,7 @@ CREATE TABLE `rooms` (
240166

241167
LOCK TABLES `rooms` WRITE;
242168
/*!40000 ALTER TABLE `rooms` DISABLE KEYS */;
243-
INSERT INTO `rooms` VALUES (1,'Hello',0),(2,'Bobby',1),(4,'Bobby',1);
169+
INSERT INTO `rooms` VALUES (5,'Room A',4),(6,'Room B',4),(7,'Room C',4),(8,'Room D',4),(9,'Room A',5),(10,'Room B',5),(11,'Room C',5);
244170
/*!40000 ALTER TABLE `rooms` ENABLE KEYS */;
245171
UNLOCK TABLES;
246172

@@ -256,7 +182,7 @@ CREATE TABLE `rooms_students` (
256182
`RoomID` int(11) NOT NULL DEFAULT '-1',
257183
`UserID` int(11) NOT NULL DEFAULT '-1',
258184
PRIMARY KEY (`ID`)
259-
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
185+
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
260186
/*!40101 SET character_set_client = @saved_cs_client */;
261187

262188
--
@@ -265,7 +191,7 @@ CREATE TABLE `rooms_students` (
265191

266192
LOCK TABLES `rooms_students` WRITE;
267193
/*!40000 ALTER TABLE `rooms_students` DISABLE KEYS */;
268-
INSERT INTO `rooms_students` VALUES (1,2,20),(2,2,12);
194+
INSERT INTO `rooms_students` VALUES (5,5,26),(7,7,25);
269195
/*!40000 ALTER TABLE `rooms_students` ENABLE KEYS */;
270196
UNLOCK TABLES;
271197

@@ -310,7 +236,7 @@ CREATE TABLE `users` (
310236
`LastName` varchar(45) NOT NULL,
311237
`School` varchar(45) DEFAULT NULL,
312238
PRIMARY KEY (`ID`)
313-
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;
239+
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
314240
/*!40101 SET character_set_client = @saved_cs_client */;
315241

316242
--
@@ -319,7 +245,7 @@ CREATE TABLE `users` (
319245

320246
LOCK TABLES `users` WRITE;
321247
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
322-
INSERT INTO `users` VALUES (1,'smith',0,'2014-06-14 02:42:52','[email protected]','','',NULL),(2,'hello',0,'2014-06-14 02:43:09','[email protected]','Bill','Smith','Smith Academy'),(3,'smith',0,'2014-06-14 02:43:09','[email protected]','','',NULL),(4,'smith',1,'2014-06-14 02:43:10','[email protected]','','',NULL),(5,'smith',0,'2014-06-14 02:43:10','[email protected]','','',NULL),(6,'smith',0,'2014-06-14 02:43:10','[email protected]','','',NULL),(7,'smith',0,'2014-06-14 02:43:10','[email protected]','','',NULL),(8,'smith',0,'2014-06-14 02:43:10','[email protected]','','',NULL),(9,'smith',0,'2014-06-14 02:43:11','[email protected]','','',NULL),(10,'smith',0,'2014-06-14 02:43:11','[email protected]','','',NULL),(11,'smith',0,'2014-06-14 02:43:11','[email protected]','','',NULL),(12,'smith',0,'2014-06-14 02:43:13','[email protected]','','',NULL),(13,'smith',0,'2014-06-14 02:43:13','[email protected]','','',NULL),(14,'smith',0,'2014-06-14 02:43:13','[email protected]','','',NULL),(15,'smith',0,'2014-06-14 02:43:14','[email protected]','','',NULL),(16,'smith',0,'2014-06-14 02:43:14','[email protected]','','',NULL),(17,'smith',0,'2014-06-14 02:43:14','[email protected]','','',NULL),(18,'smith',0,'2014-06-14 02:43:14','[email protected]','','',NULL),(19,'smith',0,'2014-06-14 02:43:14','[email protected]','','',NULL),(20,'smith',0,'2014-06-14 02:43:14','[email protected]','','',NULL),(21,'hello',1,'2014-06-14 05:09:10','[email protected]','','',NULL),(22,'hello',0,'2014-06-14 09:58:36','[email protected]','Miguel','Obregon','Seven Lakes');
248+
INSERT INTO `users` VALUES (24,'hello',1,'2014-06-14 16:04:59','[email protected]','Bill','Smith','Seven Lakes'),(25,'hello',0,'2014-06-14 16:21:13','[email protected]','Michael','Brenan','Seven Lakes'),(26,'hello',0,'2014-06-14 16:32:06','[email protected]','Miguel','Obregon','Seven Lakes'),(27,'hello',0,'2014-06-14 16:34:35','[email protected]','Andy','Sturzu','Taylor High School'),(28,'hello',0,'2014-06-14 16:46:50','[email protected]','Keyon','Amirpanahi','Seven Lakes');
323249
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
324250
UNLOCK TABLES;
325251

@@ -340,4 +266,4 @@ UNLOCK TABLES;
340266
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
341267
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
342268

343-
-- Dump completed on 2014-06-14 7:10:43
269+
-- Dump completed on 2014-06-14 11:47:31

views/students.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ <h3 class="masthead-brand" style="font-family: 'Lobster', cursive;text-spacing:2
3636
</div>
3737

3838
<div class="inner cover" style="background: rgba(255,255,255,0.2); padding: 10px; margin-bottom: 20px;">
39-
<h2 class="cover-heading">Student Sign Up </h2>
39+
<h2 class="cover-heading">Student Sign Up</h2>
4040
<hr style="border-color: black;opacity:.2">
4141
<form class="form-signin" method="GET" action="/api/register" role="form" style="opacity:.8">
4242
<input type="text" name="first" class="form-control top" placeholder="First Name" required autofocus>
4343
<input type="text" name="last" class="form-control bottom" placeholder="Last Name" required>
4444
<input id="autoschool" type="text" name="school" style="margin-bottom:10px;"class="form-control" placeholder="School" required>
4545
<input type="email" name="email" class="form-control" placeholder="Email address" required>
4646
<input type="password" name="password" class="form-control" placeholder="Password" required>
47-
<input type="text" name="code" class="form-control" style="margin-bottom:10px;" placeholder="Teacher Code" required>
47+
<input type="text" name="group" class="form-control" style="margin-bottom:10px;" placeholder="Group Code" required>
4848

4949
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign Up</button>
5050
</form>

0 commit comments

Comments
 (0)