+ select('count(id)', '[+prefix+]user_messages', "recipient='{$uid}'");
- $num_rows = db()->getValue($rs);
+ // Get number of rows
+ $rs = db()->select('count(id)', '[+prefix+]user_messages', "recipient='{$uid}'");
+ $num_rows = db()->getValue($rs);
- // ==============================================================
- // Exemple Usage
- // Note: I make 2 query to the database for this exemple, it
- // could (and should) be made with only one query...
- // ==============================================================
+ // ==============================================================
+ // Exemple Usage
+ // Note: I make 2 query to the database for this exemple, it
+ // could (and should) be made with only one query...
+ // ==============================================================
- // If current position is not set, set it to zero
- if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) {
- $int_cur_position = 0;
- } else {
- $int_cur_position = $_REQUEST['int_cur_position'];
- }
+ // If current position is not set, set it to zero
+ $int_cur_position = (int) anyv('int_cur_position', 0);
+ if ($int_cur_position < 0) {
+ $int_cur_position = 0;
+ }
- // Number of result to display on the page, will be in the LIMIT of the sql query also
- $int_num_result = $modx->config['number_of_messages'];
+ // Number of result to display on the page, will be in the LIMIT of the sql query also
+ $int_num_result = $modx->config['number_of_messages'];
+ $pager = '';
+ $dotablestuff = 0;
- $extargv = "&a=10"; // extra argv here (could be anything depending on your page)
+ $extargv = "&a=10"; // extra argv here (could be anything depending on your page)
- include_once(MODX_CORE_PATH . 'paginate.inc.php');
- // New instance of the Paging class, you can modify the color and the width of the html table
- $p = new Paging($num_rows, $int_cur_position, $int_num_result, $extargv);
+ include_once(MODX_CORE_PATH . 'paginate.inc.php');
+ // New instance of the Paging class, you can modify the color and the width of the html table
+ $p = new Paging($num_rows, $int_cur_position, $int_num_result, $extargv);
- // Load up the 2 array in order to display result
- $array_paging = $p->getPagingArray();
- $array_row_paging = $p->getPagingRowArray();
+ // Load up the 2 array in order to display result
+ $array_paging = $p->getPagingArray();
+ $array_row_paging = $p->getPagingRowArray();
- // Display the result as you like...
- $pager .= $_lang['showing'] . " " . $array_paging['lower'];
- $pager .= " " . $_lang['to'] . " " . $array_paging['upper'];
- $pager .= " (" . $array_paging['total'] . " " . $_lang['total'] . ")";
- $pager .= "
" . $array_paging['previous_link'] . '<<' . (isset($array_paging['previous_link']) ? " " : " ");
- foreach ($array_row_paging as $v) {
- $pager .= $v . ' ';
- }
- $pager .= $array_paging['next_link'] . ">>" . (isset($array_paging['next_link']) ? "" : "");
+ // Display the result as you like...
+ $pager .= $_lang['showing'] . " " . $array_paging['lower'];
+ $pager .= " " . $_lang['to'] . " " . $array_paging['upper'];
+ $pager .= " (" . $array_paging['total'] . " " . $_lang['total'] . ")";
+ $pager .= "
" . $array_paging['previous_link'] . '<<' . (isset($array_paging['previous_link']) ? " " : " ");
+ foreach ($array_row_paging as $v) {
+ $pager .= $v . ' ';
+ }
+ $pager .= $array_paging['next_link'] . ">>" . (isset($array_paging['next_link']) ? "" : "");
- $rs = db()->select(
- '*',
- '[+prefix+]user_messages',
- sprintf("recipient='%s'", $uid),
- 'postdate DESC',
- sprintf('%d, %s', $int_cur_position, $int_num_result)
- );
- $limit = db()->count($rs);
- if ($limit < 1):
- echo $_lang['messages_no_messages'];
- else:
+ $rs = db()->select(
+ '*',
+ '[+prefix+]user_messages',
+ sprintf("recipient='%s'", $uid),
+ 'postdate DESC',
+ sprintf('%d, %s', $int_cur_position, $int_num_result)
+ );
+ $limit = db()->count($rs);
+ if ($limit < 1):
+ echo $_lang['messages_no_messages'];
+ else:
echo $pager;
$dotablestuff = 1;
- ?>
+ ?>
+ id="table-1" width='100%'>
-
- |
- = $_lang['messages_subject'] ?> |
- = $_lang['messages_from'] ?> |
- = $_lang['messages_private'] ?> |
- = $_lang['messages_sent'] ?> |
-
+
+ |
+ = $_lang['messages_subject'] ?> |
+ = $_lang['messages_from'] ?> |
+ = $_lang['messages_private'] ?> |
+ = $_lang['messages_sent'] ?> |
+
- getRow($rs)) :
- $message['subject'] = decrypt($message['subject']);
- $message['message'] = decrypt($message['message']);
- $sender = $message['sender'];
- if ($sender == 0):
- $sendername = "[System]";
- else:
- $rs2 = db()->select('username', '[+prefix+]manager_users', "id='{$sender}'");
- $row2 = db()->getRow($rs2);
- $sendername = $row2['username'];
- endif;
- $messagestyle = $message['messageread'] == 0 ? "messageUnread" : "messageRead";
+ getRow($rs)) :
+ $message['subject'] = decrypt($message['subject']);
+ $message['message'] = decrypt($message['message']);
+ $sender = $message['sender'];
+ if ($sender == 0):
+ $sendername = "[System]";
+ else:
+ $rs2 = db()->select('username', '[+prefix+]manager_users', "id='{$sender}'");
+ $row2 = db()->getRow($rs2);
+ $sendername = $row2['username'];
+ endif;
+ $messagestyle = $message['messageread'] == 0 ? "messageUnread" : "messageRead";
?>
-
- | ',
- $icons_path);
- } ?> |
- = $message['subject'] ?> |
- = $sendername ?> |
- = $message['private'] == 0 ? $_lang['no'] : $_lang['yes'] ?> |
- = $modx->toDateFormat($message['postdate'] + $modx->config['server_offset_time']) ?> |
-
-
+ ',
+ $icons_path
+ );
+ } ?> |
+ = $message['subject'] ?> |
+ = $sendername ?> |
+ = $message['private'] == 0 ? $_lang['no'] : $_lang['yes'] ?> |
+ = $modx->toDateFormat($message['postdate'] + $modx->config['server_offset_time']) ?> |
+
+
-