add_to_log(SITEID, 'message', 'unblock contact', 'history.php?user1=' . $unblockcontact . '&user2=' . $USER->id, $unblockcontact); message_unblock_contact($unblockcontact); } //$PAGE->set_title('Message History'); $PAGE->set_generaltype('popup'); echo $OUTPUT->header(); echo '<table width="100%" cellpadding="0" cellspacing="0"><tr>'; echo '<td width="100">'; $userpic = moodle_user_picture::make($user, SITEID); $userpic->size = 48; $userpic->link = true; echo $OUTPUT->user_picture($userpic) . '</td>'; echo '<td valign="middle" align="center">'; echo '<div class="name">' . fullname($user) . '</div>'; echo '<div class="commands">'; if ($contact = $DB->get_record('message_contacts', array('userid' => $USER->id, 'contactid' => $user->id))) { if ($contact->blocked) { message_contact_link($user->id, 'add', false, 'user.php?id=' . $user->id, true); message_contact_link($user->id, 'unblock', false, 'user.php?id=' . $user->id, true); } else { message_contact_link($user->id, 'remove', false, 'user.php?id=' . $user->id, true); message_contact_link($user->id, 'block', false, 'user.php?id=' . $user->id, true); } } else { message_contact_link($user->id, 'add', false, 'user.php?id=' . $user->id, true); message_contact_link($user->id, 'block', false, 'user.php?id=' . $user->id, true); } message_history_link($user->id, 0, false, '', '', 'both'); echo '</div>'; echo '</td></tr></table>'; echo $OUTPUT->footer();
/** * Constructs the block contact link to display next to other users * @param bool $incontactlist is the user a contact * @param bool $isblocked is the user blocked * @param type $contact contact object * @param string $script the URL to send the user to when the link is clicked. If null, the current page. * @param bool $text include text next to the icons? * @param bool $icon include a graphical icon? * @return string */ function message_get_contact_block_link($incontactlist, $isblocked, $contact, $script=null, $text=false, $icon=true) { $strblock = ''; //commented out to allow the user to block a contact without having to remove them first /*if ($incontactlist) { //$strblock = ''; } else*/ if ($isblocked) { $strblock = ' '.message_contact_link($contact->id, 'unblock', true, $script, $text, $icon); } else{ $strblock = ' '.message_contact_link($contact->id, 'block', true, $script, $text, $icon); } return $strblock; }
message_contact_link($user->id, 'add', false, 'discussion.php?id=' . $user->id . '&noframesjs=' . $noframesjs . '&newonly=' . $newonly . '&last=' . $last, true); echo '</li><li>'; message_contact_link($user->id, 'unblock', false, 'discussion.php?id=' . $user->id . '&noframesjs=' . $noframesjs . '&newonly=' . $newonly . '&last=' . $last, true); echo '</li>'; } else { echo '<li>'; message_contact_link($user->id, 'remove', false, 'discussion.php?id=' . $user->id . '&noframesjs=' . $noframesjs . '&newonly=' . $newonly . '&last=' . $last, true); echo '</li><li>'; message_contact_link($user->id, 'block', false, 'discussion.php?id=' . $user->id . '&noframesjs=' . $noframesjs . '&newonly=' . $newonly . '&last=' . $last, true); echo '</li>'; } } else { echo '<li>'; message_contact_link($user->id, 'add', false, 'discussion.php?id=' . $user->id . '&noframesjs=' . $noframesjs . '&newonly=' . $newonly . '&last=' . $last, true); echo '</li><li>'; message_contact_link($user->id, 'block', false, 'discussion.php?id=' . $user->id . '&noframesjs=' . $noframesjs . '&newonly=' . $newonly . '&last=' . $last, true); echo '</li>'; } echo '<li>'; message_history_link($user->id, 0, false, '', '', 'both'); echo '</li>'; echo '</ul>'; echo '</div>'; echo '</div>'; // class="userinfo" echo '<div id="send">'; echo '<form id="editing" method="post" action="discussion.php">'; $usehtmleditor = can_use_html_editor() && get_user_preferences('message_usehtmleditor', 0); echo '<h1><label for="edit-message">' . get_string('sendmessage', 'message') . '</label></h1>'; echo '<div>'; if ($usehtmleditor) {
/** * Constructs the block contact link to display next to other users * * @deprecated since Moodle 3.2 * @param bool $incontactlist is the user a contact? * @param bool $isblocked is the user blocked? * @param stdClass $contact contact object * @param string $script the URL to send the user to when the link is clicked. If null, the current page. * @param bool $text include text next to the icons? * @param bool $icon include a graphical icon? * @return string */ function message_get_contact_block_link($incontactlist, $isblocked, $contact, $script = null, $text = false, $icon = true) { debugging('message_get_contact_block_link() is deprecated and is no longer used.', DEBUG_DEVELOPER); $strblock = ''; //commented out to allow the user to block a contact without having to remove them first /*if ($incontactlist) { //$strblock = ''; } else*/ if ($isblocked) { $strblock = message_contact_link($contact->id, 'unblock', true, $script, $text, $icon); } else { $strblock = message_contact_link($contact->id, 'block', true, $script, $text, $icon); } return $strblock; }
/** * Print a row of contactlist displaying user picture, messages waiting and * block links etc * @param $contact contact object containing all fields required for print_user_picture() * @param $incontactlist is the user a contact of ours? */ function message_print_contactlist_user($contact, $incontactlist = true) { $fullname = fullname($contact); $fullnamelink = $fullname; /// are there any unread messages for this contact? if ($contact->messagecount > 0) { $fullnamelink = '<strong>' . $fullnamelink . ' (' . $contact->messagecount . ')</strong>'; } if ($incontactlist) { $strcontact = message_contact_link($contact->id, 'remove', true); $strblock = ''; } else { $strcontact = message_contact_link($contact->id, 'add', true); $strblock = ' ' . message_contact_link($contact->id, 'block', true); } $strhistory = message_history_link($contact->id, 0, true, '', '', 'icon'); echo '<tr><td class="pix">'; print_user_picture($contact, SITEID, $contact->picture, 20, false, true, 'userwindow'); echo '</td>'; echo '<td class="contact">'; link_to_popup_window("/message/discussion.php?id={$contact->id}", "message_{$contact->id}", $fullnamelink, 500, 500, get_string('sendmessageto', 'message', $fullname), 'menubar=0,location=0,status,scrollbars,resizable,width=500,height=500'); echo '</td>'; echo '<td class="link"> ' . $strcontact . $strblock . ' ' . $strhistory . '</td>'; echo '</tr>'; }
function message_print_user($user = false, $iscontact = false, $isblocked = false) { global $USER; if ($user === false) { print_user_picture($USER->id, SITEID, $USER->picture, 20, false, true, 'userwindow'); } else { print_user_picture($user->id, SITEID, $user->picture, 20, false, true, 'userwindow'); echo ' '; if ($iscontact) { message_contact_link($user->id, 'remove'); } else { message_contact_link($user->id, 'add'); } echo ' '; if ($isblocked) { message_contact_link($user->id, 'unblock'); } else { message_contact_link($user->id, 'block'); } echo '<br />'; link_to_popup_window("/message/discussion.php?id={$user->id}", "message_{$user->id}", fullname($user), 400, 400, get_string('sendmessageto', 'message', fullname($user)), 'menubar=0,location=0,status,scrollbars,resizable,width=500,height=500'); } }
/** * Print a row of contactlist displaying user picture, messages waiting and * block links etc * @param $contact contact object containing all fields required for $OUTPUT->user_picture() * @param $incontactlist is the user a contact of ours? */ function message_print_contactlist_user($contact, $incontactlist = true) { global $OUTPUT; $fullname = fullname($contact); $fullnamelink = $fullname; /// are there any unread messages for this contact? if ($contact->messagecount > 0) { $fullnamelink = '<strong>' . $fullnamelink . ' (' . $contact->messagecount . ')</strong>'; } if ($incontactlist) { $strcontact = message_contact_link($contact->id, 'remove', true); $strblock = ''; } else { $strcontact = message_contact_link($contact->id, 'add', true); $strblock = ' ' . message_contact_link($contact->id, 'block', true); } $strhistory = message_history_link($contact->id, 0, true, '', '', 'icon'); echo '<tr><td class="pix">'; $userpic = moodle_user_picture::make($contact, SITEID); $userpic->size = 20; $userpic->link = true; echo $OUTPUT->user_picture($userpic); echo '</td>'; echo '<td class="contact">'; $popupoptions = array('height' => 500, 'width' => 500, 'menubar' => false, 'location' => false, 'status' => true, 'scrollbars' => true, 'resizable' => true); $link = html_link::make("/message/discussion.php?id={$contact->id}", $fullnamelink); $link->add_action(new popup_action('click', $link->url, "message_{$contact->id}", $popupoptions)); $link->title = get_string('sendmessageto', 'message', $fullname); echo $OUTPUT->link($link); echo '</td>'; echo '<td class="link"> ' . $strcontact . $strblock . ' ' . $strhistory . '</td>'; echo '</tr>'; }