Exemplo n.º 1
0
	static function getRecords( $user_id, $limit ){

		$dbo = JFactory::getDBO();

		$dbo->setQuery( modBidsHelper::getQuery($user_id) );
		$list = $dbo->loadObjectList();

		return $list;
	}
Exemplo n.º 2
0
	static function getQuery( &$params ){

            $module_type		=	$params->get("type_display",0);
            $sort_by		=	$params->get("sort_by","start_date");
            $userid=$params->get("filter_user","");
            $selectCols = array(
                    "a.id",
                    "a.title",
                    "a.userid",
                    "a.auction_type",
                    "a.initial_price",
                    "a.BIN_price",
                    "a.currency",
                    "u.username as by_user",
                    "a.start_date",
                    "a.end_date",
                    'a.params',
                    'a.close_offer',
                    'p.picture',
                    'MAX(b.bid_price) AS maxBid'
            );

            $where = array(
                    "a.published = 1",
                    "a.close_offer = 0",
                    "a.close_by_admin = 0",
                    "a.start_date <= UTC_TIMESTAMP()",
                    "a.end_date >= UTC_TIMESTAMP()"
            );
            if ($userid) {
                $where[] = "a.userid='{$userid}'";
            }

            switch( $params->get('bin_filter', 0) )
            {
                case 1:
                    $where[] = 'a.auction_type = '.AUCTION_TYPE_PUBLIC;
                    $where[] = 'a.BIN_price>0';
                    break;
                case 2:
                    $where[] = 'a.auction_type = ' . AUCTION_TYPE_BIN_ONLY;
                    break;

            }

            $orderings = array();

            modBidsHelper::_paramQuery($params, $selectCols, $where, $orderings );

            $JoinList = array("LEFT JOIN `#__users` as u on a.userid=u.id ",
                                "LEFT JOIN #__bid_pictures AS p on a.id=p.auction_id");


            $orderings[] = "a.$sort_by DESC, p.ordering";

            $query="SELECT ".implode(",",$selectCols).
            " FROM `#__bid_auctions` as a
            LEFT JOIN `#__bids` as b ON a.id=b.auction_id ".

            implode(" \r\n ",$JoinList)."\r\n".
            "WHERE ".implode(" AND ",$where)." ".PHP_EOL.
            "GROUP BY a.id ".PHP_EOL.
            "ORDER BY ".implode(",",$orderings);

            return $query;
	}
Exemplo n.º 3
0
    $user_id =JRequest::getVar('user');
    if(!$user_id){
        return;
    }
    require_once (JPATH_ROOT.DS."components".DS."com_bids".DS.'options.php');
    require_once (JPATH_ROOT.DS."components".DS."com_bids".DS.'defines.php');
    require_once (JPATH_ROOT.DS."components".DS."com_bids".DS.'helpers'.DS.'bids.php');

    BidsHelper::LoadHelperClasses();
    JHtml::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_bids'.DS.'htmlelements');

    $mid = $module->id;

    $module_type		=	$params->get("type_display",0);
    $nr_auctions		=	$params->get("nr_auctions_displayed",1);
    $image_width		=	$params->get("image_width",30);
    $image_height		=	$params->get("image_height",30);
    $display_image		=	$params->get("display_image",1);
    $display_counter	=	$params->get("display_counter",0);
    $layout             =   $params->get('template','list');

    $sort_by			=	$params->get("sort_by","start_date");
    $filter_featured	=	$params->get("featured",false);

    require_once(dirname(__FILE__).DS.'helper.php');
    $rows = modBidsHelper::getRecords( $user_id, 1 );
    if($rows && count($rows) > 0){
      require(JModuleHelper::getLayoutPath('mod_bids_custom', $layout));
    }
}
Exemplo n.º 4
0
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

error_reporting(JDEBUG ? E_ALL ^ E_STRICT : 0);

require_once (JPATH_ROOT.DS."components".DS."com_bids".DS.'options.php');
require_once (JPATH_ROOT.DS."components".DS."com_bids".DS.'defines.php');
require_once (JPATH_ROOT.DS."components".DS."com_bids".DS.'helpers'.DS.'bids.php');

BidsHelper::LoadHelperClasses();
JHtml::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_bids'.DS.'htmlelements');

$mid = $module->id;

$module_type		=	$params->get("type_display",0);
$nr_auctions		=	$params->get("nr_auctions_displayed",10);
$image_width		=	$params->get("image_width",30);
$image_height		=	$params->get("image_height",30);
$display_image		=	$params->get("display_image",1);
$display_counter	=	$params->get("display_counter",0);
$layout             =   $params->get('template','list');

$sort_by			=	$params->get("sort_by","start_date");
$filter_featured	=	$params->get("featured",false);

require_once(dirname(__FILE__).DS.'helper.php');
$rows = modBidsHelper::getRecords( $params );

require(JModuleHelper::getLayoutPath('mod_bids', $layout));