function PageCompClassifieds($sCaption, &$sShowHide) { global $site; global $short_date_format; global $p_arr; $php_date_format = getParam('php_date_format'); //$iBlogLimitChars = (int)getParam("max_classified_preview"); $iBlogLimitChars = (int) getParam("max_blog_preview"); $ID = $p_arr['ID']; if ($ID > 0) { $sQuery = "\r\n\t\t\t\tSELECT DISTINCT\r\n\t\t\t\t`ClassifiedsAdvertisements`.`ID`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Subject`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Media`,\r\n\t\t\t\t`Profiles`.`NickName`,\r\n\t\t\t\tUNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`DateTime`,\r\n\t\t\t\t`Classifieds`.`Name`, `Classifieds`.`ID` AS `CatID`,\r\n\t\t\t\t`ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`ID` AS `SubCatID`,\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Message`,\r\n\t\t\t\tCOUNT(`ClsAdvComments`.`ID`) AS 'CommCount'\r\n\t\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\t\tLEFT JOIN `ClassifiedsSubs`\r\n\t\t\t\tON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs`\r\n\t\t\t\tLEFT JOIN `Classifieds`\r\n\t\t\t\tON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`\r\n\t\t\t\tLEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile`\r\n\t\t\t\tLEFT JOIN `ClsAdvComments` ON `ClsAdvComments`.`IDAdv`=`ClassifiedsAdvertisements`.`ID`\r\n\t\t\t\tWHERE\r\n\t\t\t\t`ClassifiedsAdvertisements`.`IDProfile` = '{$ID}' AND\r\n\t\t\t\t`ClassifiedsAdvertisements`.`Status` = 'active'\r\n\t\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\t\tORDER BY `DateTime` DESC\r\n\t\t\t\tLIMIT 5\r\n\t\t\t"; $rBlogs = db_res($sQuery); if (!mysql_num_rows($rBlogs)) { return ''; } ob_start(); ?> <div id="container_classifieds"> <?php $oClassifieds = new BxDolClassifieds(); while ($aBlog = mysql_fetch_assoc($rBlogs)) { $sPic = $oClassifieds->getImageCode($aBlog['Media'], TRUE); $sLinkMore = ''; if (strlen($aBlog['Message']) > $iBlogLimitChars) { //$sLinkMore = "... <a href=\"".$site['url']."blog.php?owner=".$ID."&show=blog&blogID=".$aBlog['PostID']."\">"._t('_Read more')."</a>"; $sLinkMore = "... <a href=\"" . $site['url'] . "classifieds.php?ShowAdvertisementID=" . $aBlog['ID'] . "\">" . _t('_Read more') . "</a>"; } $sBlogSnippet = substr(strip_tags($aBlog['Message']), 0, $iBlogLimitChars) . $sLinkMore; ?> <div class="icon_block"> <div class="thumbnail_block" style="float:left;"> <?php echo '<a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $aBlog['ID'] . '" class="bottom_text">'; ?> <?php echo $sPic; ?> </a> </div> </div> <div class="blog_wrapper_n"> <div class="blog_subject_n"> <?php echo '<a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $aBlog['ID'] . '" class="bottom_text">'; ?> <?php echo $aBlog['Subject']; ?> </a> </div> <div class="blogInfo"> <span><img src="<?php echo getTemplateIcon('clock.gif'); ?> " /><?php echo date($php_date_format, $aBlog['DateTime_f']) . ' '; ?> </span> <span><?php echo _t('_in Category', getTemplateIcon('ad_category.gif'), 'classifieds.php?bClassifiedID=' . $aBlog['CatID'], process_line_output($aBlog['Name'])) . ' / ' . '<a href="classifieds.php?bSubClassifiedID=' . $aBlog['SubCatID'] . '">' . process_line_output($aBlog['NameSub']) . '</a>'; ?> </span> <span><?php echo _t('_comments N', getTemplateIcon('add_comment.gif'), $aBlog['CommCount']); ?> </span> </div> <div class="blogSnippet"> <?php echo $sBlogSnippet; ?> </div> </div> <div class="clear_both"></div> <?php } ?> </div> <?php $ret = ob_get_clean(); $show_hide = genShowHideItem('container_classifieds'); $sShowHide = $show_hide; return $ret; } else { return MsgBox(_t('_im_textNoCurrUser')); } //return DesignBoxContent( _t( $sCaption ), $ret, 1, $show_hide ); }
function PageCompClassifiedsContent($sCaption) { global $site; global $date_format; $php_date_format = getParam('php_date_format'); $mode = $_REQUEST['classifieds_mode']; if ($mode != 'rand' and $mode != 'latest' and $mode != 'top') { $mode = 'latest'; } $menu = '<div class="dbTopMenu">'; foreach (array('latest', 'top', 'rand') as $myMode) { switch ($myMode) { case 'top': $OrderBy = '`CommCount` DESC'; $sTabTitle = _t('_Top'); break; case 'latest': $OrderBy = '`DateTime` DESC'; $sTabTitle = _t('_Latest'); break; case 'rand': $OrderBy = 'RAND()'; $sTabTitle = _t('_Random'); break; } if ($mode == $myMode) { $sqlOrderBy = $OrderBy; $menu .= "\r\n\t\t\t<div class=\"active\">{$sTabTitle}</div>"; } else { $menu .= "\r\n\t\t\t<div class=\"notActive\">\r\n\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?classifieds_mode={$myMode}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;\">{$sTabTitle}</a>\r\n\t\t\t</div>"; } } $menu .= ' <div class="clear_both"></div> </div>'; $aTotalNum = db_arr("\r\n\t\tSELECT\r\n\t\t\tCOUNT(*) FROM `ClassifiedsAdvertisements`\r\n\t\tWHERE\r\n\t\t\t`Status` = 'active'\r\n\t\t"); $iTotalNum = $aTotalNum[0]; if ($iTotalNum) { //$iResPerPage = (int)getParam("max_classifieds_on_home"); $iResPerPage = (int) getParam("max_blogs_on_home"); //$iResPerPage = 3; $iTotalPages = ceil($iTotalNum / $iResPerPage); $page = (int) $_REQUEST['classifieds_page']; if ($page < 1 or $mode == 'rand') { $page = 1; } if ($page > $iTotalPages) { $page = $iTotalPages; } $sqlLimitFrom = ($page - 1) * $iResPerPage; //$iBlogLimitChars = (int)getParam("max_classified_preview"); $iBlogLimitChars = (int) getParam("max_blog_preview"); //$iBlogLimitChars = 50; $sBlogQuery = "\r\n\t\t\tSELECT DISTINCT\r\n\t\t\t`ClassifiedsAdvertisements`.`ID`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Subject`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Media`,\r\n\t\t\t`Profiles`.`NickName`,\r\n\t\t\tUNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`,\r\n\t\t\t`ClassifiedsAdvertisements`.`DateTime`,\r\n\t\t\t`Classifieds`.`Name`, `Classifieds`.`ID` AS `CatID`,\r\n\t\t\t`ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`ID` AS `SubCatID`,\r\n\t\t\tLEFT(`ClassifiedsAdvertisements`.`Message`, {$iBlogLimitChars}) as 'Message', \r\n\t\t\tCOUNT(`ClsAdvComments`.`ID`) AS 'CommCount'\r\n\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\tLEFT JOIN `ClassifiedsSubs`\r\n\t\t\tON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs`\r\n\t\t\tLEFT JOIN `Classifieds`\r\n\t\t\tON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`\r\n\t\t\tLEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile`\r\n\t\t\tLEFT JOIN `ClsAdvComments` ON `ClsAdvComments`.`IDAdv`=`ClassifiedsAdvertisements`.`ID`\r\n\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\tORDER BY {$sqlOrderBy}\r\n\t\t\tLIMIT {$sqlLimitFrom}, {$iResPerPage}\r\n\t\t"; $rBlog = db_res($sBlogQuery); $ret = ''; $oClassifieds = new BxDolClassifieds(); $ret .= '<div class="clear_both"></div>'; while ($arr = mysql_fetch_array($rBlog)) { if ($mode == 'top' && $arr['CommCount'] == 0) { continue; } $sPic = $oClassifieds->getImageCode($arr['Media'], TRUE); $sLinkMore = ''; if (strlen($arr['Message']) == $iBlogLimitChars) { $sLinkMore = "... <a href=\"" . $site['url'] . "classifieds.php?ShowAdvertisementID=" . $arr['ID'] . "\">" . _t('_Read more') . "</a>"; } $ret .= ' <div class="icon_block"> <div class="thumbnail_block" style="float:left;"> <a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $arr['ID'] . '" class="bottom_text"> ' . $sPic . ' </a> </div> </div> <div class="blog_wrapper_n"> <div class="blog_subject_n"> <a href="' . $site['url'] . 'classifieds.php?ShowAdvertisementID=' . $arr['ID'] . '" class="bottom_text">' . process_line_output($arr['Subject']) . '</a> </div> <div class="blog_author_n">' . '<span>' . _t('_By Author', $arr['NickName'], $arr['NickName']) . '</span>' . '<span><img src="' . getTemplateIcon('clock.gif') . '" />' . date($php_date_format, $arr['DateTime_f']) . '</span>' . '<span>' . _t('_in Category', getTemplateIcon('folder_small.png'), 'classifieds.php?bClassifiedID=' . $arr['CatID'], process_line_output($arr['Name'])) . ' / <a href="' . 'classifieds.php?bSubClassifiedID=' . $arr['SubCatID'] . '">' . process_line_output($arr['NameSub']) . '</a></span>' . '<span>' . _t('_comments N', getTemplateIcon('add_comment.gif'), (int) $arr['CommCount']) . '</span>' . '</div> <div class="blog_text_n">' . strip_tags(process_html_output($arr['Message'])) . $sLinkMore . '</div> </div>'; } $ret .= '<div class="clear_both"></div>'; } else { $ret .= '<div class="no_result"><div>' . _t("_No classifieds available") . '</div></div>'; } if ($iTotalPages > 1) { $ret .= ' <div class="dbBottomMenu">'; if ($page > 1) { $prevPage = $page - 1; $ret .= "\r\n\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$prevPage}\"\r\n\t\t\t\t class=\"backMembers\"\r\n\t\t\t\t onclick=\"getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;\">" . _t('_Back') . "</a>\r\n\t\t\t"; } if ($page < $iTotalPages) { $nextPage = $page + 1; $ret .= "\r\n\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?classifieds_mode={$mode}&classifieds_page={$nextPage}\"\r\n\t\t\t\t class=\"moreMembers\"\r\n\t\t\t\t onclick=\"getHtmlData( 'show_classifieds', this.href+'&show_only=classifieds'); return false;\">" . _t('_Next') . "</a>\r\n\t\t\t"; } $ret .= ' <div class="clear_both"></div> </div>'; } return DesignBoxContent(_t($sCaption), $ret, 1, $menu); }