Direct link to a glossary term inside scorm (Moodle 2.2.5)

Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Emilio Lozano -
Number of replies: 7
Picture of Moodle HQ Picture of Moodle Workplace team Picture of Plugin developers

Hi,

I need to link from inside a SCORM package to a glossary term. In Moodle 1.9.X, I could use something like this:

www.mymoodlesite.com/[...]/mod_resource/mod/glossary/showentry.php?displayformat=dictionary&concept=concept

This solution isn't working in Moodle 2.X, cause I need to provide the course id.

I need to search, usin the url parameters, a term in the course glossary by concept.


Thank you in advance and sorry for my bad English.

PS: I don't want to use glossary autolinking feature.

Average of ratings: -
In reply to Emilio Lozano

Re: Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Milio,
glossary autolinking is becoming more popular in SCORM wink. Here you can found a good discussion about promoting or not glossary autolinking into SCORM: read also here, which is a thread started few days ago. Unfortunately these threads are not useful if you don't want to use glossary autolinking - currently it doesn't work in 2.x for SCORM local contents.

Have you already tried showentry.php?displayformat=dictionary&eid=<glossary entry id for 'concept'>? This solution depends on the database of the Moodle instance: the drawback is that you cannot distribute your SCORM content in several instances without changing the eid for each Moodle instance.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Emilio Lozano -
Picture of Moodle HQ Picture of Moodle Workplace team Picture of Plugin developers

Hi Matteo,

Thank you for your answer. Thtat's exactly the problem: I need to distribute that SCORM across several moodle instances, and I don't control some of them. With Moodle 1.9 I used direct links to glossary terms for that reason.


In Moodle 2.X you can use

showentry.php?displayformat=dictionary&courseid=<id for course>&concept=<concept>

which is more useful in this case. But anyways, I have the same problem.

Is it possible to use some kind of variable to get the courseid inside the scorm?

 

Thank you!

In reply to Emilio Lozano

Re: Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Milio,
AFAIK no: even exploring parent windows using JavaScript could not be of any help, Activity Id is what you can probably get.

BTW, looking at the code - http://git.moodle.org/gw?p=moodle.git;a=blob;f=mod/glossary/showentry.php;h=74ff50ec1a410aeb46fd63f4ccad8beee4dd66f9;hb=MOODLE_19_STABLE#l34 - it seems to me that Moodle 1.9 (at least .19+) requires $courseid too (never tested).

Matteo

In reply to Matteo Scaramuccia

Re: Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Emilio Lozano -
Picture of Moodle HQ Picture of Moodle Workplace team Picture of Plugin developers

Hi Matteo,

I tweaked showentry.php code. I don't like this workaround, but I really need it. Anyways, the modification is really simple.

Adding the bold line in (just in the elseif branch) mod/glossary/showentry.php:

if ($eid) {
[...]
} else if ($concept) {
   $courseid = $COURSE->id;
   $course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
   require_course_login($course);
   $entries = glossary_get_entries_search($concept, $courseid);
   [...]

So, in the case the courseid wasn't supplied, I use current course.

Now, I can search term in the course glossaries by name.

Thank you, Matteo.



In reply to Emilio Lozano

Re: Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Milio,really nice job smile! You can do even better:

$concept  = optional_param('concept', '', PARAM_CLEAN);
$courseid = optional_param('courseid', $COURSE->id, PARAM_INT);
$eid      = optional_param('eid', 0, PARAM_INT); // glossary entry id
$displayformat = optional_param('displayformat',-1, PARAM_SAFEDIR);

This will don't break Moodle core code more then your: when courseid is not provided it will be initialised with the value of the current course otherwise it will be used the value provided in the URL provided.

Would you like to file an improvement into the Tracker? I guess, if confirmed, it could work even not with SCORM, whenever $COURSE is available.

HTH,
Matteo

Average of ratings: Useful (1)
In reply to Matteo Scaramuccia

Re: Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Emilio Lozano -
Picture of Moodle HQ Picture of Moodle Workplace team Picture of Plugin developers

That's true, Matteo. That's even better ;)

In fact, I made tests with an exported html file (from one SCORM), cause I need this to work for SCORMS and HTML files. This is my first contact with moodle developement forums, how can I file this into the tracker?

Thank you!

 

 

In reply to Emilio Lozano

Re: Direct link to a glossary term inside scorm (Moodle 2.2.5)

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Milio,
you need to create first an account into the Moodle Tracker.
Then you can:

  1. file the issue describing your use case to let the maintainer understand the reason for that improvement
  2. add a comment with the diff of the patch proposal
  3. and if you are confident with git you can even submit your patch as a git branch

In case it will be recognized as a good improvement it will go into the main stream and from then you'll never need to fix the new Moodle instances where your SCORM content will be published into wink.

HTH,
Matteo

Average of ratings: Useful (1)