-
Notifications
You must be signed in to change notification settings - Fork 0
/
memberTalkHome.php
135 lines (115 loc) · 5.27 KB
/
memberTalkHome.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
require('navbar_member.php');
try {
require("project_connection.php");
$sql = "select * FROM users WHERE role='specialist' AND userStatus='active'";
$rs = $db->prepare($sql);
$rs->execute();
$rows = $rs->fetchAll();
$expertiseSql = "select * FROM `specialists-expertise` WHERE specialistId IN (SELECT id FROM users WHERE role='specialist' AND userStatus='active')";
$expertiseRs = $db->prepare($expertiseSql);
$expertiseRs->execute();
$expertiseRows = $expertiseRs->fetchAll();
/* foreach ($expertiseRs as $exRx) {
var_dump($exRx['expertise']);
}
*/
//$x = $rs->rowcount();
$db = null;
} catch (PDOException $e) {
die("Error Message" . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="./assets/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.lordicon.com/bhenfmcm.js"></script>
<script type="text/javascript" src="https://cdn.weglot.com/weglot.min.js"></script>
<script>
Weglot.initialize({
api_key: 'wg_a4e18a6b7b6b73066b2fb181dc6a5a109'
});
</script>
<title>Browse Specialists</title>
</head>
<body style="background-color: #e3f2fd;">
<br>
<br>
<div class="mx-auto" style="width:150px; height:150px;">
<lord-icon src="https://cdn.lordicon.com/uiaaaqiz.json" trigger="loop" delay="2000" colors="primary:#92140c,secondary:#f9c9c0" style="width:150px;height:150px">
</lord-icon>
<!--
inserting attribution here since i dont have a footer
<a href="https://lordicon.com/">Icons by Lordicon.com</a>
-->
</div>
<main class="container-md">
<div class="row">
<?php
if (count($rows) > 0) {
foreach ($rows as $row) {
?>
<div class="col mt-3">
<div class="card" style="width: 18rem;">
<img src="uploadedimages/<?php echo $row['profile_pic']; ?>" style="height:221px; width:286px; object-fit:cover;">
<div class="card-body ">
<h3 class="card-title text-center"> <?php echo $row['name']; ?></h3>
<p class="card-text" style="text-align:start;">
<h5>Expertise:</h5>
<!-- <ul> -->
<?php
$flag = 0;
foreach ($expertiseRows as $expertiseRow) {
if ($expertiseRow['specialistId'] == $row['id']) {
++$flag;
if ($flag < 3)
echo "<li>" . $expertiseRow['expertise'] . "</li><br>";
elseif ($flag == 3) {
echo "<div style='display:none;'>";
echo "<li>" . $expertiseRow['expertise'] . "</li>";
} elseif ($flag > 3)
echo "<li>" . $expertiseRow['expertise'] . "</li>";
}
}
if ($flag >= 3) {
echo "</div>";
echo "<span class='text-info' onclick='displayMore(this)'>Show More</span>";
}
?>
<!-- </ul> -->
</p>
</div> <!-- end card body 1 -->
<a class="btn btn-primary" href='talkpage.php?toId=<?php echo $row['id']; ?>'>Chat </a>
</div>
</div>
<?php
}
}
?>
</div>
<div style="width:30%; margin-left:auto; margin-right:auto; margin-bottom:20px;">
<br>
<a class='btn btn-dark btn-lg d-block' style="background-image: linear-gradient(0deg, rgb(0, 172, 238) 0%, rgb(2, 126, 251) 100%);" href="<?php if (isset($_SESSION['userType'])) {
if ($_SESSION['userType'] == "member")
echo 'memberDashboard.php';
else if ($_SESSION['userType'] == "admin")
echo 'adminDashboard.php';
else if ($_SESSION['userType'] == "specialist")
echo 'specialistDashboard.php';
} else
echo 'homepage.php'; ?>">Return Home</a>
</div>
</main>
<script>
function displayMore(e) {
//console.log(e);
e.previousElementSibling.style.display = 'block';
e.style.display = 'none';
}
</script>
</body>
</html>