Exemple #1
0
/**
 * @todo Document this function
 */
function glossary_print_entry_attachment($entry, $cm, $format=NULL, $align="right", $insidetable=true) {
///   valid format values: html  : Return the HTML link for the attachment as an icon
///                        text  : Return the HTML link for tha attachment as text
///                        blank : Print the output to the screen
    if ($entry->attachment) {
          if ($insidetable) {
              echo "<table border=\"0\" width=\"100%\" align=\"$align\"><tr><td align=\"$align\" nowrap=\"nowrap\">\n";
          }
          echo glossary_print_attachments($entry, $cm, $format, $align);
          if ($insidetable) {
              echo "</td></tr></table>\n";
          }
    }
}
Exemple #2
0
function glossary_print_entry_attachment($entry, $format = NULL, $align = "right", $insidetable = true)
{
    ///   valid format values: html  : Return the HTML link for the attachment as an icon
    ///                        text  : Return the HTML link for tha attachment as text
    ///                        blank : Print the output to the screen
    if ($entry->attachment) {
        $glossary = get_record("glossary", "id", $entry->glossaryid);
        $entry->course = $glossary->course;
        //used inside print_attachment
        if ($insidetable) {
            echo "<table border=\"0\" width=\"100%\" align=\"{$align}\"><tr><td align=\"{$align}\" nowrap=\"nowrap\">\n";
        }
        echo glossary_print_attachments($entry, $format, $align);
        if ($insidetable) {
            echo "</td></tr></table>\n";
        }
    }
}
Exemple #3
0
/**
 * Print the list of attachments for this glossary entry
 *
 * @param object $entry
 * @param object $cm The coursemodule
 * @param string $format The format for this view (html, or text)
 * @param string $unused1 This parameter is no longer used
 * @param string $unused2 This parameter is no longer used
 */
function glossary_print_entry_attachment($entry, $cm, $format = null, $unused1 = null, $unused2 = null) {
    // Valid format values: html: The HTML link for the attachment is an icon; and
    //                      text: The HTML link for the attachment is text.
    if ($entry->attachment) {
        echo '<div class="attachments">';
        echo glossary_print_attachments($entry, $cm, $format);
        echo '</div>';
    }
    if ($unused1) {
        debugging('The align parameter is deprecated, please use appropriate CSS instead', DEBUG_DEVELOPER);
    }
    if ($unused2 !== null) {
        debugging('The insidetable parameter is deprecated, please use appropriate CSS instead', DEBUG_DEVELOPER);
    }
}
            if (!has_capability('mod/glossary:approve', $context)) {
                unset($entries[$key]);
                continue;
            }
        }
        // Make sure entry is not autolinking itself.
        $GLOSSARY_EXCLUDEENTRY = $entry->id;
        $context = context_module::instance($entry->cmid);
        $definition = file_rewrite_pluginfile_urls($entry->definition, 'pluginfile.php', $context->id, 'mod_glossary', 'entry', $entry->id);
        $options = new stdClass();
        $options->para = false;
        $options->trusted = $entry->definitiontrust;
        $options->context = $context;
        $entries[$key]->definition = format_text($definition, $entry->definitionformat, $options);
        $entries[$key]->attachments = '';
        if (!empty($entries[$key]->attachment)) {
            $attachments = glossary_print_attachments($entry, $cm, 'html');
            $entries[$key]->attachments = html_writer::tag('p', $attachments);
        }
        $entries[$key]->footer = "<p style=\"text-align:right\">&raquo;&nbsp;<a href=\"{$CFG->wwwroot}/mod/glossary/view.php?g={$entry->glossaryid}\">" . format_string($entry->glossaryname, true) . "</a></p>";
        $event = \mod_glossary\event\entry_viewed::create(array('objectid' => $entry->id, 'context' => $modinfo->cms[$entry->cmid]->context));
        $event->add_record_snapshot('glossary_entries', $entry);
        $event->trigger();
    }
}
echo $OUTPUT->header();
$result = new stdClass();
$result->success = true;
$result->entries = $entries;
echo json_encode($result);
echo $OUTPUT->footer();