chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
798 stars 480 forks source link

Lp subscription to user in v2 #3808

Closed jmontoyaa closed 1 year ago

jmontoyaa commented 3 years ago

In 1.11.x there are some user subscriptions that use the c_item_property table

Lp subscription to user
Lp subscription to group
Lp subscription to class

Lp category subscription to user
Lp category subscription to class
Lp category subscription to group
christianbeeznest commented 2 years ago

It is implemented for chamilo 2 in this PR https://github.com/chamilo/chamilo-lms/pull/4333

Thanks for confirmation.

NicoDucou commented 1 year ago

@christianbeeznest I'm sorry but I can can not try your PR #4333 because I can not install a new Chamilo with this branch and if I just do a quick update I get errors when trying on testing24.beeznest.com

Could you put it on testing23.beeznest.com so that I could try it please ?

Best regards

NicoDucou commented 1 year ago

The first problem is in the LP creation the 'Advanced settings" button do not open the advanced setting so we can not modify it. The second problem is that When filling only a LP name and clicking on "Continue" the LP does not get created and we have the following error : An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'next_lp_id' cannot be null The next_lp_id should be able to be null in the case we do not have a sequence and by default when we create a new LP it should be null.

christianbeeznest commented 1 year ago

Reg error in query is fixed in this PR https://github.com/chamilo/chamilo-lms/pull/4727

christianbeeznest commented 1 year ago

Hi Nicolas,

Could you use this new PR for this issue please https://github.com/chamilo/chamilo-lms/pull/4730 , first should be added the #4727

Thanks.

NicoDucou commented 1 year ago

Hi @christianbeeznest

I'm testing your branch GH-3411-3 but I can not assign users to the LP. On the page for user assignation (https://testing24.beeznest.com/main/lp/lp_subscribe_users.php?lp_id=4&cid=1&sid=0&gid=0&gradebook=0&origin=) I have the list of users on the left hand side but when I click on the arrow to move the user to the right column nothing happens, so I can not test the user subscription. image

The same thing happens in the group tool in a course, once the group is created I can enter the user's assignation to the group, for example here : https://testing24.beeznest.com/main/group/member_settings.php?cid=1&sid=0&gradebook=0&origin=&gid=1 I can select from the left hand side the users but when clicking on the arrow to move the user to the right column nothing happens so no users can be assigned to the group.

The assignation of users works fine in Master and when doing a merge with master the group tool user assignation works. But for the user assignation for LP subscription when I open the LP tool (https://testing24.beeznest.com/main/lp/lp_controller.php?cid=1&sid=0&gid=0) I get this error :

Context: Using short namespace alias "ChamiloCourseBundle:CLpRelUser" when calling Doctrine\ORM\EntityManager::getRepository
Problem: Feature was deprecated in doctrine/persistence 2.x and is not supported by installed doctrine/persistence:3.x
Solution: See the doctrine/deprecations logs for new alternative approaches.
ExceptionLogs 2Stack Trace
Doctrine\ORM\Exception\
NotSupported
in vendor/doctrine/orm/lib/Doctrine/ORM/Exception/NotSupported.php (line 31)
in vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php :: createForPersistence3 (line 821)
in var/cache/dev/ContainerIXSTNeP/proxy-classes.php -> getRepository (line 228)
EntityManager_9a5be93->getRepository()
in public/main/lp/learnpath.class.php (line 1905)
    ): bool {        $isVisible = true;        $em = Database::getManager();        /** @var \Chamilo\CourseBundle\Repository\CLpRelUserRepository $cLpRelUserRepo */        $cLpRelUserRepo = $em->getRepository('ChamiloCourseBundle:CLpRelUser');        // Getting subscribed users to a LP.        $subscribedUsersInLp = $cLpRelUserRepo->getUsersSubscribedToItem(            $lp,            $course,
learnpath::isUserSubscribedToLp()
in public/main/lp/learnpath.class.php (line 1845)
learnpath::is_lp_visible_for_student()
in public/main/lp/lp_list.php (line 241)
require('/var/www/testing24.beeznest.com/www/public/main/lp/lp_list.php')
in public/main/lp/lp_controller.php (line 1129)

So you need to do a merge with master in your branch and then fix this error to be able to finalize the testing on this issue. Do not forget to assign me the issue when it is ready so that I can test it quickly.

christianbeeznest commented 1 year ago

Thank you @NicoDucou , I just created other PR https://github.com/chamilo/chamilo-lms/pull/4747 with last changes in master.

NicoDucou commented 1 year ago

Hi @christianbeeznest It now works for user subscription to a LP. Good work, So I accepted this PR. But I'm not closign the issue because I could not test the LP category subscription because de LP Category creation do not work (It does not work on master neither).

When creating a LP category on https://testing24.beeznest.com/main/lp/lp_controller.php?cid=1&sid=0&gid=0&gradebook=0&origin=&action=add_lp_category it throws this error :

Neither the property "id" nor one of the methods "id()", "getid()"/"isid()"/"hasid()" or "__call()" exist and have public access in class "Chamilo\CourseBundle\Entity\CLpCategory".
ExceptionLogs 2Stack Trace
Twig\Error\
RuntimeError
in [src/CoreBundle/Resources/views/LearnPath/list.html.twig ](https://testing24.beeznest.com/_profiler/open?file=src/CoreBundle/Resources/views/LearnPath/list.html.twig&line=345#line345)(line 345)
                                </div>                            </div>                        {% endif %}                    {% endif %}                    {% if categories|length > 1 and lp_data.category.id %}                        <div class="panel panel-default">                            <div class="panel-heading" role="tab" id="heading-{{ lp_data.category.iid }}">                                {% if is_allowed_to_edit %}                                    <div class="tools-actions pull-right">                                        {% if lp_data.category.iid > 0 %}
in [var/cache/dev/twig/68/68d1030a7b14ed43f4d3e289e99c16da.php ](https://testing24.beeznest.com/_profiler/open?file=var/cache/dev/twig/68/68d1030a7b14ed43f4d3e289e99c16da.php&line=1001#line1001)twig_get_attribute (line 1001)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=171#line171)-> block_content (line 171)
in [var/cache/dev/twig/cf/cf96c43b79ec218f60a35e0d1b804e6d.php ](https://testing24.beeznest.com/_profiler/open?file=var/cache/dev/twig/cf/cf96c43b79ec218f60a35e0d1b804e6d.php&line=201#line201)-> displayBlock (line 201)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=171#line171)-> block_page_content (line 171)
in [var/cache/dev/twig/c4/c43be84a50c4a9f04811bb6079322add.php ](https://testing24.beeznest.com/_profiler/open?file=var/cache/dev/twig/c4/c43be84a50c4a9f04811bb6079322add.php&line=148#line148)-> displayBlock (line 148)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=171#line171)-> block_chamilo_wrap (line 171)
in [var/cache/dev/twig/c4/c43be84a50c4a9f04811bb6079322add.php ](https://testing24.beeznest.com/_profiler/open?file=var/cache/dev/twig/c4/c43be84a50c4a9f04811bb6079322add.php&line=82#line82)-> displayBlock (line 82)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=394#line394)-> doDisplay (line 394)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=367#line367)-> displayWithErrorHandling (line 367)
in [var/cache/dev/twig/cf/cf96c43b79ec218f60a35e0d1b804e6d.php ](https://testing24.beeznest.com/_profiler/open?file=var/cache/dev/twig/cf/cf96c43b79ec218f60a35e0d1b804e6d.php&line=49#line49)-> display (line 49)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=394#line394)-> doDisplay (line 394)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=367#line367)-> displayWithErrorHandling (line 367)
in [var/cache/dev/twig/68/68d1030a7b14ed43f4d3e289e99c16da.php ](https://testing24.beeznest.com/_profiler/open?file=var/cache/dev/twig/68/68d1030a7b14ed43f4d3e289e99c16da.php&line=48#line48)-> display (line 48)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=394#line394)-> doDisplay (line 394)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=367#line367)-> displayWithErrorHandling (line 367)
in [vendor/twig/twig/src/Template.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Template.php&line=379#line379)-> display (line 379)
in [vendor/twig/twig/src/TemplateWrapper.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/TemplateWrapper.php&line=40#line40)-> render (line 40)
in [vendor/twig/twig/src/Environment.php ](https://testing24.beeznest.com/_profiler/open?file=vendor/twig/twig/src/Environment.php&line=280#line280)-> render (line 280)
Environment->render()
in [public/main/inc/lib/template.lib.php ](https://testing24.beeznest.com/_profiler/open?file=public/main/inc/lib/template.lib.php&line=694#line694)(line 694)
Template->returnResponse()
in [public/main/inc/lib/template.lib.php ](https://testing24.beeznest.com/_profiler/open?file=public/main/inc/lib/template.lib.php&line=207#line207)(line 207)
Template->displayTemplate()
in [public/main/lp/lp_list.php ](https://testing24.beeznest.com/_profiler/open?file=public/main/lp/lp_list.php&line=929#line929)(line 929)
require('/var/www/testing24.beeznest.com/www/public/main/lp/lp_list.php')
in [public/main/lp/lp_controller.php ](https://testing24.beeznest.com/_profiler/open?file=public/main/lp/lp_controller.php&line=940#line940)(line 940)

I did not find the icon for group / class subscription to LP, or I did not understand how to do it, so I did not test this part neither.

christianbeeznest commented 1 year ago

Hi @NicoDucou The error about lp categories is fixed in this PR https://github.com/chamilo/chamilo-lms/pull/4752

Thanks for confirmation.

NicoDucou commented 1 year ago

Hi @christianbeeznest I've accepted PR #4752 because it solved the issue with categories and now we can subscribe users to categories. One remark. The table for the relation between lp categories and users is called c_lp_category_user and it should be called c_lp_category_rel_user to be coherent with the other table naming. Could you change the name of the table please.

Also I did not find how to subscribe a group to a LP and a group to a LP Category, there is nothing in the interface to enable this. Could you indicate where it can be done if it is implemented or implement it if it does not exist yet.

christianbeeznest commented 1 year ago

Hi @NicoDucou

The last request is done in this PR https://github.com/chamilo/chamilo-lms/pull/4758

Reg subscribe a group to LP , you can see in the same interfaz other opcion named "Subscribe groups to category"

Thanks for confirmation.

NicoDucou commented 1 year ago

You are right I did not see the indication. All good for this and for the table renaming, so closing this task. good work