Removal of THEME, added some classes, general tidy up.

This commit is contained in:
moodler
2005-02-17 08:38:50 +00:00
parent 9056cec068
commit b8340d1938
19 changed files with 183 additions and 211 deletions
+17 -22
View File
@@ -1,17 +1,15 @@
<form name="form" method="post" action="comment.php">
<table class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
<tr valign=top>
<td align=right><p><b>
<table class="generalbox">
<tr valign="top">
<td align="right"><b>
<?php echo get_string("comment","glossary") ?>:
</b></p></td>
<td align="left" rowspan="2">
</b></td>
<td rowspan="2">
<?php print_textarea($usehtmleditor, 25, 65, 630, 400, "text", $form->text); ?>
</td>
</tr>
<tr valign="top">
<td align="right" valign="middle" nowrap="nowrap">
<font size="1">
<td align="right" nowrap="nowrap">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
@@ -20,14 +18,12 @@
} else {
emoticonhelpbutton("form", "text");
}
echo "<br />";
?>
<br />
</font>
</td>
</tr>
<tr valign=top>
<td align=right><p><b><?php print_string("formattexttype"); ?>:</b></p></td>
<tr valign="top">
<td align="right"><b><?php print_string("formattexttype"); ?>:</b></td>
<td>
<?php
if ($usehtmleditor) { /// Trying this out for a while
@@ -44,24 +40,23 @@
</td>
</tr>
<tr>
<td colspan=2>
<p align=center>
<td colspan="2">
<center>
<?php
if (isset($comment->id)) {
echo "<input type=\"hidden\" name=cid value=\"$comment->id\" />";
echo "<input type=\"hidden\" name=\"cid\" value=\"$comment->id\" />";
}
?>
<input type="hidden" name=id value="<?php p($cm->id) ?>" />
<input type="hidden" name=eid value="<?php p($entry->id) ?>" />
<input type="hidden" name=action value="<?php p($action) ?>" />
<input type="hidden" name=confirm value="1">
<input type="hidden" name="id" value="<?php p($cm->id) ?>" />
<input type="hidden" name="eid" value="<?php p($entry->id) ?>" />
<input type="hidden" name="action" value="<?php p($action) ?>" />
<input type="hidden" name="confirm" value="1" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="reset" value="<?php print_string("revert") ?>" />
</p>
</center>
</td>
</tr>
</table>
</p>
</form>
+67 -64
View File
@@ -1,8 +1,8 @@
<?php // $Id$
/// This page prints a particular instance of glossary
require_once("../../config.php");
require_once("lib.php");
require_once('../../config.php');
require_once('lib.php');
require_variable($id); // Course Module ID
require_variable($eid); // Entry ID
@@ -14,98 +14,98 @@
$action = strtolower($action);
global $THEME, $USER, $CFG;
global $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
if (! $cm = get_record('course_modules', 'id', $id)) {
error('Course Module ID was incorrect');
}
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
if (! $course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
error("Course module is incorrect");
if (! $glossary = get_record('glossary', 'id', $cm->instance)) {
error('Course module is incorrect');
}
if (! $entry = get_record("glossary_entries", "id", $eid)) {
error("Entry is incorrect");
if (! $entry = get_record('glossary_entries', 'id', $eid)) {
error('Entry is incorrect');
}
if ( $cid ) {
if (! $comment = get_record("glossary_comments", "id", $cid)) {
error("Comment is incorrect");
if (! $comment = get_record('glossary_comments', 'id', $cid)) {
error('Comment is incorrect');
}
}
require_login($course->id, false, $cm);
if (isguest()) {
error("Guests are not allowed to post comments", $_SERVER["HTTP_REFERER"]);
error('Guests are not allowed to post comments', $_SERVER['HTTP_REFERER']);
}
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
add_to_log($course->id, 'glossary', 'view', "view.php?id=$cm->id", "$glossary->id",$cm->id);
switch ( $action ){
case "add":
$straction = get_string("addingcomment","glossary");
case 'add':
$straction = get_string('addingcomment','glossary');
break;
case "edit":
$straction = get_string("editingcomment","glossary");
case 'edit':
$straction = get_string('editingcomment','glossary');
break;
case "delete":
$straction = get_string("deletingcomment","glossary");
case 'delete':
$straction = get_string('deletingcomment','glossary');
break;
default:
$action = "add";
$straction = get_string("addingcomment","glossary");
$action = 'add';
$straction = get_string('addingcomment','glossary');
break;
}
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
$strcomments = get_string("comments", "glossary");
$strglossaries = get_string('modulenameplural', 'glossary');
$strglossary = get_string('modulename', 'glossary');
$strcomments = get_string('comments', 'glossary');
print_header_simple(strip_tags("$glossary->name"), "",
"<a href=index.php?id=$course->id>$strglossaries</a> -> <a href=view.php?id=$cm->id>$glossary->name</a> -> <a href=comments.php?id=$cm->id&amp;eid=$entry->id>$strcomments</a> -> " . $straction,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
print_header_simple(strip_tags("$glossary->name"), '',
"<a href=\"index.php?id=$course->id\">$strglossaries</a> -> <a href=\"view.php?id=$cm->id\">$glossary->name</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));
echo "<center>";
echo '<center>';
/// Input section
if ( $action == "delete" ) {
if ( $action == 'delete' ) {
if (($comment->userid <> $USER->id) and !isteacher($glossary->course)) {
error("You can't delete other people's comments!");
error('You can\'t delete other people\'s comments!');
}
if (!$glossary->allowcomments && !isteacher($glossary->course)) {
error("You can't delete comments in this glossary!");
error('You can\'t delete comments in this glossary!');
}
if ( $confirm ) {
delete_records("glossary_comments","id", $cid);
delete_records('glossary_comments','id', $cid);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("commentdeleted","glossary") . "</center>";
print_simple_box_start('center','40%', '#FFBBBB');
echo '<center>'.get_string('commentdeleted','glossary').'</center>';
print_simple_box_end();
print_footer($course);
add_to_log($course->id, "glossary", "delete comment", "comments.php?id=$cm->id&amp;eid=$entry->id", "$comment->id",$cm->id);
add_to_log($course->id, 'glossary', 'delete comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$comment->id",$cm->id);
redirect("comments.php?id=$cm->id&amp;eid=$entry->id");
} else {
glossary_print_comment($course, $cm, $glossary, $entry, $comment);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><br />" . get_string("areyousuredeletecomment","glossary");
print_simple_box_start('center','40%', '#FFBBBB');
echo '<center><br />'.get_string('areyousuredeletecomment','glossary');
?>
<form name="form" method="post" action="comment.php">
<input type="hidden" name=id value="<?php p($id) ?>" />
<input type="hidden" name=eid value="<?php p($eid) ?>" />
<input type="hidden" name=cid value="<?php p($cid) ?>" />
<input type="hidden" name=action value="delete" />
<input type="hidden" name=confirm value="1" />
<input type="submit" value=" <?php print_string("yes")?> " />
<input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);" />
<input type="hidden" name="id" value="<?php p($id) ?>" />
<input type="hidden" name="eid" value="<?php p($eid) ?>" />
<input type="hidden" name="cid" value="<?php p($cid) ?>" />
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="confirm" value="1" />
<input type="submit" value="<?php print_string('yes')?>" />
<input type="button" value="<?php print_string('no')?>" onclick="javascript:history.go(-1);" />
</form>
</center>
@@ -114,9 +114,9 @@
}
} else {
if (!$glossary->allowcomments && !isteacher($glossary->course)) {
error("You can't add/edit comments to this glossary!");
error('You can\'t add/edit comments to this glossary!');
}
if ( $action == "edit" ) {
if ( $action == 'edit' ) {
if (!isset($comment->timemodified)) {
$timetocheck = 0;
} else {
@@ -125,9 +125,9 @@
$ineditperiod = ((time() - $timetocheck < $CFG->maxeditingtime) || $glossary->editalways);
if ( (!$ineditperiod || $USER->id != $comment->userid) and !isteacher($course->id) and $cid) {
if ( $USER->id != $comment->userid ) {
error("You can't edit other people's comments!");
error('You can\'t edit other people\'s comments!');
} elseif (!$ineditperiod) {
error("You can't edit this. Time expired!");
error('You can\'t edit this. Time expired!');
}
die;
}
@@ -141,26 +141,26 @@
$newentry->format = $form->format;
$newentry->timemodified = time();
if ( $action == "add" ) {
if ( $action == 'add' ) {
$newentry->userid = $USER->id;
if (! $newentry->id = insert_record("glossary_comments", $newentry)) {
error("Could not insert this new comment");
if (! $newentry->id = insert_record('glossary_comments', $newentry)) {
error('Could not insert this new comment');
} else {
add_to_log($course->id, "glossary", "add comment", "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id", $cm->id);
add_to_log($course->id, 'glossary', 'add comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id", $cm->id);
}
} else {
$newentry->id = $form->cid;
$newentry->userid = $comment->userid;
if (! update_record("glossary_comments", $newentry)) {
error("Could not update this comment");
if (! update_record('glossary_comments', $newentry)) {
error('Could not update this comment');
} else {
add_to_log($course->id, "glossary", "update comment", "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id",$cm->id);
add_to_log($course->id, 'glossary', 'update comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id",$cm->id);
}
}
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("commentupdated","glossary") . "</center>";
print_simple_box_start('center','40%', '#FFBBBB');
echo '<center>'.get_string('commentupdated','glossary').'</center>';
print_simple_box_end();
print_footer($course);
@@ -169,8 +169,8 @@
} else {
/// original glossary entry
glossary_print_entry($course, $cm, $glossary, $entry, "", "", false);
echo "<br />";
glossary_print_entry($course, $cm, $glossary, $entry, '', '', false);
echo '<br />';
if ($usehtmleditor = can_use_html_editor()) {
$defaultformat = FORMAT_HTML;
@@ -181,16 +181,19 @@
$form->text = $comment->comment;
$form->format = $comment->format;
} else {
$form->text = "";
$form->text = '';
$form->format = $defaultformat;
}
include("comment.html");
include('comment.html');
if ($usehtmleditor) {
use_html_editor("text");
use_html_editor('text');
}
}
}
echo '</center>';
/// Finish the page
print_footer($course);
?>
+3 -3
View File
@@ -1,13 +1,13 @@
<?php // $Id$
/// This page prints a particular instance of glossary
require_once("../../config.php");
require_once("lib.php");
require_once('../../config.php');
require_once('lib.php');
require_variable($id); // Course Module ID
require_variable($eid); // Entry ID
global $THEME, $USER, $CFG;
global $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
+2 -2
View File
@@ -125,7 +125,7 @@ function glossary_upgrade($oldversion) {
}
if ( $oldversion < 2003103100 ) {
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and categories you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
print_simple_box('This update might take several seconds.<br />The more glossaries, entries and categories you have created, the more it will take so please be patient.','center', '50%', '', '20', 'noticebox');
if ( $glossaries = get_records("glossary")) {
$gids = "";
foreach ( $glossaries as $glossary ) {
@@ -258,7 +258,7 @@ function glossary_upgrade($oldversion) {
if ( $oldversion < 2004051400 ) {
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", '', "20", "noticebox");
if ( $entries = get_records("glossary_entries", '', '', '', 'id,concept')) {
foreach($entries as $entry) {
set_field("glossary_entries","concept",addslashes(trim($entry->concept)),"id",$entry->id);
+1 -1
View File
@@ -20,7 +20,7 @@ function glossary_upgrade($oldversion) {
}
if ( $oldversion < 2004051400 ) {
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", '', "20", "noticebox");
if ( $entries = get_records("glossary_entries", '', '', '', 'id,concept')) {
foreach($entries as $entry) {
set_field("glossary_entries","concept",addslashes(trim($entry->concept)),"id",$entry->id);
+3 -3
View File
@@ -1,9 +1,9 @@
<?php // $Id$
require_once("../../config.php");
require_once("lib.php");
require_once('../../config.php');
require_once('lib.php');
global $CFG, $USER, $THEME;
global $CFG, $USER;
require_variable($id); // Course Module ID
optional_variable($e); // EntryID
+4 -4
View File
@@ -1,18 +1,18 @@
<?php // $Id$
global $CFG, $THEME;
global $CFG;
require_once("../../config.php");
?>
<center>
<form name="form" method="post" action="editcategories.php">
<table class="generalbox" cellpadding="5" bgcolor="<?php p($THEME->cellheading)?>">
<table class="generalbox" cellpadding="5">
<tr valign="top">
<td align="right"><p><b><?php echo get_string("name") ?>:</b></p></td>
<td align="right"><b><?php echo get_string("name") ?>:</b></td>
<td>
<input type="text" name="name" size="30" value="<?php p($name) ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php echo get_string("linkcategory","glossary") ?>:</b></p></td>
<td align="right"><b><?php echo get_string("linkcategory","glossary") ?>:</b></td>
<td>
<select size="1" name="usedynalink">
<option value="1" <?php
+4 -4
View File
@@ -178,14 +178,14 @@
<div align="center">
<form name="theform" method="post" action="editcategories.php">
<table width="40%" class="generalbox" cellpadding="5" bgcolor="<?php p($THEME->cellheading)?>">
<table width="40%" class="generalbox" cellpadding="5">
<tr>
<td width="90%" align="center"><b>
<?php p(get_string("categories","glossary")) ?></b></td>
<td width="10%" align="center"><b>
<?php p(get_string("action")) ?></b></td>
</tr>
<tr><td width="100%" colspan="2" bgcolor="<?php p($THEME->cellheading2)?>">
<tr><td width="100%" colspan="2">
<table width="100%">
@@ -197,7 +197,7 @@
$num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
?>
<tr bgcolor="<?php p($THEME->cellheading2)?>">
<tr>
<td width="90%" align="left">
<?php
echo "<b>".format_text($category->name)."</b> <font size=-1>($num_entries " . get_string("entries","glossary") . ")</font>";
@@ -219,7 +219,7 @@
</td>
<tr>
<td width="100%" colspan="2" align="center" bgcolor="<?php p($THEME->cellheading2)?>">
<td width="100%" colspan="2" align="center">
<?php
$options['id'] = $cm->id;
+2 -2
View File
@@ -9,7 +9,7 @@
$hook = optional_param('hook');
$mode = optional_param('mode');
global $THEME, $USER, $CFG;
global $USER, $CFG;
$PermissionGranted = 1;
@@ -76,7 +76,7 @@
if (! update_record("glossary_entries", $entry)) {
error("Could not export the entry to the main glossary");
} else {
print_simple_box_start("center", "60%", "$THEME->cellheading");
print_simple_box_start("center", "60%");
echo "<p align=\"center\"><font size=\"3\">$entryexported</font></p></font>";
print_continue("view.php?id=$cm->id&amp;mode=entry&amp;hook=".$entry->id);
+2 -2
View File
@@ -3,7 +3,7 @@
require_once("../../config.php");
require_once("lib.php");
global $CFG, $THEME;
global $CFG;
require_variable($id);
@@ -69,7 +69,7 @@
$no = get_string("no");
echo '<form method="post" action="formats.php" name="form">';
echo '<table width="90%" align="center" bgcolor="' . $THEME->cellheading . '" class="generalbox">';
echo '<table width="90%" align="center" class="generalbox">';
?>
<tr>
<td colspan="3" align="center"><strong>
@@ -2,9 +2,8 @@
function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
global $CFG, $USER;
$colour = $THEME->cellheading2;
$user = get_record("user", "id", $entry->userid);
$strby = get_string("writtenby", "glossary");
@@ -2,9 +2,7 @@
function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=false) {
global $THEME, $USER;
$colour = $THEME->cellheading2;
global $USER;
echo "\n<table border=\"0\" width=\"95%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n";
echo "<tr valign=\"top\">\n";
@@ -1,29 +1,27 @@
<?php // $Id$
function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
global $CFG, $USER;
$colour = $THEME->cellheading2;
echo "\n<table border=\"0\" width=\"95%\" cellspacing=\"0\" cellpadding=\"3\" class=\"forumpost\" align=\"center\">\n";
echo "<tr valign=\"top\">\n";
echo "<td width=\"100%\" valign=\"top\" bgcolor=\"#FFFFFF\">\n";
echo '<table border="0" width="95%" cellspacing="0" cellpadding="3" class="forumpost" align="center">';
echo '<tr valign="top">';
echo '<td width="100%" valign="top" bgcolor="#FFFFFF">';
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
echo "<b>";
glossary_print_entry_attachment($entry,'html','right');
echo '<b>';
glossary_print_entry_concept($entry);
echo ":</b> ";
echo ':</b> ';
glossary_print_entry_definition($entry);
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
echo "</td>\n";
echo "</tr>\n";
echo '</td>';
echo '</tr>';
echo "</table>\n";
return $return;
}
function glossary_print_entry_dictionary($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
function glossary_print_entry_dictionary($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL) {
//The print view for this format is exactly the normal view, so we use it
@@ -1,9 +1,8 @@
<?php // $Id$
function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
global $CFG, $USER;
$colour = $THEME->cellheading2;
$user = get_record("user", "id", $entry->userid);
$strby = get_string("writtenby", "glossary");
@@ -11,13 +10,13 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
echo "\n<br /><table border=\"0\" width=\"95%\" cellspacing=\"0\" cellpadding=\"3\" class=\"forumpost\" align=\"center\">";
echo "\n<tr valign=\"top\">";
echo "\n<td bgcolor=\"$colour\" width=\"35\" valign=\"top\" class=\"forumpostpicture\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostpicture\">";
$return = false;
if ($entry) {
print_user_picture($user->id, $course->id, $user->picture);
echo "</td>";
echo "<td valign=\"top\" width=\"100%\" bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
echo "<td valign=\"top\" width=\"100%\" class=\"forumpostheader\">";
echo "<b>";
glossary_print_entry_concept($entry);
echo "</b><br />";
@@ -26,7 +25,7 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
echo "&nbsp;&nbsp;<font size=\"1\">(".get_string("lastedited").": ".
userdate($entry->timemodified).")</font>";
echo "</td>";
echo "\n<td bgcolor=\"$THEME->cellheading\" width=\"35\" valign=\"top\" class=\"forumpostheader\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostheader\">";
glossary_print_entry_approval($cm, $entry, $mode);
echo "</td>";
@@ -34,8 +33,8 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
echo "</tr>";
echo "\n<tr>";
echo "\n<td bgcolor=\"$colour\" width=\"35\" valign=\"top\" class=\"forumpostside\">&nbsp;</td>";
echo "\n<td width=\"100%\" colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostside\">&nbsp;</td>";
echo "\n<td width=\"100%\" colspan=\"2\" class=\"forumpostmessage\">";
echo "<table width=\"100%\" border=\"0\"><tr><td>";
if ($entry->attachment) {
@@ -1,15 +1,14 @@
<?php // $Id$
function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $USER;
global $USER;
$colour = "#FFFFFF";
$return = false;
echo "\n<table border=\"0\" cellspacing=\"0\" width=\"95%\" cellpadding=\"10\">";
echo "\n<tr valign=\"top\">";
echo "<td width=\"100%\" bgcolor=\"$colour\">";
echo "<td width=\"100%\">";
if ($entry) {
glossary_print_entry_approval($cm, $entry, $mode);
echo "<b><a href=\"showentry.php?courseid=$course->id\&amp;eid=$entry->id\&amp;displayformat=dictionary\" target=\"_blank\" onClick=\"return openpopup('/mod/glossary/showentry.php?courseid=$course->id\&amp;eid=$entry->id\&amp;displayformat=dictionary', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">";
@@ -35,9 +34,8 @@ function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode=""
function glossary_print_entry_entrylist($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
//The print view for this format is different from the normal view, so we implement it here completely
global $THEME, $CFG, $USER;
global $CFG, $USER;
$colour = $THEME->cellheading2;
//Take out autolinking in definitions un print view
$entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+4 -5
View File
@@ -1,15 +1,14 @@
<?php // $Id$
function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $USER;
global $USER;
$return = false;
if ( $entry ) {
$colour = $THEME->cellheading2;
echo "\n<br /><table border=\"0\" width=\"95%\" cellspacing=\"0\" cellpadding=\"3\" class=\"forumpost\" align=\"center\">";
echo '<tr valign=\"top\">';
echo "<td valign=\"top\" width=\"100%\" bgcolor=\"$colour\">";
echo "<td valign=\"top\" width=\"100%\">";
$entry->course = $course->id;
echo '<b>' . get_string("question","glossary") . ':</b> ';
@@ -19,7 +18,7 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hoo
echo "<font size=\"1\">(".get_string("lastedited").": ".
userdate($entry->timemodified).")</font>";
echo "</td>";
echo "\n<td bgcolor=\"$colour\" width=\"35\" valign=\"top\" class=\"forumpostheader\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostheader\">";
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
@@ -28,7 +27,7 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hoo
echo "</tr>";
echo "\n<tr>";
echo "\n<td width=\"100%\" colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
echo "\n<td width=\"100%\" colspan=\"2\" class=\"forumpostmessage\">";
echo '<b>' . get_string("answer","glossary") . ':</b> ';
glossary_print_entry_definition($entry);
@@ -1,9 +1,8 @@
<?php // $Id$
function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
global $CFG, $USER;
$colour = $THEME->cellheading2;
$user = get_record("user", "id", $entry->userid);
$strby = get_string("writtenby", "glossary");
@@ -11,13 +10,13 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
echo "\n<br /><table border=\"0\" width=\"95%\" cellspacing=\"0\" cellpadding=\"3\" class=\"forumpost\" align=\"center\">";
echo "\n<tr valign=\"top\">";
echo "\n<td bgcolor=\"$colour\" width=\"35\" valign=\"top\" class=\"forumpostpicture\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostpicture\">";
$return = false;
if ($entry) {
print_user_picture($user->id, $course->id, $user->picture);
echo "</td>";
echo "<td valign=\"top\" width=\"100%\" bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
echo "<td valign=\"top\" width=\"100%\" class=\"forumpostheader\">";
echo "<b>";
glossary_print_entry_concept($entry);
@@ -27,7 +26,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
echo "&nbsp;&nbsp;<font size=\"1\">(".get_string("lastedited").": ".
userdate($entry->timemodified).")</font>";
echo "</td>";
echo "\n<td bgcolor=\"$THEME->cellheading\" width=\"35\" valign=\"top\" class=\"forumpostheader\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostheader\">";
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
@@ -36,8 +35,8 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
echo "</tr>";
echo "\n<tr valign=\"top\">";
echo "\n<td bgcolor=\"$colour\" width=\"35\" valign=\"top\" class=\"forumpostside\">&nbsp;</td>";
echo "\n<td width=\"100%\" colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostside\">&nbsp;</td>";
echo "\n<td width=\"100%\" colspan=\"2\" class=\"forumpostmessage\">";
glossary_print_entry_definition($entry);
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
@@ -1,9 +1,8 @@
<?php // $Id$
function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
global $CFG, $USER;
$colour = $THEME->cellheading2;
echo "\n<br /><table border=\"0\" width=\"95%\" cellspacing=\"0\" cellpadding=\"3\" class=\"forumpost\" align=\"center\">";
@@ -11,7 +10,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
$return = false;
if ($entry) {
echo "<td valign=\"top\" width=\"100%\" bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
echo "<td valign=\"top\" width=\"100%\" class=\"forumpostheader\">";
echo "<b>";
glossary_print_entry_concept($entry);
@@ -20,7 +19,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
echo "<font size=\"1\">(".get_string("lastedited").": ".
userdate($entry->timemodified).")</font>";
echo "</td>";
echo "\n<td bgcolor=\"$THEME->cellheading\" width=\"35\" valign=\"top\" class=\"forumpostheader\">";
echo "\n<td width=\"35\" valign=\"top\" class=\"forumpostheader\">";
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
@@ -29,7 +28,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
echo "</tr>";
echo "\n<tr valign=\"top\">";
echo "\n<td width=\"100%\" colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
echo "\n<td width=\"100%\" colspan=\"2\" class=\"forumpostmessage\">";
glossary_print_entry_definition($entry);
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
+42 -57
View File
@@ -234,7 +234,7 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) {
/// that has occurred in glossary activities and print it out.
/// Return true if there was output, or false is there was none.
global $CFG, $THEME;
global $CFG;
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
@@ -538,8 +538,8 @@ global $CFG;
(ge.glossaryid = $glossary->id or ge.sourceglossaryid = $glossary->id) $where $orderby");
}
function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons = 1, $displayformat = -1, $ratings = NULL, $printview = false) {
global $THEME, $USER, $CFG;
function glossary_print_entry($course, $cm, $glossary, $entry, $mode='',$hook='',$printicons = 1, $displayformat = -1, $ratings = NULL, $printview = false) {
global $USER, $CFG;
$return = false;
if ( $displayformat < 0 ) {
$displayformat = $glossary->displayformat;
@@ -564,6 +564,7 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook=""
}
return $return;
}
//Default (old) print format used if custom function doesn't exist in format
function glossary_print_entry_default ($entry) {
echo '<b>'. strip_tags($entry->concept) . ': </b>';
@@ -592,13 +593,13 @@ function glossary_print_entry_definition($entry) {
//Calculate all the strings to be no-linked
//First, the concept
$term = preg_quote(trim($entry->concept),"/");
$term = preg_quote(trim($entry->concept),'/');
$pat = '/('.$term.')/is';
$doNolinks[] = $pat;
//Now the aliases
if ( $aliases = get_records("glossary_alias","entryid",$entry->id) ) {
if ( $aliases = get_records('glossary_alias','entryid',$entry->id) ) {
foreach ($aliases as $alias) {
$term = preg_quote(trim($alias->alias),"/");
$term = preg_quote(trim($alias->alias),'/');
$pat = '/('.$term.')/is';
$doNolinks[] = $pat;
}
@@ -672,9 +673,9 @@ function glossary_print_entry_definition($entry) {
echo $text;
}
function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode="",$hook="", $type = 'print') {
function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode='',$hook='', $type = 'print') {
$return = '';
if ( $aliases = get_records("glossary_alias","entryid",$entry->id) ) {
if ( $aliases = get_records('glossary_alias','entryid',$entry->id) ) {
foreach ($aliases as $alias) {
if (trim($alias->alias)) {
if ($return == '') {
@@ -694,36 +695,38 @@ function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode="",
}
}
function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$hook="", $type = 'print') {
global $THEME, $USER, $CFG;
function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$hook='', $type = 'print') {
global $USER, $CFG;
$output = false; //To decide if we must really return text in "return". Activate when needed only!
$importedentry = ($entry->sourceglossaryid == $glossary->id);
$isteacher = isteacher($course->id);
$ismainglossary = $glossary->mainglossary;
$return = "<font size=\"1\">";
$return = '<div class="commands">';
if (!$entry->approved) {
$output = true;
$return .= get_string("entryishidden","glossary");
$return .= get_string('entryishidden','glossary');
}
$return .= glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook,'html');
$return .= "</font> ";
if ( (!empty($USER->id) && $glossary->allowcomments && !isguest()) || $isteacher) {
$output = true;
$return .= " <a title=\"" . get_string("addcomment","glossary") . "\" href=\"comment.php?id=$cm->id&amp;eid=$entry->id\"><img src=\"comment.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
$return .= '<a title="' . get_string('addcomment','glossary') . '" href="comment.php?id='.$cm->id.'&amp;eid='.$entry->id.'"><img src="comment.gif" height="11" width="11" border="0" alt="'.get_string('addcomment','glossary').'" /></a>';
}
$return .= '</div>';
if ($isteacher or (!empty($USER->id) and $glossary->studentcanpost and $entry->userid == $USER->id)) {
// only teachers can export entries so check it out
if ($isteacher and !$ismainglossary and !$importedentry) {
$mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
$mainglossary = get_record('glossary','mainglossary',1,'course',$course->id);
if ( $mainglossary ) { // if there is a main glossary defined, allow to export the current entry
$output = true;
$return .= " <a title=\"" . get_string("exporttomainglossary","glossary") . "\" href=\"exportentry.php?id=$cm->id&amp;entry=$entry->id&amp;mode=$mode&amp;hook=$hook\"><img src=\"export.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
$return .= '<a title="'.get_string('exporttomainglossary','glossary') . '" href="exportentry.php?id='.$cm->id.'&amp;entry='.$entry->id.'&amp;mode='.$mode.'&amp;hook='.$hook.'"><img src="export.gif" height="11" width="11" border="0" alt="'.get_string('exporttomainglossary','glossary').'" /></a>';
}
}
@@ -765,17 +768,16 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
function glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook, $type = 'print') {
$return = '';
$count = count_records("glossary_comments","entryid",$entry->id);
$count = count_records('glossary_comments','entryid',$entry->id);
if ($count) {
$return = "<font size=\"1\">";
$return = '';
$return .= "<a href=\"comments.php?id=$cm->id&amp;eid=$entry->id\">$count ";
if ($count == 1) {
$return .= get_string("comment", "glossary");
$return .= get_string('comment', 'glossary');
} else {
$return .= get_string("comments", "glossary");
$return .= get_string('comments', 'glossary');
}
$return .= "</a>";
$return .= "</font>";
$return .= '</a>';
}
if ($type == 'print') {
@@ -1158,8 +1160,6 @@ if ( !$tTHEME ) {
$tTHEME = $THEME;
}
$tablecolor = $tTHEME->TabTableBGColor;
$currenttabcolor = $tTHEME->ActiveTabColor;
$tabcolor = $tTHEME->InactiveTabColor;
$inactivefontcolor = $tTHEME->InactiveFontColor;
@@ -1192,24 +1192,19 @@ for ($row = 0; $row < $numrows; $row++) {
echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
}
if ($tabproccessed == $currenttab) {
$currentcolor = $currenttabcolor;
$currentstyle = 'generaltabselected';
} elseif ( !$data[$tabproccessed]->link ) {
$currentstyle = 'generaltabinactive';
} else {
$currentcolor = $tabcolor;
$currentstyle = 'generaltab';
}
echo "<td class=\"$currentstyle\" width=\"$tabwidth%\" bgcolor=\"$currentcolor\" align=\"center\"><b>";
echo "<td class=\"$currentstyle\" width=\"$tabwidth%\" align=\"center\"><b>";
if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
echo "<a href=\"" . $data[$tabproccessed]->link . "\">";
}
if ( !$data[$tabproccessed]->link ) {
echo "<font color=\"$inactivefontcolor\">";
}
echo $data[$tabproccessed]->caption;
if ( !$data[$tabproccessed]->link ) {
echo "</font>";
}
if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
echo "</a>";
@@ -1220,7 +1215,6 @@ for ($row = 0; $row < $numrows; $row++) {
echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
}
} else {
$currentcolor = "";
echo "<td colspan=\"".(2* $tabsperrow)."\"></td>\n";
}
$tabproccessed++;
@@ -1239,29 +1233,25 @@ for ($row = 0; $row < $numrows; $row++) {
if ( $col == 0 ) {
echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
}
if ($tabproccessed == $currenttab) {
$currentcolor = $currenttabcolor;
$currentstyle = 'generaltabselected';
} elseif ( !$data[$tabproccessed]->link ) {
$data[$tabproccessed]->link = NULL;
$currentstyle = 'generaltabinactive';
} else {
$currentcolor = $tabcolor;
$currentstyle = 'generaltab';
}
if (!isset($data[$tabproccessed]->link)) {
$data[$tabproccessed]->link = NULL;
}
echo "<td class=\"$currentstyle\" width=\"$tabwidth%\" bgcolor=\"$currentcolor\" align=\"center\"><b>";
echo "<td class=\"$currentstyle\" width=\"$tabwidth%\" align=\"center\"><b>";
if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
echo "<a href=\"" . $data[$tabproccessed]->link . "\">";
}
if ( !$data[$tabproccessed]->link ) {
echo "<font color=\"$inactivefontcolor\">";
}
echo $data[$tabproccessed]->caption;
if ( !$data[$tabproccessed]->link ) {
echo "</font>";
}
if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
echo "</a>";
@@ -1272,12 +1262,7 @@ for ($row = 0; $row < $numrows; $row++) {
echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
}
} else {
if ($numrows > 1) {
$currentcolor = $tabcolor;
} else {
$currentcolor = "";
}
echo "<td colspan = " . (2 * ($tabsperrow - $col)) . " bgcolor=\"$currentcolor\" align=\"center\">";
echo "<td colspan = " . (2 * ($tabsperrow - $col)) . " align=\"center\">";
echo "</td>";
$col = $tabsperrow;
@@ -1291,10 +1276,10 @@ for ($row = 0; $row < $numrows; $row++) {
</td>
</tr>
<tr>
<td width="100%" bgcolor="<?php p($tablecolor) ?>"><hr /></td>
<td width="100%" class="glossaryentryheader"><hr /></td>
</tr>
<tr>
<td width="100%" bgcolor="<?php p($tablecolor) ?>">
<td width="100%" class="glossaryentry">
<center>
<?php
}