Moodle

create_groups

Details

  • Type: Task Task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Web Services
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

add new groups

Issue Links

Activity

Hide
Tusefomal added a comment -

The current implementation of this function is here:

http://cvs.moodle.org/contrib/patches/dfws/webservice/apis/group.lib.php?revision=1.1&view=markup

But for the API is necessary a massive function, I'm working on the new one but I have to know the params. By now, function gets courseid, groupname and groupdescription, but this params force to use an internal id course identifier. In other functions like get_users (http://tracker.moodle.org/browse/MDL-12887) and get_courses (http://tracker.moodle.org/browse/MDL-13128) the philosophy is to use a criteria param which determine the kind of identifier (id, idnumber...). In the other hand, I think that description is not a necessary param and can be deleted or threated in a group modifier function.

My proposal is:

/**

  • add a group to specified course
  • @param string criteria {idnumber, id, shortname}
  • @param string course: course key
  • @param string groupname
  • @return associative array groupname => integer (identifier if ok or -1 if error)
    */
    array add_groups (criteria,course,groupnames)

Group name in a course are unique and it's possible to use group name and course to identify it.

Show
Tusefomal added a comment - The current implementation of this function is here: http://cvs.moodle.org/contrib/patches/dfws/webservice/apis/group.lib.php?revision=1.1&view=markup But for the API is necessary a massive function, I'm working on the new one but I have to know the params. By now, function gets courseid, groupname and groupdescription, but this params force to use an internal id course identifier. In other functions like get_users (http://tracker.moodle.org/browse/MDL-12887) and get_courses (http://tracker.moodle.org/browse/MDL-13128) the philosophy is to use a criteria param which determine the kind of identifier (id, idnumber...). In the other hand, I think that description is not a necessary param and can be deleted or threated in a group modifier function. My proposal is: /**
  • add a group to specified course
  • @param string criteria {idnumber, id, shortname}
  • @param string course: course key
  • @param string groupname
  • @return associative array groupname => integer (identifier if ok or -1 if error) */ array add_groups (criteria,course,groupnames)
Group name in a course are unique and it's possible to use group name and course to identify it.
Hide
David Castro added a comment -

Implemented and saved on CVS.

Show
David Castro added a comment - Implemented and saved on CVS.
Hide
Jordi Piguillem Poch added a comment -

I'm using groups_create_group() function to implement this WS.

I was thinking about checking that the courseid really exist before calling it, but it would be better to check it inside groups_create_group()....

Any clue or comment?

Show
Jordi Piguillem Poch added a comment - I'm using groups_create_group() function to implement this WS. I was thinking about checking that the courseid really exist before calling it, but it would be better to check it inside groups_create_group().... Any clue or comment?

Dates

  • Created:
    Updated:
    Resolved: