dokeos-library
[ class tree: dokeos-library ] [ index: dokeos-library ] [ all elements ]

Class: CourseManager

Source Location: /main/inc/lib/course.lib.php

Class Overview




Methods



Class Details

[line 177]


[ Top ]


Class Methods


method add_user_to_course [line 344]

boolean add_user_to_course( int $user_id, string $course_code, [string $status = STUDENT])

Subscribe a user $user_id to a course $course_code.



Tags:

return:  true if subscription succeeds, boolean false otherwise.
author:  Roan Embrechts
author:  Hugues Peeters
todo:  script has ugly ifelseifelseifelseif structure, improve


Parameters:

int   $user_id   the id of the user
string   $course_code   the course code
string   $status   (optional) The user's status in the course

[ Top ]

method attempt_create_virtual_course [line 1236]

void attempt_create_virtual_course( $real_course_code, $course_title, $wanted_course_code, $course_language, $course_category)

Checks all parameters needed to create a virtual course.

If they are all set, the virtual course creation procedure is called.

Call this function instead of create_virtual_course




Parameters:

   $real_course_code  
   $course_title  
   $wanted_course_code  
   $course_language  
   $course_category  

[ Top ]

method check_parameter [line 465]

true check_parameter( $parameter, $error_message)

Checks wether a parameter exists.

If it doesn't, the function displays an error message.




Tags:

return:  if parameter is set and not empty, false otherwise
todo:  move function to better place, main_api ?


Parameters:

   $parameter  
   $error_message  

[ Top ]

method check_parameter_or_fail [line 479]

void check_parameter_or_fail( $parameter, $error_message)

Lets the script die when a parameter check fails.



Tags:

todo:  move function to better place, main_api ?


Parameters:

   $parameter  
   $error_message  

[ Top ]

method create_combined_code [line 715]

void create_combined_code( $user_is_registered_in_real_course, $real_course_code, $virtual_course_list)

Create a course code based on all real and virtual courses the user is registered in.



Parameters:

   $user_is_registered_in_real_course  
   $real_course_code  
   $virtual_course_list  

[ Top ]

method create_combined_name [line 688]

void create_combined_name( boolean $user_is_registered_in_real_course, $real_course_name, $virtual_course_list, string $real_course_name,, array $virtual_course_list,)

Create a course title based on all real and virtual courses the user is registered in.



Parameters:

boolean   $user_is_registered_in_real_course  
string   $real_course_name,   the title of the real course
array   $virtual_course_list,   the list of virtual courses
   $real_course_name  
   $virtual_course_list  

[ Top ]

method create_database_dump [line 1504]

void create_database_dump( $course_code $course_code)

Creates a file called mysql_dump.sql in the course folder



Tags:

todo:  Implementation for single database


Parameters:

$course_code   $course_code   The code of the course

[ Top ]

method create_virtual_course [line 1263]

true create_virtual_course( $real_course_code, $course_title, $wanted_course_code, $course_language, $course_category)

This function creates a virtual course.

It assumes all parameters have been checked and are not empty. It checks wether a course with the $wanted_course_code already exists.

Users of this library should consider this function private, please call attempt_create_virtual_course instead of this one.

NOTE: The virtual course 'owner' id (the first course admin) is set to the CURRENT user id.




Tags:

return:  if the course creation succeeded, false otherwise
todo:  research: expiration date of a course


Parameters:

   $real_course_code  
   $course_title  
   $wanted_course_code  
   $course_language  
   $course_category  

[ Top ]

method delete_course [line 1323]

void delete_course( string $code)

Delete a course This function deletes a whole course-area from the platform. When the given course is a virtual course, the database and directory will not be deleted.

When the given course is a real course, also all virtual courses refering to the given course will be deleted. Considering the fact that we remove all traces of the course in the main database, it makes sense to remove all tracking as well (if stats databases exist) so that a new course created with this code would not use the remains of an older course.




Tags:

todo:  When deleting a virtual course: unsubscribe users from that virtual course from the groups in the real course if they are not subscribed in that real course.
todo:  Remove globals


Parameters:

string   $code   The code of the course to delete

[ Top ]

method determine_course_title_from_course_info [line 614]

an determine_course_title_from_course_info( $user_id, $user_id, $course_info, $course_info)

Find out for which courses the user is registered and determine a visual course code and course title from that.

Takes virtual courses into account

Default case: the name and code stay what they are.

Scenarios:

  • User is registered in real course and virtual courses; name / code become a mix of all
  • User is registered in real course only: name stays that of real course
  • User is registered in virtual course only: name becomes that of virtual course
  • user is not registered to any of the real/virtual courses: name stays that of real course
(I'm not sure about the last case, but this seems not too bad)




Tags:

return:  array with indices $return_result["title"] - the course title of the combined courses $return_result["code"] - the course code of the combined courses
author:  Roan Embrechts


Parameters:

$user_id,   $user_id   the id of the user
$course_info,   $course_info   an array with course info that you get using Database::get_course_info($course_system_code);

[ Top ]

method get_access_settings [line 205]

an get_access_settings( $course_code, string $course_code,)

Returns the access settings of the course: which visibility; wether subscribing is allowed; wether unsubscribing is allowed.



Tags:

return:  array with int fields "visibility", "subscribe", "unsubscribe"
todo:  for more consistency: use course_info call from database API


Parameters:

string   $course_code,   the course code
   $course_code  

[ Top ]

method get_coach_list_from_course_code [line 1060]

void get_coach_list_from_course_code( $course_code, $session_id)



Parameters:

   $course_code  
   $session_id  

[ Top ]

method get_course_information [line 185]

an get_course_information( $course_code, string $course_code,)

Returns all the information of a given coursecode



Tags:

return:  array with all the fields of the course table
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University


Parameters:

string   $course_code,   the course code
   $course_code  

[ Top ]

method get_course_list_of_user_as_course_admin [line 572]

an get_course_list_of_user_as_course_admin( $user_id)



Tags:

return:  array with the course info of all the courses (real and virtual) of which the current user is course admin


Parameters:

   $user_id  

[ Top ]

method get_group_list_of_course [line 1209]

void get_group_list_of_course( $course_code)



Parameters:

   $course_code  

[ Top ]

method get_list_of_virtual_courses_for_specific_user_and_real_course [line 1181]

array get_list_of_virtual_courses_for_specific_user_and_real_course( $user_id, $user_id, $real_course_code, $real_course_code)

Return an array of arrays, listing course info of all courses in the list linked to the real course $real_course_code, to which the user $user_id is subscribed.



Tags:

return:  of course info arrays


Parameters:

$user_id,   $user_id   the id (int) of the user
$real_course_code,   $real_course_code   the id (char) of the real course

[ Top ]

method get_real_and_linked_user_list [line 1146]

array get_real_and_linked_user_list( $course_code, [ $with_sessions = true], [ $session_id = 0], array $course_info)

Return user info array of all users registered in the specified course this includes the users of the course itsel and the users of all linked courses.



Tags:

return:  with user info


Parameters:

array   $course_info  
   $course_code  
   $with_sessions  
   $session_id  

[ Top ]

method get_real_course_code_select_html [line 426]

a get_real_course_code_select_html( string $element_name, [ $has_size = true], [ $only_current_user_courses = true], $user_id, boolean $has_size,, boolean $only_current_user_courses,)

This code creates a select form element to let the user choose a real course to link to.

A good non-display library should not use echo statements, but just return text/html so users of the library can choose when to display.

We display the course code, but internally store the course id.




Tags:

return:  string containing html code for a form select element.
deprecated:  Function not in use


Parameters:

boolean   $has_size,   true the select tag gets a size element, false it stays a dropdownmenu
boolean   $only_current_user_courses,   true only the real courses of which the current user is course admin are displayed, false all real courses are shown.
string   $element_name   the name of the select element
   $has_size  
   $only_current_user_courses  
   $user_id  

[ Top ]

method get_real_course_list [line 510]

an get_real_course_list( )



Tags:

return:  array with the course info of all real courses on the platform


[ Top ]

method get_real_course_list_of_user_as_course_admin [line 544]

an get_real_course_list_of_user_as_course_admin( $user_id)



Tags:

return:  array with the course info of the real courses of which the current user is course admin


Parameters:

   $user_id  

[ Top ]

method get_student_list_from_course_code [line 1103]

array get_student_list_from_course_code( string $course_code, [ $with_session = false], [ $session_id = 0], boolean $full)

Return user info array of all users registered in the specified real or virtual course This only returns the users that are registered in this actual course, not linked courses.



Tags:

return:  with user id


Parameters:

string   $course_code  
boolean   $full   list to true if we want sessions students too
   $with_session  
   $session_id  

[ Top ]

method get_target_of_linked_course [line 845]

the get_target_of_linked_course( the $virtual_course_code)

This function returns the course code of the real course to which a virtual course is linked.



Tags:

return:  course code of the real course


Parameters:

the   $virtual_course_code   course code of the virtual course

[ Top ]

method get_user_in_course_status [line 220]

int get_user_in_course_status( $user_id, $course_code)

Returns the status of a user in a course, which is COURSEMANAGER or STUDENT.



Tags:

return:  the status of the user in that course


Parameters:

   $user_id  
   $course_code  

[ Top ]

method get_user_list_from_course_code [line 1015]

array get_user_list_from_course_code( string $course_code, [ $with_session = true], [ $session_id = 0])

Return user info array of all users registered in the specified real or virtual course This only returns the users that are registered in this actual course, not linked courses.



Tags:

return:  with user info


Parameters:

string   $course_code  
   $with_session  
   $session_id  

[ Top ]

method get_virtual_courses_linked_to_real_course [line 824]

void get_virtual_courses_linked_to_real_course( $real_course_code, $real_course_code)

Return an array of arrays, listing course info of all virtual course linked to the real course ID $real_course_code



Parameters:

$real_course_code,   $real_course_code   the id of the real course which the virtual courses are linked to

[ Top ]

method get_virtual_course_info [line 743]

void get_virtual_course_info( $real_course_code, $real_course_code)

Return course info array of virtual course

Note this is different from getting information about a real course!




Parameters:

$real_course_code,   $real_course_code   the id of the real course which the virtual course is linked to

[ Top ]

method get_virtual_course_list [line 527]

an get_virtual_course_list( )



Tags:

return:  array with the course info of all virtual courses on the platform


[ Top ]

method has_virtual_courses_from_code [line 803]

true has_virtual_courses_from_code( $real_course_code, $user_id)



Tags:

return:  if the real course has virtual courses that the user is subscribed to, false otherwise


Parameters:

   $real_course_code  
   $user_id  

[ Top ]

method is_course_teacher [line 922]

true is_course_teacher( $user_id, $user_id, $course_code, $course_code)

Is the user a teacher in the given course?



Tags:

return:  if the user is a teacher in the course, false otherwise


Parameters:

$user_id,   $user_id   the id (int) of the user
$course_code,   $course_code   the course code

[ Top ]

method is_existing_course_code [line 489]

true is_existing_course_code( $wanted_course_code)



Tags:

return:  if there already are one or more courses with the same code OR visual_code (visualcode), false otherwise


Parameters:

   $wanted_course_code  

[ Top ]

method is_user_subscribed_in_course [line 872]

true is_user_subscribed_in_course( $user_id, $user_id, $course_info, $course_code, [ $in_a_session = false])

Return course info array of virtual course



Tags:

return:  if the user is registered in the course, false otherwise


Parameters:

$user_id,   $user_id   the id (int) of the user
$course_info,   $course_code   array with info about the course (comes from course table)
   $in_a_session  

[ Top ]

method is_user_subscribed_in_real_or_linked_course [line 939]

true is_user_subscribed_in_real_or_linked_course( $user_id, $user_id, $course_info, $course_code, [ $session_id = ''])

Is the user subscribed in the real course or linked courses?



Tags:

return:  if the user is registered in the real course or linked courses, false otherwise


Parameters:

$user_id,   $user_id   the id (int) of the user
$course_info,   $course_code   array with info about the course (comes from course table, see database lib)
   $session_id  

[ Top ]

method is_virtual_course_from_system_code [line 760]

true is_virtual_course_from_system_code( $system_code, string $system_code,)



Tags:

return:  if the course is a virtual course, false otherwise


Parameters:

string   $system_code,   the system code of the course
   $system_code  

[ Top ]

method is_virtual_course_from_visual_code [line 782]

true is_virtual_course_from_visual_code( $visual_code)

What's annoying is that you can't overload functions in PHP.



Tags:

return:  if the course is a virtual course, false otherwise


Parameters:

   $visual_code  

[ Top ]

method subscribe_user [line 275]

void subscribe_user( $user_id, $course_code, [ $status = STUDENT])

Subscribe a user to a course. No checks are performed here to see if course subscription is allowed.



Tags:



Parameters:

   $user_id  
   $course_code  
   $status  

[ Top ]

method unsubscribe_user [line 235]

void unsubscribe_user( int|array $user_id, string $course_code)

Unsubscribe one or more users from a course



Parameters:

int|array   $user_id  
string   $course_code  

[ Top ]

method userCourseSort [line 1542]

void userCourseSort( $user_id, $course_code)



Parameters:

   $user_id  
   $course_code  

[ Top ]


Documentation generated on Wed, 05 Sep 2007 06:14:30 +0200 by phpDocumentor 1.4.0