first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
GLOSSARY FORMAT PLUGINS
-----------------------
Starting with Moodle 1.4, the glossary module supports a plugin
architecture to create your own formats. This plugin system allows
you to "invent" your own presentations for your glossary data. :-)
To facilitate the creation process a TEMPLATE format has been created.
You should use it as the base for your own modifications (this requires
some basic PHP skills). The template includes all the available data.
Please, follow these STEPS:
1.-Think of an English word (or short phrase) to define your format.
For further reference in this document, we call it "THENAME".
2.-Duplicate the TEMPLATE directory (under mod/glossary/formats/TEMPLATE).
3.-Rename it to THENAME
4.-Go into the THENAME directory and rename the TEMPLATE_format.php file
to THENAME_format.php
5.-Edit the THENAME_format.php file. Change every ocurrence of TEMPLATE to
THENAME.
6.-Login into Moodle. Go to any glossary in your site.
7.-Edit (configure) your glossary. In the Format popup you'll see a new
entry. It will be showed as "displayformatTHENAME". Select it and view
your glossary.
8.-Edit the THENAME_format.php. Make your format modifications and reload your
web page to see them in your glossary. This file has been commented to make
things easier to understand (further suggestions welcome!)
9.-If you want to translate your THENAME format name to some nice name to
be showed in the Format popup, simply, edit your lang/XX/glossary.php
file (where XX is your language) and create a new displayformatTHENAME
string.
10.-Enjoy!! (and don't forget to send your amazing glossary formats to
the Glossary forum on http://moodle.org. They will be welcome!! ;-)
To talk about Glossary formats, go to:
http://moodle.org/mod/forum/view.php?id=742
Eloy (stronk7)
08/02/2004 (MM/DD/YYYY) :-D
@@ -0,0 +1,109 @@
<?php
function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $aliases=true) {
global $CFG, $USER, $DB, $OUTPUT;
$user = $DB->get_record('user', array('id'=>$entry->userid));
$strby = get_string('writtenby', 'glossary');
if ($entry) {
echo '<table class="glossarypost TEMPLATE">';
echo '<tr>';
echo '<td class="entryheader">';
//Use this function to show author's image
//Comments: Configuration not supported
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
//Line separator to show this template fine. :-)
echo '<br />';
//Use this code to show author's name
//Comments: Configuration not supported
$fullname = fullname($user);
$by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>' . '<br />';
//Use this code to show modification date
//Comments: Configuration not supported
echo get_string('lastedited').': '. userdate($entry->timemodified) . '<br /></span>';
//Use this function to show the approval button. It'll be shown if necessary
//Comments: You can configure this parameters:
//----Define where to show the approval button
$approvalalign = 'right'; //Values: left, center and right (default right)
//----Define if the approval button must be showed into a 100% width table
$approvalinsidetable = true; //Values: true, false (default true)
//Call the function
glossary_print_entry_approval($cm, $entry, $mode, $approvalalign, $approvalinsidetable);
//Line separator to show this template fine. :-)
echo '<br />';
echo '</td>';
echo '<td class="entryattachment">';
//Line separator to show this template fine. :-)
echo "<br />\n";
echo '</td></tr>';
echo '<tr valign="top">';
echo '<td class="entry">';
//Use this function to print the concept in a heading <h3>
//Comments: Configuration not supported
glossary_print_entry_concept($entry);
//Line separator not normally needed now.
//echo "<br />\n";
//Use this function to show the definition
//Comments: Configuration not supported
glossary_print_entry_definition($entry, $glossary, $cm);
// Use this function to show the attachment. It'll be shown if necessary.
glossary_print_entry_attachment($entry, $cm, 'html');
//Line separator to show this template fine. :-)
echo "<br />\n";
//Use this function to show aliases, editing icons and ratings (all know as the 'lower section')
//Comments: You can configure this parameters:
//----Define when to show the aliases popup
// use it only if you are really sure!
//$aliases = true; //Values: true, false (Default: true)
//----Uncoment this line to avoid editing icons being showed
// use it only if you are really sure!
//$printicons = false;
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases);
echo '</td>';
echo '</tr>';
echo "</table>\n";
} else {
echo '<div style="text-align:center">';
print_string('noentry', 'glossary');
echo '</div>';
}
}
function glossary_print_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) {
//The print view for this format is exactly the normal view, so we use it
//Anyway, you can modify this to use your own print format!!
//Take out autolinking in definitions in print view
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
//Call to view function (without icons, ratings and aliases) and return its result
return glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
}
@@ -0,0 +1,43 @@
<?php
function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $aliases=false) {
global $USER, $OUTPUT;
echo '<table class="glossarypost continuous" cellspacing="0">';
echo '<tr valign="top">';
echo '<td class="entry">';
glossary_print_entry_approval($cm, $entry, $mode);
echo '<div class="concept">';
glossary_print_entry_concept($entry);
echo '</div> ';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) {
echo $OUTPUT->tag_list(core_tag_tag::get_item_tags(
'mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags');
}
$entry->alias = '';
echo '</td></tr>';
echo '<tr valign="top"><td class="entrylowersection">';
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases, false);
echo '</td>';
echo '</tr>';
echo "</table>\n";
}
function glossary_print_entry_continuous($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) {
//The print view for this format is exactly the normal view, so we use it
//Take out autolinking in definitions un print view
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
//Call to view function (without icons, ratings and aliases) and return its result
glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
}
@@ -0,0 +1,38 @@
<?php
function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $aliases=true) {
global $CFG, $USER, $OUTPUT;
echo '<table class="glossarypost dictionary" cellspacing="0">';
echo '<tr valign="top">';
echo '<td class="entry">';
glossary_print_entry_approval($cm, $entry, $mode);
echo '<div class="concept">';
glossary_print_entry_concept($entry);
echo '</div> ';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) {
echo $OUTPUT->tag_list(core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags');
}
echo '</td></tr>';
echo '<tr valign="top"><td class="entrylowersection">';
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases);
echo '</td>';
echo '</tr>';
echo "</table>\n";
}
function glossary_print_entry_dictionary($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) {
//The print view for this format is exactly the normal view, so we use it
//Take out autolinking in definitions in print view
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
//Call to view function (without icons, ratings and aliases) and return its result
return glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
}
@@ -0,0 +1,79 @@
<?php
function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode='',$hook='',$printicons=1, $aliases=true) {
global $CFG, $USER, $DB, $OUTPUT;
$user = $DB->get_record('user', array('id'=>$entry->userid));
$strby = get_string('writtenby', 'glossary');
if ($entry) {
echo '<table class="glossarypost encyclopedia" cellspacing="0">';
echo '<tr valign="top">';
echo '<td class="left picture">';
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
echo '</td>';
echo '<th class="entryheader">';
echo '<div class="concept">';
glossary_print_entry_concept($entry);
echo '</div>';
$fullname = fullname($user);
$by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
echo '</th>';
echo '<td class="entryapproval">';
glossary_print_entry_approval($cm, $entry, $mode);
echo '</td>';
echo '</tr>';
echo '<tr valign="top">';
echo '<td class="left side" rowspan="2">&nbsp;</td>';
echo '<td colspan="2" class="entry">';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, null);
if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) {
echo $OUTPUT->tag_list(
core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags');
}
if ($printicons or $aliases) {
echo '</td></tr>';
echo '<tr>';
echo '<td colspan="2" class="entrylowersection">';
glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$aliases);
echo ' ';
}
echo '</td></tr>';
echo "</table>\n";
} else {
echo '<div style="text-align:center">';
print_string('noentry', 'glossary');
echo '</div>';
}
}
function glossary_print_entry_encyclopedia($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) {
//The print view for this format is exactly the normal view, so we use it
//Take out autolinking in definitions un print view
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
//Call to view function (without icons, ratings and aliases) and return its result
return glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode, $hook, false, false);
}
@@ -0,0 +1,67 @@
<?php
function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $aliases=true) {
global $USER, $OUTPUT;
$return = false;
echo '<table class="glossarypost entrylist" cellspacing="0">';
echo '<tr valign="top">';
echo '<td class="entry">';
if ($entry) {
glossary_print_entry_approval($cm, $entry, $mode);
$anchortagcontents = glossary_print_entry_concept($entry, true);
$link = new moodle_url('/mod/glossary/showentry.php', array('courseid' => $course->id,
'eid' => $entry->id, 'displayformat' => 'dictionary'));
$anchor = html_writer::link($link, $anchortagcontents);
echo "<div class=\"concept\">$anchor</div> ";
echo '</td><td align="right" class="entrylowersection">';
if ($printicons) {
glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,'print');
}
if (!empty($entry->rating)) {
echo '<br />';
echo '<span class="ratings d-block pt-3">';
$return = glossary_print_entry_ratings($course, $entry);
echo '</span>';
}
echo '<br />';
} else {
echo '<div style="text-align:center">';
print_string('noentry', 'glossary');
echo '</div>';
}
echo '</td></tr>';
echo "</table>";
echo "<hr>\n";
return $return;
}
function glossary_print_entry_entrylist($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) {
//Take out autolinking in definitions un print view
// TODO use <nolink> tags MDL-15555.
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
echo html_writer::start_tag('table', array('class' => 'glossarypost entrylist mod-glossary-entrylist'));
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('class' => 'entry mod-glossary-entry'));
echo html_writer::start_tag('div', array('class' => 'mod-glossary-concept'));
glossary_print_entry_concept($entry);
echo html_writer::end_tag('div');
echo html_writer::start_tag('div', array('class' => 'mod-glossary-definition'));
glossary_print_entry_definition($entry, $glossary, $cm);
echo html_writer::end_tag('div');
echo html_writer::start_tag('div', array('class' => 'mod-glossary-lower-section'));
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, false, false);
echo html_writer::end_tag('div');
echo html_writer::end_tag('td');
echo html_writer::end_tag('tr');
echo html_writer::end_tag('table');
}
+63
View File
@@ -0,0 +1,63 @@
<?php
function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $aliases=true) {
global $USER, $OUTPUT;
if ( $entry ) {
echo '<table class="glossarypost faq" cellspacing="0">';
echo '<tr valign="top">';
echo '<th class="entryheader">';
$entry->course = $course->id;
echo '<div class="concept">' . get_string('question','glossary') . ': ';
glossary_print_entry_concept($entry);
echo '</div>';
echo '<span class="time">('.get_string('lastedited').': '.
userdate($entry->timemodified).')</span>';
echo '</th>';
echo '<td class="entryattachment">';
glossary_print_entry_approval($cm, $entry, $mode);
echo '</td>';
echo '</tr>';
echo "\n<tr>";
echo '<td colspan="2" class="entry">';
echo '<b>'.get_string('answer','glossary').':</b> ';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) {
echo $OUTPUT->tag_list(
core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags');
}
echo '</td></tr>';
echo '<tr valign="top"><td colspan="3" class="entrylowersection">';
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases);
echo '</td></tr></table>';
} else {
echo '<div style="text-align:center">';
print_string('noentry', 'glossary');
echo '</div>';
}
}
function glossary_print_entry_faq($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) {
//The print view for this format is exactly the normal view, so we use it
//Take out autolinking in definitions un print view
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
//Call to view function (without icons, ratings and aliases) and return its result
return glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
}
@@ -0,0 +1,78 @@
<?php
function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $aliases=true) {
global $CFG, $USER, $DB, $OUTPUT;
$user = $DB->get_record('user', array('id'=>$entry->userid));
$strby = get_string('writtenby', 'glossary');
if ($entry) {
echo '<table class="glossarypost fullwithauthor" cellspacing="0">';
echo '<tr valign="top">';
echo '<td class="picture">';
echo $OUTPUT->user_picture($user, array('courseid'=>$course->id));
echo '</td>';
echo '<th class="entryheader">';
echo '<div class="concept">';
glossary_print_entry_concept($entry);
echo '</div>';
$fullname = fullname($user);
$by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
echo '</th>';
echo '<td class="entryattachment">';
glossary_print_entry_approval($cm, $entry, $mode);
echo '</td>';
echo '</tr>';
echo '<tr valign="top">';
echo '<td class="left">&nbsp;</td>';
echo '<td colspan="2" class="entry">';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) {
echo $OUTPUT->tag_list(
core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags');
}
echo '</td></tr>';
echo '<tr valign="top">';
echo '<td class="left">&nbsp;</td>';
echo '<td colspan="2" class="entrylowersection">';
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases);
echo ' ';
echo '</td></tr>';
echo "</table>\n";
} else {
echo '<div style="text-align:center">';
print_string('noentry', 'glossary');
echo '</div>';
}
}
function glossary_print_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1) {
//The print view for this format is exactly the normal view, so we use it
//Take out autolinking in definitions un print view
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
//Call to view function (without icons, ratings and aliases) and return its result
return glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
}
@@ -0,0 +1,64 @@
<?php
function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $aliases=true) {
global $CFG, $USER, $OUTPUT;
if ($entry) {
echo '<table class="glossarypost fullwithoutauthor" cellspacing="0">';
echo '<tr valign="top">';
echo '<th class="entryheader">';
echo '<div class="concept">';
glossary_print_entry_concept($entry);
echo '</div>';
echo '<span class="time">('.get_string('lastedited').': '.
userdate($entry->timemodified).')</span>';
echo '</th>';
echo '<td class="entryattachment">';
glossary_print_entry_approval($cm, $entry, $mode);
echo '</td>';
echo '</tr>';
echo '<tr valign="top">';
echo '<td width="100%" colspan="2" class="entry">';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) {
echo $OUTPUT->tag_list(
core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags');
}
echo '</td></tr>';
echo '<tr valign="top"><td colspan="2" class="entrylowersection">';
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases);
echo ' ';
echo '</td></tr>';
echo "</table>\n";
} else {
echo '<center>';
print_string('noentry', 'glossary');
echo '</center>';
}
}
function glossary_print_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1) {
//The print view for this format is exactly the normal view, so we use it
//Take out autolinking in definitions un print view
$entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
//Call to view function (without icons, ratings and aliases) and return its result
return glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
}