예제 #1
0
 /**
  * Sets value of lp_u : a link to Last Poster profile
  * and lp_t a time of last post
  *
  * @todo should make the last answerer an array
  *       and then just push the value there
  *       This way if answer is deleted we can just delete
  *       that one element from array!
  *
  * @param User                                  $User object of type User who made the last
  *                                                    Answer or Comment to this question
  *
  * @param \Lampcms\Answer                       $Answer
  *
  * @return object $this
  */
 public function setLatestAnswer(User $User, Answer $Answer)
 {
     $aLatest = $this->offsetGet('a_latest');
     $a = array('u' => '<a href="' . $User->getProfileUrl() . '">' . $User->getDisplayName() . '</a>', 't' => date('F j, Y g:i a T', $Answer->getLastModified()), 'id' => $Answer->getResourceId());
     /**
      * Latest answer data goes
      * to top of array
      */
     \array_unshift($aLatest, $a);
     $this->offsetSet('a_latest', $aLatest);
     return $this;
 }