Merged from stable

This commit is contained in:
moodler
2004-08-26 15:21:57 +00:00
parent 2b08c2ab0d
commit 359f27588b
4 changed files with 49 additions and 32 deletions
+18 -21
View File
@@ -1407,15 +1407,15 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
global $THEME, $USER, $CFG;
static $stredit, $strdelete, $strreply, $strparent, $threadedmode, $isteacher, $adminedit;
static $stredit, $strdelete, $strreply, $strparent, $strprune, $strpruneheading, $threadedmode, $isteacher, $adminedit;
if (empty($stredit)) {
$stredit = get_string("edit", "forum");
$strdelete = get_string("delete", "forum");
$strreply = get_string("reply", "forum");
$strparent = get_string("parent", "forum");
$strprune = get_string("prune", "forum");
$strpruneheading = get_string("pruneheading", "forum");
$stredit = get_string('edit', 'forum');
$strdelete = get_string('delete', 'forum');
$strreply = get_string('reply', 'forum');
$strparent = get_string('parent', 'forum');
$strpruneheading = get_string('pruneheading', 'forum');
$strprune = get_string('prune', 'forum');
$threadedmode = (!empty($USER->mode) and ($USER->mode == FORUM_MODE_THREADED));
$isteacher = isteacher($courseid);
$adminedit = (isadmin() and !empty($CFG->admineditalways));
@@ -1486,40 +1486,37 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
echo $attachedimages;
}
echo "<p align=right><font size=-1>";
$commands = array();
if ($post->parent) {
if ($threadedmode) {
echo "<a href=\"$CFG->wwwroot/mod/forum/discuss.php?d=$post->discussion&parent=$post->parent\">$strparent</a> | ";
$commands[] = "<a href=\"$CFG->wwwroot/mod/forum/discuss.php?d=$post->discussion&parent=$post->parent\">$strparent</a>";
} else {
echo "<a href=\"$CFG->wwwroot/mod/forum/discuss.php?d=$post->discussion#$post->parent\">$strparent</a> | ";
$commands[] = "<a href=\"$CFG->wwwroot/mod/forum/discuss.php?d=$post->discussion#$post->parent\">$strparent</a>";
}
}
$age = time() - $post->created;
if ($ownpost or $adminedit) {
if (($age < $CFG->maxeditingtime) or $adminedit) {
echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?edit=$post->id\">$stredit</a> | ";
$commands[] = "<a href=\"$CFG->wwwroot/mod/forum/post.php?edit=$post->id\">$stredit</a>";
}
}
if (isteacheredit($courseid) and $post->parent) {
echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?prune=$post->id\" title=\"$strpruneheading\">$strprune</a> | ";
$commands[] = "<a href=\"$CFG->wwwroot/mod/forum/post.php?prune=$post->id\" title=\"$strpruneheading\">$strprune</a>";
}
if (($ownpost and $age < $CFG->maxeditingtime) or $isteacher) {
echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">$strdelete</a>";
if ($reply) {
echo " | ";
} else {
echo "&nbsp;&nbsp;";
}
$commands[] = "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">$strdelete</a>";
}
if ($reply) {
echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?reply=$post->id\">$strreply</a>";
echo "&nbsp;&nbsp;";
$commands[] = "<a href=\"$CFG->wwwroot/mod/forum/post.php?reply=$post->id\">$strreply</a>";
}
echo "</p>";
echo "<p align=right><font size=-1>";
echo implode(' | ', $commands).'&nbsp;&nbsp;';
echo "</font></p>";
echo "<div align=right><p align=right>";
+20
View File
@@ -478,6 +478,23 @@ function glossary_get_entries($glossaryid, $entrylist, $pivot = "") {
WHERE glossaryid = '$glossaryid'
AND id IN ($entrylist)");
}
function glossary_get_entries_search($concept, $courseid) {
global $CFG;
$conceptupper = strtoupper(trim($concept));
return get_records_sql("SELECT e.*, g.name as glossaryname
FROM {$CFG->prefix}glossary_entries e,
{$CFG->prefix}glossary g
WHERE e.glossaryid = g.id
AND ( (e.casesensitive != 0 and UPPER(concept) = '$conceptupper')
OR (e.casesensitive = 0 and concept = '$concept'))
AND (g.course = '$courseid' OR g.globalglossary = 1)
AND e.usedynalink != 0
AND g.usedynalink != 0");
}
function glossary_get_entries_sorted($glossary, $where="", $orderby="", $pivot = "") {
global $CFG;
if ($where) {
@@ -586,6 +603,9 @@ function glossary_print_entry_definition($entry) {
if (!empty($entry->highlight)) {
$text = highlight($entry->highlight, $text);
}
if (isset($entry->footer)) { // Unparsed footer info
$text .= $entry->footer;
}
echo $text;
}
+10 -11
View File
@@ -12,19 +12,18 @@
}
if ($eid) {
$entries[] = get_record("glossary_entries", "id", $eid);
$entry = get_record("glossary_entries", "id", $eid);
$glossary = get_record('glossary','id',$entry->glossaryid);
$entry->glossaryname = $glossary->name;
$entries[] = $entry;
} else if ($concept) {
$entries = get_records_sql("select e.* from {$CFG->prefix}glossary_entries e, {$CFG->prefix}glossary g".
" where e.glossaryid = g.id and".
" (e.casesensitive != 0 and ucase(concept) = '" . strtoupper(trim($concept)). "' or".
" e.casesensitive = 0 and concept = '$concept') and".
" (g.course = $courseid or g.globalglossary) and".
" e.usedynalink != 0 and g.usedynalink != 0");
$entries = glossary_get_entries_search($concept, $courseid);
}
foreach ($entries as $entry) {
$glossary = get_record('glossary','id',$entry->glossaryid);
foreach ($entries as $key => $entry) {
//$entries[$key]->footer = "<p align=\"right\">&raquo;&nbsp;<a onClick=\"if (window.opener) {window.opener.location.href='$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid'; return false;} else {openpopup('/mod/glossary/view.php?g=$entry->glossaryid', 'glossary', 'menubar=1,location=1,toolbar=1,scrollbars=1,directories=1,status=1,resizable=1', 0); return false;}\" href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\" target=\"_blank\">$entry->glossaryname</a></p>"; // Could not get this to work satisfactorily in all cases - Martin
$entries[$key]->footer = "<p align=\"right\">&raquo;&nbsp;<a target=\"_blank\" href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">$entry->glossaryname</a></p>";
}
if (!empty($courseid)) {
@@ -38,10 +37,10 @@
$CFG->framename = "newwindow";
if ($course->category) {
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname",
"<a target=\"newwindow\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $strglossaries -> $strsearch", "", "", true, "&nbsp;", "&nbsp;");
} else {
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname",
"$strglossaries -> $strsearch", "", "", true, "&nbsp;", "&nbsp;");
}
+1
View File
@@ -49,6 +49,7 @@
if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id)) {
error("Could not determine which course module this belonged to!");
}
$id = $cm->id;
} else {
error("Must specify glossary ID or course module ID");
}