-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
98 lines (82 loc) · 2.94 KB
/
dashboard.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
require_once("config.php");
$filter = ['username' => 'a'];
$options = [];
$query = new MongoDB\Driver\Query($filter, $options);
$cursor = $manager->executeQuery('faculty_portal.users', $query);
//$username = 'sid230798';
#$result = pg_query($pg, "select username from users where username='$username'");
//$dept_name = 'EE';
//$result = pg_query($pg, "select Faculty.Name, Users.username from Faculty, Department, Users where Faculty.Id = Users.Id and Faculty.dept_id = Department.Id and Department.name='$dept_name'");
#$result = pg_query($pg, "select Faculty.Name, Users.username from Faculty, Department, Users, HOD where Faculty.Id = Users.Id and Faculty.dept_id = Department.Id and HOD.dept_id = Department.Id and Department.name='$dept_name'");
//$resultArr = pg_fetch_all($result);
#echo count($resultArr);
/*
for($c = 0; $c < count($resultArr); $c++){
print_r($resultArr[$c]['name']);
}*/
#print_r(len($resultArr);
/*
$iterator = new IteratorIterator($cursor);
$iterator->rewind();
while (true) {
if ($iterator->valid()) {
$document = $iterator->current();
printf("Consumed document created at: %s\n", $document->createdAt);
print_r($document);
}
$iterator->next();
}*/
/*echo $cursor->ModuleAccountInfo[0]->username*/
//$result = pg_query($pg, "select faculty.Id from Faculty, Users where Faculty.Id = Users.Id and Users.username='a' and Users.password='12qwaszx'");
//$resultArr = pg_fetch_all($result);
//echo $resultArr[0]['id'];
$publication = array();
foreach($cursor as $entry){
$c = get_object_vars($entry);
$id = $c['_id']->__toString();
print_r($id);
#$obj = new MongoDB\BSON\ObjectID($id);
#print_r($obj);
foreach($c['Publication'] as $pub){
$tmp = get_object_vars($pub);
$tmp['Paper'] = "Mostly Sane";
array_push($publication, $tmp);
}
}
print_r($publication);
$insRec = new MongoDB\Driver\BulkWrite;
$username = "a";
$pass = "12qwaszx";
$name = "Dr. Aditya";
$email = "a@iitrpr.ac.in";
$overview = "Interested in Machine Learning, Enthu as well";
//$insRec->update(['_id'=>new MongoDB\BSON\ObjectID($id)],['$set' => ["Publication" => $publication]]);
$insRec->update(['_id'=>new MongoDB\BSON\ObjectID($id)],['$set' => ["username" => $username, "password" => $pass, "name" => $name, "email" => $email, "Overview" => $overview]]);
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY, 1000);
$result = $manager->executeBulkWrite('faculty_portal.users', $insRec, $writeConcern);
echo $result->getModifiedCount();
/*
foreach($publication as $row)
echo "Yes";
*/
#print_r($publication)
?>
<!DOCTYPE html>
<html>
<body>
Logged In
<input type="text" value=""te>
<p> <?php echo $publication.length; ?> </p>
<div class="Publication">
<ul>
<?php foreach($publication as $pub){?>
<li>
<h2 style="color: blue"><?php echo $pub['Paper']; ?> </h2>
<p><?php echo $pub['Conf'];?></p>
</li>
<?php }?>
</ul>
</div>
</body>
</html>