public function join_category($categoryid) {

        if ($categoryid === GLOSSARY_SHOW_ALL_CATEGORIES) {
            $this->joins[] = sprintf('JOIN {glossary_entries_categories} %s ON %s = %s',
                self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
                self::resolve_field('entryid', 'entries_categories'));

            $this->joins[] = sprintf('JOIN {glossary_categories} %s ON %s = %s',
                self::ALIAS_CATEGORIES, self::resolve_field('id', 'categories'),
                self::resolve_field('categoryid', 'entries_categories'));

        } else if ($categoryid === GLOSSARY_SHOW_NOT_CATEGORISED) {
            $this->joins[] = sprintf('LEFT JOIN {glossary_entries_categories} %s ON %s = %s',
                self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
                self::resolve_field('entryid', 'entries_categories'));

        } else {
            $this->joins[] = sprintf('JOIN {glossary_entries_categories} %s ON %s = %s AND %s = :joincategoryid',
                self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
                self::resolve_field('entryid', 'entries_categories'),
                self::resolve_field('categoryid', 'entries_categories'));
            $this->params['joincategoryid'] = $categoryid;

        }
    }
public function join_category($categoryid) {

        if ($categoryid === GLOSSARY_SHOW_ALL_CATEGORIES) {
            $this->joins[] = sprintf('JOIN {glossary_entries_categories} %s ON %s = %s',
                self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
                self::resolve_field('entryid', 'entries_categories'));

            $this->joins[] = sprintf('JOIN {glossary_categories} %s ON %s = %s',
                self::ALIAS_CATEGORIES, self::resolve_field('id', 'categories'),
                self::resolve_field('categoryid', 'entries_categories'));

        } else if ($categoryid === GLOSSARY_SHOW_NOT_CATEGORISED) {
            $this->joins[] = sprintf('LEFT JOIN {glossary_entries_categories} %s ON %s = %s',
                self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
                self::resolve_field('entryid', 'entries_categories'));

        } else {
            $this->joins[] = sprintf('JOIN {glossary_entries_categories} %s ON %s = %s AND %s = :joincategoryid',
                self::ALIAS_ENTRIES_CATEGORIES, self::resolve_field('id', 'entries'),
                self::resolve_field('entryid', 'entries_categories'),
                self::resolve_field('categoryid', 'entries_categories'));
            $this->params['joincategoryid'] = $categoryid;

        }
    }
public function join_category ( $ categoryid ) { if ( $ categoryid === GLOSSARY_SHOW_ALL_CATEGORIES ) { $ this -> joins [ ] = sprintf ( 'JOIN {glossary_entries_categories} %s ON %s = %s' , self :: ALIAS_ENTRIES_CATEGORIES , self :: resolve_field ( 'id' , 'entries' ) , self :: resolve_field ( 'entryid' , 'entries_categories' ) ) ; $ this -> joins [ ] = sprintf ( 'JOIN {glossary_categories} %s ON %s = %s' , self :: ALIAS_CATEGORIES , self :: resolve_field ( 'id' , 'categories' ) , self :: resolve_field ( 'categoryid' , 'entries_categories' ) ) ; } else if ( $ categoryid === GLOSSARY_SHOW_NOT_CATEGORISED ) { $ this -> joins [ ] = sprintf ( 'LEFT JOIN {glossary_entries_categories} %s ON %s = %s' , self :: ALIAS_ENTRIES_CATEGORIES , self :: resolve_field ( 'id' , 'entries' ) , self :: resolve_field ( 'entryid' , 'entries_categories' ) ) ; } else { $ this -> joins [ ] = sprintf ( 'JOIN {glossary_entries_categories} %s ON %s = %s AND %s = :joincategoryid' , self :: ALIAS_ENTRIES_CATEGORIES , self :: resolve_field ( 'id' , 'entries' ) , self :: resolve_field ( 'entryid' , 'entries_categories' ) , self :: resolve_field ( 'categoryid' , 'entries_categories' ) ) ; $ this -> params [ 'joincategoryid' ] = $ categoryid ; } }
Join on the category tables.

Depending on the category passed the joins will be different. This is due to the display
logic that assumes that when displaying all categories the non categorised entries should
not be returned, etc...

@param int $categoryid The category ID, or GLOSSARY_SHOW_* constant.
Join on the category tables .