× Feature Requests

Please do NOT use this section of the forum to request help if Joomdle does not work for you in some particular way. Your post will be deleted.

Moodle Strings Untranslated in Joomdle Search Results

4 months 4 days ago
ncy
Posts: 18
More
Topic Author
Moodle Strings Untranslated in Joomdle Search Results #1
Although format_text() is applied to search results, the Moodle data returned is always in the default language. This is seemingly solved by passing in the language tag (i.e. JFactory::getLanguage()->getTag()) to JoomdleHelperContent::call_method("search_XXXXX", ...) and setting in /auth/joomdle/auth.php for each of these functions:
public function search_XXXXX (...) {
    global $SESSION;
    $langtag = substr($langtag, 0, 2); // Moodle language tags are 2-letters only
    $SESSION->lang = $langtag;
    ...

Where XXXXX is courses/categories/topics. BUT, this breaks the link, giving an "Invalid controller" error. Rather than mess with the router, I just rewrite the link myself:

/plugins/search/courses/courses.php
$rows_result[$i]->href = $params->get('MOODLE_URL') . '/course/view.php?id='.$row['remoteid'];

/plugins/search/coursecategories/coursecategories.php:
$rows_result[$i]->href = $params->get('MOODLE_URL') . '/course/index.php?categoryid='.$row['cat_id'];

/plugins/search/coursetopics/coursetopics.php:
$rows_result[$i]->href = $params->get('MOODLE_URL') . '/course/view.php?id='.$row['course'].'#section-'.$row['section'];
$rows_result[$i]->title= $row['sec_name'];

Of course, if you are using Moodle embedded within Joomla, this probably doesn't work the way you want. It would be nice to have a configuration option to choose whether to directly link to the Moodle pages. Unfortunately the modifications above are indeed directly to Joomdle code.
4 months 4 days ago
Antonio Durán
Posts: 6975
More
Moodle Strings Untranslated in Joomdle Search Results #2
Thanks for your contributions, I will study them and get back to you.

> Of course, if you are using Moodle embedded within Joomla, this probably doesn't work the way you want. It would be nice to have a configuration option to choose whether to directly link to the Moodle pages.

Do you mean having an option in search plugins, to link to Moodle instead of Joomdle pages in Joomla, like it's done now, right?
For example, in courses plugin, depending on the option, it would link to:
$rows_result[$i]->href = 'index.php?option=com_joomdle&view=detail&cat_id='.$cat_slug.'&course_id='.$course_slug;
or:
$rows_result[$i]->href = $params->get('MOODLE_URL') . '/course/view.php?id='.$row['remoteid'];
4 months 3 days ago
ncy
Posts: 18
More
Topic Author
Moodle Strings Untranslated in Joomdle Search Results #3

Do you mean having an option in search plugins, to link to Moodle instead of Joomdle pages in Joomla, like it's done now, right?


Yes, exactly :). Thanks for the speedy replies.
1 week 2 days ago
ncy
Posts: 18
More
Topic Author
Moodle Strings Untranslated in Joomdle Search Results #4
Even though I set the search plugins for category/course/topic as Link To: Moodle, my links still open in a Joomdle wrapper on the Joomla site.

Also, some code things I noticed:


coursecategories.php:
get_category_link() is missing:
$itemid = $this->params->get('item_id', '');
and this line doesn't seem necessary:
$course_slug = $row['remoteid']."-".$row['fullname'];


courses.php:
get_course_link() is missing:
$itemid = $this->params->get('item_id', '');


coursetopics.php:
get_topic_link() is missing:
$itemid = $this->params->get('item_id', '');

1 week 1 day ago
Antonio Durán
Posts: 6975
More
Moodle Strings Untranslated in Joomdle Search Results #5
Thanks for the feedback.

> Even though I set the search plugins for category/course/topic as Link To: Moodle, my links still open in a Joomdle wrapper on the Joomla site.

Have you set "Open Moodle links in" option in Joomdle config in Joomla, under Links behaviour? If you see it open the wrapper, it is configured like that there.


As for the code changes, I changed by this one, as the item id is a component parameter:
                $itemid = $params->get( 'default_itemid' );
1 week 1 day ago
ncy
Posts: 18
More
Topic Author
Moodle Strings Untranslated in Joomdle Search Results #6

Have you set "Open Moodle links in" option in Joomdle config in Joomla, under Links behaviour? If you see it open the wrapper, it is configured like that there.


Oops, you are right. I still had it set to Wrapper in the Joomdle config. It works OK.

As for the code changes, I changed by this one, as the item id is a component parameter:

                $itemid = $params->get( 'default_itemid' );


Cool, thank you for checking.