From 0b2a379dd8dbe1f2a1d2dfe2fd1c8ca52d5a6ff5 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Mon, 1 Oct 2012 11:52:03 +0000 Subject: [PATCH] Add Thread object creation to /operator/userhistory.php Replace direct work with thread table's fields by Thread object --- src/messenger/webim/operator/userhistory.php | 10 ++++++---- src/messenger/webim/view/userhistory.php | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/messenger/webim/operator/userhistory.php b/src/messenger/webim/operator/userhistory.php index f3f400b4..58f52071 100644 --- a/src/messenger/webim/operator/userhistory.php +++ b/src/messenger/webim/operator/userhistory.php @@ -38,12 +38,11 @@ function threads_by_userid($userid) if ($userid == "") { return null; } - + return $db->query( - "select dtmcreated as created, " . - "dtmmodified as modified, threadid, remote, agentName, userName " . + "select {chatthread}.* " . "from {chatthread} " . - "where userid=? order by created DESC", + "where userid=? order by dtmcreated DESC", array($userid), array('return_rows' => Database::RETURN_ALL_ROWS) ); @@ -53,6 +52,9 @@ $found = threads_by_userid($userid); prepare_menu($operator); setup_pagination($found, 6); +foreach ($page['pagination.items'] as $key => $item) { + $page['pagination.items'][$key] = Thread::createFromDbInfo($item); +} start_html_output(); require('../view/userhistory.php'); ?> \ No newline at end of file diff --git a/src/messenger/webim/view/userhistory.php b/src/messenger/webim/view/userhistory.php index 437163e3..e7142da7 100644 --- a/src/messenger/webim/view/userhistory.php +++ b/src/messenger/webim/view/userhistory.php @@ -46,16 +46,16 @@ if( $page['pagination.items'] ) { foreach( $page['pagination.items'] as $chatthread ) { ?> - + userName)) ?> - + remote)) ?> - + agentName ) { ?>agentName)) ?> - , + modified-$chatthread->created) ?>, created) ?>