[svn r9926] new function get_online_user_list($current_user_id)

use of formvalidator in all three new_message functions (these can be combined later to reduce code duplication)
skala
Evie Embrechts 18 years ago
parent 683e1b4a1f
commit 17fc7fc947
  1. 16
      plugin/messages/functions.inc.php
  2. 19
      plugin/messages/new_message.php

@ -1,4 +1,4 @@
<?php // $Id: functions.inc.php 9847 2006-10-30 12:52:12Z evie_em $ <?php // $Id: functions.inc.php 9926 2006-11-09 13:46:10Z evie_em $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -40,6 +40,20 @@ function display_select_user_list($_uid,$_name,$width,$size)
echo "</select>"; echo "</select>";
} }
function get_online_user_list($current_user_id)
{
$MINUTE=30;
global $statsDbName;
$userlist = WhoIsOnline($current_user_id,$statsDbName,$MINUTE);
foreach($userlist as $row)
{
$receiver_id = $row[0];
$online_user_list[$receiver_id] = GetFullUserName($receiver_id).($current_user_id==$receiver_id?("&nbsp;(".get_lang('Myself').")"):(""));
}
return $online_user_list;
}
/** /**
* Displays info stating that the message is sent successfully. * Displays info stating that the message is sent successfully.
*/ */

@ -1,4 +1,4 @@
<?php // $Id: new_message.php 9925 2006-11-09 13:31:36Z evie_em $ <?php // $Id: new_message.php 9926 2006-11-09 13:46:10Z evie_em $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -74,7 +74,7 @@ $nameTools = get_lang('ComposeMessage');
*/ */
function show_compose_to_any($user_id) function show_compose_to_any($user_id)
{ {
echo '<form action="'.$_SERVER['PHP_SELF']. /*echo '<form action="'.$_SERVER['PHP_SELF'].
'" method="post" name="msgform" id="msgform" onSubmit="return validate(msgform,user_list)"> '" method="post" name="msgform" id="msgform" onSubmit="return validate(msgform,user_list)">
<table width="100%" border="0" cellpadding="5" cellspacing="0"> <table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr> <tr>
@ -95,7 +95,20 @@ function show_compose_to_any($user_id)
<input name="compose" type="hidden" id="compose" value="1"></td> <input name="compose" type="hidden" id="compose" value="1"></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
</table>'; </table>';*/
$online_user_list = get_online_user_list($user_id,$_name,$width,$size);
$default['title'] = "Please enter a title";
$default['user_list'] = $receiver_id;
$form = new FormValidator('compose_message');
$form->addElement('select', 'user_list', get_lang('SendMessageTo'), $online_user_list);
$form->add_textfield('title', get_lang('MessageTitle'));
$form->add_html_editor('content', get_lang('MessageContent'));
$form->addElement('submit', 'compose', get_lang('Ok'));
$form->setDefaults($default);
$form->display();
} }
function show_compose_reply_to_message($message_id, $receiver_id) function show_compose_reply_to_message($message_id, $receiver_id)

Loading…
Cancel
Save