Beispiel #1
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     
     $query
         ->select('cc.title AS category');
 }
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     if ($this->_state->source instanceof KDatabaseRowInterface || $this->_state->container) {
         $query->select('c.slug AS container');
     }
 }
Beispiel #3
0
	protected function _buildQueryColumns(KDatabaseQuery $query)
	{
		parent::_buildQueryColumns($query);

		$query->select('categories.title AS category')
			  ->select('users.name AS editor');
	}
Beispiel #4
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     $query->select(array('person.*', 'tbl.*'))->select(array('IFNULL(person.posts, 0) AS posts', 'IFNULL(person.avatar, CONCAT(LOWER(\'/MEDIA/COM_NINJABOARD/IMAGES/AVATAR\'), LOWER(\'.PNG\'))) AS avatar', 'person.signature AS signature'))->select(array('(SELECT rank_file FROM #__ninjaboard_ranks WHERE IFNULL(person.posts, 0) >= min AND enabled = 1 ORDER BY min DESC LIMIT 0, 1) AS rank_icon', '(SELECT title FROM #__ninjaboard_ranks WHERE IFNULL(person.posts, 0) >= min AND enabled = 1 ORDER BY min DESC LIMIT 0, 1) AS rank_title'));
     parent::_buildQueryColumns($query);
     //Build query for the screen names
     KFactory::get('admin::com.ninjaboard.model.people')->buildScreenNameQuery($query, 'person', 'tbl', 'display_name');
 }
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     if (!$this->_state->isUnique()) {
         $query->select('COUNT(relations.attachments_attachment_id) AS count')->select('table')->select('row');
     }
     return parent::_buildQueryColumns($query);
 }
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     if ($this->_state->connect) {
         $query->select('trans.*');
         $query->select('rel.*');
     }
 }
Beispiel #7
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     if ($this->_state->distinct && !empty($this->_state->column)) {
         $query->distinct()->select($this->_state->column)->select($this->_state->column . ' AS logs_log_id');
     } else {
         parent::_buildQueryColumns($query);
         $query->select('users.name AS created_by_name');
     }
 }
Beispiel #8
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     $query->select('user.usertype')->select('person.posts AS person_posts')->select('tbl.ninjaboard_post_id AS id')->select("IFNULL(person.avatar, '/media/com_ninjaboard/images/avatar.png') AS avatar")->select("IF(topic.first_post_id = tbl.ninjaboard_post_id, tbl.subject, CONCAT('RE: ', first_post.subject)) AS subject")->select('person.signature')->select('(SELECT rank_file FROM #__ninjaboard_ranks WHERE person.posts >= min AND enabled = 1 ORDER BY min DESC LIMIT 1) AS rank_icon')->select('(SELECT title FROM #__ninjaboard_ranks WHERE person.posts >= min AND enabled = 1 ORDER BY min DESC LIMIT 1) AS rank_title');
     //Build query for the screen names
     KFactory::get('admin::com.ninjaboard.model.people')->buildScreenNameQuery($query, 'person', 'user', 'display_name', 'IFNULL(tbl.guest_name, \'' . JText::_('Anonymous') . '\')');
     if ($search = $this->_state->search) {
         $query->select(array('forum.title AS forum', 'topic.ninjaboard_topic_id AS topic', 'topic.hits'));
     }
 }
Beispiel #9
0
 /**
  * Builds SELECT columns list for the query.
  *
  * @param   KDatabaseQuery  A query object.
  * @return  void
  */
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     $state = $this->_state;
     $query->select('IF(session.session_id IS NOT NULL, 1, 0) AS loggedin');
     $query->select('IF(tbl.block = 1, 0, 1) AS enabled');
     if ($state->loggedin) {
         $query->select(array('session.client_id AS loggedin_client_id', 'session.time AS loggedin_on', 'session.session_id AS loggedin_session_id'));
     }
 }
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     if ($this->_state->section) {
         if ($this->_state->section == 'com_content' || is_numeric($this->_state->section)) {
             $query->select('sections.title AS section_title')->select('SUM( IF(content.state <> -2,1,0)) activecount');
         } else {
             $query->select('SUM(IF(child.catid,1,0)) activecount');
         }
     }
 }
Beispiel #11
0
    protected function _buildQueryColumns(KDatabaseQuery $query)
    {
        parent::_buildQueryColumns($query);

        $query->select('section.title AS section_title')
            ->select('category.title AS category_title')
            ->select('user.name AS created_by_name')
            ->select('user.id   AS created_by_id')
            ->select('IF(frontpage.content_id, 1, 0) AS featured')
            ->select('frontpage.ordering AS featured_ordering')
            ->select('group.name AS group_name');
    }
Beispiel #12
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     $query->select('COUNT(crumbs.ancestor_id) AS level')->select('GROUP_CONCAT(crumbs.ancestor_id ORDER BY crumbs.level DESC SEPARATOR \'/\') AS path');
     if ($this->getTable()->hasBehavior('orderable')) {
         if (!$query->count) {
             $query->select('o2.custom AS ordering');
         }
         if (in_array($this->_state->sort, array('title', 'created_on', 'custom'))) {
             $column = sprintf('GROUP_CONCAT(LPAD(`o`.`%s`, 5, \'0\') ORDER BY crumbs.level DESC  SEPARATOR \'/\') AS order_path', $this->_state->sort);
             $query->select($column);
         }
     }
     parent::_buildQueryColumns($query);
 }
Beispiel #13
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     $query->select('tbl.*')->select('first_post.subject')->select('first_post.subject AS title')->select('first_post.subject AS alias')->select('last_post.subject AS last_post_subject')->select('first_post.created_time AS first_post_date')->select('first_post.created_user_id AS started_by')->select('tbl.last_post_by AS created_user_id')->select('tbl.last_post_on AS last_post_date');
     // Do some joins here, to avoid unnecessary joins in count queries
     $query->join('LEFT', 'ninjaboard_posts AS first_post', 'first_post.ninjaboard_post_id = tbl.first_post_id')->join('LEFT', 'ninjaboard_posts AS last_post', 'last_post.ninjaboard_post_id = tbl.last_post_id')->join('LEFT', 'users AS last_post_user', 'last_post_user.id = tbl.last_post_by')->join('LEFT', 'ninjaboard_people AS last_post_person', 'last_post_person.ninjaboard_person_id = tbl.last_post_by');
     //Build query for the screen names
     KFactory::get('admin::com.ninjaboard.model.people')->buildScreenNameQuery($query, 'last_post_person', 'last_post_user', 'last_post_username', 'IFNULL(last_post.guest_name, \'' . JText::_('Anonymous') . '\')');
     if ($this->_state->forum) {
         $query->select('IF((symlink.ninjaboard_forum_id = ' . $this->_state->forum . '), forum.title, NULL) AS moved_to_forum_title');
     }
     if (KFactory::get('lib.joomla.user')->guest) {
         $query->select(array('0 AS new', '1 AS unread'));
     } else {
         $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
         $table = KFactory::get('admin::com.ninjaboard.database.table.logtopicreads');
         $select = KFactory::tmp('lib.koowa.database.query')->select('UNIX_TIMESTAMP(IFNULL(MIN(created_on), NOW()))')->where('created_by', '=', $me->id);
         if ($this->_state->forum) {
             $select->where('ninjaboard_forum_id', '=', $this->_state->forum);
         }
         $start = $table->select($select, KDatabase::FETCH_FIELD);
         $query->select(array('IF(UNIX_TIMESTAMP(tbl.last_post_on) > ' . (int) $start . ', 1, 0) AS new', 'IF(log.created_on > tbl.last_post_on || tbl.last_post_by = ' . (int) $me->id . ', 0, 1) AS unread'));
     }
 }
Beispiel #14
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     $query->columns[] = 'u.name AS user_name';
     parent::_buildQueryColumns($query);
 }
Beispiel #15
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     $query->select(array('user.*', 'IFNULL(tbl.posts, 0) AS posts'))->select(array('(SELECT rank_file FROM #__ninjaboard_ranks WHERE IFNULL(tbl.posts, 0) >= min AND enabled = 1 ORDER BY min DESC LIMIT 0, 1) AS rank_icon', '(SELECT title FROM #__ninjaboard_ranks WHERE IFNULL(tbl.posts, 0) >= min AND enabled = 1 ORDER BY min DESC LIMIT 0, 1) AS rank_title'));
     $this->buildScreenNameQuery($query);
 }
Beispiel #16
0
	protected function _buildQueryColumns(KDatabaseQuery $query)
	{
		parent::_buildQueryColumns($query);
		$query->select('categorycount')
			->select('SUM( IF(active.state <> -2,1,0)) activecount');
	}
 /**
  * Builds SELECT fields list for the query
  */
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     $query->select('tbl.id');
     $query->columns[] = 'CONCAT_WS( " / ",s.title, tbl.title ) AS title';
     parent::_buildQueryColumns($query);
 }
 /**
  * Builds SELECT fields list for the query
  */
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     $query->select('tbl.element AS value')->select('tbl.name AS title');
     parent::_buildQueryColumns($query);
 }
Beispiel #19
0
    protected function _buildQueryColumns(KDatabaseQuery $query)
    {
		parent::_buildQueryColumns($query);

		$query->select('COUNT(weblinks.id) AS numlinks');
    }
Beispiel #20
0
 protected function _buildQueryColumns(KDatabaseQuery $query)
 {
     parent::_buildQueryColumns($query);
     //Build query for the screen names
     //KFactory::get('admin::com.ninjaboard.model.people')->buildScreenNameQuery($query, 'person', 'user', 'recipient');
 }