Welcome! Log In Create A New Profile

Advanced

The Portfolio course_man.php

Posted by 78044545CharlesU 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
The Portfolio course_man.php
September 10, 2013 02:32AM
Hi Prof mac,

Do we get to know how many courses that there are to choose from on your server or do we have do some fancy looping
when we build the table?

CharlesU
Re: The Portfolio course_man.php
September 10, 2013 03:27AM
Hi Prof mac,

Sorry, my first question was not very clear and I probably would have the answer I deserved. Can we assume that
the list of courses will fit on one web page?

CharlesU
avatar
Mac
Re: The Portfolio course_man.php
September 10, 2013 07:20AM
Remember I add courses using your app, then use the courses. A drop-down is generally better.
Re: The Portfolio course_man.php
September 10, 2013 11:17AM
Hi,

I Was hoping to use a modified version of the table, Text book page 166, to display the courses available
on the index page. Addicted to the way it loads. Back to the drawing board, I guess!

Thanks,

CharlesU
avatar
Mac
Re: The Portfolio course_man.php
September 10, 2013 02:29PM
You cannot change the table structure...
Re: The Portfolio course_man.php
September 10, 2013 10:35PM
Hi Prof mac,

I think you're telling me to go back and read the tut letter again. I found the following on page 12

Page and forms for managing courses

The page for managing courses should generate a listing (preferably in a table format
or table layout) of all current courses with links to Add/Delete/Edit a course.

e.g.

Add a new course (this is a link)

Course A........................., Delete, Edit
Course B........................., Delete, Edit
Course C........................., Delete, Edit

Clicking the delete link will delete the course – and the course from the students who
registered for it. Clicking the Edit link will open the course details in a form, where the
user can edit the details and do an update. The Add a new course link points at a new
form where you can add a new course. You may change the layout of links on your
pages as you wish, as long as it makes sense and is easy to use.

I'm sure things will fall into place as we go on.

Thanks,

CharlesU
avatar
Mac
Re: The Portfolio course_man.php
September 11, 2013 07:18AM
Ooops, sorry. You can change the layout of that table yes.
Re: The Portfolio course_man.php
September 11, 2013 01:43PM
Hi,

My problem! I had difficulty in phrasing the question but we got there.
Thanks for your patience!

CharlesU
Re: The Portfolio course_man.php
September 25, 2013 11:39AM
Started working on this page.

Managed to add and delete courses so far. Now just have to add the edit functionality and fix one glitch then hopefully have this page done! (I am getting very worried that I will not be able to finish this project on time...)

One question:
Whenever I load the page (not only with refresh, but actually when I go from index to this page) a new course is created automatically. I can delete it, but then again, a new course is created automatically.

I did include
Language: PHP
"';.$_SERVER[';PHP_SELF';].';"
in my form action, so don't understand why this could be happening... Any ideas anyone?
avatar
Mac
Re: The Portfolio course_man.php
September 25, 2013 01:09PM
A form cannot submit itself on its own - if you refresh the "submitted" page it will add another course because in this case it resends the submitted information.
Post some code.
Re: The Portfolio course_man.php
September 28, 2013 10:31AM
Hi Prof Mac,

I actually managed to fix it with an if(isset()) that I forgot to add in. So that problem solved! =)

I am now experiencing difficulty with the edit functionality, but first want to take another look at it to see if I can figure out my mistake myself before I ask for help again...
Re: The Portfolio course_man.php
September 28, 2013 01:23PM
Course_man.php page done and dusted! smiling bouncing smiley
Re: The Portfolio course_man.php
October 04, 2013 09:17AM
Hi Everyone

i'm starting with this page and i'm very much lost at this point. on this page "Course_man.php" page i should be able to add new courses to database and edit the ones added already. am i right?
avatar Re: The Portfolio course_man.php
October 04, 2013 09:43AM
And delete.
Re: The Portfolio course_man.php
October 04, 2013 10:57AM
OK that's right,
Re: The Portfolio course_man.php
October 04, 2013 10:59AM
silly question i know, what happens to the Course database table and the course_student database table?
avatar Re: The Portfolio course_man.php
October 04, 2013 11:21AM
If you delete a course, you will also need to delete it from any other table that uses course.
Re: The Portfolio course_man.php
October 04, 2013 11:23AM
Sorry i was not clear about this question. what i meant was this 2 database tables i have to populate manually.
avatar Re: The Portfolio course_man.php
October 04, 2013 11:44AM
Your question has been answered at the top of this topic.
avatar Re: The Portfolio course_man.php
October 04, 2013 11:54AM
I have built in a fail-safe in my course_man page. No course may be deleted without deleting all the students registered for that course first. This prevent courses being deleted while there are still students registered for it.

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
Re: The Portfolio course_man.php
October 04, 2013 01:07PM
Thanks bigron. and Alex what is fail-safe? is it a function or what?
Re: The Portfolio course_man.php
October 04, 2013 02:26PM
What he's saying is that the way he has programmed it, if you want to delete a course, it first checks to see if there are students registered for that course, and if there is, it won't let you delete the course.
It is not a "built in function" that comes with php, it is the way he's structured his logic and coded the program winking smiley
Re: The Portfolio course_man.php
October 04, 2013 03:13PM
Wow,
Re: The Portfolio course_man.php
October 06, 2013 11:03AM
Great idea Alex! I was wondering what would be the best way to approach the deleting of courses.

At this stage I am just trying to get the basic things working on each page, and then planning on going back and adding in precautions like that.
I am done with this page in the sense that I can add, edit and delete courses, but at this stage I do not delete the students taking said course yet.

Something I have been thinking about, maybe anyone give some thoughts on this:
The Tut letter says nothing about if a student should want to register for more than one course. Is anyone making that possible? If so, how are you planning on approaching the deletion of courses? (If you set it up that students taking a course is deleted along with your course, then they will be deleted even though they are taking another course).

The other option is of course that the student has to register separately for each course and then have a different student number for each course. But that just seems like a waste to me...

Like I said, I would love to hear anyone else's train of thinking on this. smile
avatar Re: The Portfolio course_man.php
October 06, 2013 11:40AM
The approach Alex suggested is best. (Although I assume he meant deleting the student registration for a specific course, rather than the actual student).

Do not allow deletion of a course if it is in use elsewhere.
You would have to de-register all students from a specific course, before the course could be deleted.

Deleting a student along with a course is a bit extreme.

Basically you need to ensure that if a course is deleted, it does not exist in any other table.
Re: The Portfolio course_man.php
October 07, 2013 12:12AM
@Elizabeth

The tut letter actually does say that a student can "register online for one (or more) of many courses" (page 8)
With regards to how to delete students then when deleting a course I refer to what bigron11 also said - you don't delete the student from the student table, you'll delete the "connection" that linked that student to the specific course (ie - the entry in the course_student table).

I don't think to have students register separately for each course is a good idea because that would cause a duplication in information, and keeping that information consistent and up to date for all the "versions" of what is actually the same person will be a giant and unnecessary task.
Just as an example : think of what would be necessary if student "John Doe" is registered for 5 different courses and his telephone number changes. Which "version" of him would you update (if he's registered 5 times with 5 different student numbers) and how would you update the other versions of him; how would the system even know that the other versions of him actually refers to the same person?

That's why it's very important to always think about what you will be dealing with before starting a programming project, especially so you can structure your database correctly!
In this case we've been given the database structure, where the students are in their own table, one entry (row) per student, each student having their own unique student number; the courses database with each having their own unique course id; and then a table that connects the two together (course_student).
That should hint, if not tell you how to connect one student to many courses winking smiley
But if you need more help just shout, we're all here for each other!
Re: The Portfolio course_man.php
October 07, 2013 12:26AM
With regards to when deleting a course, to deny the admin to delete it until all students removed is one option, I do feel that there is another option too :

When trying to delete a course, the admin can be given a warning that there are students registered for the course (maybe even list all the students so the admin can see what is going on)
and then ask for confirmation that he wishes to delete the course and thereby remove all those students from said course.


I don't know if there is a "best practice" when it comes to how to do this, I guess it would depend on what the client wants if this was something you were coding as a job for a client / work.
What I like above the second way however is that it doesn't take you away from the page you were working on, which in my opinion makes it faster and more user friendly. But that's only my two cents!! spinning smiley sticking its tongue out
avatar Re: The Portfolio course_man.php
October 07, 2013 11:55AM
In doing this course I had a bit of an unfair advantage. I work as an IT Support Officer for a college. We currently employ a very large system by the name of ITS. This is written in JAVA and all data is stored in an Oracle database. This thing is huge. In supporting this I have taken some of the features in our live system and employed that in my webapp for this course.

Why would you first have to delete all students before deleting a course?
With everything there is always finances connected to it somehow. Be it a bursary or the student paying for himself. If you just delete a course, all those students who have already paid must somehow get their money back. In a live system, if you first delete the registration, the student will get credited automatically by the system. This does not delete the student only the registration.

This is but one thing that one has to keep in mind. Planning before coding is supremely important!!

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
Re: The Portfolio course_man.php
October 07, 2013 12:20PM
Whatever coding needs to be executed when removing a student from a course will still come in play, I just meant that it would be nice if it were executed from the "delete a course" page instead of having to navigate away. winking smiley
Re: The Portfolio course_man.php
October 07, 2013 12:25PM
Hi AlexB,

I think the tut letter states that deleting of the students is optional. I have chosen not to delete the students and plan
to generate a list of the students affected with the option to delete them manually. That is if time allows,
Don't know if I'm going to make the deadline!!!

Regards CharlesU
avatar Re: The Portfolio course_man.php
October 07, 2013 12:28PM
This can be possible. If you were to code your course page in such a way, say for instance, you include a checkbox at the top that will give you an option to show the course with the student registered for it when it is ticked. This will give you a display of :

CourseA
|-------------Student 1 Edit Delete
|-------------Student 2 Edit Delete
CourseB
|-------------Student 1 Edit Delete
|-------------Student 2 Edit Delete


Or if the checkbox is left unchecked:

CourseA
CourseB





78183472 Wrote:
-------------------------------------------------------
> Whatever coding needs to be executed when removing
> a student from a course will still come in play, I
> just meant that it would be nice if it were
> executed from the "delete a course" page instead
> of having to navigate away. winking smiley

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
avatar Re: The Portfolio course_man.php
October 07, 2013 12:30PM
Cool. Good Luck with the deadline. I know how it feels, got near mine and there was still so much that I wanted to change, but kept on breaking stuff that worked.smiling bouncing smiley



78044545CharlesU Wrote:
-------------------------------------------------------
> Hi AlexB,
>
> I think the tut letter states that deleting of the
> students is optional. I have chosen not to delete
> the students and plan
> to generate a list of the students affected with
> the option to delete them manually. That is if
> time allows,
> Don't know if I'm going to make the deadline!!!
>
> Regards CharlesU

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
Re: The Portfolio course_man.php
October 08, 2013 09:35AM
Great ideas you sharing here guys, thank you.

I also don't think registering students seperately for each course is a good idear, it will duplicate info unnecessarily.
My approach of registering a student would be to have a drop-down populated with all already existing courses from your DB, then when you register a student you get to choose which
course to enroll for, then populate the relevant tables.

With the deletion of a course, One cannot delete a course while it is still been enrolled for, before deleting a course u need to check if there are students registered for it first.
If indeed the course needs to be deleted, there is no need to touch the student table, u need to update the relevant student numbers (sno) in the course_student table with a zero for
example, just to remove references to the actual students and then delete the course. and all your students will still be registered for other courses.
Re: The Portfolio course_man.php
October 08, 2013 10:01AM
Hi there,

The way I read it, is that the Administrator has full control of the site. The student cannot stop the Administrator from deleting a course.
We have the choice of deleting the students that land up with no courses but the tut letter suggests that would be a waste. A table of students with
no courses is possible. Please confirm that I've understood Tutorial correctly otherwise it's back to the drawing board for me!

CharlesU
Re: The Portfolio course_man.php
October 09, 2013 12:43PM
Hi

I see what u getting at CharlesU, but still a course cannot be deleted if there are students assigned or registered for it.

Database referential integrity will NOT allow that. whether u are an Administrator or not.

Only courses that have not been registered for will be possible to delete
Re: The Portfolio course_man.php
October 09, 2013 03:13PM
I think what Charles is saying is that there can be students in the database that aren't currently registered to any courses.
Ie - student John Doe exists in the student table, but since he's not currently registered for any courses, there won't be a entry with his student number in the course_student table.

I can't see how that messes up the referential integrity, it's not like there's a student in the course_student table connected to a course id that doesn't exist anymore.
Re: The Portfolio course_man.php
October 09, 2013 10:48PM
Hi there,

The tut letter point 3. bottom of page nine and top of page 10. " For example, when you delete a course you may want to delete all the students associated with
that course. But after careful consideration, it makes sense to keep a history. You may decide to move such students to a history table when the course is deleted,
or you may want to leave the students table intact, but add another flag to the course table so that it is not drawn to the list that students use when they select a course.

I don't understand the last sentence but......

It would make sense to make a table where these students can be deleted individually. In real life they would be given an opportunity to take another course or at the very
least be notified that they are no longer registered for a course.

Regards CharlesU
avatar
Mac
Re: The Portfolio course_man.php
October 10, 2013 09:05AM
By adding a flag you keep the course details in the course table but it is marked as "retired" i.e. you exclude it from the selection list by using an appropriate WHERE query I.e. where flag is/or is not x. If you want to draw a list if retired courses you just adapt the WHERE query accordingly. These are just pointers - the idea is to get you to think and that is what you re doing now smiling smiley
Re: The Portfolio course_man.php
October 10, 2013 09:50AM
Hi and Ooops!

I'm going to loose marks here! If I had time, I was going to make a list of students that were no longer connected to courses.
But I see that would have meant another page!

Regards Charles
avatar Re: The Portfolio course_man.php
October 10, 2013 10:05AM
Not necessarily another page.

If you already have a page that lists students / courses, you could just add an if ..else construct with an alternative sql query that would list either students /courses, or students not registered for any courses.
Would require a small adjustment in the calling script to allow for the options.
Re: The Portfolio course_man.php
October 10, 2013 10:12AM
Thanx Prof Mac

@78183472, I think you missing my point, it does not mess up the referential integrity, but referential integrity does not allow deletion of a parent record if a child record exist - that's all I am saying.

The point is to delete a course, if a course has students registered for it, referential integrity will not allow that deletion to happen, unless u go to the child table which is (student_course) and delete all
references to the students registered for that course you want to delete.
Re: The Portfolio course_man.php
October 10, 2013 10:14AM
You don't event need to touch the student table at this stage
Re: The Portfolio course_man.php
October 10, 2013 10:41AM
Hi Prof

Just bit of clarity from you. In real life a course will not be deleted while students are still registered for it.

What I need to know - does an Administrator get to delete courses that have been enrolled for or courses that do not have students?
avatar Re: The Portfolio course_man.php
October 10, 2013 10:51AM
We have a student administrator that takes care of creating and deleting of courses. Usually a course does not get deleted, it just gets flagged as not being presented any more. In live systems there is always finances and a history of enrolments that is in some way linked to a course. Just deleting a course may result in broken links in the finance and history modules.




Kayc78145228 Wrote:
-------------------------------------------------------
> Hi Prof
>
> Just bit of clarity from you. In real life a
> course will not be deleted while students are
> still registered for it.
>
> What I need to know - does an Administrator get to
> delete courses that have been enrolled for or
> courses that do not have students?

___________________________________________________________________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning...
Re: The Portfolio course_man.php
October 10, 2013 12:00PM
Hi bigron,

If time permits I'll give a go. In the meantime I've built my list based on Textbook Chapter 10, charlist.php as a template. You can clearly see
the all the students and all the courses they are registered for as well the students that are not registered for a course. Fantastic!.
One problem though, you can see their enemies as well !!!!. Comes from working like a parrot.

Regards CharlesU
avatar
Mac
Re: The Portfolio course_man.php
October 10, 2013 12:37PM
Kayc78145228 Wrote:
-------------------------------------------------------
> Hi Prof
>
> Just bit of clarity from you. In real life a
> course will not be deleted while students are
> still registered for it.
>
> What I need to know - does an Administrator get to
> delete courses that have been enrolled for or
> courses that do not have students?

Stop the lorry.... Remember what is discussed here is what is added in the the added functionality document (surprisingly, quite a lot of students do not hand in this document every semester??? This document is as important as the code and counts 20% of the final mark . . ). You do not code what is discussed here because you are not allowed to change the db.

The suggestions in the tut letter is to get you thinking... which quite a few of you are doing now smiling smiley

It would be silly to delete a course with active students/historical students in real life . The only reason one would want to delete a course that has students is if you have stolen student money smiling smiley In testing your app I will add and delete a course, and if I am happy, make it available for students to select, and that is where it stops as far as the minimum requirements go. Now, you can add code that prevents me from deleting a course when students are associated with. This will count as code that makes the app better without changing the db, which counts 30%.
Re: The Portfolio course_man.php
October 10, 2013 03:20PM
I got it 100%. Thanx and good luck to the others thumbs upsmile
avatar
Mac
Re: The Portfolio course_man.php
October 11, 2013 08:50AM
This is the thing about programming in general - as you go along these "other" questions come up. Will this or that not work better? And then you add a few more days of work smiling smiley That is why there are minimum requirements, but also why we leave space for you to expand according to your logic, and which results in a higher mark.
Re: The Portfolio course_man.php
October 11, 2013 10:56AM
Thanks Prof mac,

Most of us are working on " The first priority is that it should work" ! Then taking it from there. I'm taking
it that it is a PHP Course and am using as little HTML as possible. In short making the app, functional
and neat as possible, not pretty.

Regards CharlesU
Re: The Portfolio course_man.php
October 17, 2013 10:46PM
Hi Guys

I am having a little bit of an issue with my code for editing the database, it's not updating the database. Please help

Language: PHP
echo ';<td bgcolor="#FFFFFF" width="5%" align="center"> ';; echo ';<a href="course_man.php?edit=true">Edit</a>';; echo "<div>"; if (!empty($_GET[';edit';])) { echo ';<form name="course_add" action="course_man.php" method="post">';; echo ';<table border="0" width="600" cellspacing="1" cellpadding="3" bgcolor="#666666" align="center">';; echo ';<div>';; echo ';<tr>';; echo ';<td>';; echo ';Course Name';; echo ';</td>';; echo ';<tr>';; echo ';</div>';; echo ';<div>';; echo ';<td>';; echo ';<input type"text" name="cname_update" id="$row["cid"]">';; echo ';</td>';; echo ';</tr>';; echo ';</div>';; echo ';<div>';; echo ';<tr>';; echo ';<td>';; echo ';<input type="submit" name="submit" value="Edit">';; echo ';</td>';; echo ';</tr>';; echo ';</div>';; echo ';</table>';; echo ';</form>';; }   if (!empty($_POST[';cname_update';])) {   //Get values from form $cname_up = $_POST[';cname_update';];   if ($db_found) { $SQL = ';UPDATE course SET cname=$cname_up WHERE cid=$row["cid"] ';; $result = mysql_query($SQL);   } if ($resilt = true) { echo "done"; } DEBUG: print_r ($_POST); }

Regards,

Milan
Sorry, only registered users may post in this forum.

Click here to login