Beispiel #1
0
function b_recent_offers_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    // Creating the partner handler object
    $offer_handler =& smartpartner_gethandler('offer');
    $partner_handler =& smartpartner_gethandler('partner');
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
    $smartpermissions_handler = new SmartobjectPermissionHandler($partner_handler);
    $grantedItems = $smartpermissions_handler->getGrantedItems('full_view');
    if (!empty($grantedItems)) {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('partnerid', '(' . implode(', ', $grantedItems) . ')', 'IN'));
        $criteria->add(new Criteria('date_pub', time(), '<'));
        $criteria->add(new Criteria('date_end', time(), '>'));
        $criteria->add(new Criteria('status', _SPARTNER_STATUS_ONLINE));
        $criteria->setsort('date_sub');
        $criteria->setOrder('DESC');
        $criteria->setLimit($options[2]);
        $offersObj =& $offer_handler->getObjects($criteria);
        $block = array();
        if ($offersObj) {
            foreach ($offersObj as $offerObj) {
                $block['offers'][] = $offerObj->toArray('e');
            }
            $smartConfig =& smartpartner_getModuleConfig();
            //$image_info = smartpartner_imageResize($partnerObj->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']);
            if ($options[0] == 1) {
                $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"';
            }
            $block['see_all'] = 1;
            $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL_OFFERS;
            $block['smartpartner_url'] = SMARTPARTNER_URL;
        }
    }
    return $block;
}