I'm trying to get familiar with the chamilo 2.0. I want to start building on a 'timetable'-application. I managed to build some general functions with the application generator.
Now I'm trying to customize some things. Because my application will use de groups from the groups application I want to get some information from the groups.
When I use
GroupDataManager :: get_instance()->retrieve_group(1); I get the data from the selected group. This is ok.
When I use
GroupDataManager :: get_instance()->retrieve_groups(); I get a lot of information but not the data of all the groups like the functions suggests.
Is this a bug, or more likely am I doing something wrong?
I tried to look in other applications to see how its done there, but it seems it isn't working there either...
Also the groups integration in the weblcms-application is not completed yet, right?
Updated by Ludwig Theunis almost 12 years ago
- Assignee set to Ludwig Theunis
- Target version set to 2
I'me sorry but I found the solution.
I have to use a while loop to get the data from the groups object like this:
$groups = GroupDataManager :: get_instance()->retrieve_groups();
while ($groups = $groups->next_result())
dump($group); // just testing ;-)
I was thinking the method retrieve_groups() was going to this for me, like the method retrieve_group() does, but apparently I was wrong, so it is not a bug.
Updated by Sven Vanpoucke almost 12 years ago
When retrieving groups or other objects, you actually get a resultset from the function. You can loop very easy through this resultset with the next-result function. However if you want to have the data as an array you can use the function as_array() on the resultset.