- Posts: 7
Issues With Labels in Moodle 1.9
- Terry Carter
- Topic Author
- Offline
- New Member
-
Less
More
13 years 1 month ago #1
by Terry Carter
Issues With Labels in Moodle 1.9 was created by Terry Carter
So each of our courses have label resources that describe things such as who our presenters are etc...
The issue we were running into was that Joomdle was trying to URL encode the label string when viewing a course in Course View. After digging through the code in com_joomdle/views/course I was able to find the source of the problem.
Around line 150 in tmpl/default.php
else if ($resource == 'label')
{
$label = JoomdleHelperContent::call_method ('get_label', $resource);
echo $label;
}
This IF statement is in the middle of what looks to be the code to determine if a Direct Link is available or not.
Comment out this line of code.
Paste this line of code around line 171 directly after the final else statement.
if ($resource == 'label'){
$label = JoomdleHelperContent::call_method ('get_label', $resource);
echo $label;
}else{
echo $resource .'<br>';
}
Of just replace components/com_joomdle/views/course/tmpl/default.php with the file from the attached ZIP.
Hope this is of some help to someone, took me a while to find the answer.
The issue we were running into was that Joomdle was trying to URL encode the label string when viewing a course in Course View. After digging through the code in com_joomdle/views/course I was able to find the source of the problem.
Around line 150 in tmpl/default.php
else if ($resource == 'label')
{
$label = JoomdleHelperContent::call_method ('get_label', $resource);
echo $label;
}
This IF statement is in the middle of what looks to be the code to determine if a Direct Link is available or not.
Comment out this line of code.
Paste this line of code around line 171 directly after the final else statement.
if ($resource == 'label'){
$label = JoomdleHelperContent::call_method ('get_label', $resource);
echo $label;
}else{
echo $resource .'<br>';
}
Of just replace components/com_joomdle/views/course/tmpl/default.php with the file from the attached ZIP.
Hope this is of some help to someone, took me a while to find the answer.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
13 years 1 month ago #2
by Antonio Durán
Replied by Antonio Durán on topic Issues With Labels in Moodle 1.9
Thank you very much for the fix! I will take a look at it to try to include it for next release.
Please Log in or Create an account to join the conversation.
- Terry Carter
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 7
13 years 1 month ago #3
by Terry Carter
Replied by Terry Carter on topic Issues With Labels in Moodle 1.9
No problem, you guys are great.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
13 years 1 month ago #4
by Antonio Durán
Replied by Antonio Durán on topic Issues With Labels in Moodle 1.9
Hi.
I have taken a look at the provided code, but I see it must be from an older Joomdle version, right?
Can you provide a way to reproduce the problem, so I can check how it works with current code?
Thank you!
I have taken a look at the provided code, but I see it must be from an older Joomdle version, right?
Can you provide a way to reproduce the problem, so I can check how it works with current code?
Thank you!
Please Log in or Create an account to join the conversation.
- Terry Carter
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 7
13 years 1 month ago #5
by Terry Carter
Replied by Terry Carter on topic Issues With Labels in Moodle 1.9
We are using Joomdle 0.9 with Moodle 1.9. Not really any steps I can give you in order to reproduce the issue. We are using a default install of Joomla, Moodle, and Joomdle.
What produced the problem is when we were adding a course in Moodle and had a label as one of the resources.
Then in Joomla when you clicked on a Course Details link it would load the course but the labels were all coming across as URLs in an array like this:
this+is+label+number+1+for+the+course...
Each label was stored as a value in the array of labels so it was iterating through each one and trying to URL encode them.
Once I moved your code around it resolved the issue. From what I can tell of your code it was iterating through the array where you had it set to look for a direct url link. Dropping this section of code out of the direct url if statement resolved the issue and it stopped seeing the returned array as an array of urls.
Hope this clears up any confusion.
What produced the problem is when we were adding a course in Moodle and had a label as one of the resources.
Then in Joomla when you clicked on a Course Details link it would load the course but the labels were all coming across as URLs in an array like this:
this+is+label+number+1+for+the+course...
Each label was stored as a value in the array of labels so it was iterating through each one and trying to URL encode them.
Once I moved your code around it resolved the issue. From what I can tell of your code it was iterating through the array where you had it set to look for a direct url link. Dropping this section of code out of the direct url if statement resolved the issue and it stopped seeing the returned array as an array of urls.
Hope this clears up any confusion.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7909
13 years 1 month ago #6
by Antonio Durán
Replied by Antonio Durán on topic Issues With Labels in Moodle 1.9
Thanks for the additional info.
I tested and could reproduce the problem on a j2.5 + Moodle 1.9 installation.
I checked why it did not happen in J1.5, and it turns out it seems I already had some problems with the placement of that code, as it was different there. I guess I just forgot to do the same on J2.5 code.
I have done it now.
Thanks again for your help.
I tested and could reproduce the problem on a j2.5 + Moodle 1.9 installation.
I checked why it did not happen in J1.5, and it turns out it seems I already had some problems with the placement of that code, as it was different there. I guess I just forgot to do the same on J2.5 code.
I have done it now.
Thanks again for your help.
Please Log in or Create an account to join the conversation.
- Terry Carter
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 7
13 years 1 month ago #7
by Terry Carter
Replied by Terry Carter on topic Issues With Labels in Moodle 1.9
No problem Antonio, glad I could be of help.
Please Log in or Create an account to join the conversation.