コード例 #1
0
                                 /****************** edit a conversation ****************************************/
                                 $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
    $groupmode = groups_get_activity_groupmode($cm, $course);
    if ($groupmode == SEPARATEGROUPS || $groupmode == VISIBLEGROUPS) {
        // pass the user's groupid if in groups mode to view.php
        // NOTE: this defaults to users first group, needs to be updated to handle grouping mode also
        // ULPGC ecastro activity_group handles grouping & group
        if ($firstgroup = groups_get_activity_group($cm, true)) {
            $URL .= "&group=" . $firstgroup;
        }
    }
    $tabs[0][] = new tabobject(0, $URL, $names[0]);
}
$tabs[0][] = new tabobject(1, "view.php?id={$cm->id}&pane=" . DIALOGUEPANE_CURRENT, $names[1]);
$tabs[0][] = new tabobject(3, "view.php?id={$cm->id}&pane=" . DIALOGUEPANE_CLOSED, $names[3]);
print_tabs($tabs, $pane, NULL, NULL, false);
echo "<br />\n";
$names = dialogue_get_available_users($dialogue, $context, 0);
switch ($pane) {
    case 0:
        // Open dialogue
        if (!$hascapopen) {
            notify(get_string("notavailable", "dialogue"));
            print_continue("view.php?id={$cm->id}");
            break;
        }
        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;