Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groups assignation #37

Closed
wants to merge 1 commit into from
Closed

Conversation

Pedagotheque
Copy link

Hello,

We made modifications to add the following feature:

  • Group assignation

This feature may interest you or other users?
If you want so you can contact me for further information.
Regards
Camille

@ndunand
Copy link
Owner

ndunand commented Aug 17, 2021

Hello Camille @Pedagotheque ,

Thanks for sharing this, we'll look into it asap.


$DB->delete_records('enrol_attributes_groups', array('enrolid' => $instance->id));

foreach ($groups as $value) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, $value here should better be called something like $groupid.

Copy link
Owner

@ndunand ndunand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello again Camille @Pedagotheque ,

I haven't tried your feature yet, but:

I had a first look at your modifications. These look straightforward enough. I have just made a couple suggestions about cosmetics.

Also, my choice (instead of having to rely on a new enrol_groups table) would have been to serialize group data into $enrol->customtext2 (since customtext1 is already used to store the rule. Then you could get rid of the upgrade DB process and install.xml files. It's a little bit less elegant, but would yield to less code in the end, which I tend to always prefer.

Anyway, none of these are integration stoppers for me, and I am very thankful to you for sharing this.

Let me know what you think, and in the meantime I will try to find some time to test the feature soon.

Cheers,
Nicolas


// Start modification
$groups = $data->groupselect;
foreach ($groups as $value) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, $value should be named $groupid.

$object->enrolid = $id;
$DB->insert_record('enrol_attributes_groups', $object);
}
// End modification
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Start|End modification" comments can be removed.

$groups = groups_get_all_groups($courseid);

$groups2 = array();
foreach ($groups as $value) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, $value should be called $group.

NicoAlexH added a commit to NicoAlexH/moodle-enrol_attributes that referenced this pull request Sep 16, 2021
@ndunand
Copy link
Owner

ndunand commented Oct 8, 2021

This is now being continued in #38

@ndunand ndunand closed this Oct 8, 2021
ndunand added a commit that referenced this pull request Oct 8, 2021
Integration of pr #37, unit tests and some bug fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants