public function GetQueryRestriction($oExcludeItem = null, $bReturnAsArray = false)
    {
        $sQuery = '';
        $aQueryItems = array();
        $iPointer = $this->getItemPointer();
        $this->GoToStart();
        while ($oItem = $this->Next()) {
            if (is_null($oExcludeItem) || !$oExcludeItem->IsSameAs($oItem)) {
                $sTmpQuery = trim($oItem->GetQueryRestrictionForActiveFilter());
                if (!empty($sTmpQuery)) {
                    $aQueryItems[] = $sTmpQuery;
                }
            }
        }
        $this->setItemPointer($iPointer);
        if (!$bReturnAsArray) {
            if (count($aQueryItems)) {
                $sQuery = '('.implode(') AND (', $aQueryItems).')';
            }

            return $sQuery;
        } else {
            return $aQueryItems;
        }
    }