コード例 #1
0
                                    $entry = get_record('dialogue_entries', 'id', $params->entryid);
                                    $conversation = get_record('dialogue_conversations', 'id', $entry->conversationid);
                                    if (!empty($params->firstentry)) {
                                        set_field('dialogue_entries', 'text', addslashes($params->firstentry), 'id', $entry->id);
                                        set_field('dialogue_entries', 'timemodified', time(), 'id', $entry->id);
                                        set_field('dialogue_conversations', 'recipientid', $params->recipientid, 'id', $conversation->id);
                                        set_field('dialogue_conversations', 'lastrecipientid', $params->recipientid, 'id', $conversation->id);
                                        set_field('dialogue_conversations', 'subject', $params->subject, 'id', $conversation->id);
                                        if ($entry->attachment = dialogue_add_attachment($entry, 'attachment', $messages)) {
                                            set_field('dialogue_entries', 'attachment', $entry->attachment, 'id', $entry->id);
                                        }
                                        add_to_log($course->id, 'dialogue', 'edit entry', "view.php?id={$cm->id}", $entry->id, $cm->id);
                                        redirect("dialogues.php?id={$cm->id}&pane={$params->pane}&action=printdialogue&cid={$conversation->id}", get_string('replyupdated', 'dialogue'));
                                    }
                                    if ($names = dialogue_get_available_users($dialogue, $context, $conversation->id)) {
                                        $mform = new mod_dialogue_open_form('dialogues.php', array('names' => $names));
                                        $mform->set_data(array('id' => $cm->id, 'recipientid' => $conversation->recipientid, 'entryid' => $entry->id, 'subject' => stripslashes($conversation->subject), 'firstentry' => $entry->text, 'action' => 'editconversation'));
                                        $mform->display();
                                    }
                                } else {
                                    /*************** no man's land **************************************/
                                    error('Fatal Error: Unknown Action: ' . $params->action . "\n");
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
コード例 #2
0
     if ($groupmode && !$hascapmanage) {
         if ($group > 0) {
             $members = groups_get_members($group, 'u.id');
             if (!in_array($USER->id, array_keys($members))) {
                 notify(get_string("cannotadd", "dialogue"));
                 print_continue("view.php?id={$cm->id}");
                 break;
             }
         } else {
             notify(get_string("cannotaddall", "dialogue"));
             print_continue("view.php?id={$cm->id}");
             break;
         }
     }
     if ($names) {
         $mform = new mod_dialogue_open_form('dialogues.php', array('names' => $names));
         $mform->set_data(array('id' => $cm->id, 'action' => 'openconversation'));
         $mform->display();
     } else {
         notify(get_string("noavailablepeople", "dialogue"));
         print_continue("view.php?id={$cm->id}");
     }
     break;
 case 1:
     // Current dialogues
 // Current dialogues
 case 2:
     // print active conversations requiring a reply from the other person.
     dialogue_list_conversations($dialogue, $currentgroup, 'open');
     break;
 case 3: