예제 #1
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     if (!$this->_state->isUnique()) {
         $query->join('LEFT', 'attachments_relations AS relations', 'relations.attachments_attachment_id = tbl.attachments_attachment_id');
     }
     return parent::_buildQueryJoins($query);
 }
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     if ($this->_state->source instanceof KDatabaseRowInterface || $this->_state->container) {
         $query->join('LEFT', 'files_containers AS c', 'c.files_container_id = tbl.files_container_id');
     }
 }
예제 #3
0
	protected function _buildQueryJoins(KDatabaseQuery $query)
	{
		parent::_buildQueryJoins($query);

		$query->join('LEFT', 'categories AS categories', 'categories.id = tbl.catid')
			  ->join('LEFT', 'users AS users', 'users.id = tbl.checked_out');
	}
예제 #4
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryJoins($query);
     $iso_code = substr(JFactory::getLanguage()->getTag(), 0, 2);
     if ($iso_code != 'en') {
         $prefix = $iso_code . '_';
     }
     if (is_array($state->type)) {
         $subquery = '(';
         $i = 1;
         foreach ($state->type as $type) {
             $subquery .= 'SELECT ' . KInflector::pluralize($type) . '_' . KInflector::singularize($type) . '_id AS id, LOWER("' . strtoupper(KInflector::pluralize($type)) . '_' . strtoupper(KInflector::pluralize($type)) . '") AS test FROM #__' . $prefix . KInflector::pluralize($type) . '_' . KInflector::pluralize($type) . ' AS ' . KInflector::pluralize($type) . '
             WHERE enabled = 1 AND frontpage = 1';
             if (KInflector::singularize($type) == 'event') {
                 $subquery .= ' AND start_date >= CURDATE()';
             }
             if ($i < count($state->type)) {
                 $subquery .= ' UNION ALL ';
             }
             $i++;
         }
         $subquery .= ')';
         $query->join[] = array('type' => 'INNER', 'table' => $subquery . 'AS b', 'condition' => array('tbl.row = b.id AND tbl.table = b.test'));
     }
 }
예제 #5
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     // Optionally join the articles if the article link is used.
     $query->select('articles.title AS article_title');
     $query->join('left outer', '#__articles_articles AS articles', 'tbl.articles_article_id = articles.articles_article_id');
 }
예제 #6
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     $state = $this->_state;
     parent::_buildQueryJoins($query);
     if ($state->sort) {
         $query->join('INNER', '#__cck_values AS cck', 'cck.cck_fieldset_id = tbl.cck_fieldset_id AND cck.row = tbl.tenders_tender_id AND cck.table = LOWER(\'' . strtoupper($this->getTable()->getName()) . '\')');
     }
 }
예제 #7
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     $query->select('users.name AS name');
     $query->select('users.username AS username');
     $query->select('users.email AS email');
     $query->join('LEFT', 'users AS users', 'users.id = tbl.profile_user_id');
 }
예제 #8
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     if ($this->_state->connect) {
         $query->join('cross', '#__translations_translations AS trans', '1 = 1');
         $query->join('left outer', '#__translations_translations_relations AS rel', 'trans.translations_translation_id = rel.translations_translation_id AND rel.lang = tbl.lang_code');
     }
 }
예제 #9
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     if (!$this->_state->user_id) {
         ///*
         $query->join('left', 'ninjaboard_message_recipients AS recipient', 'recipient.ninjaboard_message_id = tbl.ninjaboard_message_id')->join('left', 'users AS user', 'user.id = tbl.created_by OR user.id = recipient.user_id')->join('left', 'ninjaboard_people AS person', 'person.ninjaboard_person_id = tbl.created_by');
         //*/
     }
 }
예제 #10
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     $query->join('LEFT', 'ninjaboard_forums AS forum', 'forum.ninjaboard_forum_id = tbl.forum_id')->join('LEFT', 'ninjaboard_topic_symlinks AS symlink', '(symlink.ninjaboard_topic_id = tbl.ninjaboard_topic_id AND symlink.ninjaboard_forum_id != tbl.forum_id)');
     if (!KFactory::get('lib.joomla.user')->guest) {
         $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
         $query->join('left', 'ninjaboard_log_topic_reads AS log', 'log.created_by = ' . $me->id . ' AND ' . 'log.ninjaboard_forum_id = tbl.forum_id AND ' . 'log.ninjaboard_topic_id = tbl.ninjaboard_topic_id');
     }
 }
예제 #11
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     if (!$this->_state->isUnique()) {
         if ($this->_state->subscribed) {
             $query->join('RIGHT', 'news_subscriptions AS subscription', 'subscription.news_article_id = tbl.news_article_id');
         }
     }
 }
예제 #12
0
    protected function _buildQueryJoins(KDatabaseQuery $query)
    {
        //Exclude joins if counting records
        if (!$query->count) {
            $query->join[] = array('type' => 'LEFT', 'table' => '(SELECT section, COUNT(section) categorycount FROM #__categories 
					WHERE published <> -2 GROUP BY section) AS cat', 'condition' => array('cat.section = tbl.id'));
            $query->join('LEFT', 'content AS active', 'active.sectionid = tbl.id');
        }
        parent::_buildQueryJoins($query);
    }
예제 #13
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     $state = $this->_state;
     $query->join('LEFT', 'sections AS section', 'section.id = tbl.sectionid')->join('LEFT', 'categories AS category', 'category.id = tbl.catid')->join('LEFT', 'users AS user', 'user.id = tbl.created_by')->join('LEFT', 'groups AS group', 'group.id = tbl.access');
     if (is_bool($state->featured) && $state->featured == true) {
         $query->join('RIGHT', 'content_frontpage AS frontpage', 'frontpage.content_id = tbl.id');
     } else {
         $query->join('LEFT', 'content_frontpage AS frontpage', 'frontpage.content_id = tbl.id');
     }
 }
예제 #14
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     $query->join('left', 'users AS user', 'user.id = tbl.ninjaboard_person_id');
     //->join('left', 'ninjaboard_ranks AS rank', 'IFNULL(person.posts, 0) >= rank.min')
     //->order('rank.min', 'DESC');
     if (JVersion::isCompatible('1.6.0')) {
         $query->join('left', 'user_usergroup_map AS joomla_usergroup', 'joomla_usergroup.user_id = user.id')->select('GROUP_CONCAT(joomla_usergroup.group_id SEPARATOR \'|\') AS ninjaboard_usergroup_id');
     } else {
         $query->join('left', 'ninjaboard_joomla_user_group_maps AS joomla_map', 'joomla_map.joomla_gid = user.gid')->select("IFNULL((SELECT GROUP_CONCAT(ninjaboard_map.ninjaboard_user_group_id SEPARATOR '|') FROM #__ninjaboard_user_group_maps AS ninjaboard_map WHERE ninjaboard_map.joomla_user_id = user.id), joomla_map.ninjaboard_gid) AS ninjaboard_usergroup_id");
     }
     parent::_buildQueryJoins($query);
 }
예제 #15
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     //Exclude joins if counting records
     if (!$query->count) {
         if ($this->_state->section) {
             if ($this->_state->section == 'com_content' || is_numeric($this->_state->section)) {
                 $query->join('LEFT', 'content AS content', 'content.catid = tbl.id');
                 $query->join('LEFT', 'sections AS sections', 'sections.id = tbl.section');
             } else {
                 $query->join('LEFT', substr($this->_state->section, 4) . ' AS child', 'child.catid = tbl.id');
             }
         }
     }
     parent::_buildQueryJoins($query);
 }
예제 #16
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     $query->join('left', 'ninjaboard_people AS person', 'person.ninjaboard_person_id = tbl.id');
     /*
     		$query
     			->join('left', 'ninjaboard_joomla_user_group_maps AS joomla_map', 'joomla_map.joomla_gid = tbl.gid')
     			->select("IFNULL((SELECT GROUP_CONCAT(ninjaboard_map.ninjaboard_user_group_id SEPARATOR '|') FROM #__ninjaboard_user_group_maps AS ninjaboard_map WHERE ninjaboard_map.joomla_user_id = tbl.id), joomla_map.ninjaboard_gid) AS ninjaboard_usergroup_id");
     //*/
     //Get the default gid for users that's not mapped
     $gid = (int) KFactory::get('admin::com.ninjaboard.model.joomlausergroupmaps')->getGuest()->gid;
     if (JVersion::isCompatible('1.6.0')) {
         //$query
         //->join('left', 'user_usergroup_map AS joomla_usergroup', 'joomla_usergroup.user_id = tbl.id')
         //->select('GROUP_CONCAT(joomla_usergroup.group_id SEPARATOR \'|\') AS ninjaboard_usergroup_id');
     } else {
         $query->join('left', 'ninjaboard_joomla_user_group_maps AS joomla_map', 'joomla_map.joomla_gid = tbl.gid')->select("IFNULL(IFNULL((SELECT GROUP_CONCAT(ninjaboard_map.ninjaboard_user_group_id SEPARATOR '|') FROM #__ninjaboard_user_group_maps AS ninjaboard_map WHERE ninjaboard_map.joomla_user_id = tbl.id), joomla_map.ninjaboard_gid), {$gid}) AS ninjaboard_usergroup_id");
     }
     parent::_buildQueryJoins($query);
 }
예제 #17
0
 /**
  * @param KDatabaseQuery $query
  */
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     $relation = $this->getTable()->getRelationTable();
     $id_column = $this->getTable()->getIdentityColumn();
     $query->join('inner', '#__' . $relation . ' AS crumbs', 'crumbs.descendant_id = tbl.' . $id_column);
     if ($this->getTable()->hasBehavior('orderable')) {
         // This one is to have a breadcrumbs style order like 1/3/4
         if (in_array($this->_state->sort, array('title', 'created_on', 'custom'))) {
             $query->join('inner', '#__makundi_category_orderings AS o', 'crumbs.ancestor_id = o.' . $id_column);
         }
         // This one is to display the custom ordering in backend
         if (!$query->count) {
             $query->join('left', '#__makundi_category_orderings AS o2', 'tbl.' . $id_column . ' = o2.' . $id_column);
         }
     }
     if ($this->_state->parent_id) {
         $query->join('inner', '#__' . $relation . ' AS r', 'r.descendant_id = tbl.' . $id_column);
     }
     parent::_buildQueryJoins($query);
 }
예제 #18
0
    protected function _buildQueryJoins(KDatabaseQuery $query)
    {
		parent::_buildQueryJoins($query);
		
		$query->join('LEFT', 'weblinks AS weblinks', 'weblinks.catid = tbl.id');
    }
예제 #19
0
 protected function _buildQueryJoins(KDatabaseQuery $query)
 {
     parent::_buildQueryJoins($query);
     $query->join('left', 'users AS user', 'user.id = tbl.created_user_id')->join('left', 'ninjaboard_people AS person', 'person.ninjaboard_person_id = tbl.created_user_id')->join('left', 'ninjaboard_topics AS topic', 'topic.ninjaboard_topic_id = tbl.ninjaboard_topic_id')->join('left', 'ninjaboard_posts AS first_post', 'first_post.ninjaboard_post_id = topic.first_post_id')->join('left', 'ninjaboard_forums AS forum', 'forum.ninjaboard_forum_id = topic.forum_id');
 }