- Posts: 3
Showing categories in module my courses
- marco cassisa
- Topic Author
- Offline
- New Member
-
Less
More
12 years 7 months ago - 12 years 7 months ago #1
by marco cassisa
Showing categories in module my courses was created by marco cassisa
Hi there!
I managed to get joomdle fully functional for my school and... want to thank you very much for all this precious work.
In the module my courses no category appear, while it happens in the menu (which uses com_joomdle code, if I am right) following the configuration in "config views"-details.
It seems to me - correct me please if I am wrong - that the relevant portion of code to have the module showing the categories is in com_joomdle/views/coursecategories/view.html.php lines 44ff.
Is adapting this code the right way to implement this functionality in the module?
Thanks
marco
I managed to get joomdle fully functional for my school and... want to thank you very much for all this precious work.
In the module my courses no category appear, while it happens in the menu (which uses com_joomdle code, if I am right) following the configuration in "config views"-details.
It seems to me - correct me please if I am wrong - that the relevant portion of code to have the module showing the categories is in com_joomdle/views/coursecategories/view.html.php lines 44ff.
Code:
$this->cat_id = $id;
$this->cat_name = JoomdleHelperContent::call_method ('get_cat_name', $id);
$user = & JFactory::getUser();
$username = $user->username;
$this->cursos = JoomdleHelperContent::getCourseCategory ($id, $username);
$this->categories = JoomdleHelperContent::getCourseCategories ($id);
if(is_object($menu) && $menu->query['view'] != 'coursecategory') {
$pathway->addItem($this->cat_name, '');
}
Is adapting this code the right way to implement this functionality in the module?
Thanks
marco
Last edit: 12 years 7 months ago by marco cassisa. Reason: typo in topic
Please Log in or Create an account to join the conversation.
- marco cassisa
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
12 years 7 months ago #2
by marco cassisa
Replied by marco cassisa on topic Showing categories in module my courses
Hi folks.
I reply to myself, hoping that can help others.
I managed to have the module joomdle_my_courses to show categories (and group courses by category) modifying the file
mod_joomdle_mycourses/tmpl/default.php
lines 44 ff.
This time my thanks go to JoodmleHelperContent and its methods
(and to com_joomdle/views/mycourses/view.html.php and com_joomdle/views/mycourses/tmpl/default.php where the code comes from).
It would be an improvement if the module would get the components parameter show_categories, but I have no time now to do it.
Bye all
I reply to myself, hoping that can help others.
I managed to have the module joomdle_my_courses to show categories (and group courses by category) modifying the file
mod_joomdle_mycourses/tmpl/default.php
lines 44 ff.
Code:
//insert those lines from here
if(!class_exists('JoomdleHelperContent'))require_once (JPATH_BASE.'/components/com_joomdle/helpers/content.php');
$user = JFactory::getUser();
$username = $user->username;
$joomdleHelper = new JoomdleHelperContent;
$cursos = JoomdleHelperContent::call_method ('my_courses', $username, 1); //insert till here
if (is_array($cursos)) {
foreach ($cursos as $id => $curso) {
if ($curso['category'] != $prev_cat) {//insert from here to get categories
$prev_cat = $curso['category'];
$cat_name = JoomdleHelperContent::call_method ('get_cat_name', $curso['category']);
echo '<strong>'. $cat_name.'</strong>';
}//insert till here
This time my thanks go to JoodmleHelperContent and its methods
It would be an improvement if the module would get the components parameter show_categories, but I have no time now to do it.
Bye all
Please Log in or Create an account to join the conversation.
- Chris
-
- Offline
- Moderator
-
12 years 7 months ago #3
by Chris
Replied by Chris on topic Showing categories in module my courses
Thank you very much for sharing your code. I am sure others will find it useful and perhaps we will include this or similar in future releases.
Please Log in or Create an account to join the conversation.