Example #1
0
    function GenAdsByDate()
    {
        $sCode = MsgBox(_t('_Empty'));
        $sDate = bx_get('date');
        $aDate = explode('/', $sDate);
        $iValue1 = (int) $aDate[0];
        $iValue2 = (int) $aDate[1];
        $iValue3 = (int) $aDate[2];
        if ($iValue1 > 0 && $iValue2 > 0 && $iValue3 > 0) {
            $sCaption = _t('_bx_ads_caption_browse_by_day') . getLocaleDate(strtotime("{$iValue1}-{$iValue2}-{$iValue3}"), BX_DOL_LOCALE_DATE_SHORT);
            require_once $this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php';
            $oTmpAdsSearch = new BxAdsSearchUnit();
            $oTmpAdsSearch->aCurrent['sorting'] = 'last';
            $oTmpAdsSearch->aCurrent['restriction']['calendar-min'] = array('value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 00:00:00')", 'field' => 'DateTime', 'operator' => '>=', 'no_quote_value' => true);
            $oTmpAdsSearch->aCurrent['restriction']['calendar-max'] = array('value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 23:59:59')", 'field' => 'DateTime', 'operator' => '<=', 'no_quote_value' => true);
            $sLastAds = $oTmpAdsSearch->displayResultBlock();
            if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) {
                $sLastAds = MsgBox(_t('_Empty'));
            } else {
                $oTmpAdsSearch->aCurrent['paginate']['page_url'] = $sRequest;
                $sLastAds .= $oTmpAdsSearch->showPagination();
            }
            $sRetHtmlVal = <<<EOF
<div class="dbContent">
    {$sLastAds}
</div>
EOF;
            return DesignBoxContent($sCaption, $sRetHtmlVal, 1);
        }
    }