topic.phtml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * @version 7.9 [rev.7.9.01]
  4. */
  5. if ($sale instanceof \Ppb\Db\Table\Row\Sale) {
  6. /** @var \Ppb\Db\Table\Row\User $user */
  7. $user = $this->userDetails($this->loggedInUser['id'])->getUser();
  8. $active = $user->isActive();
  9. ?>
  10. <?php echo $this->partial('partials/sale.phtml', array(
  11. 'sale' => $sale,
  12. 'postageDesc' => ($active) ? true : false,
  13. 'caption' => ($active) ? true : false,
  14. 'directPaymentButton' => ($active) ? true : false,
  15. 'type' => $this->loggedInUser['id'] == $sale['seller_id'] ? 'sold' : 'bought')); ?>
  16. <?php }
  17. else {
  18. // TODO: not an ideal solution
  19. $topicTitle = $message->getTopicTitle();
  20. @preg_match('#Private Message - Listing ID: \#(.*)#', $topicTitle, $matches);
  21. if (count($matches) > 1) {
  22. if (!empty($matches[1])) {
  23. $listingsService = new \Ppb\Service\Listings();
  24. $listing = $listingsService->findBy('id', intval($matches[1]));
  25. if (count($listing) > 0) {
  26. echo $this->partial('partials/listing-box.phtml', array(
  27. 'listing' => $listing)) . '<br>';
  28. }
  29. }
  30. }
  31. }
  32. ?>
  33. <h4 class="headline">
  34. <span><?php echo $this->_('Message Board'); ?></span>
  35. </h4>
  36. <?php echo ($message['topic_id'] != null) ? $this->partial('partials/messages.phtml', array(
  37. 'message' => $message)) : null; ?>
  38. <?php echo $this->action('create', 'messaging', 'members', array(
  39. 'receiver_id' => ($this->loggedInUser['id'] == $message['sender_id']) ?
  40. $message['receiver_id'] : $message['sender_id'],
  41. 'sale_id' => $message['sale_id'],
  42. 'topic_id' => $message['topic_id'])); ?>