I have been stuck writing loads of codes and searching on the net to get this done.
My requirement is as mentioned in the question, that I want to get all the courses a student is enrolled in and get its parent categories in tree structure and put them in their hierarchical order into an object or array to encode it and pass it to the android app. Problem is that a student can be enrolled to multiple courses that fall under different categories, but their parent categories might be same.
It would be appreciated if anyone could kindly help with this, if there is any built in method in moodle to achieve this purpose..!!
Thanks in advance.