- New encapsulated functions in order to make easier to create new display formats
- Fixed problem when showing 'ALL' in alphabet frame - Disabled unnecessary fields when selecting DO NOT AUTOMATICALY LINK THIS ENTRY in the adde entry screen
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<form name="form" method="post" action="deleteentry.php">
|
||||
|
||||
<input type="hidden" name=id value="<?php p($cm->id) ?>">
|
||||
<input type="hidden" name=id value="<?php p($cm->id) ?>">
|
||||
<input type="hidden" name=mode value="delete">
|
||||
<input type="hidden" name=go value="1">
|
||||
<input type="hidden" name=entry value="<?php echo $entry ?>">
|
||||
|
||||
+19
-20
@@ -1,5 +1,5 @@
|
||||
<center>
|
||||
<form name="theform" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
|
||||
<form name="form" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
|
||||
<table class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php echo get_string("concept","glossary") ?>:</b></p></td>
|
||||
@@ -33,24 +33,18 @@
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php echo get_string("entryusedynalink","glossary") ?>:</b></p></td>
|
||||
<td>
|
||||
<select size="1" name="usedynalink">
|
||||
<option value="1" <?php
|
||||
if ( isset($newentry->usedynalink) ) {
|
||||
if ($newentry->usedynalink) {
|
||||
echo "selected";
|
||||
}
|
||||
}
|
||||
?>
|
||||
><?php echo get_string("yes") ?></option>
|
||||
<option value="0" <?php
|
||||
if ( isset($newentry->usedynalink) ) {
|
||||
if (!$newentry->usedynalink) {
|
||||
echo "selected";
|
||||
}
|
||||
}
|
||||
?>><?php echo get_string("no") ?>
|
||||
</option>
|
||||
</select> <?php helpbutton("usedynalink", get_string("usedynalink", "glossary"), "glossary") ?>
|
||||
<script>
|
||||
var items = ['casesensitive','fullmatch'];
|
||||
</script>
|
||||
<?php
|
||||
$selected = "";
|
||||
if ( isset($newentry->usedynalink) ) {
|
||||
if ($newentry->usedynalink) {
|
||||
$selected = "checked";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="usedynalink" value=1 <?php p($selected) ?> onclick="return lockoptions('form','usedynalink', items)"> <?php helpbutton("usedynalink", get_string("usedynalink", "glossary"), "glossary") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
@@ -148,6 +142,11 @@
|
||||
echo "<input type=\"hidden\" name=e value=\"$newentry->id\">";
|
||||
}
|
||||
?>
|
||||
|
||||
<input type="hidden" name=husedynalink value="1">
|
||||
<input type="hidden" name=hcasesensitive value="0">
|
||||
<input type="hidden" name=hfullmatch value="1">
|
||||
|
||||
<input type="hidden" name=id value="<?=$cm->id ?>">
|
||||
<input type="hidden" name=tab value="<?=$tab ?>">
|
||||
<input type="hidden" name=cat value="<?=$cat ?>">
|
||||
@@ -166,7 +165,7 @@
|
||||
|
||||
<?PHP
|
||||
if ($usehtmleditor) {
|
||||
print_richedit_javascript("theform", "text", "yes");
|
||||
print_richedit_javascript("form", "text", "yes");
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -30,7 +30,9 @@ if (! $glossary = get_record("glossary", "id", $cm->instance)) {
|
||||
}
|
||||
if ( $confirm ) {
|
||||
$form = data_submitted();
|
||||
|
||||
if ( !isset($form->usedynalink) ) {
|
||||
$form->usedynalink = 0;
|
||||
}
|
||||
$timenow = time();
|
||||
$form->text = clean_text($form->text, $form->format);
|
||||
|
||||
|
||||
+17
-21
@@ -14,31 +14,27 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
|
||||
echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostpicture\">";
|
||||
if ($entry) {
|
||||
print_user_picture($user->id, $course->id, $user->picture);
|
||||
}
|
||||
echo "</td>";
|
||||
echo "<td nowrap valign=\"top\" width=100% bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
|
||||
if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
|
||||
}
|
||||
if ($entry->attachment) {
|
||||
$entry->course = $glossary->course;
|
||||
echo "<table border=0 align=right><tr><td>";
|
||||
echo glossary_print_attachments($entry, "html");
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
if ($entry) {
|
||||
echo "<b>$entry->concept</b><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "<td nowrap valign=\"top\" width=100% bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
|
||||
|
||||
glossary_print_entry_approval($cm, $entry, $tab);
|
||||
glossary_print_entry_attachment($entry,"html","right");
|
||||
|
||||
echo "<b>";
|
||||
glossary_print_entry_concept($entry);
|
||||
echo "</b><br />";
|
||||
|
||||
echo "<font size=\"2\">$strby $user->firstname $user->lastname</font>";
|
||||
echo " <font size=1>(".get_string("lastedited").": ".
|
||||
userdate($entry->timemodified).")</font>";
|
||||
}
|
||||
echo "</tr>";
|
||||
echo "</tr>";
|
||||
|
||||
echo "\n<tr>";
|
||||
echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostside\"> </td>";
|
||||
echo "\n<td width=100% bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
|
||||
if ($entry) {
|
||||
echo format_text($entry->definition, $entry->format);
|
||||
echo "\n<tr>";
|
||||
echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostside\"> </td>";
|
||||
echo "\n<td width=100% bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
|
||||
|
||||
glossary_print_entry_definition($entry);
|
||||
glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab,$cat);
|
||||
|
||||
} else {
|
||||
|
||||
+13
-18
@@ -14,24 +14,21 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
|
||||
echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostpicture\">";
|
||||
if ($entry) {
|
||||
print_user_picture($user->id, $course->id, $user->picture);
|
||||
}
|
||||
echo "</td>";
|
||||
echo "<td align=\"top\" nowrap width=100% bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
|
||||
if ($entry) {
|
||||
if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
|
||||
}
|
||||
echo "<b>$entry->concept</b><br />";
|
||||
echo "</td>";
|
||||
echo "<td align=\"top\" nowrap width=100% bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
|
||||
glossary_print_entry_approval($cm, $entry, $tab);
|
||||
echo "<b>";
|
||||
glossary_print_entry_concept($entry);
|
||||
echo "</b><br />";
|
||||
echo "<font size=\"2\">$strby $user->firstname $user->lastname</font>";
|
||||
echo " <font size=1>(".get_string("lastedited").": ".
|
||||
userdate($entry->timemodified).")</font>";
|
||||
}
|
||||
echo "</tr>";
|
||||
echo "</tr>";
|
||||
|
||||
echo "\n<tr>";
|
||||
echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostside\"> </td>";
|
||||
echo "\n<td width=100% align=\"top\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
|
||||
|
||||
echo "\n<tr>";
|
||||
echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostside\"> </td>";
|
||||
echo "\n<td width=100% align=\"top\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
|
||||
if ($entry) {
|
||||
if ($entry->attachment) {
|
||||
$entry->course = $course->id;
|
||||
if (strlen($entry->definition)%2) {
|
||||
@@ -39,11 +36,9 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
|
||||
} else {
|
||||
$align = "left";
|
||||
}
|
||||
echo "<table border=0 align=$align><tr><td>";
|
||||
echo glossary_print_attachments($entry);
|
||||
echo "</td></tr></table>";
|
||||
glossary_print_entry_attachment($entry,"",$align);
|
||||
}
|
||||
echo format_text($entry->definition, $entry->format);
|
||||
glossary_print_entry_definition($entry);
|
||||
|
||||
glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab,$cat);
|
||||
|
||||
|
||||
+15
-17
@@ -6,31 +6,29 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
|
||||
if ( $entry ) {
|
||||
$colour = $THEME->cellheading2;
|
||||
|
||||
echo "\n<table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
|
||||
echo '<table border=1 cellspacing=0 width=95% valign=top cellpadding=10>';
|
||||
|
||||
echo "\n<tr>";
|
||||
echo '<tr>';
|
||||
echo "<td width=100% bgcolor=\"$colour\">";
|
||||
$entry->course = $course->id;
|
||||
if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
|
||||
}
|
||||
if ($entry->attachment) {
|
||||
echo "<table border=0 align=right><tr><td>";
|
||||
echo glossary_print_attachments($entry, "html");
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
echo "<b>" . get_string("question","glossary") . ":</b> $entry->concept<br>";
|
||||
echo " <font size=1>".get_string("lastedited").": ".userdate($entry->timemodified)."</font></tr>";
|
||||
echo "\n<tr><td width=100% bgcolor=\"$THEME->cellcontent\">";
|
||||
echo "<b>" . get_string("answer","glossary") . ":</b> " . format_text($entry->definition, $entry->format);
|
||||
glossary_print_entry_approval($cm, $entry, $tab);
|
||||
glossary_print_entry_attachment($entry,"html","right");
|
||||
|
||||
echo '<b>' . get_string("question","glossary") . ':</b> ';
|
||||
echo glossary_print_entry_concept($entry) . '<br>';
|
||||
echo ' <font size=1>' . get_string("lastedited").': '.userdate($entry->timemodified) . '</font></tr>';
|
||||
echo "<tr><td width=100% bgcolor=\"$THEME->cellcontent\">";
|
||||
echo '<b>' . get_string("answer","glossary") . ':</b> ';
|
||||
echo glossary_print_entry_definition($entry);
|
||||
|
||||
|
||||
glossary_print_entry_icons($course, $cm, $glossary, $entry, $tab, $cat);
|
||||
echo "</td></tr></table>\n";
|
||||
echo '</td></tr></table>';
|
||||
|
||||
} else {
|
||||
echo "<center>";
|
||||
echo '<center>';
|
||||
print_string("noentry", "glossary");
|
||||
echo "</center>";
|
||||
echo '</center>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,27 +9,18 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
|
||||
|
||||
echo "\n<tr>";
|
||||
echo "<td width=100% bgcolor=\"$colour\">";
|
||||
if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
|
||||
}
|
||||
if ($entry->attachment) {
|
||||
$entry->course = $course->id;
|
||||
echo "<table border=0 align=right><tr><td>";
|
||||
echo glossary_print_attachments($entry, "html");
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
echo "<b>$entry->concept</b><br>";
|
||||
glossary_print_entry_approval($cm, $entry, $tab);
|
||||
if ($entry) {
|
||||
glossary_print_entry_attachment($entry,"html","right");
|
||||
echo "<b>";
|
||||
glossary_print_entry_concept($entry);
|
||||
echo "</b><br />";
|
||||
echo " <font size=1>".get_string("lastedited").": ".userdate($entry->timemodified)."</font>";
|
||||
}
|
||||
echo "</tr>";
|
||||
|
||||
echo "\n<tr><td width=100% bgcolor=\"$THEME->cellcontent\">";
|
||||
if ($entry) {
|
||||
echo format_text($entry->definition, $entry->format);
|
||||
|
||||
echo "</tr>";
|
||||
echo "\n<tr><td width=100% bgcolor=\"$THEME->cellcontent\">";
|
||||
|
||||
glossary_print_entry_definition($entry);
|
||||
glossary_print_entry_icons($course, $cm, $glossary, $entry, $tab, $cat);
|
||||
|
||||
} else {
|
||||
echo "<center>";
|
||||
print_string("noentry", "glossary");
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
$link = "<A HREF=\"view.php?id=$glossary->coursemodule\">$glossary->name</A>";
|
||||
}
|
||||
|
||||
$count = count_records("glossary_entries", "glossaryid", $glossary->id);
|
||||
$count = count_records_sql("SELECT COUNT(*) FROM {$CFG->prefix}glossary_entries where (glossaryid = $glossary->id or sourceglossaryid = $glossary->id)");
|
||||
|
||||
if ($course->format == "weeks" or $course->format == "topics") {
|
||||
if (empty($glossary->section)) {
|
||||
|
||||
+62
-52
@@ -249,6 +249,33 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $tab="",$cat="")
|
||||
}
|
||||
}
|
||||
}
|
||||
function glossary_print_entry_concept($entry) {
|
||||
echo $entry->concept;
|
||||
}
|
||||
|
||||
function glossary_print_entry_definition($entry) {
|
||||
$definition = str_ireplace($entry->concept,"<nolink>$entry->concept</nolink>",$entry->definition);
|
||||
echo format_text($definition, $entry->format);
|
||||
}
|
||||
|
||||
function glossary_print_entry_attachment($entry,$format,$align) {
|
||||
/// 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
|
||||
echo "<table border=0 align=$align><tr><td>";
|
||||
echo glossary_print_attachments($entry,$format,$align);
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
}
|
||||
|
||||
function glossary_print_entry_approval($cm, $entry, $tab) {
|
||||
if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
|
||||
}
|
||||
}
|
||||
|
||||
function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$tab="",$cat="") {
|
||||
global $THEME, $USER;
|
||||
@@ -256,19 +283,14 @@ function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$tab=""
|
||||
$colour = $THEME->cellheading2;
|
||||
|
||||
echo "\n<TR>";
|
||||
echo "<TD WIDTH=100% valign=\"top\" BGCOLOR=\"#FFFFFF\">";
|
||||
if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
|
||||
}
|
||||
if ($entry->attachment) {
|
||||
$entry->course = $course->id;
|
||||
echo "<table border=0 align=right><tr><td>";
|
||||
echo glossary_print_attachments($entry,"html");
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
echo "<b>$entry->concept</b>: ";
|
||||
echo format_text($entry->definition, $entry->format);
|
||||
glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab,$cat);
|
||||
echo "<TD WIDTH=100% class=\"generalbox\" valign=\"top\" BGCOLOR=\"#FFFFFF\">";
|
||||
glossary_print_entry_approval($cm, $entry, $tab);
|
||||
glossary_print_entry_attachment($entry,"html","right");
|
||||
echo "<b>";
|
||||
glossary_print_entry_concept($entry);
|
||||
echo ":</b> ";
|
||||
glossary_print_entry_definition($entry);
|
||||
glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab,$cat);
|
||||
echo "</td>";
|
||||
echo "</TR>";
|
||||
}
|
||||
@@ -276,21 +298,15 @@ function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$tab=""
|
||||
function glossary_print_entry_continuous($course, $cm, $glossary, $entry,$tab="",$cat="") {
|
||||
global $THEME, $USER;
|
||||
if ($entry) {
|
||||
if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
|
||||
}
|
||||
if ($entry->attachment) {
|
||||
$entry->course = $course->id;
|
||||
echo "<table border=0 align=right><tr><td>";
|
||||
echo glossary_print_attachments($entry, "html");
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
echo " $entry->concept ";
|
||||
echo format_text($entry->definition, $entry->format);
|
||||
|
||||
glossary_print_entry_approval($cm, $entry, $tab);
|
||||
glossary_print_entry_attachment($entry,"html","right");
|
||||
glossary_print_entry_concept($entry);
|
||||
echo " ";
|
||||
glossary_print_entry_definition($entry);
|
||||
glossary_print_entry_icons($course, $cm, $glossary, $entry, $tab, $cat);
|
||||
}
|
||||
}
|
||||
|
||||
function glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab="",$cat="") {
|
||||
global $THEME, $USER;
|
||||
|
||||
@@ -953,11 +969,7 @@ function glossary_sort_entries ( $entry0, $entry1 ) {
|
||||
function glossary_print_comment($course, $cm, $glossary, $entry, $comment) {
|
||||
global $THEME, $CFG, $USER;
|
||||
|
||||
// if ($entry->timemarked < $entry->modified) {
|
||||
$colour = $THEME->cellheading2;
|
||||
// } else {
|
||||
// $colour = $THEME->cellheading;
|
||||
// }
|
||||
$colour = $THEME->cellheading2;
|
||||
|
||||
$user = get_record("user", "id", $comment->userid);
|
||||
$strby = get_string("writtenby","glossary");
|
||||
@@ -972,7 +984,7 @@ function glossary_print_comment($course, $cm, $glossary, $entry, $comment) {
|
||||
echo "<br><FONT SIZE=1>(".get_string("lastedited").": ".userdate($comment->timemodified).")</FONT></small><br>";
|
||||
echo "</TD>";
|
||||
|
||||
echo "<TD NOWRAP valign=top WIDTH=75% BGCOLOR=\"$THEME->cellcontent\">";
|
||||
echo "<TD valign=top WIDTH=75% BGCOLOR=\"$THEME->cellcontent\">";
|
||||
if ($comment) {
|
||||
echo format_text($comment->comment, $comment->format);
|
||||
} else {
|
||||
@@ -995,30 +1007,28 @@ function glossary_print_comment($course, $cm, $glossary, $entry, $comment) {
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
|
||||
function glossary_print_dynaentry($courseid, $entries) {
|
||||
global $THEME, $USER;
|
||||
function glossary_print_dynaentry($courseid, $entries) {
|
||||
global $THEME, $USER;
|
||||
|
||||
$colour = $THEME->cellheading2;
|
||||
$colour = $THEME->cellheading2;
|
||||
|
||||
echo "\n<center><table width=95% border=0><tr>";
|
||||
echo "<td width=100%\">";
|
||||
if ( $entries ) {
|
||||
foreach ( $entries as $entry ) {
|
||||
|
||||
if (! $glossary = get_record("glossary", "id", $entry->glossaryid)) {
|
||||
error("Glossary ID was incorrect or no longer exists");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $glossary->course)) {
|
||||
error("Glossary is misconfigured - don't know what course it's from");
|
||||
}
|
||||
if (!$cm = get_coursemodule_from_instance("glossary", $entry->glossaryid, $courseid) ) {
|
||||
error("Glossary is misconfigured - don't know what course module it is ");
|
||||
}
|
||||
|
||||
glossary_print_entry($course, $cm, $glossary, $entry);
|
||||
echo "\n<center><table width=95% border=0><tr>";
|
||||
echo "<td width=100%\">";
|
||||
if ( $entries ) {
|
||||
foreach ( $entries as $entry ) {
|
||||
if (! $glossary = get_record("glossary", "id", $entry->glossaryid)) {
|
||||
error("Glossary ID was incorrect or no longer exists");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $glossary->course)) {
|
||||
error("Glossary is misconfigured - don't know what course it's from");
|
||||
}
|
||||
if (!$cm = get_coursemodule_from_instance("glossary", $entry->glossaryid, $courseid) ) {
|
||||
error("Glossary is misconfigured - don't know what course module it is ");
|
||||
}
|
||||
glossary_print_entry($course, $cm, $glossary, $entry);
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr></table></center>";
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr></table></center>";
|
||||
}
|
||||
?>
|
||||
|
||||
+45
-24
@@ -34,13 +34,18 @@
|
||||
}
|
||||
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id&tab=$tab", "$glossary->id");
|
||||
|
||||
/// stablishing default tab
|
||||
$framebydefault = GLOSSARY_STANDARD_VIEW;
|
||||
if ($glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS) {
|
||||
$framebydefault = GLOSSARY_DATE_VIEW;
|
||||
}
|
||||
|
||||
/// checking for valid values for sortorder and sortkey
|
||||
if ( $sortorder = strtolower($sortorder) ) {
|
||||
if ($sortorder != 'asc' and $sortorder != 'desc') {
|
||||
$sortorder = '';
|
||||
} else {
|
||||
$l = '';
|
||||
$l = ''; /// if we are sorting by date, reset the searching by terms or letters
|
||||
$search = '';
|
||||
}
|
||||
}
|
||||
@@ -49,22 +54,31 @@
|
||||
$sortkey = '';
|
||||
}
|
||||
}
|
||||
/// in this point:
|
||||
/// $sortkey = CREATION | UPDATE | ''
|
||||
/// $sortorder = asc | desc | ''
|
||||
|
||||
if ( $sortkey or $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS) {
|
||||
if ( !$sortkey and $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS) {
|
||||
if ( $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
|
||||
$tab = $framebydefault;
|
||||
|
||||
if ( !$sortkey ) {
|
||||
$sortkey = 'CREATION';
|
||||
$sortorder = 'asc';
|
||||
}
|
||||
if ( !$sortorder ) {
|
||||
$sortorder = 'asc';
|
||||
}
|
||||
} else {
|
||||
$orderby = 'concept ASC';
|
||||
if ( !$sortkey ) {
|
||||
$sortkey = 'concept';
|
||||
}
|
||||
if ( !$sortorder ) {
|
||||
$sortorder = 'asc';
|
||||
}
|
||||
}
|
||||
|
||||
// creating matrix of words to search if apply
|
||||
$search = trim(strip_tags($search));
|
||||
if ($search and !$eid) {
|
||||
if ($search and !$eid) { /// searching terms
|
||||
$l = '';
|
||||
$searchterms = explode(' ', $search); // Search for words independently
|
||||
foreach ($searchterms as $key => $searchterm) {
|
||||
@@ -73,18 +87,18 @@
|
||||
}
|
||||
}
|
||||
$search = trim(implode(' ', $searchterms));
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
} elseif ($eid) {
|
||||
$tab = $framebydefault;
|
||||
} elseif ($eid) { /// searching a specify entry
|
||||
$search = '';
|
||||
}
|
||||
|
||||
$alphabet = explode('|', get_string("alphabet","glossary"));
|
||||
if ($l == '' and $search == '' and $sortkey == '' and !$eid) {
|
||||
if ($l == '' and $search == '' and !$eid) {
|
||||
// if the user is just entering the glossary...
|
||||
if ($tab != GLOSSARY_APPROVAL_VIEW) {
|
||||
$l = $alphabet[0];
|
||||
} else {
|
||||
$l = 'ALL';
|
||||
$l = 'ALL'; /// show ALL by default in the waiting approval frame
|
||||
}
|
||||
} elseif ($eid) {
|
||||
$l = '';
|
||||
@@ -167,15 +181,16 @@
|
||||
$glossary_tCFG->TabsPerRow = 4;
|
||||
$glossary_tCFG->TabSeparation = 4;
|
||||
|
||||
$data[GLOSSARY_STANDARD_VIEW]->link = "view.php?id=$id";
|
||||
$data[GLOSSARY_STANDARD_VIEW]->caption = get_string("standardview", "glossary");
|
||||
|
||||
$data[GLOSSARY_CATEGORY_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_CATEGORY_VIEW;
|
||||
$data[GLOSSARY_CATEGORY_VIEW]->caption = get_string("categoryview", "glossary");
|
||||
|
||||
$data[GLOSSARY_DATE_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_DATE_VIEW;
|
||||
$data[GLOSSARY_DATE_VIEW]->caption = get_string("dateview", "glossary");
|
||||
|
||||
$data[GLOSSARY_DATE_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_DATE_VIEW;
|
||||
if ( $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS ) {
|
||||
$data[GLOSSARY_STANDARD_VIEW]->link = "view.php?id=$id";
|
||||
$data[GLOSSARY_CATEGORY_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_CATEGORY_VIEW;
|
||||
}
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
$data[GLOSSARY_APPROVAL_VIEW]->caption = get_string("waitingapproval", "glossary");
|
||||
$data[GLOSSARY_APPROVAL_VIEW]->link = "";
|
||||
@@ -185,10 +200,10 @@
|
||||
$data[GLOSSARY_APPROVAL_VIEW]->caption .= "<br><font size=1>(" . count($hiddenentries) . " " . get_string("entries","glossary") . ")</font>";
|
||||
$data[GLOSSARY_APPROVAL_VIEW]->link = "view.php?id=$id&tab=".GLOSSARY_APPROVAL_VIEW;
|
||||
} elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
$tab = $framebydefault;
|
||||
}
|
||||
} elseif ( $tab == GLOSSARY_APPROVAL_VIEW ) {
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
$tab = $framebydefault;
|
||||
}
|
||||
|
||||
/// printing header of the current tab
|
||||
@@ -220,6 +235,17 @@
|
||||
|
||||
/// Printing the entries
|
||||
|
||||
switch ($sortkey) {
|
||||
case 'CREATION':
|
||||
$orderby = "timecreated $sortorder";
|
||||
break;
|
||||
case 'UPDATE':
|
||||
$orderby = "timemodified $sortorder";
|
||||
break;
|
||||
default:
|
||||
$orderby = "$sortkey $sortorder";
|
||||
}
|
||||
|
||||
switch ($tab) {
|
||||
case GLOSSARY_CATEGORY_VIEW:
|
||||
if ($cat == GLOSSARY_SHOW_ALL_CATEGORIES) {
|
||||
@@ -259,11 +285,6 @@
|
||||
} elseif ($eid) { // looking for an entry
|
||||
$allentries = get_records_select("glossary_entries", "id = $eid");
|
||||
} elseif ( $l or $sortkey ) {
|
||||
if ($sortkey == 'CREATION') {
|
||||
$orderby = "timecreated $sortorder";
|
||||
} else {
|
||||
$orderby = "timemodified $sortorder";
|
||||
}
|
||||
$where = '';
|
||||
if ($l != 'ALL' and $l != 'SPECIAL') {
|
||||
switch ($CFG->dbtype) {
|
||||
@@ -402,10 +423,10 @@
|
||||
} else {
|
||||
switch ($glossary->displayformat) {
|
||||
case GLOSSARY_FORMAT_CONTINUOUS:
|
||||
echo '</td></tr></table>';
|
||||
echo '</td></tr></table><p>';
|
||||
break;
|
||||
case GLOSSARY_FORMAT_SIMPLE:
|
||||
echo '</table></center>';
|
||||
echo '</table></center><p>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user