-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
40 lines (39 loc) · 909 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include 'auth.php';
include 'head.php';
?>
<h1>Home</h1>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
try{
$m = new MongoClient();
$db = $m->selectDB("teamboard-dev");
$boards = new MongoCollection($db, "boards");
$tickets = new MongoCollection($db, "tickets");
$users = new MongoCollection($db, "users");
$cursor = $boards->find();
foreach($cursor as $doc){
$luonut = $users->findone(array('_id' => $doc['createdBy']));
echo <<<rivi
Taulun nimi: [{$doc['name']}]
Luonut: [{$luonut['email']}]
rivi;
$boardtickets = $tickets->find(array('board' => $doc['_id']));
echo '<ul>';
foreach($boardtickets as $ticket){
echo <<<rivi
<li style="color:{$ticket['color']};">{$ticket['content']}</li>
rivi;
}
echo '</ul>';
echo '<br/>';
}
}
catch ( MongoConnectionException $e )
{
echo '<p>Could not connect to MongoDB</p>';
exit();
}
include("foot.php");
?>