예제 #1
0
 /**
  * Add block with user's answers
  *
  * @return object $this
  *
  * @todo finish up with pagination
  *
  */
 protected function addAnswers()
 {
     /**
      *
      * html of parsed answers and pagination links
      * at the bottom all wrapped inside <div class="user_answers">
      *
      * @var $userQuestions
      */
     $userQuestions = UserAnswers::get($this->Registry, $this->User);
     /**
      * UserQuestions::get() may return an empty string
      * if this user does not have
      * any answers in which case skip the
      * rest of the method
      */
     if (empty($userQuestions)) {
         return $this;
     }
     /**
      * @todo must user Router now!
      */
     $cond = $this->Registry->Request->get('sort', 's', 'recent');
     $tabs = Urhere::factory($this->Registry)->get('tplSortuans', $cond, array('uid' => $this->User->getUid()));
     $ansBlock = '<div id="useranswers" class="cp fl sortable paginated">' . $userQuestions . '</div>';
     $this->aPageVars['body'] .= $tabs . $ansBlock;
     return $this;
 }
예제 #2
0
 /**
  * Get paginated and sorted block with user
  * Answers and returl via XHR
  *
  */
 protected function getAnswers()
 {
     d('getting answers block');
     $s = \Lampcms\UserAnswers::get($this->Registry, $this->User);
     Responder::sendJSON(array('replace' => array('target' => 'useranswers', 'content' => $s)));
 }