Presentation is loading. Please wait.

Presentation is loading. Please wait.

Faculty of Sciences and Social Sciences HOPE Uploading Resources Stewart Blakeway FML 213

Similar presentations


Presentation on theme: "Faculty of Sciences and Social Sciences HOPE Uploading Resources Stewart Blakeway FML 213"— Presentation transcript:

1 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Uploading Resources Stewart Blakeway FML 213 blakews@hope.ac.uk

2 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE What we have done myPhpAdmin – Created a database – Tables – Fields Inserted Data – Registration (this could be a student or tutor) Selected Data – Used as part of the authentication process Session Variables – If the authentication process was successful The include statement – Makes our job much easier

3 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE What we have done so far Applying user levels to your current users table – Registering as a tutor – Registering as a student Dynamically displaying different menus/links dependent on the user – Authorising the tutor – Authorising the student Allowing a tutor to upload a list of students for registration

4 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE What we have covered Ace training requires a new system for students that enrol onto their course(s). There will typically be three methods of enrolment: from a list, by a tutor, or by a student. Students that register themselves require authorising by the tutor. Tutors are created by administrator(s) after the credentials of the tutor has been checked. To become a course tutor the individual will register as a tutor. The tutor will have the facility of uploading various resources, such as powerpoint presentations and documents. Once uploaded they should either: be made available to the student, not available or available within a specified date range. Satisfactory

5 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE What will we do today? Allow tutor to upload a resource – Make available – Make available given date – Close

6 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Recap 1.Create a connection to the SQL Server $conn = mysql_connect (“localhost”, “root”, “root”); 2.Select the database mysql_select_db (“database”, $conn); 3.Construct the SQL statement $sql = (“what I want to do with the database”); 4.Execute the SQL mysql_query ($sql,$conn);

7 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Our Database acetraining only accounts for students! What about tutors and administrators user userID userForename userSurname userEmail userPassword userType userActive

8 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE We need to expand our database There may be many resources – Each tutor will have resources – Resources are made available or not This could be within a set period

9 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Our Database acetraining We have not considered multiple courses in this implementation user userID userForename userSurname userEmail userPassword userType userActive resource userID resourceName resourceLocation resourceStart resourceFinish

10 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE showTutorPage() function showTutorPage() { echo (" You are logged in as a tutor, what would you like to do? Show students waiting to be authorised for your course Enter student registration details manually Enrol students from a list "); } Upload Resource

11 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE uploadResource.php What is the criteria? – make available? from start date / finish date 1.Get Resource 2.Get Start Date (available from) 3.Get Finish Date (available until) 4.Construct SQL based on 1,2 and 3

12 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE getResource() 1,2 and 3 echo (" Choose a resource to upload: Resource Name Resource Available from / / (dd/mm/yyyy) Resource Available until / / (dd/mm/yyyy) "); Can you sketch out what would be displayed by the browser?

13 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE uploadFileandProcess() 4 $target_path = basename($_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; $conn = mysql_connect("localhost","root","root"); mysql_select_db("aceTraining",$conn); $userID = $_SESSION['userID']; $resourceLocation = basename($_FILES['uploadedfile']['name']); $resourceName = $_POST['resourceName']; $startDate = $_POST['s_yyyy']. "-". $_POST['s_mm']. "-". $_POST['s_dd']; $finishDate = $_POST['f_yyyy']. "-". $_POST['f_mm']. "-". $_POST['f_dd']; $sql = ("INSERT INTO resource (userID, resourceName, resourceLocation, resourceStart, resourceFinish) VALUES ('$_SESSION[userID]', '$resourceName', '$resourceLocation', '$startDate', '$finishDate')"); echo " ". $sql. " "; mysql_query($sql,$conn) or die(mysql_error()); } From the form Original Path name Path to temporary file on the server

14 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE What we have done Allowed the tutor to upload a resource – specified start date – specified finish date – specified resource location – specified resource name Next? – displaying available resources dependent on start and finish date

15 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Assume student is logged in! display student page – we have prepared for this in login.php – function called showStudentPage() display resources available for download – ie, what the tutor has uploaded

16 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE showStudentPage() $currentDate = date('Ymd'); $conn = mysql_connect("localhost","root","root"); mysql_select_db("aceTraining",$conn); $sql = ("SELECT * FROM resource"); $records = mysql_query($sql,$conn) or die (mysql_error()); while ($currentResource = mysql_fetch_array($records)) { echo " "; if ((str_replace("-", "", $currentResource['resourceStart']) <= $currentDate) && (str_replace("-", "", $currentResource['resourceFinish']) >= $currentDate)) { echo (" ". " ". $currentResource['resourceName']. " "); } echo (" "); }

17 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Satisfactory We have done enough to pass the webpage criteria of the assessment – don’t forget you also have a report – and a presentation – and an exam

18 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Satisfactory Student and Tutor can register – tutor must authorise student, administrator must authorise tutor Student and Tutor can log in Tutor can – authorise pending students – enrol students from a list – upload resources (powerpoint, documents, pdf, etc) – resources can be made available within a given period Students can – view available resources within the given period

19 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Considerations Tutors – we have not accounted for tutor(s) delivering multiple courses – we haven’t allowed for the tutor to change start and finish times (or to delete) of uploaded files – we don’t allow the tutor to structure resources (weeks, content type, file type) – Tutors can not change their details (email address, password) Students – we have not accounted for student(s) enrolled for a particular course (or multiple courses) – we have not facilitated the tracking of student progress – we don’t allow the student to change their details

20 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Next? Example code is online Next week is a drop-in support session – students that can not get this working should come and speak with me as soon as possible

21 www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Any Questions? Remaining time is for student support


Download ppt "Faculty of Sciences and Social Sciences HOPE Uploading Resources Stewart Blakeway FML 213"

Similar presentations


Ads by Google