From 9b1a0374e05ddcf64d594a823834ac0f54804046 Mon Sep 17 00:00:00 2001 From: rkingdon Date: Mon, 13 Oct 2003 12:41:36 +0000 Subject: [PATCH] Dialogue version 2003101300. --- mod/dialogue/backuplib.php | 1 + mod/dialogue/db/mysql.php | 4 + mod/dialogue/db/mysql.sql | 1 + mod/dialogue/dialogues.php | 76 ++++++- mod/dialogue/lib.php | 416 ++++++++++++++++++------------------ mod/dialogue/mod.html | 1 + mod/dialogue/restorelib.php | 3 +- mod/dialogue/version.php | 2 +- 8 files changed, 290 insertions(+), 214 deletions(-) diff --git a/mod/dialogue/backuplib.php b/mod/dialogue/backuplib.php index f389ed2a9b..d688a074e6 100644 --- a/mod/dialogue/backuplib.php +++ b/mod/dialogue/backuplib.php @@ -83,6 +83,7 @@ fwrite ($bf,full_tag("LASTID",6,false,$conversation->lastid)); fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$conversation->timemodified)); fwrite ($bf,full_tag("CLOSED",6,false,$conversation->closed)); + fwrite ($bf,full_tag("SEENON",6,false,$conversation->seenon)); fwrite ($bf,full_tag("CTYPE",6,false,$conversation->ctype)); fwrite ($bf,full_tag("FORMAT",6,false,$conversation->format)); fwrite ($bf,full_tag("SUBJECT",6,false,$conversation->subject)); diff --git a/mod/dialogue/db/mysql.php b/mod/dialogue/db/mysql.php index ca351c2b94..9eceda8a42 100644 --- a/mod/dialogue/db/mysql.php +++ b/mod/dialogue/db/mysql.php @@ -11,6 +11,10 @@ function dialogue_upgrade($oldversion) { execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue_conversations` ADD `subject` VARCHAR(100) NOT NULL DEFAULT ''"); } + if ($oldversion < 2003101300) { + execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue_conversations` ADD `seenon` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `closed`"); + } + $result = true; return $result; } diff --git a/mod/dialogue/db/mysql.sql b/mod/dialogue/db/mysql.sql index 1c2407983f..a6fb38d860 100644 --- a/mod/dialogue/db/mysql.sql +++ b/mod/dialogue/db/mysql.sql @@ -46,6 +46,7 @@ CREATE TABLE prefix_dialogue_conversations ( lastid int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', closed tinyint(3) NOT NULL default '0', + seenon int(10) unsigned NOT NULL default '0', ctype tinyint(3) NOT NULL default '0', format tinyint(2) NOT NULL default '0', subject varchar(100) not null default '', diff --git a/mod/dialogue/dialogues.php b/mod/dialogue/dialogues.php index 6e005cf459..8421fe9859 100644 --- a/mod/dialogue/dialogues.php +++ b/mod/dialogue/dialogues.php @@ -3,10 +3,13 @@ /************************************************* ACTIONS handled are: - closeconversation + closeconversation confirmclose + getsubject insertentries openconversation + showdialogues + updatesubject ************************************************/ @@ -94,7 +97,28 @@ "view.php?id=$cm->id&pane=$pane"); } + /****************** get subject ************************************/ + elseif ($action == 'getsubject' ) { + + if (empty($_GET['cid'])) { + error("Confirm Close: conversation id missing"); + } + print_heading(get_string("addsubject", "dialogue")); + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "
".get_string("subject", "dialogue")."
\n"; + } + /****************** insert conversation entries ******************************/ elseif ($action == 'insertentries' ) { @@ -118,11 +142,16 @@ error("Insert Entries: Could not insert dialogue record!"); } if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversation->id)) { - error("Insert Entries: could not set lastid"); + error("Insert Dialogue Entries: could not set lastid"); } if (!set_field("dialogue_conversations", "timemodified", $timenow, "id", $conversation->id)) { - error("Insert Entries: could not set lastid"); + error("Insert Dialogue Entries: could not set lastid"); + } + // reset seenon time + if (!set_field("dialogue_conversations", "seenon", 0, "id", + $conversation->id)) { + error("Insert Dialogue Entries: could not reset seenon"); } add_to_log($course->id, "dialogue", "add entry", "view.php?id=$cm->id", "$item->id"); $n++; @@ -140,7 +169,7 @@ print_simple_box( text_to_html($dialogue->intro) , "center"); echo "
"; - dialogue_list_closed_conversations($dialogue, $USER); + dialogue_list_closed_conversations($dialogue); } /****************** open conversation ************************************/ @@ -186,10 +215,25 @@ } - /****************** show dialogue ****************************************/ - elseif ($action == 'showdialogue') { + /****************** print dialogue (allowing new entry)********************/ + elseif ($action == 'printdialogue') { + + if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) { + error("Print Dialogue: can not get conversation record"); + } + + echo "
\n"; + print_simple_box( text_to_html($dialogue->intro) , "center"); + echo "
"; + + dialogue_print_conversation($dialogue, $conversation); + } + + + /****************** show dialogues ****************************************/ + elseif ($action == 'showdialogues') { - if (!$conversation = get_record("dialogue_conversations", "id", $_GET['conversationid'])) { + if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) { error("Show Dialogue: can not get conversation record"); } @@ -197,11 +241,27 @@ print_simple_box( text_to_html($dialogue->intro) , "center"); echo "
"; - dialogue_show_conversation($dialogue, $conversation, $USER); + dialogue_show_conversation($dialogue, $conversation); dialogue_show_other_conversations($dialogue, $conversation); } + /****************** update subject ****************************************/ + elseif ($action == 'updatesubject') { + + if (!$conversation = get_record("dialogue_conversations", "id", $_POST['cid'])) { + error("Update Subject: can not get conversation record"); + } + + if (!$_POST['subject']) { + redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("nosubject", "dialogue")); + } elseif (!set_field("dialogue_conversations", "subject", $_POST['subject'], "id", $_POST['cid'])) { + error("Update subject: could not update conversation record"); + } + redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("subjectadded", "dialogue")); + } + + /*************** no man's land **************************************/ else { error("Fatal Error: Unknown Action: ".$action."\n"); diff --git a/mod/dialogue/lib.php b/mod/dialogue/lib.php index 8f5fb56c5f..2a381eb95d 100644 --- a/mod/dialogue/lib.php +++ b/mod/dialogue/lib.php @@ -357,6 +357,8 @@ function dialogue_delete_expired_conversations() { } } + +////////////////////////////////////////////////////////////////////////////////////// function dialogue_get_participants($dialogueid) { //Returns the users with data in one dialogue //(users with records in dialogue_conversations, creators and receivers) @@ -490,17 +492,19 @@ global $USER; ////////////////////////////////////////////////////////////////////////////////////// -function dialogue_get_conversations($dialogue, $user, $condition = '') { +function dialogue_get_conversations($dialogue, $user, $condition = '', $order = '') { global $CFG; if (!empty($condition)) { - return get_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND - (userid = $user->id OR recipientid = $user->id) AND $condition", "timemodified DESC"); - } - else { - return get_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND - (userid = $user->id OR recipientid = $user->id)", "timemodified DESC"); - } + $condition = ' AND '.$condition; + } + if (empty($order)) { + $order = "timemodified DESC"; + } + return get_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND + (userid = $user->id OR recipientid = $user->id) $condition", $order); + + } @@ -573,7 +577,9 @@ function dialogue_get_closed_logs($course, $timestart) { // OTHER dialogue FUNCTIONS /////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// -function dialogue_list_conversations_closed($dialogue, $user) { +function dialogue_list_conversations_closed($dialogue) { +// list the closed for the current user + global $USER; if (! $course = get_record("course", "id", $dialogue->course)) { error("Course is misconfigured"); @@ -582,19 +588,10 @@ function dialogue_list_conversations_closed($dialogue, $user) { error("Course Module ID was incorrect"); } - if ($conversations = dialogue_get_conversations($dialogue, $user, "closed = 1")) { - print_simple_box_start(); - $table->head = array (get_string("dialoguewith", "dialogue"), - get_string("numberofentries", "dialogue"), get_string("lastentry", "dialogue"), - get_string("status", "dialogue")); - $table->width = "100%"; - $table->align = array ("left", "center", "left", "left"); - $table->size = array ("*", "*", "*", "*"); - $table->cellpadding = 2; - $table->cellspacing = 0; - - foreach ($conversations as $conversation) { - if ($user->id != $conversation->userid) { + if ($conversations = dialogue_get_conversations($dialogue, $USER, "closed = 1")) { + // reorder the conversations by (other) name + foreach ($conversations as $conversation) { + if ($USER->id != $conversation->userid) { if (!$with = get_record("user", "id", $conversation->userid)) { error("User's record not found"); } @@ -604,15 +601,33 @@ function dialogue_list_conversations_closed($dialogue, $user) { error("User's record not found"); } } - $total = dialogue_count_entries($dialogue, $conversation); - $byuser = dialogue_count_entries($dialogue, $conversation, $user); + $names[$conversation->id] = "$with->firstname $with->lastname"; + } + asort($names); + + print_simple_box_start(); + $table->head = array (get_string("dialoguewith", "dialogue"), get_string("subject", "dialogue"), + get_string("numberofentries", "dialogue"), get_string("lastentry", "dialogue"), + get_string("status", "dialogue")); + $table->width = "100%"; + $table->align = array ("left", "left", "center", "left", "left"); + $table->size = array ("*", "*", "*", "*", "*"); + $table->cellpadding = 2; + $table->cellspacing = 0; + + foreach ($names as $cid=>$name) { + if (!$conversation = get_record("dialogue_conversations", "id", $cid)) { + error("Closed conversations: could not find conversation record"); + } + $total = dialogue_count_entries($dialogue, $conversation); + $byuser = dialogue_count_entries($dialogue, $conversation, $USER); if ($conversation->closed) { $status = get_string("closed", "dialogue"); } else { $status = get_string("open", "dialogue"); } - $table->data[] = array("id&action=showdialogue&conversationid=$conversation->id\">". - "$with->firstname $with->lastname", $byuser." ".get_string("of", "dialogue")." ".$total, + $table->data[] = array("id&action=showdialogues&cid=$conversation->id\">". + "$name", $conversation->subject, $byuser." ".get_string("of", "dialogue")." ".$total, userdate($conversation->timemodified), $status); } print_table($table); @@ -622,9 +637,9 @@ function dialogue_list_conversations_closed($dialogue, $user) { ////////////////////////////////////////////////////////////////////////////////////// -function dialogue_list_conversations_other($dialogue, $user) { -// list the conversations awaiting response from the other person - global $THEME; +function dialogue_list_conversations_other($dialogue) { +// list the conversations of the current user awaiting response from the other person + global $THEME, $USER; if (! $course = get_record("course", "id", $dialogue->course)) { error("Course is misconfigured"); @@ -633,95 +648,59 @@ function dialogue_list_conversations_other($dialogue, $user) { error("Course Module ID was incorrect"); } - $timenow = time(); - $showbutton = false; - $showemoticon = false; // never show emoticons for now - need to close or reload the popup - // window to get the focus into the correct textarea on the second time round - - echo "
\n"; - echo "\n"; - echo "id\">\n"; - echo "\n"; - - if ($conversations = dialogue_get_conversations($dialogue, $user, "lastid = $user->id AND closed = 0")) { - $showbutton = true; - print_simple_box_start("center", "", $THEME->cellcontent2); - foreach ($conversations as $conversation) { - echo "
\n"; - echo ""; - echo "\n"; - - if ($entries = get_records_select("dialogue_entries", "conversationid = $conversation->id", "id")) { - foreach ($entries as $entry) { - if ($entry->userid == $user->id) { - echo "\n"; + $names[$conversation->id] = "$with->firstname $with->lastname"; + } + asort($names); + + print_simple_box_start(); + $table->head = array (get_string("dialoguewith", "dialogue"), get_string("subject", "dialogue"), + get_string("numberofentries", "dialogue"), get_string("lastentry", "dialogue"), + get_string("status", "dialogue")); + $table->width = "100%"; + $table->align = array ("left", "left", "center", "left", "left"); + $table->size = array ("*", "*", "*", "*", "*"); + $table->cellpadding = 2; + $table->cellspacing = 0; + + foreach ($names as $cid=>$name) { + if (!$conversation = get_record("dialogue_conversations", "id", $cid)) { + error("Closed conversations: could not find conversation record"); + } + $total = dialogue_count_entries($dialogue, $conversation); + $byuser = dialogue_count_entries($dialogue, $conversation, $USER); + if ($conversation->seenon) { + $status = get_string("seen", "dialogue", format_time($timenow - $conversation->seenon)); + } else { + $status = get_string("notyetseen", "dialogue"); } - echo "\n"; - echo ""; - echo "
cellheading2\" valign=\"top\">\n"; - if ($conversation->userid == $user->id) { - if (!$otheruser = get_record("user", "id", $conversation->recipientid)) { - error("User not found"); - } + $timenow = time(); + if ($conversations = dialogue_get_conversations($dialogue, $USER, "lastid = $USER->id AND closed = 0")) { + // reorder the conversations by (other) name + foreach ($conversations as $conversation) { + if ($USER->id != $conversation->userid) { + if (!$with = get_record("user", "id", $conversation->userid)) { + error("User's record not found"); + } } else { - if (!$otheruser = get_record("user", "id", $conversation->userid)) { - error("User not found"); + if (!$with = get_record("user", "id", $conversation->recipientid)) { + error("User's record not found"); } } - // print_user_picture($user->id, $course->id, $user->picture); - echo "".get_string("dialoguewith", "dialogue", "$otheruser->firstname $otheruser->lastname"). - "cellheading2\">$conversation->subject 
\n"; - echo "
\n"; - echo "id&cid=$conversation->id&pane=2\">". - get_string("close", "dialogue")."\n"; - helpbutton("closedialogue", get_string("close", "dialogue"), "dialogue"); - echo "
\n"; - echo text_to_html("".get_string("onyouwrote", "dialogue", - userdate($entry->timecreated)).":
".$entry->text); - } - else { - echo "
body\">\n"; - echo text_to_html("".get_string("onwrote", "dialogue", - userdate($entry->timecreated)." ".$otheruser->firstname).":
". - $entry->text); - } - } - echo "
". - get_string("typefollowup", "dialogue")."
\n"; - helpbutton("writing", get_string("helpwriting"), "dialogue", true, true); - echo "
"; - if ($showemoticon) { - emoticonhelpbutton("replies", "reply$conversation->id"); - $showemoticon = false; + $table->data[] = array("id&action=printdialogue&cid=$conversation->id\">". + "$name", $conversation->subject, $byuser." ".get_string("of", "dialogue")." ".$total, + userdate($conversation->timemodified), $status); } - echo "
\n"; - // use a cumbersome name on the textarea as the emoticonhelp doesn't like an "array" name - echo "\n"; - echo "

\n"; - } - print_simple_box_end(); - } - if ($showbutton) { - echo "
\n"; - echo "".get_string("sendmailmessages", "dialogue").": \n"; - if ($dialogue->maildefault) { - echo "\n"; - } - else { - echo "\n"; - } - echo "
\n"; - } - echo "
\n"; + print_table($table); + print_simple_box_end(); + } } ////////////////////////////////////////////////////////////////////////////////////// -function dialogue_list_conversations_self($dialogue, $user) { - global $THEME; +function dialogue_list_conversations_self($dialogue) { +// list open conversations of the current user awaiting their reply + global $THEME, $USER; if (! $course = get_record("course", "id", $dialogue->course)) { error("Course is misconfigured"); @@ -740,15 +719,21 @@ function dialogue_list_conversations_self($dialogue, $user) { echo "id\">\n"; echo "\n"; - // first the ones requiring a resonse from the user - if ($conversations = dialogue_get_conversations($dialogue, $user, "lastid != $user->id AND closed = 0")) { + // list the conversations requiring a resonse from this user in full + if ($conversations = dialogue_get_conversations($dialogue, $USER, "lastid != $USER->id AND closed = 0")) { $showbutton = true; print_simple_box_start("center"); foreach ($conversations as $conversation) { + // set seenon if required + if (!$conversation->seenon) { + if (!set_field("dialogue_conversations", "seenon", $timenow, "id", $conversation->id)) { + error("List conversations self: could not set seenon"); + } + } echo "
\n"; echo ""; echo ""; echo ""; - echo ""; + echo ""; if ($entries = get_records_select("dialogue_entries", "conversationid = $conversation->id", "id")) { foreach ($entries as $entry) { - if ($entry->userid == $user->id) { + if ($entry->userid == $USER->id) { echo ""; - echo ""; + echo ""; if ($entries = get_records_select("dialogue_entries", "conversationid = $otherconversation->id", "id")) { foreach ($entries as $entry) { - if ($entry->userid == $USER->id) { + if ($entry->userid == $user->id) { echo "
cellheading2\" valign=\"top\">\n"; - if ($conversation->userid == $user->id) { + if ($conversation->userid == $USER->id) { if (!$otheruser = get_record("user", "id", $conversation->recipientid)) { error("User not found"); } @@ -763,7 +748,14 @@ function dialogue_list_conversations_self($dialogue, $user) { "cellheading2\">$conversation->subject 
\n"; echo "
\n"; - if (dialogue_count_entries($dialogue, $conversation)) { + if (!$conversation->subject) { + // conversation does not have a subject, show add subject link + echo "id&cid=$conversation->id&pane=2\">". + get_string("addsubject", "dialogue")."\n"; + helpbutton("addsubject", get_string("addsubject", "dialogue"), "dialogue"); + echo "  | "; + } + if (dialogue_count_entries($dialogue, $conversation)) { echo "id&cid=$conversation->id&pane=1\">". get_string("close", "dialogue")."\n"; helpbutton("closedialogue", get_string("close", "dialogue"), "dialogue"); @@ -775,7 +767,7 @@ function dialogue_list_conversations_self($dialogue, $user) { if ($entries = get_records_select("dialogue_entries", "conversationid = $conversation->id", "id")) { foreach ($entries as $entry) { - if ($entry->userid == $user->id) { + if ($entry->userid == $USER->id) { echo "
\n"; echo text_to_html("".get_string("onyouwrote", "dialogue", userdate($entry->timecreated)).":
".$entry->text); @@ -818,11 +810,12 @@ function dialogue_list_conversations_self($dialogue, $user) { echo "
\n"; echo "".get_string("sendmailmessages", "dialogue").": \n"; if ($dialogue->maildefault) { - echo "\n"; + echo " \n"; } else { - echo "\n"; + echo " \n"; } + helpbutton("sendmail", get_string("sendmailmessages", "dialogue"), "dialogue"); echo "
\n"; } echo "\n"; @@ -831,38 +824,104 @@ function dialogue_list_conversations_self($dialogue, $user) { ////////////////////////////////////////////////////////////////////////////////////// -function dialogue_print_feedback($course, $entry, $grades) { - global $CFG, $THEME; - - if (! $teacher = get_record("user", "id", $entry->teacher)) { - error("Weird dialogue error"); +function dialogue_print_conversation($dialogue, $conversation) { +// print a conversation and allow a new entry + global $THEME, $USER; + + if (! $course = get_record("course", "id", $dialogue->course)) { + error("Course is misconfigured"); } + if (! $cm = get_coursemodule_from_instance("dialogue", $dialogue->id, $course->id)) { + error("Course Module ID was incorrect"); + } + + $timenow = time(); + $showbutton = false; + $showemoticon = false; // never show emoticons for now - need to close or reload the popup + // window to get the focus into the correct textarea on the second time round + + echo "
\n"; + echo "\n"; + echo "id\">\n"; + echo "\n"; - echo "\n\n"; + } + echo "\n"; + echo ""; + echo "
"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo ""; - - echo "\n
body\" WIDTH=35 VALIGN=TOP>"; - print_user_picture($teacher->id, $course->id, $teacher->picture); - echo "cellheading\">$teacher->firstname $teacher->lastname"; - echo "  ".userdate($entry->timemarked).""; - echo "
cellcontent\">"; - - echo "

"; - if ($grades[$entry->rating]) { - echo get_string("grade").": "; - echo $grades[$entry->rating]; - } else { - print_string("nograde"); + $showbutton = true; + print_simple_box_start("center", "", $THEME->cellcontent2); + echo "

\n"; + echo ""; + echo "\n"; - echo text_to_html($entry->comment); - echo "
cellheading2\" valign=\"top\">\n"; + if ($conversation->userid == $USER->id) { + if (!$otheruser = get_record("user", "id", $conversation->recipientid)) { + error("User not found"); + } + } + else { + if (!$otheruser = get_record("user", "id", $conversation->userid)) { + error("User not found"); + } + } + // print_user_picture($user->id, $course->id, $user->picture); + echo "".get_string("dialoguewith", "dialogue", "$otheruser->firstname $otheruser->lastname"). + "cellheading2\">$conversation->subject 
\n"; + echo "
\n"; + if (!$conversation->subject) { + // conversation does not have a subject, show add subject link + echo "id&cid=$conversation->id&pane=2\">". + get_string("addsubject", "dialogue")."\n"; + helpbutton("addsubject", get_string("addsubject", "dialogue"), "dialogue"); + echo "  | "; } - echo "

"; + echo "id&cid=$conversation->id&pane=2\">". + get_string("close", "dialogue")."\n"; + helpbutton("closedialogue", get_string("close", "dialogue"), "dialogue"); + echo "
"; - echo "
"; + if ($entries = get_records_select("dialogue_entries", "conversationid = $conversation->id", "id")) { + foreach ($entries as $entry) { + if ($entry->userid == $USER->id) { + echo "
\n"; + echo text_to_html("".get_string("onyouwrote", "dialogue", + userdate($entry->timecreated)).":
".$entry->text); + } + else { + echo "
body\">\n"; + echo text_to_html("".get_string("onwrote", "dialogue", + userdate($entry->timecreated)." ".$otheruser->firstname).":
". + $entry->text); + } + } + echo "
". + get_string("typefollowup", "dialogue")."
\n"; + helpbutton("writing", get_string("helpwriting"), "dialogue", true, true); + echo "
"; + if ($showemoticon) { + emoticonhelpbutton("replies", "reply$conversation->id"); + $showemoticon = false; + } + echo "
\n"; + // use a cumbersome name on the textarea as the emoticonhelp doesn't like an "array" name + echo "\n"; + echo "

\n"; + print_simple_box_end(); + if ($showbutton) { + echo "
\n"; + echo "".get_string("sendmailmessages", "dialogue").": \n"; + if ($dialogue->maildefault) { + echo " \n"; + } + else { + echo " \n"; + } + helpbutton("sendmail", get_string("sendmailmessages", "dialogue"), "dialogue"); + echo "
\n"; + } + echo "
\n"; } @@ -953,59 +1012,8 @@ function dialogue_print_tabbed_heading($tabs) { ////////////////////////////////////////////////////////////////////////////////////// -function dialogue_print_user_entry($course, $user, $entry, $teachers, $grades) { +function dialogue_show_conversation($dialogue, $conversation) { global $THEME, $USER; - - if ($entry->timemarked < $entry->modified) { - $colour = $THEME->cellheading2; - } else { - $colour = $THEME->cellheading; - } - - echo "\n"; - - echo "\n"; - echo "\n"; - echo ""; - - echo "\n"; - - if ($entry) { - echo "\n"; - echo ""; - } - echo "
body\" WIDTH=35 VALIGN=TOP>"; - print_user_picture($user->id, $course->id, $user->picture); - echo "$user->firstname $user->lastname"; - if ($entry) { - echo "  ".get_string("lastedited").": ".userdate($entry->modified).""; - } - echo "
cellcontent\">"; - if ($entry) { - echo format_text($entry->text, $entry->format); - } else { - print_string("noentry", "dialogue"); - } - echo "
"; - if (!$entry->teacher) { - $entry->teacher = $USER->id; - } - print_user_picture($entry->teacher, $course->id, $teachers[$entry->teacher]->picture); - echo "".get_string("feedback").":"; - choose_from_menu($grades, "r$entry->id", $entry->rating, get_string("nograde")."..."); - if ($entry->timemarked) { - echo "  ".userdate($entry->timemarked).""; - } - echo "

"; - echo "

\n"; -} - - -////////////////////////////////////////////////////////////////////////////////////// -function dialogue_show_conversation($dialogue, $conversation, $user) { - global $THEME; if (! $course = get_record("course", "id", $dialogue->course)) { error("Course is misconfigured"); @@ -1020,7 +1028,7 @@ function dialogue_show_conversation($dialogue, $conversation, $user) { echo "
cellheading2\" valign=\"top\">\n"; - if ($conversation->userid == $user->id) { + if ($conversation->userid == $USER->id) { if (!$otheruser = get_record("user", "id", $conversation->recipientid)) { error("User not found"); } @@ -1033,11 +1041,11 @@ function dialogue_show_conversation($dialogue, $conversation, $user) { // print_user_picture($user->id, $course->id, $user->picture); echo "".get_string("dialoguewith", "dialogue", "$otheruser->firstname $otheruser->lastname"). "cellheading2\" valign=\"top\">$conversation->subject 
cellheading2\" valign=\"top\">$conversation->subject 
\n"; echo text_to_html("".get_string("onyouwrote", "dialogue", userdate($entry->timecreated)). @@ -1061,7 +1069,7 @@ function dialogue_show_conversation($dialogue, $conversation, $user) { ////////////////////////////////////////////////////////////////////////////////////// function dialogue_show_other_conversations($dialogue, $conversation) { // prints the other CLOSED conversations for this pair of users - global $THEME, $USER; + global $THEME; if (! $course = get_record("course", "id", $dialogue->course)) { error("Course is misconfigured"); @@ -1078,14 +1086,14 @@ function dialogue_show_other_conversations($dialogue, $conversation) { } if ($conversations = get_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND - (userid = $user->id AND recipientid = $otheruser->id) OR (userid = $otheruser->id AND - recipientid = $user->id) AND closed = 1", "timemodified DESC")) { + ((userid = $user->id AND recipientid = $otheruser->id) OR (userid = $otheruser->id AND + recipientid = $user->id)) AND closed = 1", "timemodified DESC")) { if (count($conversations) > 1) { $timenow = time(); foreach ($conversations as $otherconversation) { if ($conversation->id != $otherconversation->id) { // for this conversation work out which is the other user - if ($otherconversation->userid == $USER->id) { + if ($otherconversation->userid == $user->id) { if (!$otheruser = get_record("user", "id", $otherconversation->recipientid)) { error("Show other conversations: could not get user record"); } @@ -1103,11 +1111,11 @@ function dialogue_show_other_conversations($dialogue, $conversation) { // print_user_picture($otheruser->id, $course->id, $otheruser->picture); echo "".get_string("dialoguewith", "dialogue", "$otheruser->firstname $otheruser->lastname")."cellheading2\" valign=\"top\">$conversation->subject 
cellheading2\" valign=\"top\">$otherconversation->subject 
\n"; echo text_to_html("".get_string("onyouwrote", "dialogue", userdate($entry->timecreated)).":
".$entry->text); diff --git a/mod/dialogue/mod.html b/mod/dialogue/mod.html index d156544808..958219bee9 100644 --- a/mod/dialogue/mod.html +++ b/mod/dialogue/mod.html @@ -26,6 +26,7 @@ if (!isset($form->maildefault)) { $form->maildefault = 0; } +print_heading_with_help(get_string("furtherinformation", "dialogue"), "info", "dialogue"); ?>
action="mod.php"> diff --git a/mod/dialogue/restorelib.php b/mod/dialogue/restorelib.php index fd78ae14cf..afca359ca2 100644 --- a/mod/dialogue/restorelib.php +++ b/mod/dialogue/restorelib.php @@ -105,7 +105,7 @@ dialoguelastid = backup_todb($conversation_info['#']['LASTID']['0']['#']); $conversation->timemodified = backup_todb($conversation_info['#']['TIMEMODIFIED']['0']['#']); $conversation->closed = backup_todb($conversation_info['#']['CLOSED']['0']['#']); + $conversation->seenon = backup_todb($conversation_info['#']['SEENON']['0']['#']); $conversation->ctype = backup_todb($conversation_info['#']['CTYPE']['0']['#']); $conversation->format = backup_todb($conversation_info['#']['FORMAT']['0']['#']); $conversation->subject = backup_todb($conversation_info['#']['SUBJECT']['0']['#']); diff --git a/mod/dialogue/version.php b/mod/dialogue/version.php index c29a074e69..d933dd1087 100644 --- a/mod/dialogue/version.php +++ b/mod/dialogue/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2003100500; +$module->version = 2003101300; $module->cron = 60; ?> -- 2.39.5