| View previous topic :: View next topic |
| Author |
Message |
ndorotea
Joined: 08 Feb 2006 Posts: 10
|
Posted: Wed Feb 22, 2006 11:30 pm Post subject: [Fixed 1.6.4] Error when i inscribe Classes in Courses |
|
|
Hi,
when i try to associate classes or users to a course, i get the following error:
Fatal error: Undefined class name 'rolesrights' in F:\WebSites\aprender\claroline\inc\lib\course.lib.php on line 261
and the association is canceled.
I upgrade dokeos from 1.6.2 to 1.6.3. In 1.6.2 all worked fine.
What can i do to solve this problem ? |
|
| |
| Back to top |
|
 |
bmollet
Joined: 17 Aug 2004 Posts: 1868
|
Posted: Thu Feb 23, 2006 9:14 am Post subject: |
|
|
It looks like some code from the community release has been added in this 1.6.3 version. I'll fix this and let you know how to solve this. _________________ Bart Mollet - Hogeschool Gent - Digitaal Leren |
|
| |
| Back to top |
|
 |
bmollet
Joined: 17 Aug 2004 Posts: 1868
|
Posted: Thu Feb 23, 2006 9:21 am Post subject: |
|
|
Ok. You can fix this by replacing the function subscribe_user in the file ~/claroline/inc/lib/course.lib.php by following code:
/**
* Subscribe a user to a course. No checks are performed here to see if
* course subscription is allowed.
* @see add_user_to_course
*/
function subscribe_user($user_id, $course_code, $status = STUDENT)
{
$user_table = Database :: get_main_table(MAIN_USER_TABLE);
$course_table = Database :: get_main_table(MAIN_COURSE_TABLE);
$course_user_table = Database :: get_main_table(MAIN_COURSE_USER_TABLE);
$status = ($status == STUDENT || $status == COURSEMANAGER) ? $status : STUDENT;
if (empty ($user_id) || empty ($course_code))
{
return false;
}
else
{
// previously check if the user are already registered on the platform
$handle = api_sql_query("SELECT status FROM ".$user_table."
WHERE `user_id` = '$user_id' ");
if (mysql_num_rows($handle) == 0)
{
return false; // the user isn't registered to the platform
}
else
{
//check if user isn't already subscribed to the course
$handle = api_sql_query("SELECT * FROM ".$course_user_table."
WHERE `user_id` = '$user_id'
AND `course_code` ='$course_code'");
if (mysql_num_rows($handle) > 0)
{
return false; // the user is already subscribed to the course
}
else
{
$max_sort = api_max_sort_value('0', $user_id);
$add_course_user_entry_sql = "INSERT INTO ".$course_user_table."
SET `course_code` = '$course_code',
`user_id` = '$user_id',
`status` = '".$status."',
`sort` = '". ($max_sort +1)."'";
$result = api_sql_query($add_course_user_entry_sql);
if ($result )
{
return true;
}
else
{
return false;
}
}
}
}
} _________________ Bart Mollet - Hogeschool Gent - Digitaal Leren |
|
| |
| Back to top |
|
 |
fredmatrack
Joined: 27 Jan 2006 Posts: 12
|
Posted: Thu Feb 23, 2006 9:53 am Post subject: |
|
|
| If I download the 1.6.3 file from the Dokeos-site (to do an upgrade from 1.6.2), is this bug still there or is it already fixed in that download? |
|
| |
| Back to top |
|
 |
bmollet
Joined: 17 Aug 2004 Posts: 1868
|
Posted: Thu Feb 23, 2006 9:56 am Post subject: |
|
|
| fredmatrack wrote: | | If I download the 1.6.3 file from the Dokeos-site (to do an upgrade from 1.6.2), is this bug still there or is it already fixed in that download? |
I've informed all developers on our maillist about this just after I've posted the message above. I don't think the download-packages are fixed allready. _________________ Bart Mollet - Hogeschool Gent - Digitaal Leren |
|
| |
| Back to top |
|
 |
ndorotea
Joined: 08 Feb 2006 Posts: 10
|
Posted: Fri Feb 24, 2006 11:35 am Post subject: |
|
|
Hello,
i've made the changes, and now i get this error:
Fatal error: Call to undefined function: api_max_sort_value() in
F:/ WebSites/aprender/claroline/ inc/lib/course.lib.php on line 286
thanks. |
|
| |
| Back to top |
|
 |
pcvowd
Joined: 14 Jul 2005 Posts: 17
|
Posted: Tue Feb 28, 2006 6:34 pm Post subject: |
|
|
| same problem here |
|
| |
| Back to top |
|
 |
pcool
Joined: 23 Jun 2003 Posts: 3490 Location: Ghent University
|
Posted: Tue Feb 28, 2006 6:42 pm Post subject: |
|
|
api_max_sort_value() is probably named max_sort_value() in your installation.
try to replace api_max_sort_value() by max_sort_value() _________________ Patrick Cool, ICT&O, Ghent University (UGent)
Minerva - home of more than 30.000 active 'Dokeos' users
http://icto.ugent.be |
|
| |
| Back to top |
|
 |
TL
Joined: 23 Oct 2005 Posts: 139 Location: SG St-Pieter Beringen-Lummen
|
Posted: Tue Feb 28, 2006 6:59 pm Post subject: Had the same problems, |
|
|
Everything OK now THNKS |
|
| |
| Back to top |
|
 |
pcvowd
Joined: 14 Jul 2005 Posts: 17
|
Posted: Wed Mar 01, 2006 1:02 pm Post subject: |
|
|
| In what file do I replace that? |
|
| |
| Back to top |
|
 |
bmollet
Joined: 17 Aug 2004 Posts: 1868
|
Posted: Wed Mar 01, 2006 1:17 pm Post subject: |
|
|
| pcvowd wrote: | | In what file do I replace that? |
claroline/ inc/lib/course.lib.php on line 286
Edit: Fixed now in 1.6.x branch _________________ Bart Mollet - Hogeschool Gent - Digitaal Leren |
|
| |
| Back to top |
|
 |
ndorotea
Joined: 08 Feb 2006 Posts: 10
|
Posted: Wed Mar 01, 2006 7:40 pm Post subject: |
|
|
Perfect.
Thanks |
|
| |
| Back to top |
|
 |
pcvowd
Joined: 14 Jul 2005 Posts: 17
|
Posted: Wed Mar 01, 2006 7:44 pm Post subject: |
|
|
Problem solved. Thank you ! |
|
| |
| Back to top |
|
 |
|