17 require_once SQ_SYSTEM_ROOT.
'/core/assets/system/simple_report/simple_report.inc';
43 parent::__construct($assetid);
67 $generated = $report[
'generated'];
68 $report = $report[
'report_data'];
69 $total_system_messages_by_type = $report[
'total_system_messages_by_type'];
70 $total_user_messages_by_type = $report[
'total_user_messages_by_type'];
71 $total_messages_by_status = $report[
'total_messages_by_status'];
74 <td class="sq-backend-table-cell">
77 <td class="sq-backend-table-cell" align="right">
82 $table_format =
' <br><b>%s</b><br><br>
83 <table class="sq-backend-table">
85 <th class="sq-backend-table-header">Message Type</th>
86 <th class="sq-backend-table-header" width="70" align="right">Total</th>
93 foreach ($total_system_messages_by_type as $report) {
94 $rows_string .= sprintf($row_format, $report[
'type'], $report[
'total']);
97 $table = sprintf($table_format,
'System Messages', $rows_string);
103 foreach ($total_user_messages_by_type as $report) {
104 $rows_string .= sprintf($row_format, $report[
'type'], $report[
'total']);
107 $table = sprintf($table_format,
'User Messages', $rows_string);
114 <td class="sq-backend-table-cell" style="width: 10px">
117 <td class="sq-backend-table-cell">
120 <td class="sq-backend-table-cell" align="right">
125 foreach ($total_messages_by_status as $report) {
126 $status = $report[
'status'];
127 $unknown_status = FALSE;
130 case 'U': $status =
'Unread';
133 case 'R': $status =
'Read';
136 case 'D': $status =
'Deleted';
139 default: $unknown_status = TRUE;
144 if (!$unknown_status) {
145 if ($status ==
'Deleted') {
146 $icon =
'<img src="'.sq_web_path(
'lib').
'/web/images/icons/internal_message/trash.png">';
148 $icon =
'<img src="'.sq_web_path(
'lib').
'/web/images/icons/internal_message/message_'.strtolower($status).
'.png">';
152 $rows_string .= sprintf($row_format, $icon, $status, $report[
'total']);
156 $table_format =
' <br>
157 <table class="sq-backend-table">
159 <th class="sq-backend-table-header" colspan="2">Message Status</th>
160 <th class="sq-backend-table-header" width="70" align="right">Total</th>
166 $table = sprintf($table_format, $rows_string);
186 $messages_report = Array(
187 'total_system_messages_by_type' => Report_Total_Internal_Messages::_getTotalInternalMessagesByType(
'system'),
188 'total_user_messages_by_type' => Report_Total_Internal_Messages::_getTotalInternalMessagesByType(
'user'),
189 'total_messages_by_status' => Report_Total_Internal_Messages::_getTotalInternalMessagesByStatus(),
193 'generated' => $today,
194 'report_data' => $messages_report,
213 private static function _getTotalInternalMessagesByType($message_type=
'all')
218 if ($message_type ==
'system') {
219 $where_clause =
'WHERE type LIKE '.MatrixDAL::quote(
'system.%');
220 }
else if ($message_type ==
'user') {
221 $where_clause =
'WHERE type NOT LIKE '.MatrixDAL::quote(
'system.%');
224 $sql =
'SELECT type, COUNT(*) AS total '.
225 'FROM sq_internal_msg '.$where_clause.
226 'GROUP BY type ORDER BY total DESC, type';
242 private function _getTotalInternalMessagesByStatus()
245 $sql =
'SELECT status, COUNT(*) AS total '.
246 'FROM sq_internal_msg '.
247 'GROUP BY status ORDER BY status DESC';