GithubHelp home page GithubHelp logo

moodle-an-hochschulen / moodle-availability_cohort Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 4.0 105 KB

Moodle availability plugin which lets users restrict resources, activities and sections based on cohorts.

License: GNU General Public License v3.0

PHP 74.85% Gherkin 25.15%
moodle moodle-availability moodle-plugin

moodle-availability_cohort's People

Contributors

abias avatar andrewhancox avatar kathrin84 avatar lucaboesch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

moodle-availability_cohort's Issues

Move away from YUI

This issue serves as a reminder that this plugin still uses YUI in its JavaScript code.
Currently, I am not aware that you can build availability_* plugins without YUI.
But as soon as Moodle core supports this, this plugin should be adapted.

Add contains or equals opperator

Hi
I have a request that I think would add great value to the plugin.
In our case specifically we work with many different companies who have different branches within the company, so my example will be based on this, but it could easily be applied to different teachers teaching the same course but having separate cohorts per teacher.

If you have for instance you have 10 companies each with 20 branches you end up with 200 cohorts.

Company all 10 companies get access to the same study material and content with one exception each one has a custom certificate for their company, which means using your plugin we can achieve this by restricting each certificate to the 20 cohorts linked to that company, but this does mean adding 200 restriction rules per course, which sucks but I can deal with that if I must.
Where my issue comes in is company one then opens 2 new branches which means that besides creating the cohort's we need to remember to go add these 2 new cohorts to all the restriction settings in all the courses. We use a cohort naming convention of "Company Name - Branch - subbranch"

What I would like to propose is a way to tell the plugin to restrict based on "Cohort Name Contains" or "Cohort Name =" (which is basically what ti doe now.

The Contains function would allow people to enter a portion of the cohort name and restrict based on any cohort that contains that word, which drastically cuts down on the amount of restriction rules that need to be added to an activity.

only 25 cohorts are displayed

In my organisation, we have hundreds of cohorts (for a specific reason), the 25 limit is inappropriate.

Would it be possible to use the in-place search that we can find during the cohort enrollment ?

Transfer cohort functions to Moodle core

In locallib.php, there are some functions which are used to gather information about multiple cohorts at once.
It would be worthwhile to transfer these functions to Moodle core to /lib/cohortlib.php

Error when trying to remove/rename elements in section restricted with cohort access

I have a section of a course restricted to a cohort. If a person with manager role tries to add content it's all fine, however, when he tries to rename/delete content he receives the following error:

Error code: codingerror
* line 498 of /lib/pagelib.php: coding_exception thrown
* line 830 of /lib/pagelib.php: call to moodle_page->magic_get_context()
* line 1456 of /lib/weblib.php: call to moodle_page->__get()
* line 169 of /availability/condition/cohort/classes/condition.php: call to format_string()
* line 159 of /availability/classes/condition.php: call to availability_cohort\condition->get_description()
* line 526 of /availability/classes/tree.php: call to core_availability\condition->get_standalone_description()
* line 476 of /availability/classes/tree.php: call to core_availability\tree->get_full_information_recursive()
* line 216 of /availability/classes/info.php: call to core_availability\tree->get_result_information()
* line 2774 of /lib/modinfolib.php: call to core_availability\info->is_available()
* line 2737 of /lib/modinfolib.php: call to section_info->get_available()
* line 1900 of /lib/modinfolib.php: call to section_info->__get()
* line 1921 of /lib/modinfolib.php: call to cm_info->obtain_dynamic_data()
* line 1234 of /lib/modinfolib.php: call to cm_info->get_user_visible()
* line 3030 of /lib/moodlelib.php: call to cm_info->__get()
* line 515 of /lib/externallib.php: call to require_login()
* line 91 of /course/classes/output/course_module_name.php: call to external_api::validate_context()
* line 3776 of /course/lib.php: call to core_course\output\course_module_name::update()
* line 8059 of /lib/moodlelib.php: call to core_course_inplace_editable()
* line 478 of /lib/external/externallib.php: call to component_callback()
* line 261 of /lib/externallib.php: call to core_external::update_inplace_editable()
* line 81 of /lib/ajax/service.php: call to external_api::call_external_function()

He has all the rights for cohort:
image

What could be the problem?

As admin I can rename/remove content without problems. Once the restriction is removed also managers can rename/remove content.

error when copy a course that use availability_cohort

Hi. thank you for developing this useful module.
When copy a course that use availability cohort module, copy failed. this error in log appear

Adhoc task failed: core\task\asynchronous_copy_task,Call to undefined function availability_cohort\cohort_get_cohort()
Backtrace:

  • line 680 of /availability/classes/tree.php: call to availability_cohort\condition->include_after_restore()
  • line 323 of /availability/classes/info.php: call to core_availability\tree->update_after_restore()
  • line 926 of /backup/moodle2/restore_stepslib.php: call to core_availability\info->update_after_restore()
  • line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_update_availability->define_execution()
  • line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
  • line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
  • line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 385 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 137 of /lib/classes/task/asynchronous_copy_task.php: call to restore_controller->execute_plan()
  • line 341 of /lib/cronlib.php: call to core\task\asynchronous_copy_task->execute()
  • line 198 of /lib/cronlib.php: call to cron_run_inner_adhoc_task()
  • line 76 of /lib/cronlib.php: call to cron_run_adhoc_tasks()
  • line 178 of /admin/cli/cron.php: call to cron_run()

When i remove that activity that use availability cohort module, copy become successful.

is this already in core or what do I understand under "cohort"?

Hi, there are already groups in core moodle, so for what is the cohort? Sorry, I do not understand the plugin description. Perhaps you can also show a picture with the settings of one activity or participants? Or is the cohort one step higher than a course?
(I'm also fine with an answer in german or PM ;-)

Not all cohorts available in selection menu

We use v. v3.5-r3 of the plugin in Moodle 3.5 - I can't select from all cohorts, because the list only shows the first 25 of currently 54 global cohorts. That resembles exactly the first page in the cohorts-management section. How can I set the rest of the cohorts with the plugin? (In other areas usually all items are available in the respective menues...)

Cohort selection limited to 25 cohorts

The use of cohort_get_available_cohorts($context); in frontend.php (https://github.com/moodleuulm/moodle-availability_cohort/blob/master/classes/frontend.php#L87) only returns 25 cohorts by default. See the function definition at Moodle: https://github.com/moodle/moodle/blob/MOODLE_35_STABLE/cohort/lib.php#L239

I'm not sure what makes the most sense here for a fix, be it some hardcoded limit, or maybe something that you could have an end user set in a setting? Thoughts?

For the case we are using this, we hardcoded it to 1000. The call was changed to:

return cohort_get_available_cohorts($context, 0, 0, 1000);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.