dokeos   dokeos

dokeos > community > forum
Dokeos Forum Forum Index Dokeos Forum

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Fixed 1.6.4] Error when i inscribe Classes in Courses

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Dokeos Forum Forum Index -> Bugs Dokeos 1.6.x
View previous topic :: View next topic  
Author Message
ndorotea



Joined: 08 Feb 2006
Posts: 10

PostPosted: Wed Feb 22, 2006 11:30 pm    Post subject: [Fixed 1.6.4] Error when i inscribe Classes in Courses Reply with quote

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
View user's profile Send private message
bmollet



Joined: 17 Aug 2004
Posts: 1868

PostPosted: Thu Feb 23, 2006 9:14 am    Post subject: Reply with quote

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
View user's profile Send private message
bmollet



Joined: 17 Aug 2004
Posts: 1868

PostPosted: Thu Feb 23, 2006 9:21 am    Post subject: Reply with quote

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
View user's profile Send private message
fredmatrack



Joined: 27 Jan 2006
Posts: 12

PostPosted: Thu Feb 23, 2006 9:53 am    Post subject: Reply with quote

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
View user's profile Send private message
bmollet



Joined: 17 Aug 2004
Posts: 1868

PostPosted: Thu Feb 23, 2006 9:56 am    Post subject: Reply with quote

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
View user's profile Send private message
ndorotea



Joined: 08 Feb 2006
Posts: 10

PostPosted: Fri Feb 24, 2006 11:35 am    Post subject: Reply with quote

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
View user's profile Send private message
pcvowd



Joined: 14 Jul 2005
Posts: 17

PostPosted: Tue Feb 28, 2006 6:34 pm    Post subject: Reply with quote

same problem here
Back to top
View user's profile Send private message Visit poster's website
pcool



Joined: 23 Jun 2003
Posts: 3490
Location: Ghent University

PostPosted: Tue Feb 28, 2006 6:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
TL



Joined: 23 Oct 2005
Posts: 139
Location: SG St-Pieter Beringen-Lummen

PostPosted: Tue Feb 28, 2006 6:59 pm    Post subject: Had the same problems, Reply with quote

Everything OK now THNKS

Back to top
View user's profile Send private message Send e-mail Visit poster's website
pcvowd



Joined: 14 Jul 2005
Posts: 17

PostPosted: Wed Mar 01, 2006 1:02 pm    Post subject: Reply with quote

In what file do I replace that?
Back to top
View user's profile Send private message Visit poster's website
bmollet



Joined: 17 Aug 2004
Posts: 1868

PostPosted: Wed Mar 01, 2006 1:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
ndorotea



Joined: 08 Feb 2006
Posts: 10

PostPosted: Wed Mar 01, 2006 7:40 pm    Post subject: Reply with quote

Perfect.

Thanks
Back to top
View user's profile Send private message
pcvowd



Joined: 14 Jul 2005
Posts: 17

PostPosted: Wed Mar 01, 2006 7:44 pm    Post subject: Reply with quote

Problem solved.

Thank you !

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Dokeos Forum Forum Index -> Bugs Dokeos 1.6.x All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP