Changeset 249

Show
Ignore:
Timestamp:
2009-02-20 09:59:07 (3 years ago)
Author:
hannes
Message:

link to first new post for this user on forum overview (ticket #108)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/pages/Forum.php

    r213 r249  
    113113                $row4 = $q4->fetchObject(); 
    114114                $q4 = NULL; 
     115                // find out target page of the link (first unread post) 
     116                $q6 = $C->prepare('SELECT COUNT(*) FROM ' . $SETTINGS['dbtableprefix'] . 'posts WHERE topic = :topic AND posttime <= :lastvisit'); 
     117                $q6->bindParam(':topic', $row2['topicid'], PDO::PARAM_INT, 12); 
     118                $q6->bindParam(':lastvisit', $_SESSION['lastvisit'], PDO::PARAM_STR, 20); 
     119                $q6->execute(); 
     120                $_oldposts = $q6->fetchColumn(); 
     121                $q6 = NULL; 
     122                $_targetpage = max(1, ceil($_oldposts / $SETTINGS['postsperpage'])); 
    115123                // get first and last poster information 
    116124                if ($row3->postedbymember == 0) { 
     
    156164                $_mark .= '</td>'; 
    157165                // add all the previously compiled topic information to table 
    158                 $table->addRow(Array($_mark, '<td' . $_class . '><h3>' . $_prefix . '<a href="' . $F->link('topic') . 'id=' . $row2['topicid'] . '">' . htmlentities($row2['topictitle'], ENT_QUOTES, 'UTF-8') . '</a></h3>' . str_replace('&', '&amp;', $_multipages) . '</td>', '<td align="center"' . $_class . '>' . $row2['posts'] . '</td>', '<td align="center"' . $_class . '>' . $row2['views'] . '</td>', '<td' . $_class . '><div>' . $LANG['by'] . ' ' . $_poster1->getProfileLink() . '</div><div>' . $LANG['at'] . ' ' . $F->datetime($row3->posttime, FALSE, TRUE) . '</div><div>' . $LANG['on'] . ' ' . $F->datetime($row3->posttime, TRUE, FALSE) . '</div></td>', '<td' . $_class . '><div>' . $LANG['by'] . ' ' . $_poster2->getProfileLink() . '</div><div>' . $LANG['at'] . ' ' . $F->datetime($row4->posttime, FALSE, TRUE) . '</div><div>' . $LANG['on'] . ' ' . $F->datetime($row4->posttime, TRUE, FALSE) . '</div></td>'), FALSE, TRUE); 
     166                $table->addRow(Array($_mark, '<td' . $_class . '><h3>' . $_prefix . '<a href="' . $F->link('topic') . 'id=' . $row2['topicid'] . '">' . htmlentities($row2['topictitle'], ENT_QUOTES, 'UTF-8') . '</a></h3>' . str_replace('&', '&amp;', $_multipages) . '</td>', '<td align="center"' . $_class . '>' . $row2['posts'] . '</td>', '<td align="center"' . $_class . '>' . $row2['views'] . '</td>', '<td' . $_class . '><div>' . $LANG['by'] . ' ' . $_poster1->getProfileLink() . '</div><div>' . $LANG['at'] . ' ' . $F->datetime($row3->posttime, FALSE, TRUE) . '</div><div>' . $LANG['on'] . ' ' . $F->datetime($row3->posttime, TRUE, FALSE) . '</div></td>', '<td' . $_class . '><div>' . $LANG['by'] . ' ' . $_poster2->getProfileLink() . '</div><div>' . $LANG['at'] . ' <a href="' . $F->link('topic') . 'id=' . $row2['topicid'] . '&amp;amp;page=' . $_targetpage . '#newpost">' . $F->datetime($row4->posttime, FALSE, TRUE) . '</a></div><div>' . $LANG['on'] . ' ' . $F->datetime($row4->posttime, TRUE, FALSE) . '</div></td>'), FALSE, TRUE); 
    159167            } 
    160168            // add finished table to parent HTML element