Ejemplo n.º 1
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     $where = array('class_key' => 'SocietyBlog');
     $c->where($where);
     return $c;
 }
Ejemplo n.º 2
0
 protected function setSelection(xPDOQuery $c)
 {
     $c = parent::setSelection($c);
     /*
         Получаем данные диалоговой ветви
     */
     $c->leftJoin('SocietyThread', 'thread', "thread.target_class='modResource' AND thread.target_id={$this->classKey}.id");
     /*
         Проверяем, есть ли голос пользователя здесь
     */
     $c->leftJoin('SocietyVote', 'vote', "vote.target_class='modResource' AND vote.target_id={$this->classKey}.id AND vote.user_id = " . $this->modx->user->id);
     $c->leftJoin('modUser', 'CreatedBy');
     $c->select(array("CreatedBy.username as author_username", "thread.id as thread_id", "thread.positive_votes", "thread.negative_votes", "thread.comments_count", "vote.id as vote_id", "vote.vote_direction", "vote.vote_value"));
     $c->prepare();
     return $c;
 }