: |
@@ -33,24 +33,18 @@
: |
-
+
+usedynalink) ) {
+ if ($newentry->usedynalink) {
+ $selected = "checked";
+ }
+ }
+?>
+ onclick="return lockoptions('form','usedynalink', items)">
|
@@ -148,6 +142,11 @@
echo "id\">";
}
?>
+
+
+
+
+
@@ -166,7 +165,7 @@
diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php
index 76c8fcb8b3a..2a2413ebc4b 100644
--- a/mod/glossary/edit.php
+++ b/mod/glossary/edit.php
@@ -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);
diff --git a/mod/glossary/formats/2.php b/mod/glossary/formats/2.php
index 17d8b0fd389..2b495f61845 100644
--- a/mod/glossary/formats/2.php
+++ b/mod/glossary/formats/2.php
@@ -14,31 +14,27 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
echo "\n| ";
if ($entry) {
print_user_picture($user->id, $course->id, $user->picture);
- }
- echo " | ";
- echo "cellheading\" class=\"forumpostheader\">";
- if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- echo "id&eid=$entry->id&tab=$tab\"> ";
- }
- if ($entry->attachment) {
- $entry->course = $glossary->course;
- echo "| ";
- echo glossary_print_attachments($entry, "html");
- echo " | ";
- }
- if ($entry) {
- echo "$entry->concept ";
+
+ echo " | ";
+ echo "cellheading\" class=\"forumpostheader\">";
+
+ glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_attachment($entry,"html","right");
+
+ echo "";
+ glossary_print_entry_concept($entry);
+ echo " ";
+
echo "$strby $user->firstname $user->lastname";
echo " (".get_string("lastedited").": ".
userdate($entry->timemodified).")";
- }
- echo " |
";
+ echo "";
- echo "\n";
- echo "\n| | ";
- echo "\ncellcontent\" class=\"forumpostmessage\">";
- if ($entry) {
- echo format_text($entry->definition, $entry->format);
+ echo "\n |
";
+ echo "\n| | ";
+ echo "\ncellcontent\" class=\"forumpostmessage\">";
+
+ glossary_print_entry_definition($entry);
glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab,$cat);
} else {
diff --git a/mod/glossary/formats/3.php b/mod/glossary/formats/3.php
index 0c2155e7982..8c2652a24d0 100644
--- a/mod/glossary/formats/3.php
+++ b/mod/glossary/formats/3.php
@@ -14,24 +14,21 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
echo "\n | ";
if ($entry) {
print_user_picture($user->id, $course->id, $user->picture);
- }
- echo " | ";
- echo "cellheading\" class=\"forumpostheader\">";
- if ($entry) {
- if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- echo "id&eid=$entry->id&tab=$tab\"> ";
- }
- echo "$entry->concept ";
+ echo " | ";
+ echo "cellheading\" class=\"forumpostheader\">";
+ glossary_print_entry_approval($cm, $entry, $tab);
+ echo "";
+ glossary_print_entry_concept($entry);
+ echo " ";
echo "$strby $user->firstname $user->lastname";
echo " (".get_string("lastedited").": ".
userdate($entry->timemodified).")";
- }
- echo " |
";
+ echo "";
+
+ echo "\n";
+ echo "\n| | ";
+ echo "\ncellcontent\" class=\"forumpostmessage\">";
- echo "\n |
";
- echo "\n| | ";
- echo "\ncellcontent\" 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 "| ";
- echo glossary_print_attachments($entry);
- echo " | ";
+ 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);
diff --git a/mod/glossary/formats/4.php b/mod/glossary/formats/4.php
index 58769a12958..246eb536fa4 100644
--- a/mod/glossary/formats/4.php
+++ b/mod/glossary/formats/4.php
@@ -6,31 +6,29 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
if ( $entry ) {
$colour = $THEME->cellheading2;
- echo "\n";
+ echo '';
- echo "\n";
+ echo ' ';
echo "";
$entry->course = $course->id;
- if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- echo "id&eid=$entry->id&tab=$tab\"> ";
- }
- if ($entry->attachment) {
- echo "| ";
- echo glossary_print_attachments($entry, "html");
- echo " | ";
- }
- echo "" . get_string("question","glossary") . ": $entry->concept ";
- echo " ".get_string("lastedited").": ".userdate($entry->timemodified)." | ";
- echo "\ncellcontent\">";
- echo "" . get_string("answer","glossary") . ": " . format_text($entry->definition, $entry->format);
+ glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_attachment($entry,"html","right");
+
+ echo '' . get_string("question","glossary") . ': ';
+ echo glossary_print_entry_concept($entry) . ' ';
+ echo ' ' . get_string("lastedited").': '.userdate($entry->timemodified) . ' | ';
+ echo "| cellcontent\">";
+ echo '' . get_string("answer","glossary") . ': ';
+ echo glossary_print_entry_definition($entry);
+
glossary_print_entry_icons($course, $cm, $glossary, $entry, $tab, $cat);
- echo " | \n";
+ echo ' ';
} else {
- echo "";
+ echo '';
print_string("noentry", "glossary");
- echo "";
+ echo '';
}
}
diff --git a/mod/glossary/formats/5.php b/mod/glossary/formats/5.php
index 0e798470b59..e4ec4700280 100644
--- a/mod/glossary/formats/5.php
+++ b/mod/glossary/formats/5.php
@@ -9,27 +9,18 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
echo "\n |
";
echo "";
- if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- echo "id&eid=$entry->id&tab=$tab\"> ";
- }
- if ($entry->attachment) {
- $entry->course = $course->id;
- echo "| ";
- echo glossary_print_attachments($entry, "html");
- echo " | ";
- }
- echo "$entry->concept ";
+ glossary_print_entry_approval($cm, $entry, $tab);
if ($entry) {
+ glossary_print_entry_attachment($entry,"html","right");
+ echo "";
+ glossary_print_entry_concept($entry);
+ echo " ";
echo " ".get_string("lastedited").": ".userdate($entry->timemodified)."";
- }
- echo " |
";
-
- echo "\n| cellcontent\">";
- if ($entry) {
- echo format_text($entry->definition, $entry->format);
-
+ echo " |
";
+ echo "\ncellcontent\">";
+
+ glossary_print_entry_definition($entry);
glossary_print_entry_icons($course, $cm, $glossary, $entry, $tab, $cat);
-
} else {
echo "";
print_string("noentry", "glossary");
diff --git a/mod/glossary/index.php b/mod/glossary/index.php
index c85fa8deaf1..346c85689f0 100644
--- a/mod/glossary/index.php
+++ b/mod/glossary/index.php
@@ -66,7 +66,7 @@
$link = "coursemodule\">$glossary->name";
}
- $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)) {
diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php
index 76fb8c2f05c..55f55cc32ac 100644
--- a/mod/glossary/lib.php
+++ b/mod/glossary/lib.php
@@ -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,"$entry->concept",$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 "| ";
+ echo glossary_print_attachments($entry,$format,$align);
+ echo " | ";
+ }
+}
+
+function glossary_print_entry_approval($cm, $entry, $tab) {
+ if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
+ echo "id&eid=$entry->id&tab=$tab\"> ";
+ }
+}
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";
- echo "";
- if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- echo "id&eid=$entry->id&tab=$tab\"> ";
- }
- if ($entry->attachment) {
- $entry->course = $course->id;
- echo "| ";
- echo glossary_print_attachments($entry,"html");
- echo " | ";
- }
- echo "$entry->concept: ";
- echo format_text($entry->definition, $entry->format);
- glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab,$cat);
+ echo " | ";
+ glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_attachment($entry,"html","right");
+ echo "";
+ glossary_print_entry_concept($entry);
+ echo ": ";
+ glossary_print_entry_definition($entry);
+ glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab,$cat);
echo " | ";
echo " ";
}
@@ -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 "id&eid=$entry->id&tab=$tab\"> ";
- }
- if ($entry->attachment) {
- $entry->course = $course->id;
- echo "| ";
- echo glossary_print_attachments($entry, "html");
- echo " | ";
- }
- 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 " (".get_string("lastedited").": ".userdate($comment->timemodified).") ";
echo " | ";
- echo "cellcontent\">";
+ echo " | 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 " |
";
}
- 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';
break;
case GLOSSARY_FORMAT_SIMPLE:
- echo '