[svn r18292] logic changes - added link breadcrumb and outbox in message tool - (see FS#3621)

skala
Isaac Flores 16 years ago
parent e1ba34c02e
commit 15d5d2ffd1
  1. 13
      main/auth/profile.php
  2. 4
      main/inc/lib/message.lib.php
  3. 16
      main/messages/inbox.php
  4. 41
      main/messages/message.class.php
  5. 24
      main/messages/new_message.php
  6. 35
      main/messages/outbox.php
  7. 26
      main/messages/view_message.php

@ -1,4 +1,4 @@
<?php // $Id: profile.php 18272 2009-02-05 22:12:50Z iflorespaz $
<?php // $Id: profile.php 18292 2009-02-06 19:08:47Z iflorespaz $
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
@ -793,19 +793,18 @@ if (api_get_setting('allow_message_tool')=='true') {
include (api_get_path(LIBRARY_PATH).'message.lib.php');
$number_of_new_messages = MessageManager::get_new_messages();
$number_of_outbox_message=MessageManager::get_number_of_messages_sent();
$cant_out_box=' ('.$number_of_outbox_message.')';
$cant_msg = ' ('.$number_of_new_messages.')';
if($number_of_new_messages==0) {
$cant_msg= '';
}
$number_of_new_messages_of_friend=UserFriend::get_message_number_invitation_by_user_id(api_get_user_id());
//echo '<div class="message-view" style="display:none;">'.get_lang('ViewMessages').'</div>';
echo '<div class="message-content">
<h2 class="message-title">'.get_lang('Message').'</h2>
<p>
<a href="../messages/inbox.php" class="message-body">'.get_lang('Inbox').$cant_msg.' </a><br />
<a href="../messages/new_message.php" class="message-body">'.get_lang('Compose').'</a><br />' .
'</p>';
<a href="../messages/outbox.php" class="message-body">'.get_lang('OutBox').$cant_out_box.'</a><br />
<a href="../messages/new_message.php" class="message-body">'.get_lang('Compose').'</a><br />
</p>';
if ($number_of_new_messages_of_friend>0) {

@ -111,9 +111,9 @@ $table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')))
$table->display();
}
function get_number_of_messages_send_mask() {
return MessageManager::get_number_of_messages_send();
return MessageManager::get_number_of_messages_sent();
}
function get_message_data_send_mask($from, $number_of_items, $column, $direction) {
return MessageManager::get_message_data_send($from, $number_of_items, $column, $direction);
return MessageManager::get_message_data_sent($from, $number_of_items, $column, $direction);
}
?>

@ -72,12 +72,24 @@ function deselect_all(formita)
$nameTools = get_lang('Messages');
$request=api_is_xml_http_request();
if ($request===false) {
Display::display_header($nameTools,get_lang('Inbox'));
$interbreadcrumb[]= array (
'url' => '#',
'name' => get_lang($nameTools)
);
$interbreadcrumb[]= array (
'url' => 'outbox.php',
'name' => get_lang('Outbox')
);
$interbreadcrumb[]= array (
'url' => 'inbox.php',
'name' => get_lang('Inbox')
);
Display::display_header('');
$link_ref="new_message.php";
} else {
$link_ref="../messages/new_message.php?rs=1";
}
api_display_tool_title(get_lang('Inbox'));
api_display_tool_title('');
$table_message = Database::get_main_table(TABLE_MESSAGE);

@ -93,7 +93,7 @@ class MessageManager {
*/
public static function get_number_of_messages () {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status IN (0,1) AND user_receiver_id=".api_get_user_id();
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status IN (0,1,3) AND user_receiver_id=".api_get_user_id();
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$result = Database::fetch_array($sql_result);
return $result['number_messages'];
@ -109,7 +109,7 @@ class MessageManager {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
$sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3 FROM $table_message " .
"WHERE user_receiver_id=".api_get_user_id()." AND msg_status IN (0,1)" .
"WHERE user_receiver_id=".api_get_user_id()." AND msg_status IN (0,1,3)" .
"ORDER BY col$column $direction LIMIT $from,$number_of_items";
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$i = 0;
@ -152,10 +152,17 @@ class MessageManager {
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
}
/**
* Set status deleted
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @return array
*/
public static function delete_message_by_user_sender ($user_sender_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "UPDATE $table_message " .
"SET msg_status=8 WHERE user_sender_id=".Database::escape_string($user_sender_id)." AND id=".Database::escape_string($id);
"SET msg_status=3 WHERE user_sender_id=".Database::escape_string($user_sender_id)." AND id=".Database::escape_string($id);
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
}
@ -171,7 +178,13 @@ class MessageManager {
$result = api_sql_query($query,__FILE__,__LINE__);
return $row = Database::fetch_array($result);
}
/**
* Gets information about if exist messages
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @return boolean
*/
public static function exist_message ($user_id, $id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT id FROM $table_message WHERE user_receiver_id=".Database::escape_string($user_id)." AND id='".Database::escape_string($id)."'";
@ -182,7 +195,15 @@ class MessageManager {
else
return false;
}
public static function get_message_data_send ($from, $number_of_items, $column, $direction) {
/**
* Gets information about messages sent
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @param string
* @return array
*/
public static function get_message_data_sent ($from, $number_of_items, $column, $direction) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
$sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3 FROM $table_message " .
@ -210,7 +231,13 @@ class MessageManager {
}
return $message_list;
}
public static function get_number_of_messages_send () {
/**
* Gets information about number messages sent
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param void
* @return integer
*/
public static function get_number_of_messages_sent () {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status IN (0,1) AND user_sender_id=".api_get_user_id();
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
@ -253,7 +280,7 @@ class MessageManager {
<TR> <h1>'.$row[5].'</h1></TR>
</TD>
<TR>
<TD>'.get_lang('From').'&nbsp;<b>'.GetFullUserName($row[1],$mysqlMainDb).'</b> '.strtolower(get_lang('To')).'&nbsp; <b>'.GetFullUserName($row[2],$mysqlMainDb).'</b> </TD>
<TD>'.get_lang('From').'&nbsp;<b>'.GetFullUserName($row[1]).'</b> '.strtolower(get_lang('To')).'&nbsp; <b>'.GetFullUserName($row[2]).'</b> </TD>
</TR>
<TR>
<TD >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>

@ -1,4 +1,4 @@
<?php // $Id: new_message.php 18274 2009-02-05 22:34:52Z iflorespaz $
<?php // $Id: new_message.php 18292 2009-02-06 19:08:47Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
@ -7,7 +7,7 @@
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
Copyright (c) 2009 Isaac Flores Paz <isaac.flores.paz@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
@ -50,6 +50,7 @@ if (api_get_setting('allow_message_tool')!='true'){
require_once'../messages/message.class.php';
require_once(api_get_path(LIBRARY_PATH).'/text.lib.php');
require_once(api_get_path(LIBRARY_PATH).'/formvalidator/FormValidator.class.php');
$nameTools= get_lang('Messages');
/*
-----------------------------------------------------------
Constants and variables
@ -98,6 +99,9 @@ $(document).ready(function (){
});
</script>';
$nameTools = get_lang('ComposeMessage');
$fck_attribute['Height'] = "150";
$fck_attribute['Width'] = "95%";
$fck_attribute['ToolbarSet'] = "Profil";
/*
==============================================================================
FUNCTIONS
@ -141,7 +145,8 @@ function manage_form ($default, $select_from_user_list = null) {
$form = new FormValidator('compose_message');
if (isset($select_from_user_list)) {
$form->addElement('text','id_text_name',get_lang('SendMessageTo'),array('size' => 40,'id'=>'id_text_name'));
$form->add_textfield('id_text_name',get_lang('SendMessageTo'),true,array('size' => 40,'id'=>'id_text_name'));
$form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('html','<div id="id_div_search" class="message-search">&nbsp;</div>');
$form->addElement('hidden','user_list','',array('id'=>'user_list'));
//$form->addElement('select','user_list',get_lang('SendMessageTo'),$select_from_user_list);
@ -177,6 +182,16 @@ if (isset($_GET['rs'])) {
'url' => '../social/'.$_SESSION['social_dest'],
'name' => get_lang('SocialNetwork')
);
} else {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('Messages'));
$interbreadcrumb[]= array (
'url' => 'outbox.php',
'name' => get_lang('Outbox')
);
$interbreadcrumb[]= array (
'url' => 'inbox.php',
'name' => get_lang('Inbox')
);
}
$interbreadcrumb[]= array (
'url' => '#',
@ -195,8 +210,9 @@ if (!isset($_POST['compose'])) {
show_compose_to_any($_user['user_id']);
}
} else {
if(api_get_user_id() && isset($_POST['user_list']) && isset($_POST['content'])) {
if(api_get_user_id() && isset($_POST['user_list']) && isset($_POST['content']) && isset($_POST['id_text_name'])) {
$default['title'] = $_POST['title'];
$default['id_text_name'] = $_POST['id_text_name'];
$default['user_list'] = $_POST['user_list'];
manage_form($default);
} else {

@ -31,6 +31,7 @@
$language_file= 'messages';
$cidReset=true;
include_once ('../inc/global.inc.php');
require_once '../messages/message.class.php';
require_once (api_get_path(LIBRARY_PATH).'message.lib.php');
api_block_anonymous_users();
@ -75,33 +76,39 @@ function deselect_all(formita)
$nameTools = get_lang('Messages');
$request=api_is_xml_http_request();
if ($request===false) {
Display::display_header($nameTools,get_lang('Outbox'));
$interbreadcrumb[]= array (
'url' => '#',
'name' => get_lang($nameTools)
);
$interbreadcrumb[]= array (
'url' => 'inbox.php',
'name' => get_lang('Inbox')
);
$interbreadcrumb[]= array (
'url' => 'outbox.php',
'name' => get_lang('Outbox')
);
Display::display_header('');
}
api_display_tool_title(get_lang('Outbox'));
$table_message = Database::get_main_table(TABLE_MESSAGE);
echo '<div class=actions>';
echo get_lang('ReadMessageComment');
echo '</div>';
$user_sender_id=api_get_user_id();
$id=Security::remove_XSS($_GET['id']);
if (isset($_GET['action']) && $_GET['action']=='deleteone') {
MessageManager::delete_message_by_user_sender($user_sender_id,$id);
}
if (!isset($_GET[del_msg])) {
if ($_REQUEST['action']!='delete') {
outbox_display();
} else {
$num_msg = $_POST['total'];
for ($i=0;$i<$num_msg;$i++) {
if($_POST[$i]) {
//the user_id was necesarry to delete a message??
delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]);
}
$delete_list_id=array();
$delete_list_id=$_POST['id'];
for ($i=0;$i<count($delete_list_id);$i++) {
//the user_id was necesarry to delete a message??
MessageManager::delete_message_by_user_sender(api_get_user_id(), $delete_list_id[$i]);
}
inbox_display();
outbox_display();
}
/*
==============================================================================

@ -1,4 +1,4 @@
<?php // $Id: view_message.php 18274 2009-02-05 22:34:52Z iflorespaz $
<?php // $Id: view_message.php 18292 2009-02-06 19:08:47Z iflorespaz $
/*
==============================================================================
Dokeos - elearning and course management software
@ -37,20 +37,26 @@ if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Inbox'));
if (isset($_GET['id_send'])) {
$nameTools = get_lang('Messages');
if (isset($_GET['id_send']) || isset($_GET['id'])) {
if (isset($_GET['rs'])) {
$interbreadcrumb[]= array (
'url' => '../social/'.$_SESSION['social_dest'].'?#remote-tab-2',
'name' => get_lang('SocialNetwork')
);
}
} else {
if (isset($_GET['rs'])) {
$interbreadcrumb[]= array (
'url' => '../social/'.$_SESSION['social_dest'],
'name' => get_lang('SocialNetwork')
);
} else {
$interbreadcrumb[]= array (
'url' => '#',
'name' => get_lang($nameTools)
);
$interbreadcrumb[]= array (
'url' => 'inbox.php',
'name' => get_lang('Inbox')
);
$interbreadcrumb[]= array (
'url' => 'outbox.php',
'name' => get_lang('Outbox')
);
}
}
/*

Loading…
Cancel
Save