-
Notifications
You must be signed in to change notification settings - Fork 1
/
tutor_profile.php
144 lines (101 loc) · 3.95 KB
/
tutor_profile.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
136
137
138
139
140
141
142
143
144
<?php
include 'components/connect.php';
if(isset($_COOKIE['user_id'])){
$user_id = $_COOKIE['user_id'];
}else{
$user_id = '';
}
if(isset($_POST['tutor_fetch'])){
$tutor_email = $_POST['tutor_email'];
$tutor_email = filter_var($tutor_email, FILTER_SANITIZE_STRING);
$select_tutor = $conn->prepare('SELECT * FROM `tutors` WHERE email = ?');
$select_tutor->execute([$tutor_email]);
$fetch_tutor = $select_tutor->fetch(PDO::FETCH_ASSOC);
$tutor_id = $fetch_tutor['id'];
$count_playlists = $conn->prepare("SELECT * FROM `playlist` WHERE tutor_id = ?");
$count_playlists->execute([$tutor_id]);
$total_playlists = $count_playlists->rowCount();
$count_contents = $conn->prepare("SELECT * FROM `content` WHERE tutor_id = ?");
$count_contents->execute([$tutor_id]);
$total_contents = $count_contents->rowCount();
$count_likes = $conn->prepare("SELECT * FROM `likes` WHERE tutor_id = ?");
$count_likes->execute([$tutor_id]);
$total_likes = $count_likes->rowCount();
$count_comments = $conn->prepare("SELECT * FROM `comments` WHERE tutor_id = ?");
$count_comments->execute([$tutor_id]);
$total_comments = $count_comments->rowCount();
}else{
header('location:teachers.php');
}
?>
<!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">
<title>tutor's profile</title>
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
<!-- custom css file link -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'components/user_header.php'; ?>
<!-- teachers profile section starts -->
<section class="tutor-profile">
<h1 class="heading">profile details</h1>
<div class="details">
<div class="tutor">
<img src="uploaded_files/<?= $fetch_tutor['image']; ?>" alt="">
<h3><?= $fetch_tutor['name']; ?></h3>
<span><?= $fetch_tutor['profession']; ?></span>
</div>
<div class="flex">
<p>total playlists : <span><?= $total_playlists; ?></span></p>
<p>total videos : <span><?= $total_contents; ?></span></p>
<p>total likes : <span><?= $total_likes; ?></span></p>
<p>total comments : <span><?= $total_comments; ?></span></p>
</div>
</div>
</section>
<!-- teachers profile section ends -->
<section class="courses">
<h1 class="heading">latest courese</h1>
<div class="box-container">
<?php
$select_courses = $conn->prepare("SELECT * FROM `playlist` WHERE tutor_id = ? AND status = ?");
$select_courses->execute([$tutor_id, 'active']);
if($select_courses->rowCount() > 0){
while($fetch_course = $select_courses->fetch(PDO::FETCH_ASSOC)){
$course_id = $fetch_course['id'];
$select_tutor = $conn->prepare("SELECT * FROM `tutors` WHERE id = ?");
$select_tutor->execute([$fetch_course['tutor_id']]);
$fetch_tutor = $select_tutor->fetch(PDO::FETCH_ASSOC);
?>
<div class="box">
<div class="tutor">
<img src="uploaded_files/<?= $fetch_tutor['image']; ?>" alt="">
<div>
<h3><?= $fetch_tutor['name']; ?></h3>
<span><?= $fetch_course['date']; ?></span>
</div>
</div>
<img src="uploaded_files/<?= $fetch_course['thumb']; ?>" class="thumb" alt="">
<h3 class="title"><?= $fetch_course['title']; ?></h3>
<a href="playlist.php?get_id=<?= $course_id; ?>" class="inline-btn">view playlist</a>
</div>
<?php
}
}else{
echo '<p class="empty">no courses added yet!</p>';
}
?>
</div>
</section>
<!-- courses section ends -->
<?php include 'components/footer.php'; ?>
<!-- custom js file link -->
<script src="js/script.js"></script>
</body>
</html>