function getBlockCode_Groups()
 {
     global $site;
     $mode = $_REQUEST['groups_mode'];
     if ($mode != 'rand' and $mode != 'latest') {
         $mode = 'latest';
     }
     $aDBTopMenu = array();
     //$menu = '<div class="dbTopMenu">';
     foreach (array('latest', 'rand') as $myMode) {
         switch ($myMode) {
             case 'latest':
                 $sTabTitle = _t('_Latest');
                 break;
             case 'rand':
                 $sTabTitle = _t('_Random');
                 break;
         }
         $aDBTopMenu[$sTabTitle] = array('href' => "{$_SERVER['PHP_SELF']}?groups_mode={$myMode}", 'dynamic' => true, 'active' => $myMode == $mode);
         /*if( $mode == $myMode ) {
         			$menu .= "<div class=\"active\">$sTabTitle</div>";
         		} else {
         			$menu .= "
         			<div class=\"notActive\">
         				<a href=\"{$_SERVER['PHP_SELF']}?groups_mode=$myMode\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_groups', this.href+'&amp;show_only=groups'); return false;\">$sTabTitle</a>
         			</div>";
         		}*/
     }
     /*$menu .= '
     			<div class="clear_both"></div>
     		</div>';*/
     $iTotalNum = db_value("SELECT COUNT(*) AS 'Cnt' FROM `Groups` WHERE `status` = 'Active'");
     $oGroups = new BxDolGroups();
     if ($iTotalNum) {
         $iResPerPage = (int) getParam("max_blogs_on_home");
         $iTotalPages = ceil($iTotalNum / $iResPerPage);
         $page = (int) $_REQUEST['groups_page'];
         if ($page < 1 or $mode == 'rand') {
             $page = 1;
         }
         if ($page > $iTotalPages) {
             $page = $iTotalPages;
         }
         $sqlLimitFrom = ($page - 1) * $iResPerPage;
         $sBlocks = $oGroups->GenAnyBlockContent($mode, 0, "LIMIT {$sqlLimitFrom}, {$iResPerPage}");
         $ret = $sBlocks;
     } else {
         $ret .= '<div class="no_result"><div>' . _t("_No groups available") . '</div></div>';
     }
     $aDBBottomMenu = array();
     if ($iTotalPages > 1) {
         //$ret .= '<div class="dbBottomMenu">';
         if ($page > 1) {
             $prevPage = $page - 1;
             $aDBBottomMenu[_t('_Back')] = array('href' => "{$_SERVER['PHP_SELF']}?groups_mode={$mode}&amp;groups_page={$prevPage}", 'dynamic' => true, 'class' => 'backMembers');
             /*$sBackC = _t('_Back');
             				$retR .= <<<EOF
             	<a href="{$_SERVER['PHP_SELF']}?groups_mode={$mode}&amp;groups_page={$prevPage}" class="backMembers" onclick="getHtmlData( 'show_groups', this.href+'&amp;show_only=groups'); return false;">
             		{$sBackC}
             	</a>
             EOF;*/
         }
         if ($page < $iTotalPages) {
             $nextPage = $page + 1;
             $aDBBottomMenu[_t('_Next')] = array('href' => "{$_SERVER['PHP_SELF']}?groups_mode={$mode}&amp;groups_page={$nextPage}", 'dynamic' => true, 'class' => 'moreMembers');
             /*$sNextC = _t('_Next');
             				$retR .= <<<EOF
             	<a href="{$_SERVER['PHP_SELF']}?groups_mode={$mode}&amp;groups_page={$nextPage}" class="moreMembers" onclick="getHtmlData( 'show_groups', this.href+'&amp;show_only=groups'); return false;">
             		{$sNextC}
             	</a>
             EOF;*/
         }
         $sBMViewAllLink = $oGroups->bUseFriendlyLinks ? "{$site['url']}groups/all/" : "{$site['url']}grp.php";
         $aDBBottomMenu[_t('_View All')] = array('href' => $sBMViewAllLink, 'dynamic' => false, 'class' => 'viewAllMembers');
         //$ret .= '<div class="clear_both"></div></div>';
     }
     return array($ret, $aDBTopMenu, $aDBBottomMenu);
 }
    function showBlockGroups($sCaption, $bNoDB = false)
    {
        global $site;
        $ID = $this->_iProfileID;
        if ($ID > 0) {
            $sQuery = "\r\n\t\t\t\tSELECT COUNT(`Groups`.`ID`) AS 'Cnt'\r\n\t\t\t\tFROM `GroupsMembers`, `Groups`\r\n\t\t\t\tWHERE \r\n\t\t\t\t`Groups`.`status` = 'Active' AND\r\n\t\t\t\t`GroupsMembers`.`memberID` = {$ID} AND\r\n\t\t\t\t`GroupsMembers`.`groupID`  = `Groups`.`ID` AND\r\n\t\t\t\t`GroupsMembers`.`status`   = 'Active'\r\n\t\t\t";
            $iBlogs = db_value($sQuery);
            if ($iBlogs > 0) {
                $oGroups = new BxDolGroups();
                $sBlocks = $oGroups->GenAnyBlockContent('last', $ID);
                $ret = <<<EOF
<div id="container_groups">
\t{$sBlocks}
</div>
EOF;
                $show_hide = $this->genShowHideItem('container_groups');
                if ($bNoDB) {
                    return $ret;
                } else {
                    echo DesignBoxContent(_t($sCaption), $ret, 1, $show_hide);
                }
            } else {
                return;
            }
        } else {
            if ($bNoDB) {
                return MsgBox(_t('_im_textNoCurrUser'));
            } else {
                echo MsgBox(_t('_im_textNoCurrUser'));
            }
        }
    }
    function getBlockCode_Groups()
    {
        if ($this->iMember > 0) {
            $sqlQuery = "\r\n\t\t\t\tSELECT COUNT(`Groups`.`ID`) AS 'Cnt'\r\n\t\t\t\tFROM `GroupsMembers`, `Groups`\r\n\t\t\t\tINNER JOIN `GroupsCateg` ON `GroupsCateg`.`ID` = `Groups`.`categID` \r\n\t\t\t\tWHERE\r\n\t\t\t\t`GroupsMembers`.`memberID` = '{$this->iMember}' AND `GroupsMembers`.`groupID`  = `Groups`.`ID` AND `GroupsMembers`.`status`   = 'Active'\r\n\t\t\t";
            $iBlogs = db_value($sqlQuery);
            if ($iBlogs > 0) {
                $oGroups = new BxDolGroups();
                $sBlocks = $oGroups->GenAnyBlockContent('latest', $this->iMember);
                $ret = <<<EOF
<div id="container_groups">
\t{$sBlocks}
</div>
EOF;
                $show_hide = $this->genShowHideItem('container_groups');
                $sShowHide = $show_hide;
                return $ret;
            } else {
                return '';
            }
        } else {
            return MsgBox(_t('_im_textNoCurrUser'));
        }
    }