Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tutorat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ZHANG David
tutorat
Commits
ba5566ec
Commit
ba5566ec
authored
4 months ago
by
ZHANG David
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
0ee61b98
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/prof_view_files.php
+77
-0
77 additions, 0 deletions
code/prof_view_files.php
with
77 additions
and
0 deletions
code/prof_view_files.php
0 → 100644
+
77
−
0
View file @
ba5566ec
<?php
include
'config.php'
;
session_start
();
if
(
!
isset
(
$_SESSION
[
'user'
])
||
$_SESSION
[
'user'
][
'role'
]
!==
'tutor'
)
{
echo
"<div class='container'><p class='error'>Access denied. Only tutors can view files.</p><a href='login.php'>Go back</a></div>"
;
exit
;
}
$user
=
$_SESSION
[
'user'
];
$tutor_id
=
intval
(
$user
[
'id'
]);
// Récupération de l'ID du professeur connecté
// Récupérer uniquement les dépôts créés par ce professeur
$depots
=
$conn
->
query
(
"SELECT * FROM depots WHERE tutor_id =
$tutor_id
"
);
?>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
View Files
</title>
<link
rel=
"stylesheet"
href=
"style.css"
>
</head>
<body>
<?php
include
'sidebar.php'
;
?>
<div
class=
"main-content"
>
<div
class=
"attendance-page"
>
<h1>
View Files
</h1>
<?php
if
(
$depots
->
num_rows
>
0
)
:
?>
<?php
while
(
$depot
=
$depots
->
fetch_assoc
())
:
?>
<h2>
<?=
htmlspecialchars
(
$depot
[
'nom'
])
?>
</h2>
<p>
<?=
htmlspecialchars
(
$depot
[
'description'
])
?>
</p>
<ul>
<?php
$depot_id
=
intval
(
$depot
[
'id'
]);
$files
=
$conn
->
query
(
"SELECT * FROM fichiers WHERE depot_id =
$depot_id
"
);
if
(
$files
->
num_rows
>
0
)
:
?>
<table
border=
"1"
cellpadding=
"10"
>
<thead>
<tr>
<th>
File Name
</th>
<th>
Sender
</th>
<th>
Upload Date
</th>
<th>
Download
</th>
</tr>
</thead>
<tbody>
<?php
while
(
$file
=
$files
->
fetch_assoc
())
:
?>
<tr>
<td>
<?=
htmlspecialchars
(
$file
[
'nom_fichier'
])
?>
</td>
<td>
<?=
htmlspecialchars
(
$file
[
'expediteur'
])
?>
</td>
<td>
<?=
date
(
'd-m-Y H:i'
,
strtotime
(
$file
[
'date_upload'
]))
?>
</td>
<td>
<a
href=
"
<?=
htmlspecialchars
(
$file
[
'path_fichier'
])
?>
"
download
>
Download
</a>
</td>
</tr>
<?php
endwhile
;
?>
</tbody>
</table>
<?php
else
:
?>
<p>
Pas de fichiers téléversés encore
</p>
<?php
endif
;
?>
</ul>
<?php
endwhile
;
?>
<?php
else
:
?>
<p>
No depots found.
</p>
<?php
endif
;
?>
</div>
</div>
</body>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment