Beispiel #1
0
function glossary_comment_print_header($course, $cm, $glossary, $entry, $action)
{
    switch ($action) {
        case 'add':
            $straction = get_string('addingcomment', 'glossary');
            break;
        case 'edit':
            $straction = get_string('editingcomment', 'glossary');
            break;
        case 'delete':
            $straction = get_string('deletingcomment', 'glossary');
            break;
    }
    $strglossary = get_string('modulename', 'glossary');
    $strcomments = get_string('comments', 'glossary');
    $navlinks = array();
    $navlinks[] = array('name' => $strcomments, 'link' => "comments.php?id={$cm->id}&eid={$entry->id}", 'type' => 'title');
    $navlinks[] = array('name' => $straction, 'link' => '', 'type' => 'action');
    $navigation = build_navigation($navlinks, $cm);
    print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, update_module_button($cm->id, $course->id, $strglossary), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm));
    /// print original glossary entry for any comment action (add, update, delete)
    glossary_print_entry($course, $cm, $glossary, $entry, 'approval', '', false);
}
Beispiel #2
0
echo '<p style="text-align:right"><span style="font-size:0.75em">' . userdate(time()) . '</span></p>';
echo get_string("site") . ': <strong>' . format_string($site->fullname) . '</strong><br />';
echo get_string("course") . ': <strong>' . format_string($course->fullname) . ' (' . format_string($course->shortname) . ')</strong><br />';
echo get_string("modulename", "glossary") . ': <strong>' . format_string($glossary->name, true) . '</strong>';
if ($allentries) {
    foreach ($allentries as $entry) {
        // Setting the pivot for the current entry
        $pivot = $entry->glossarypivot;
        $upperpivot = $textlib->strtoupper($pivot);
        // Reduce pivot to 1cc if necessary
        if (!$fullpivot) {
            $upperpivot = $textlib->substr($upperpivot, 0, 1);
        }
        // If there's  group break
        if ($currentpivot != $upperpivot) {
            // print the group break if apply
            if ($printpivot) {
                $currentpivot = $upperpivot;
                $pivottoshow = $currentpivot;
                if (isset($entry->userispivot)) {
                    // printing the user icon if defined (only when browsing authors)
                    $user = $DB->get_record("user", array("id" => $entry->userid));
                    $pivottoshow = fullname($user);
                }
                echo "<p class='mdl-align'><strong>" . clean_text($pivottoshow) . "</strong></p>";
            }
        }
        glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook, 1, $displayformat, false, true);
    }
}
print_footer('empty');
Beispiel #3
0
/**
 * Print a detailed representation of what a  user has done with
 * a given particular instance of this module, for user activity reports.
 *
 * @global object
 * @param object $course
 * @param object $user
 * @param object $mod
 * @param object $glossary
 */
function glossary_user_complete($course, $user, $mod, $glossary) {
    global $CFG, $OUTPUT;
    require_once("$CFG->libdir/gradelib.php");

    $grades = grade_get_grades($course->id, 'mod', 'glossary', $glossary->id, $user->id);
    if (!empty($grades->items[0]->grades)) {
        $grade = reset($grades->items[0]->grades);
        echo $OUTPUT->container(get_string('grade').': '.$grade->str_long_grade);
        if ($grade->str_feedback) {
            echo $OUTPUT->container(get_string('feedback').': '.$grade->str_feedback);
        }
    }

    if ($entries = glossary_get_user_entries($glossary->id, $user->id)) {
        echo '<table width="95%" border="0"><tr><td>';
        foreach ($entries as $entry) {
            $cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id);
            glossary_print_entry($course, $cm, $glossary, $entry,"","",0);
            echo '<p>';
        }
        echo '</td></tr></table>';
    }
}
Beispiel #4
0
add_to_log($course->id, "glossary", "view", "view.php?id={$cm->id}", "{$glossary->id}", $cm->id);
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
$strallcategories = get_string("allcategories", "glossary");
$straddentry = get_string("addentry", "glossary");
$strnoentries = get_string("noentries", "glossary");
$strsearchconcept = get_string("searchconcept", "glossary");
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");
$strcomments = get_string("comments", "glossary");
$straddcomment = get_string("addcomment", "glossary");
$navigation = build_navigation($strcomments, $cm);
print_header_simple(strip_tags("{$strcomments}: {$entry->concept}"), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
/// original glossary entry
echo "<div class=\"boxaligncenter\">";
glossary_print_entry($course, $cm, $glossary, $entry, "", "", false);
echo "</div>";
/// comments
echo $OUTPUT->heading(format_string(get_string('commentson', 'glossary') . " <b>\"{$entry->concept}\"</b>"));
if (has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
    echo $OUTPUT->heading("<a href=\"comment.php?action=add&amp;entryid={$entry->id}\">{$straddcomment} <img title=\"{$straddcomment}\" src=\"comment.gif\" class=\"iconsmall\" alt=\"{$straddcomment}\" /></a>");
}
if ($comments = $DB->get_records("glossary_comments", array("entryid" => $entry->id), "timemodified ASC")) {
    foreach ($comments as $comment) {
        glossary_print_comment($course, $cm, $glossary, $entry, $comment);
        echo '<br />';
    }
} else {
    echo $OUTPUT->heading(get_string("nocomments", "glossary"));
}
/// Finish the page
Beispiel #5
0
                if (preg_match('/^\\-/', $searchterm)) {
                    unset($searchterms[$key]);
                } else {
                    $searchterms[$key] = preg_replace('/^\\+/', '', $searchterm);
                }
                //Avoid highlight of <2 len strings. It's a well known hilight limitation.
                if (strlen($searchterm) < 2) {
                    unset($searchterms[$key]);
                }
            }
            $strippedsearch = implode(' ', $searchterms);
            // Rebuild the string
            $entry->highlight = $strippedsearch;
        }
        /// and finally print the entry.
        if (glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook, 1, $displayformat, $ratings)) {
            $ratingsmenuused = true;
        }
        $entriesshown++;
    }
}
if (!$entriesshown) {
    print_simple_box('<div style="text-align:center">' . get_string("noentries", "glossary") . '</div>', "center", "95%");
}
if ($ratingsmenuused) {
    echo "<div class=\"boxaligncenter\"><input type=\"submit\" value=\"" . get_string("sendinratings", "glossary") . "\" />";
    if ($glossary->scale < 0) {
        if ($scale = get_record("scale", "id", abs($glossary->scale))) {
            print_scale_menu_helpbutton($course->id, $scale);
        }
    }
Beispiel #6
0
function glossary_user_complete($course, $user, $mod, $glossary)
{
    /// Print a detailed representation of what a  user has done with
    /// a given particular instance of this module, for user activity reports.
    global $CFG;
    require_once "{$CFG->libdir}/gradelib.php";
    $grades = grade_get_grades($course->id, 'mod', 'glossary', $glossary->id, $user->id);
    if (!empty($grades->items[0]->grades)) {
        $grade = reset($grades->items[0]->grades);
        echo '<p>' . get_string('grade') . ': ' . $grade->str_long_grade . '</p>';
        if ($grade->str_feedback) {
            echo '<p>' . get_string('feedback') . ': ' . $grade->str_feedback . '</p>';
        }
    }
    if ($entries = glossary_get_user_entries($glossary->id, $user->id)) {
        echo '<table width="95%" border="0"><tr><td>';
        foreach ($entries as $entry) {
            $cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id);
            glossary_print_entry($course, $cm, $glossary, $entry, "", "", 0);
            echo '<p>';
        }
        echo '</td></tr></table>';
    }
}
Beispiel #7
0
function glossary_user_complete($course, $user, $mod, $glossary)
{
    /// Print a detailed representation of what a  user has done with
    /// a given particular instance of this module, for user activity reports.
    global $CFG;
    if ($entries = glossary_get_user_entries($glossary->id, $user->id)) {
        echo '<table width="95%" border="0"><tr><td>';
        foreach ($entries as $entry) {
            $cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id);
            glossary_print_entry($course, $cm, $glossary, $entry, "", "", 0);
            echo '<p>';
        }
        echo '</td></tr></table>';
    }
}
Beispiel #8
0
 public function prepare_package()
 {
     define('PORTFOLIO_INTERNAL', true);
     ob_start();
     $entry = clone $this->entry;
     glossary_print_entry($this->get('course'), $this->cm, $this->glossary, $entry, null, null, false);
     $content = ob_get_clean();
     return $this->exporter->write_new_file($content, clean_filename($this->entry->concept) . '.html', false);
 }
Beispiel #9
0
function glossary_comment_print_header($course, $cm, $glossary, $entry, $action)
{
    switch ($action) {
        case 'add':
            $straction = get_string('addingcomment', 'glossary');
            break;
        case 'edit':
            $straction = get_string('editingcomment', 'glossary');
            break;
        case 'delete':
            $straction = get_string('deletingcomment', 'glossary');
            break;
    }
    $strglossaries = get_string('modulenameplural', 'glossary');
    $strglossary = get_string('modulename', 'glossary');
    $strcomments = get_string('comments', 'glossary');
    print_header_simple(format_string($glossary->name), '', "<a href=\"index.php?id={$course->id}\">{$strglossaries}</a> -> <a href=\"view.php?id={$cm->id}\">" . format_string($glossary->name, true) . "</a> -> <a href=\"comments.php?id={$cm->id}&amp;eid={$entry->id}\">{$strcomments}</a> -> " . $straction, '', '', true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
    /// print original glossary entry for any comment action (add, update, delete)
    glossary_print_entry($course, $cm, $glossary, $entry, 'approval', '', false);
}