This repository has been archived by the owner on Jul 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMessages.php
88 lines (71 loc) · 2.16 KB
/
Messages.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* Messages
*
* @package Messaging module
*/
// Include Common functions.
require_once 'modules/Messaging/includes/Common.fnc.php';
// Include Messages functions.
require_once 'modules/Messaging/includes/Messages.fnc.php';
$title = ProgramTitle();
if ( SchoolInfo( 'SCHOOLS_NB' ) > 1
&& User( 'PROFILE' ) !== 'student' )
{
// If more than 1 school, mention current school.
$title .= ' (' . SchoolInfo( 'TITLE' ) . ')';
}
DrawHeader( $title );
if ( $_REQUEST['modfunc'] === 'archive' )
{
$archived = MessageArchive( $_REQUEST['message_id'] );
if ( $archived )
{
$note[] = button( 'check', '', '', 'bigger' ) . ' ' . _( 'Message archived.' );
}
if ( function_exists( 'RedirectURL' ) )
{
// @since 3.3.
RedirectURL( 'modfunc' );
}
}
if ( isset( $note ) )
{
echo ErrorMessage( $note, 'note' );
}
if ( isset( $_REQUEST['view'] )
&& $_REQUEST['view'] === 'message'
&& MessageOutput( $_REQUEST['message_id'] ) )
{
// Display message.
// exit;
}
else
{
// Display messages list.
$views_data = GetMessagesViewsData();
// Get current view.
$current_view = 'unread';
if ( isset( $_REQUEST['view'] )
&& in_array( $_REQUEST['view'], array_keys( $views_data ) ) )
{
$current_view = $_REQUEST['view'];
}
$views_left = '<a href="' . $views_data['unread']['link'] . '">' .
( $current_view === 'unread' ?
'<b>' . $views_data['unread']['label'] . '</b>' : $views_data['unread']['label'] ) .
'</a> | <a href="' . $views_data['read']['link'] . '">' .
( $current_view === 'read' ?
'<b>' . $views_data['read']['label'] . '</b>' : $views_data['read']['label'] ) .
'</a> | <a href="' . $views_data['archived']['link'] . '">' .
( $current_view === 'archived' ?
'<b>' . $views_data['archived']['label'] . '</b>' : $views_data['archived']['label'] ) . '</a>';
$views_right = '<a href="' . $views_data['sent']['link'] . '">' .
( $current_view === 'sent' ?
'<b>' . $views_data['sent']['label'] . '</b>' : $views_data['sent']['label'] ) . '</a>';
DrawHeader( $views_left, $views_right );
// Display View header.
DrawHeader( '<b>' . $views_data[ $current_view ]['plural'] . '</b>' );
// Display View.
MessagesListOutput( $current_view );
}