Ejemplo n.º 1
0
 function onAfterSaveAuctionSuccess($auction)
 {
     if (!$auction->published) {
         return;
     }
     //not published yet
     $orderitems = BidsHelperAuction::getOrderItemsForAuction($auction->id, self::getItemName());
     if (count($orderitems)) {
         foreach ($orderitems as $item) {
             if ($item->status == 'C') {
                 return;
             }
         }
         //Auction was paid for!
     }
     $model = self::getModel();
     $price = $model->getItemPrice($auction->cat);
     if (!floatval($price->price)) {
         return;
     }
     // Free publishing
     $modelbalance = JTheFactoryPricingHelper::getModel('balance');
     $balance = $modelbalance->getUserBalance();
     if (BidsHelperPrices::comparePrices($price, array("price" => $balance->balance, "currency" => $balance->currency)) > 0) {
         //insufficient funds
         $auction->published = 0;
         $a = JTable::getInstance('auction');
         $a->bind($auction);
         $a->store();
         $modelorder = JTheFactoryPricingHelper::getModel('orders');
         $item = $model->getOderitem($auction);
         $order = $modelorder->createNewOrder($item, $price->price, $price->currency, null, 'P');
         $session = JFactory::getSession();
         $session->set('checkout-order', $order->id, self::getContext());
         return;
     }
     //get funds from account, create confirmed order
     $balance_minus = BidsHelperPrices::convertCurrency($price->price, $price->currency, $balance->currency);
     $modelbalance->decreaseBalance($balance_minus);
     $modelorder = JTheFactoryPricingHelper::getModel('orders');
     $item = $model->getOderitem($auction);
     $order = $modelorder->createNewOrder($item, $price->price, $price->currency, null, 'C');
 }
Ejemplo n.º 2
0
    function display($tmpl) {

        $model = $this->getModel('suggestions');

        $userProfile = BidsHelperTools::getUserProfileObject();

        $filter_bidtype = $model->getState('filters.filter_bidtype');
        $lists['filter_bidtype'] = JHTML::_('listauctions.selectBidType', $filter_bidtype );
        $sfilters['bid_type'] = $filter_bidtype;

        $gallery = BidsHelperGallery::getGalleryPlugin();

        $suggestions = $model->get('suggestions');
        $rownr = 0;
        foreach($suggestions as &$s) {
            $s->rownr = ++$rownr;
            $s->links = JHTML::_('auctiondetails.createLinks',$s);
            BidsHelperAuction::renderAuctionTiming($s);
            $s->countdownHtml = JHTML::_('auctiondetails.countdownHtml',$s);

            $gallery->clearImages();
            $gallery->addImageList(explode(',', $s->pictures));
            $s->thumbnail = $gallery->getThumbImage();
        }

        JHTML::script(JURI::root().'components/com_bids/js/jquery/jquery.js');
        JHTML::script(JURI::root().'components/com_bids/js/jquery/jquery.noconflict.js');

        BidsHelperHtml::loadCountdownJS();

        JHTML::script( JURI::root().'components/com_bids/js/startup.js' );

        $this->assign('auction_rows', $suggestions);
        $this->assign('pagination', $model->get('pagination') );
        $this->assign('lists', $lists);
        $this->assign('sfilters', $sfilters);
        $this->assign('userProfile',$userProfile);

        parent::display($tmpl);
    }
Ejemplo n.º 3
0
 function onBeforeDisplay($task, $smarty)
 {
     if (!is_object($smarty)) {
         return;
     }
     if (!in_array($task, array('viewbids', 'details'))) {
         return;
     }
     $auction = $smarty->get_template_vars('auction');
     $curent_info = $smarty->get_template_vars('payment_items_header');
     if ($auction->close_offer || !$auction->published || !$auction->isMyAuction() || $auction->featured == 'featured') {
         return;
     }
     $orderitems = BidsHelperAuction::getOrderItemsForAuction($auction->id, self::getItemName());
     if (count($orderitems)) {
         $priceinfo = JText::_("COM_BIDS_PAYMENT_FOR_FEATURE_AUCTION_IS_PENDING");
         foreach ($orderitems as $item) {
             if ($item->status == 'C') {
                 return;
             }
         }
         //Auction was payed for!
         $smarty->assign('payment_items_header', $curent_info . $priceinfo);
         return;
     }
     $model = self::getModel();
     $price = $model->getItemPrice($auction->cat);
     if (!floatval($price->price)) {
         return;
     } else {
         $priceinfo = "<a href='" . BidsHelperRoute::getFeaturedRoute($auction->id) . "'>";
         $priceinfo .= JText::_("COM_BIDS_UPGRADE_TO_FEATURED_FOR") . number_format($price->price, 2) . " " . $price->currency;
         $priceinfo .= "</a><br/>";
     }
     $smarty->assign('payment_items_header', $curent_info . $priceinfo);
 }
Ejemplo n.º 4
0
    function viewbids() {

        $my = JFactory::getUser();
        $database = JFactory::getDBO();

        $id = JRequest::getInt('id');

        $redirectURL = JRoute::_('index.php?option=com_bids', false);

        $auctionmodel = $this->getModel('auction');
        if (!$auctionmodel->load($id)) {
            $this->setRedirect( $redirectURL, JText::_('COM_BIDS_ERR_DOES_NOT_EXIST')) ;
            return;
        }
        $auction = $auctionmodel->get('auction');
        if (!$auction->published) {
            if ($my->guest || !$auctionmodel->ownsAuction($my->id)) {
                $this->setRedirect( $redirectURL, JText::_('COM_BIDS_ERR_DOES_NOT_EXIST') );
                return;
            }
        } else {
            if( time() < BidsHelperDateTime::getTimeStamp($auction->start_date) && !$auctionmodel->ownsAuction($my->id) ) {
                $this->setRedirect( $redirectURL, JText::_('COM_BIDS_ERR_DOES_NOT_EXIST') );
                return;
            }
        }

        if($auction->close_by_admin) {
            if ($my->guest || !$auctionmodel->ownsAuction($my->id)) {
                $this->setRedirect( $redirectURL, JText::_('COM_BIDS_ERR_DOES_NOT_EXIST'));
                return;
            } else {
                //raise warning for seller
                JError::raiseWarning(1,JText::_('COM_BIDS_ERR_AUCTION_BANNED'));
            }
        }

        $auctionmodel->hitAuction($id);

        BidsHelperAuction::renderAuctionTiming($auction);

        BidsHelperAuction::setAuctionStatus($auction);


//////////// EX-renderAuctionData

        // [+] Rates
        $database->setQuery("SELECT
                AVG(rating) AS all_rates,
                IF(rate_type='auctioneer',AVG(rating),0) AS auctioneer_rates,
                IF(rate_type='bidder',AVG(rating),0) AS bidder_rates
        FROM #__bid_rate
        WHERE user_rated_id=".$auction->userid);

        $rates = $database->loadAssocList();
        if (isset($rates[0]))
            $rates = $rates[0];
        $auction->rating_auctioneer = $rates["auctioneer_rates"];
        $auction->rating_bidder = $rates["bidder_rates"];
        $auction->rating_overall = $rates["all_rates"];

        // [-] Rates

        $view = $this->getView('auction', 'html');
        $view->setModel($auctionmodel,true);

        $view->display('t_auctiondetails.tpl');
    }
Ejemplo n.º 5
0
 static function inputShipmentPrice($auction, $isAdmin = false)
 {
     $cfg = BidsHelperTools::getConfig();
     $db = JFactory::getDBO();
     if (!$cfg->bid_opt_multiple_shipping) {
         $db->setQuery("SELECT price FROM #__bid_shipment_prices WHERE zone=0 AND auction=" . $db->quote($auction->id));
         if ($auction->published) {
             return BidsHelperAuction::formatPrice($db->loadResult()) . '&nbsp;' . $auction->currency;
         } else {
             return '<input name="shipZones[]" type="hidden" value="0" />' . '<input name="shipPrices[]" type="text" class="inputbox priceRight" size="7"  value="' . number_format($db->loadResult(), 2) . '" /><span class="bidsRefreshCurrency">' . $auction->currency . '</span>';
         }
     }
     $db->setQuery("SELECT * FROM #__bid_shipment_zones ORDER BY `name`");
     $shipZones = $db->loadObjectList();
     $optZones = array();
     $zoneNames = $zoneIds = array();
     foreach ($shipZones as $sz) {
         $optZones[] = JHTML::_('select.option', $sz->id, $sz->name);
         $zoneNames[] = $sz->name;
         $zoneIds[] = $sz->id;
     }
     $p = JTable::getInstance('bidshipzone');
     $shipPrices = $p->getPriceList(max($auction->id, @$auction->oldid));
     $html = '';
     $i = 0;
     if (count($shipPrices)) {
         $html = '<table>';
         if ($auction->published) {
             foreach ($shipPrices as $sp) {
                 $i++;
                 $html .= '<tr>';
                 $html .= '<td>' . $sp->name . '&nbsp;&nbsp;</td>';
                 $html .= '<td>' . number_format($sp->price, 2) . '&nbsp;' . $auction->currency . '</td>';
                 $html .= '</tr>';
             }
         } else {
             //already saved shipping zones
             foreach ($shipPrices as $sp) {
                 $i++;
                 $html .= '<tr>';
                 $html .= '<td>' . JHTML::_('select.genericlist', $optZones, 'shipZones[]', 'class="inputbox"', 'value', 'text', $sp->id) . '</td>';
                 $html .= '<td><input type="text" class="inputbox validate-price" name="shipPrices[]" value="' . number_format($sp->price, 2) . '" /></td>';
                 $html .= '</tr>';
             }
         }
         $html .= '</table>';
     }
     if (!$auction->published || $isAdmin) {
         $html .= '<div id="shippingZonesContainer"></div>';
         $document = JFactory::getDocument();
         $js = 'var CurrentIndex = ' . $i++ . ';
             var SHIPOptions = Array(\'' . implode('\',\'', $zoneNames) . '\');
             var SHIPIDS = Array(' . implode(',', $zoneIds) . ');
             var SHIPNO = ' . count($shipZones) . ';';
         $document->addScriptDeclaration($js);
         $html .= JHTML::link('javascript:SHIPAddzone();', JText::_('COM_BIDS_ADD_SHIPPING_ZONE'));
     }
     return $html;
 }
Ejemplo n.º 6
0
    echo JHTML::link('index.php?option=' . APP_EXTENSION . '&task=bidshistory&tmpl=component&id=' . $row->id, $nr_bids, 'class="modal" rel="{handler: \'iframe\'}"');
    ?>
                            </td>

                            <td align="center">
                                <?php 
    echo BidsHelperAuction::formatDate($row->end_date);
    ?>
                            </td>

                            <td align="center">
                                <?php 
    if ($row->closed_date != '0000-00-00 00:00:00' && $row->close_by_admin != 1 && $row->close_offer == 1) {
        echo JText::_('COM_BIDS_CLOSED_DATE') . ':' . BidsHelperAuction::formatDate($row->closed_date);
    } elseif ($row->close_by_admin == 1) {
        echo JText::_('COM_BIDS_CLOSED_BY_ADMIN') . " " . BidsHelperAuction::formatDate($row->closed_date);
    } elseif ($row->published == 0) {
        echo JText::_('COM_BIDS_UNPUBLISHED');
    } elseif ($row->start_date > gmdate('Y-m-d H:i:s')) {
        echo JText::_('COM_BIDS_FUTURE');
    } elseif ($row->end_date < gmdate('Y-m-d H:i:s')) {
        echo JText::_('COM_BIDS_EXPIRED');
    } else {
        echo JText::_('COM_BIDS_ACTIVE');
    }
    ?>
                            </td>
                        </tr>
                        <?php 
    $k = 1 - $k;
}
Ejemplo n.º 7
0
	function getDisplayTab($tab,$user,$ui){

		$database = JFactory::getDBO();
		$my = JFactory::getUser();

		if($my->id!=$user->user_id){
			return null;
		}

		$params = $this->params;

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

		$query = "SELECT
		            u.username,b.*,
		            c.name as currency_name, MAX(bi.bid_price) AS curr_bid
			FROM #__bid_auctions b
			LEFT JOIN #__bids as bi on bi.auction_id=b.id
			left join #__bid_currency c on b.currency=c.id
			left join #__bid_watchlist w on ".$user->user_id."=w.userid
			left join #__users u on b.userid = u.id
			where b.id=w.auction_id
			group by b.id
			order by id desc
			";

		$database->setQuery($query);
		$nrwatches = $database->loadObjectList();

		$total = count($nrwatches);

		$limitstart=0;
		$pagingParams = $this->_getPaging( array(), array( "mywatch_" ) );
		if (isset($pagingParams["mywatch_limitstart"])) {
			$limitstart=$pagingParams["mywatch_limitstart"];
		}

		$database->setQuery($query,$limitstart, ITEMS_PER_PAGE);
		$mywatches = $database->loadObjectList();

		$pagingParams["limitstart"] = $limitstart;
		$pagingParams["limit"] = ITEMS_PER_PAGE;


		$return = "\t\t<div>\n";
		$return .="<table width='100%'>";
		$return .='<form name="topForm'.$tab->tabid.'" action="index.php" method="post">';
		$return .="<input type='hidden' name='option' value='com_comprofiler' />";
		$return .="<input type='hidden' name='task' value='userProfile' />";
		$return .="<input type='hidden' name='user' value='".$user->user_id."' />";
		$return .="<input type='hidden' name='tab' value='".$tab->tabid."' />";
		$return .="<input type='hidden' name='act' value='' />";


		if($mywatches) {
			$return	.= '<tr>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_title').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_auctioneer').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_start_date').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_end_date').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_initial_price').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_price').'</th>';
			$return .= '</tr>';
			$k=0;
			foreach ($mywatches as $mw){
            $link_view_details = JRoute::_("index.php?option=com_bids&task=userdetails&id=".$mw->userid);
			$link_view_auction = JHtml::_('auctiondetails.auctionDetailsURL', $mw, false);
			//var_dump($myratings);exit;
			 $return .='<tr class="mywatch'.$k.'">';
			 $return .='<td>';
			 $return .= '<a href="'.$link_view_auction.'">'.$mw->title.'</a>';
			 $return .='</td>';
			 $return .='<td>';
			 $return .= '<a href="'.$link_view_details.'">'.$mw->username.'</a>';
			 $return .='</td>';
			 $return .='<td>';
			 $return .= $this->printDate($mw->start_date);
			 $return .='</td>';
			 $return .='<td>';
			 $return .= $this->printDate($mw->end_date);
			 $return .='</td>';
			 $return .='<td>';
			 $return .= BidsHelperAuction::formatPrice($mw->initial_price)." ".$mw->currency;
			 $return .='</td>';
			 $return .='<td>';
			 $return .= BidsHelperAuction::formatPrice($mw->curr_bid)." ".$mw->currency;
			 $return .='</td>';
			 $return .= "</tr>";
			 $k=1-$k;

			 }
		} else {

			$return .=	"".JText::_('COM_BIDS_NO_ITEMS')."";

		}
		$pageslinks = "index.php?option=com_comprofiler&task=userProfile&user=$user->user_id&tab=$tab->tabid";

		$return .= "<tr height='20px'>";
		$return .= "<td colspan='3' align='center'>";
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "<tr>";
		$return .= "<td colspan='2' align='center'>";
		$return .= $this->_writePaging($pagingParams,"mywatch_", ITEMS_PER_PAGE, $total);
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "</form>";
		$return .= "</table>";
		$return .= "</div>";

		//$return ="";
		return $return;
	}
Ejemplo n.º 8
0
    function getDisplayTab($tab, $user, $ui) {

        $database = & JFactory::getDBO();
        $my = &JFactory::getUser();

        $params = $this->params;

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

        $cfg = new BidConfig();

// total ratings
        $query = "select count(*) from #__bid_rate r
			  left join #__users us on r.voter_id = us.id
			  left join #__bid_auctions a on r.auction_id = a.id
		      where r.user_rated_id = ".$user->user_id;
        $database->setQuery($query);
        $total = $database->loadResult();

        $limitstart = 0;
        $pagingParams = $this->_getPaging(array(), array("myrates_"));
        if (isset($pagingParams["myrates_limitstart"])) {
            $limitstart = $pagingParams["myrates_limitstart"];
        }

// my ratings
        $query = "select r.*,us.username,a.title
              from #__bid_rate r
			  left join #__users us on r.voter_id = us.id
			  left join #__bid_auctions a on r.auction_id = a.id
		      where r.user_rated_id = ".$user->user_id;
        $database->setQuery($query, $limitstart, ITEMS_PER_PAGE);

        $pagingParams["limitstart"] = $limitstart;
        $pagingParams["limit"] = ITEMS_PER_PAGE;
        $myratings = $database->loadObjectList();

// all ratings
        $query = "select sum(rating) from #__bid_rate r
			  left join #__users us on r.voter_id = us.id
			  left join #__bid_auctions a on r.auction_id = a.id
		      where r.user_rated_id = ".$user->user_id;
        $database->setQuery($query);
        $all_ratings = $database->loadResult();

// seller ratings
        $query = "select avg(rating) from #__bid_rate r
			  left join #__users us on r.voter_id = us.id
			  left join #__bid_auctions a on r.auction_id = a.id
		      where r.user_rated_id = ".$user->user_id." and rate_type='auctioneer' ";
        $database->setQuery($query);
        $seller_ratings = intval($database->loadResult());

// buyer ratings
        $query = "select avg(rating) from #__bid_rate r
			  left join #__users us on r.voter_id = us.id
			  left join #__bid_auctions a on r.auction_id = a.id
		      where r.user_rated_id = ".$user->user_id." and rate_type!='auctioneer' ";
        $database->setQuery($query);

        $buyer_ratings = intval($database->loadResult());

        $rating = ($total > 0) ? intval($all_ratings / $total) : 0;


        $return = "<style type='text/css'>
						#auction_star{height:12px;margin:0px;padding:0px;}
					</style>";



        $return .="<span class='auction_my_rating'>" . JText::_('COM_BIDS_OVERALL_RATING') . ": <span class='rating_user' rating='" . $rating . "'></span>&nbsp;($rating/10)</span><br>";
        $return .="<span class='auction_my_rating'>" . JText::_('COM_BIDS_RATING_AUCTIONEER') . ": <span class='rating_user' rating='" . $seller_ratings . "'></span>&nbsp;($seller_ratings/10)</span><br>";
        $return .="<span class='auction_my_rating'>" . JText::_('COM_BIDS_RATING_BIDDER') . ": <span class='rating_user' rating='" . $buyer_ratings . "'></span>&nbsp;($buyer_ratings/10)</span>";
        $return .='<form name="topForm' . $tab->tabid . '" action="index.php" method="post">';
        $return .="<table width='100%'>";
        $return .="<input type='hidden' name='option' value='com_comprofiler' />";
        $return .="<input type='hidden' name='task' value='userProfile' />";
        $return .="<input type='hidden' name='user' value='" . $user->user_id . "' />";
        $return .="<input type='hidden' name='tab' value='" . $tab->tabid . "' />";
        $return .="<input type='hidden' name='act' value='' />";

        if ($myratings) {
            $return .= '<tr>';
            $return .='<td colspan=3><hr></td>';
            $return .= '</tr>';
            $k = 0;

            foreach ($myratings as $mr) {
                $link_view_details = JRoute::_("index.php?option=com_bids&task=userdetails&id=".$mr->voter_id);
                $link_view_bids = JRoute::_('index.php?option=com_bids&task=viewbids&id='.$mr->auction_id.':'.$mr->title);
                $utype = ($mr->rate_type == 'auctioneer') ? JText::_('COM_BIDS_BUYER') : JText::_('COM_BIDS_SELLER');


                $return .="<tr class='myrating" . ($k) . "'>";
                $return .="<td colspan=3>";
                $return .="<a href='" . $link_view_bids . "'>$mr->title</a>";
                $return .="</td>";
                $return .= "</tr>";
                $return .='<tr class="myrating' . $k . '">';
                $return .='<td>';
                $return .= "<a href='" . $link_view_details . "'>$mr->username </a>(" . $utype . ") - " . BidsHelperAuction::formatDate($mr->modified);
                $return .= "</td>";
                $return .="<td width='20%' colspan=2 nowrap>";
                $return .="<span class='rating_user' rating='" . $mr->rating . "'></span>";
                $return .="</td>";
                $return .="</tr>";
                $return .="<tr class='myrating" . ($k) . "'>";
                $return .="<td colspan='3' style='border-bottom:1px solid black'>";
                $return .= $mr->review;
                $return .= "</td>";
                $return .= "</tr>";
                $k = 1 - $k;
            }
        } else {

            $return .= "" . JText::_('COM_BIDS_NO_ITEMS') . "";
        }

        $pageslinks = "index.php?option=com_comprofiler&task=userProfile&user=$user->user_id&tab=$tab->tabid";

        $return .= "<tr height='20px'>";
        $return .= "<td colspan='3' align='center'>";
        $return .= "</td>";
        $return .= "</tr>";

        $return .= "<tr>";
        $return .= "<td colspan='2' align='center'>";
        $return .= $this->_writePaging($pagingParams, "myrates_", ITEMS_PER_PAGE, $total);
        $return .= "</td>";
        $return .= "</tr>";

        $return .= "</table>";
        $return .= "</form>";

        JHtml::_('behavior.mootools');
        JHtml::script( JURI::root() . "components/com_bids/js/ratings.js" );
        JHtml::script( JURI::root() . "components/com_bids/js/startup.js" );

        $document = JFactory::getDocument();
        $document->addScriptDeclaration('var JS_ROOT_HOST=\''.JUri::root().'\';');

        return $return;
    }
Ejemplo n.º 9
0
    function display($tpl=null) {

        $database = JFactory::getDBO();
        $my = JFactory::getUser();
        $cfg = BidsHelperTools::getConfig();

        JHTML::_('behavior.modal');
        JHTML::_('behavior.tooltip');

        JHTML::script(JURI::root().'components/com_bids/js/ratings.js');
        JHTML::script( JURI::root().'components/com_bids/js/startup.js' );

        $model = $this->getModel();
        $profile = $model->get('profile');

        $lists['balance'] = $model->getBalance();

        $lists["ratings"] = $model->getRatings(10);
        $lists["messages"]["received"] = $model->getMessages();

        if ($cfg->bid_opt_allow_user_settings && $profile->isSeller) {

            $p = JTable::getInstance('bidusersettings');
            $p->load($my->id);
            $settings = $p->settings;

            $lists['user_settings'] = array();

            if($cfg->bid_opt_enable_hour) {
                //convert end time to GMT
                try {
                    $endTime = @$settings["end_hour"].':'.@$settings["end_minute"];
                    @list($settings["end_hour"],$settings["end_minute"]) = explode(':',JHTML::date($endTime,'H:i'));
                } catch(Exception $e) {
                    if(JDEBUG) {
                        //JError::raiseWarning(1,$e->getMessage());
                    }
                }
                //end time is GMT, convert it to locale

                $lists['user_settings']['end_hour'] = '<input type="text" name="end_hour" class="inputbox" value="'.@$settings['end_hour'].'" style="width:20px;" />';
                $lists['user_settings']['end_minute'] = '<input type="text" name="end_minute" class="inputbox" value="'.@$settings['end_minute'].'" style="width:20px;" />';
            }
            $lists['user_settings']['payment_info'] = '<input style="width: 300px;" type="text" name="payment_info"
            class="inputbox"
            value="'.@$settings['payment_info'].'" />';
            $lists['user_settings']['shipment_info'] = '<input style="width: 300px;" type="text" name="shipment_info" class="inputbox" value="'.@$settings['shipment_info'].'" />';
            $lists['user_settings']['show_reserve'] = JHTML::_('select.booleanlist','show_reserve',null,@$settings['show_reserve'],'COM_BIDS_SHOW','COM_BIDS_HIDE');
            $lists['user_settings']['auto_accept_bin'] = JHTML::_('select.booleanlist','auto_accept_bin',null,@$settings['auto_accept_bin']);
            $lists['user_settings']['bid_counts'] = JHTML::_('select.booleanlist','bid_counts',null,@$settings['bid_counts'],'COM_BIDS_SHOW','COM_BIDS_HIDE');
            $lists['user_settings']['max_price'] = JHTML::_('select.booleanlist','max_price',null,@$settings['max_price'],'COM_BIDS_SHOW','COM_BIDS_HIDE');

            $fi = isset($settings['auction_type']) ? $settings['auction_type'] : null;

            $opts = array();
            $opts[] = JHTML::_('select.option', '', JText::_('COM_BIDS_PICK_TYPE_OF_AUCTION'));
            $opts[] = JHTML::_('select.option', AUCTION_TYPE_PUBLIC, JText::_('COM_BIDS_PUBLIC_LABEL'));
            if ($cfg->bid_opt_global_enable_private)
                $opts[] = JHTML::_('select.option', AUCTION_TYPE_PRIVATE, JText::_('COM_BIDS_PRIVATE_LABEL'));
            if ($cfg->bid_opt_enable_bin_only)
                $opts[] = JHTML::_('select.option', AUCTION_TYPE_BIN_ONLY, JText::_('COM_BIDS_BIN_ONLY_LABEL'));

            $lists['user_settings']['auction_type'] = JHTML::_('select.genericlist', $opts, 'auction_type', 'class="inputbox" alt="auction_type"', 'value', 'text', $fi);

            $fi = isset($settings['currency']) ? $settings['currency'] : null;

            $query = "SELECT name AS value, name AS text FROM #__bid_currency ORDER BY id";
            $opts = null;
            $database->setQuery($query);
            $opts = $database->loadObjectList();
            $defaultOpt = JHtml::_('select.option','',JText::_('COM_BIDS_SELECT_CURRENCY'));
            array_unshift($opts,$defaultOpt);
            $lists["user_settings"]['currency'] = JHTML::_('select.genericlist', $opts, 'currency',
                'class="inputbox" onchange="bidsRefreshCurrency(this.value)"', 'value', 'text', $fi);

            $lists['user_settings']['shipment_price'] = '<input type="text" name="shipment_price" class="inputbox"
            style="text-align: right; width: 80px;" value="' . BidsHelperAuction::formatPrice
            (@$settings['shipment_price']) . '" />&nbsp;&nbsp;<span class="bidsRefreshCurrency">'.$fi.'</span>';
        }

        $lists["links"]=array(
          "upload_funds"=>BidsHelperRoute::getAddFundsRoute(),
          "payment_history"=>BidsHelperRoute::getPaymentsHistoryRoute()
        );

        $lists['fbLikeButton'] = JHTML::_('userProfile.fbLikeButton', $profile);
        $lists['linkEditProfile'] = JHTML::_('userprofile.linkEditProfile');
        $lists['linkUserRatings'] = JHTML::_('userprofile.linkUserRatings',$profile);

        $profile->paypalemail = BidsHelperTools::cloack_email($profile->paypalemail);

        $fields = CustomFieldsFactory::getFieldsList("user_profile");

        if($cfg->terms_and_conditions) {
            $lists['linktc'] = JRoute::_('index.php?option=com_bids&task=terms_and_conditions&tmpl=component');
        }


        $this->assign("user", $profile);
        $this->assign("lists", $lists);
        $this->assign("fields", $fields);
        $this->assign('return', JRequest::getCmd("return"));

        return parent::display($tpl);
    }
Ejemplo n.º 10
0
        <div style="clear: both;"></div>
    </div>
        <?php 
    }
    ?>
    <?php 
}
?>

    <div class="auction_edit_field_container">
        <div class="auction_edit_field_label"><?php 
echo JText::_('COM_BIDS_MAX_BID');
?>
</div>
        <div class="auction_edit_field_input"><?php 
echo $auction->highestBid ? BidsHelperAuction::formatPrice($auction->highestBid->bid_price) . ' ' . $auction->currency : '-';
?>
</div>
        <div style="clear: both;"></div>
    </div>
    <div class="auction_edit_field_container">
        <div class="auction_edit_field_label"></div>
        <div class="auction_edit_field_input"></div>
        <div style="clear: both;"></div>
    </div>

    <div class="auction_edit_subsection">
        <div><?php 
echo JText::_('COM_BIDS_SHIPPING_SETTINGS');
?>
</div>
Ejemplo n.º 11
0
 static function bidderPaypalButton($auction)
 {
     $my = JFactory::getUser();
     $cfg = BidsHelperTools::getConfig();
     $tfApp = JTheFactoryApplication::getInstance();
     //build paypal url based on the payment gateway settings
     JModel::addIncludePath($tfApp->app_path_admin . DS . 'payments' . DS . 'models');
     $model = JModel::getInstance('Gateways', 'JTheFactoryModel');
     $gateways = $model->getGatewayList(true);
     $pgw = null;
     foreach ($gateways as $gw) {
         if ('pay_paypal' == $gw->classname) {
             $pgw = $gw;
         }
     }
     $paypalURL = JDEBUG ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr';
     $sellerProfile = BidsHelperTools::getUserProfileObject($auction->userid);
     $totalPrice = 0;
     $totalItems = 0;
     $priceDetails = array();
     foreach ($auction->wonBids as $b) {
         if ($b->userid == $my->id) {
             $totalPrice += $cfg->bid_opt_quantity_enabled ? $b->bid_price * $b->quantity : $b->bid_price;
             $totalItems += $cfg->bid_opt_quantity_enabled ? $b->quantity : 1;
             $priceDetails[] = $b->quantity . ' x ' . BidsHelperAuction::formatPrice($b->bid_price) . ' ' . $auction->currency;
         }
     }
     $auction->shipmentPrices = isset($auction->shipmentPrices) ? (array) $auction->shipmentPrices : array();
     if ($cfg->bid_opt_multiple_shipping && count($auction->shipmentPrices) > 1) {
         //multiple shipment options
         $opts = array();
         $opts[] = JHTML::_('select.option', 0, JText::_('COM_BIDS_SELECT_SHIPMENT_ZONE'));
         foreach ($auction->shipmentPrices as $sp) {
             $opts[] = JHTML::_('select.option', number_format($sp->price, $cfg->bid_opt_number_decimals), $sp->name . ' (' . BidsHelperAuction::formatPrice($sp->price) . ' ' . $auction->currency . ')');
         }
         $shipmentPrice = '<input type="hidden" id="bidderTotalPrice' . $auction->id . '" value="' . number_format($totalPrice, $cfg->bid_opt_number_decimals) . '" />' . (count($opts) > 1 ? JText::_('COM_BIDS_SHIP_TO') . JHTML::_('select.genericlist', $opts, 'amount', 'onchange="refreshTotalPrice(' . $auction->id . ',this.value);"') : '');
     } elseif (count($auction->shipmentPrices) == 1) {
         //single shipment zone
         $totalPrice += $auction->shipmentPrices[0]->price;
         $shipmentPrice = JText::_('COM_BIDS_SHIPMENT') . ': ' . BidsHelperAuction::formatPrice($auction->shipmentPrices[0]->price) . ' ' . $auction->currency . ' ' . ($auction->shipment_info ? JHTML::tooltip($auction->shipment_info) : '');
     } else {
         $shipmentPrice = '';
     }
     $html = $shipmentPrice ? $shipmentPrice . '<br />' : "";
     $tooltip = ($totalItems > 1 ? $totalItems . ' ' . JText::_('COM_BIDS_PAYPAL_BUTTON_ITEMS') . '<br />' : '') . implode('<br />', $priceDetails);
     $html .= ' <span id="amount_total' . $auction->id . '" class="bids_price">' . BidsHelperAuction::formatPrice($totalPrice) . '</span> ' . $auction->currency . '&nbsp;' . JHTML::tooltip($tooltip);
     if (empty($sellerProfile->paypalemail)) {
         $html .= '';
     } else {
         $html .= '<form name="paypalForm' . $auction->id . '" action="' . $paypalURL . '" method="post">
                 <input type="hidden" name="cmd" value="_xclick" />
                 <input type="hidden" name="business" value="' . $sellerProfile->paypalemail . '" />
                 <input type="hidden" name="item_name" value="' . $auction->title . '" />
                 <input type="hidden" name="item_number" value="' . $auction->id . '" />
                 <input type="hidden" name="invoice" value="' . $auction->auction_nr . '" />
                 <input type="hidden" name="quantity" value="1" />
                 <input type="hidden" name="return" value="' . trim(JUri::root(), '/') . self::auctionDetailsURL($auction) . '" />
                 <input type="hidden" name="tax" value="0" />
                 <input type="hidden" name="rm" value="2" />
                 <input type="hidden" name="no_note" value="1" />
                 <input type="hidden" name="no_shipping" value="1" />
                 <input type="hidden" name="currency_code" value="' . $auction->currency . '" />
                 <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but06.gif" name="submit" alt="' . JText::_('COM_BIDS_PAYPAL_BUYNOW') . '" />
                 <input type="hidden" name="amount" value="' . $totalPrice . '" />
             </form><br />';
     }
     return $html;
 }
Ejemplo n.º 12
0
	function getDisplayTab($tab,$user,$ui){

		$my = & JFactory::getUser();
		$database = & JFactory::getDBO();


		if($my->id!=$user->user_id){
			return null;
		}

		$params = $this->params;
        JHtml::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_bids'.DS.'htmlelements');

		$where = " where ";
		$where .= " a.userid = '$user->user_id' ";
		$where .= " and b.close_offer =0 and  b.close_by_admin=0 and published=1";

		$query="select a.id as parent_message,a.bid_price,a.modified as bid_date, a.auction_id,
            b.newmessages as bid_newmessages,
            a.accept as accept, a.cancel as cancel,
             b.*,c.name as currency_name, u.name as name, u.username
            from #__bids a
            left join #__bid_auctions b on a.auction_id=b.id
       		left join #__bid_currency c on b.currency=c.id
            left join #__users u on u.id=b.userid
            $where order by id desc";

		$database->setQuery($query);
		$nrbids = $database->loadObjectList();


		$total = count($nrbids);

		$limitstart=0;
		$pagingParams = $this->_getPaging( array(), array( "mybids_" ) );
		if (isset($pagingParams["mybids_limitstart"])) {
			$limitstart=$pagingParams["mybids_limitstart"];
		}

		$database->setQuery($query,$limitstart, ITEMS_PER_PAGE);
		$mybids = $database->loadObjectList();

		$pagingParams["limitstart"] = $limitstart;
		$pagingParams["limit"] = ITEMS_PER_PAGE;

		$return = "\t\t<div>\n";
		$return .="<table width='100%'>";
		$return .='<form name="topForm'.$tab->tabid.'" action="index.php" method="post">';
		$return .="<input type='hidden' name='option' value='com_comprofiler' />";
		$return .="<input type='hidden' name='task' value='userProfile' />";
		$return .="<input type='hidden' name='user' value='".$user->user_id."' />";
		$return .="<input type='hidden' name='tab' value='".$tab->tabid."' />";
		$return .="<input type='hidden' name='act' value='' />";


		if($mybids) {
			$return	.= '<tr>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_title').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_auctioneer').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_end_date').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_price').'</th>';
			$return .= '</tr>';
			$k=0;
			foreach ($mybids as $mb){
			    /*@var $mb mosBidOffer*/
                $link_view_details = JRoute::_("index.php?option=com_bids&task=userdetails&id=$mb->userid");
    			$link_view_auction = JHtml::_('auctiondetails.auctionDetailsURL', $mb, false);

    			if ($mb->auction_type==AUCTION_TYPE_PUBLIC){
    			    //Outbid?
    			    $database->setQuery("select count(*) from #__bids where id<>'$mb->parent_message' and bid_price+0>$mb->bid_price and auction_id = $mb->auction_id ");
    			    $outbid=$database->loadResult();
    			    $msg = JText::_( $outbid ? 'COM_BIDS_OUTBIDDED' : 'COM_BIDS_HIGHEST_BID' );
    			}elseif ($mb->auction_type==AUCTION_TYPE_PRIVATE) {
    			    $msg=Jtext::_('COM_BIDS_PRIVATE');
    			}elseif ($mb->auction_type==AUCTION_TYPE_BIN_ONLY) {
    			    $msg=Jtext::_('COM_BIDS_BINPRICE');
    			}

    			 $return .='<tr class="mywatch'.$k.'">';
    			 $return .='<td>';
    			 $return .= '<a href="'.$link_view_auction.'">'.$mb->title.'</a>';
    			 $return .='</td>';
    			 $return .='<td>';
    			 $return .= '<a href="'.$link_view_details.'">'.$mb->username.'</a>';
    			 $return .='</td>';
    			 $return .='<td>';
    			 $return .= $this->printDate($mb->end_date);
    			 $return .='</td>';
    			 $return .='<td>';
    			 $return .= BidsHelperAuction::formatPrice($mb->bid_price)." ".$mb->currency;
    			 $return .='</td>';
    			 $return .='<td>';
    			 $return .= $msg;
    			 $return .='</td>';
    			 $return .= "</tr>";
    			 $k=1-$k;

			 }
		} else {

			$return .=	"".JText::_('COM_BIDS_NO_ITEMS')."";

		}

		$return .= "<tr height='20px'>";
		$return .= "<td colspan='3' align='center'>";
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "<tr>";
		$return .= "<td colspan='2' align='center'>";
		$return .= $this->_writePaging($pagingParams,"mybids_", ITEMS_PER_PAGE, $total);
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "</form>";
		$return .= "</table>";
		$return .= "</div>";

		//$return ="";
		return $return;
	}
Ejemplo n.º 13
0
    function display($tpl=null) {

        $mainframe = JFactory::getApplication();
        $database = JFactory::getDBO();
        $my = JFactory::getUser();
        $cfg = BidsHelperTools::getConfig();

        $model = $this->getModel();
        $auction = $model->get('auction');

        $document = JFactory::getDocument();
        $document->setTitle($auction->title);
        $document->setMetaData('description', strip_tags($auction->shortdescription));
        $document->setMetaData('abstract', strip_tags($auction->description));
        foreach($auction->tagNames as $tag) {
            $document->setMetaData('keywords', $tag);
        }

        $jsQuantity = 'var has_quantity = ' . ( ($cfg->bid_opt_quantity_enabled && $auction->nr_items > 1) ?
                'true' : 'false' ) . ';';
        $document->addScriptDeclaration($jsQuantity);

        $links_path = JHtml::_('auctiondetails.auctionDetailsURL',$auction);

        $pathway = $mainframe->getPathway();
        $pathway->addItem($auction->title, $links_path);

        /* PLUGINS */
        $database->setQuery("select * from #__bid_pricing where enabled=1 order by ordering");
        $pp = $database->loadObjectList();
        $pricing_plugins = array();
        foreach ($pp as $p) {
            $pricing_plugins[$p->itemname] = $p;
        }
        $this->assign('pricing_plugins', $pricing_plugins);

        $auction->countdownHtml = JHTML::_('auctiondetails.countdownHtml',$auction);

        $auctioneer = JFactory::getUser($auction->userid);
        $profile = BidsHelperTools::getUserProfileObject($auctioneer->id);

        $this->assign('auctioneer', $auctioneer);
        $this->assign('auctioneer_details', $profile);

        $document = JFactory::getDocument();
        $js = 'var must_accept_term = '.((strip_tags($cfg->terms_and_conditions))?"true;":"false;");
        $this->assign('terms_and_conditions',(strip_tags($cfg->terms_and_conditions))?1:0);
        $document->addScriptDeclaration($js);
        $document->addScriptDeclaration('var auction_currency=\''.$auction->currency.'\';');

        /* PLUGINS */
        if ($cfg->bid_opt_enable_captcha) {
            $this->assign("cs", BidsHelperHtml::init_captcha());
        }

        $u = JTable::getInstance('biduser');
        $ratings = $u->getRatingsList($auctioneer->id);

        $list = array();

        $list['auctionWatchlist'] = JHTML::_('auctiondetails.follow',$auction);
        $list['auctionReport'] = JHTML::_('auctiondetails.report',$auction);
        $list['auctionChooseWinner'] = JHTML::_('auctiondetails.chooseWinner',$auction);
        $list['auctionRate'] = JHTML::_('auctiondetails.rate',$auction);
        $list['auctionFbLikeButton'] = JHTML::_('auctionDetails.fbLikeButton',$auction);
        $list['userRated'] = JHTML::_('auctionDetails.selectUserRated',$auction);
        $list['ratingsDetails'] = JHTML::_('auctionDetails.linkRatingsDetails',$auction,$ratings);

        $modelAuctions = JModelLegacy::getInstance('auctions','bidsModel');
        $otherAuctions = $modelAuctions->getOtherAuctionsList($auction->userid,$auction->id,4);

        $gallery = BidsHelperGallery::getGalleryPlugin();
        foreach($otherAuctions as &$oa) {
            BidsHelperAuction::renderAuctionTiming($oa);

            $gallery->clearImages();
            $gallery->addImageList($oa->imagelist);

            $oa->thumbnail = $oa->get('thumbnail');
            $oa->countdownHtml = JHTML::_('auctiondetails.countdownHtml',$oa);
        }
        $list['other_items'] = $otherAuctions;
        $list['tagLinks'] = JHtml::_('auctiondetails.taglinks',$auction);

        $list['ratings'] = BidsHelperHtml::getRatingsSelect();

        if(AUCTION_TYPE_BIN_ONLY==$auction->auction_type && $auction->quantity > 1) {

            $itemsPurchased = 0;

            foreach($auction->wonBids as $wb) {
                if($wb->userid==$my->id) {
                    $itemsPurchased += $wb->quantity;
                }
            }

            $list['myPurchasedItems'] = $itemsPurchased;
        }

        $userProfile = BidsHelperTools::getUserProfileObject();

	    $gallery->writeJS();

        $sellerProfile = BidsHelperTools::getUserProfileObject($auction->userid);

        $list['bidderPaypalButton'] = JHTML::_('auctiondetails.bidderPaypalButton',$auction);

        $auction->payment_name = $auction->payment_method;
        $auction->thumbnail = $auction->get('thumbnail');
        $auction->gallery = $auction->get('gallery');
        $auction->links = JHTML::_('auctiondetails.createLinks',$auction);
        $auction->username = $sellerProfile->username;
        $auction->paypalemail = isset($sellerProfile->paypalemail) ? $sellerProfile->paypalemail : null;
        $auction->start_date_text = JHTML::_('auctiondetails.startDateHtml', $auction);
        $auction->end_date_text = JHTML::_('auctiondetails.endDateHtml', $auction);

        $auction->minIncrement = $model->getMinIncrement();
        $auction->minAcceptedPrice = $model->getMinAcceptedPrice();
        $auction->isMyAuction = $model->ownsAuction($my->id);

        $mybids = $model->getUserBids($my->id);
        $auction->myBid = reset($mybids);

        $auction->my_proxy_bid = $auction->myBid ? $auction->myBid->max_proxy_price : 0;
        $auction->mybid = $auction->myBid ? $auction->myBid->bid_price : 0;

        $auction->winner_list = $auction->wonBids;
        $auction->winBid = 0;

        if($auction->highestBid && $auction->highestBid->accept) {
            $auction->winBid = $auction->highestBid->bid_price;
        }

        $auction->highestBidder = $auction->highestBid ? $auction->highestBid->username : '';
        $auction->highestBidderId = $auction->highestBid ? $auction->highestBid->userid : 0;

        if(!$auction->highestBid) {
            $auction->highestBid = new stdClass();
            $auction->highestBid->bid_price = 0;
        }
        $auction->highestBid->bid_price =
                (
                    $auction->isMyAuction ||
                    (!empty($auction->params['max_price']) && $auction->auction_type!=AUCTION_TYPE_PRIVATE)
                ) ?
                ($auction->highestBid ? $auction->highestBid->bid_price : 0) : 'private';


        $auction->iAmWinner = $model->isWinner($my->id);

        $suggestions = isset($auction->suggestions) ? $auction->suggestions : null;

        JHTML::script(JURI::root().'components/com_bids/js/jquery/jquery.js');
        JHTML::script(JURI::root().'components/com_bids/js/jquery/jquery.noconflict.js');
        JHTML::script(JURI::root().'components/com_bids/js/auctions.js');
        JHTML::script(JURI::root().'components/com_bids/js/startup.js');
        JHTML::_('behavior.modal');

        BidsHelperHtml::loadCountdownJS();

        $this->assign('auction', $auction);
        $this->assign('userProfile',$userProfile);
        $this->assign('message_list', $model->getAuctionMessages($auction->id));
        $this->assign('bid_list', $auction->bids );
        $this->assign('bid_history', $auction->bids_history );
        $this->assign('positions', array());
        $this->assign('suggestions', $suggestions);
        $this->assign('lists', $list);

        parent::display($tpl);
    }
Ejemplo n.º 14
0
    function smarty_print_price($params) {
        $auction = $params['auction'];
        $price = $params['price'];
        $currency = '';
        if (is_object($auction)) {
            $currency = $auction->currency;
        }

        $nocss = isset($params['nocss']) && $params['nocss'];
        $cssPrice = isset($params['cssprice']) ? $params['cssprice'] : 'bids_price';
        $cssCurrency = isset($params['csscurrency']) ? $params['csscurrency'] : 'bids_currency';

        $p = ($nocss ? '' : '<span class="'.$cssPrice.'">') . BidsHelperAuction::formatPrice($price). ($nocss ? '' :
        '</span>');
        if ($p) {
            return $p . '&nbsp;' . ($nocss ? '' : '<span class="'.$cssCurrency.'">') .$currency. ($nocss ? '' :
                    '</span>');
        } else {
            return '-';
        }
    }
Ejemplo n.º 15
0
 private function commissionBuyer($auction, $bid)
 {
     $orderitems = BidsHelperAuction::getOrderItemsForAuction($bid->id, self::getItemName());
     if (count($orderitems)) {
         foreach ($orderitems as $item) {
             if ($item->status == 'C') {
                 return;
             }
         }
         //Bid was paid for!
     }
     $my = JFactory::getUser();
     $model = self::getModel();
     $price = $model->getItemPrice($auction->cat, 'buyer');
     if (!floatval($price->price)) {
         return;
     }
     // no buyer's premium
     $modelbalance = JTheFactoryPricingHelper::getModel('balance');
     $balance = $modelbalance->getUserBalance();
     $bp_amount = $price->price * $bid->bid_price / 100;
     $currency = $auction->currency;
     $funds_delta = 0;
     if (BidsHelperPrices::comparePrices(array("price" => $bp_amount, "currency" => $currency), array("price" => $balance->balance, "currency" => $balance->currency)) > 0) {
         $funds_delta = BidsHelperPrices::convertCurrency($balance->balance, $balance->currency, $currency);
         if ($funds_delta <= 0) {
             $funds_delta = 0;
         }
         //if he has some funds - get the rest
         $has_funds = false;
     } else {
         $has_funds = true;
     }
     $balance_minus = BidsHelperPrices::convertCurrency($bp_amount, $currency, $balance->currency);
     $modelbalance->decreaseBalance($balance_minus);
     $modelorder = JTheFactoryPricingHelper::getModel('orders');
     $items = array($model->getOderitem($auction, $bid, 'buyer'));
     if ($funds_delta > 0) {
         $item = new stdClass();
         $item->itemname = JText::_("COM_BIDS_EXISTING_FUNDS");
         $item->itemdetails = JText::_("COM_BIDS_EXISTING_FUNDS");
         $item->iteminfo = 0;
         $item->price = -$funds_delta;
         $item->currency = $currency;
         $item->quantity = 1;
         $item->params = '';
         $items[] = $item;
     }
     $order = $modelorder->createNewOrder($items, $bp_amount - $funds_delta, $currency, $bid->userid, $has_funds ? 'C' : 'P');
     if (!$has_funds && $my->id == $bid->userid) {
         $session = JFactory::getSession();
         $session->set('checkout-order', $order->id, self::getContext());
     }
     $date = new JDate();
     $comission_table = self::getTable();
     $comission_table->userid = $bid->userid;
     $comission_table->auction_id = $auction->id;
     $comission_table->bid_id = $bid->id;
     $comission_table->comission_date = $date->toMySQL();
     $comission_table->amount = $bp_amount;
     $comission_table->currency = $currency;
     $comission_table->commissionType = 'buyer';
     $comission_table->store();
 }
Ejemplo n.º 16
0
	function getDisplayTab($tab,$user,$ui){

        $my = &JFactory::getUser();
        $database = &JFactory::getDBO();

        if($my->id!=$user->user_id){
                return null;
        }

        $params = $this->params;

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

        $where=" where a.userid='$my->id' and accept=1";

        $query="select a.id as parent_message,a.bid_price,a.modified as bid_date,
             a.accept as accept, a.cancel as cancel,
             b.*, b.newmessages as bid_newmessages,
             c.name as currency_name,
             u.name as name, u.username,
             r.rating
            from #__bids a
            left join #__bid_auctions b on a.auction_id=b.id
            left join #__bid_currency c on b.currency=c.id
            left join #__users u on u.id=b.userid
    	    left join #__bid_rate r on r.voter_id='$my->id' and r.auction_id=b.id "
            .$where."  order by id desc";

		$database->setQuery($query);
		$nrbids = $database->loadObjectList();


		$total = count($nrbids);

		$limitstart=0;
		$pagingParams = $this->_getPaging( array(), array( "mywonbids_" ) );
		if (isset($pagingParams["mywonbids_limitstart"])) {
			$limitstart=$pagingParams["mywonbids_limitstart"];
		}

		$database->setQuery($query,$limitstart, ITEMS_PER_PAGE);
		$mybids = $database->loadObjectList();

		$pagingParams["limitstart"] = $limitstart;
		$pagingParams["limit"] = ITEMS_PER_PAGE;

		$return = "<div>";
		$return .="<table width='100%'>";
		$return .='<form name="topForm'.$tab->tabid.'" action="index.php" method="post">';
		$return .="<input type='hidden' name='option' value='com_comprofiler' />";
		$return .="<input type='hidden' name='task' value='userProfile' />";
		$return .="<input type='hidden' name='user' value='".$user->user_id."' />";
		$return .="<input type='hidden' name='tab' value='".$tab->tabid."' />";
		$return .="<input type='hidden' name='act' value='' />";


		if($mybids) {
			$return	.= '<tr>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_title').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_auctioneer').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_end_date').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_bid_price').'</th>';
			$return .= '<th class="list_ratings_header">'.Jtext::_('COM_BIDS_rate').'</th>';
			$return .= '</tr>';
			$k=0;
			foreach ($mybids as $mb){
	            $link_view_details = JRoute::_('index.php?option=com_bids&task=userdetails&id='.$mb->userid);
				$link_view_auction = JHtml::_('auctiondetails.auctionDetailsURL', $mb, false);
				$return .='<tr class="mywatch'.$k.'">';
				$return .='<td>';
				$return .= '<a href="'.$link_view_auction.'">'.$mb->title.'</a>';
				$return .='</td>';
				$return .='<td>';
				$return .= '<a href="'.$link_view_details.'">'.$mb->username.'</a>';
				$return .='</td>';
				$return .='<td>';
				$return .= $mb->close_offer ? $this->printDate($mb->closed_date) : Jtext::_('COM_BIDS_N/A');
				$return .='</td>';
				$return .='<td>';
				$return .= BidsHelperAuction::formatPrice($mb->bid_price)." ".$mb->currency;
				$return .='</td>';
				$return .='<td>';
				if ($mb->rating){
					$return .= $mb->rating;
				}else{
					$return .= '<a href="'.$link_view_auction.'#bid_list">'.Jtext::_('COM_BIDS_rate').'</a>';
				}
				$return .='</td>';
				$return .= "</tr>";
				$k=1-$k;
			}
		} else {
			$return .=	"".JText::_('COM_BIDS_NO_ITEMS')."";
		}


		$return .= "<tr height='20px'>";
		$return .= "<td colspan='3' align='center'>";
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "<tr>";
		$return .= "<td colspan='2' align='center'>";

		$return .= $this->_writePaging($pagingParams,"mywonbids_", ITEMS_PER_PAGE, $total);
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "</form>";
		$return .= "</table>";
		$return .= "</div>";

		//$return ="";
		return $return;
	}
Ejemplo n.º 17
0
    function display($tmpl) {

        jimport('joomla.html.parameter');

        $cfg = BidsHelperTools::getConfig();

        $model = $this->getModel('auctions');
        $items = $model->get('auctions');

        $lists=array();

		$gallery = BidsHelperGallery::getGalleryPlugin();

        $i=0;
        foreach($items as $k=>&$item) {

            $item->rownr = ++$i;
            $item->params = new JParameter($item->params);

            $gallery->clearImages();
            $gallery->addImageList(explode(',',$item->pictures));
            $item->thumbnail = $gallery->getThumbImage();

            $item->start_date_text = JHTML::_('auctiondetails.startDateHtml', $item);

            $item->description = JFilterOutput::cleanText($item->description);
            $item->shortdescription = JFilterOutput::cleanText($item->shortdescription);

            $item->tagIds = $item->tagIds ? explode(',', $item->tagIds) : array();
            $item->tagNames = $item->tagNames ? explode(',', $item->tagNames) : array();

            $item->links = JHTML::_('auctiondetails.createLinks',$item);
            if (!isset($item->favorite))
                $item->favorite = false;
            $item->del_from_watchlist = (bool) $item->favorite;
            $item->add_from_watchlist = !$item->del_from_watchlist;

            if ($cfg->bid_opt_multiple_shipping) {
                $p = JTable::getInstance('bidshipzone');
                $item->shipping_zones = $p->getPriceList($item->id);
            }

            BidsHelperAuction::renderAuctionTiming($item);
            $item->countdownHtml = JHTML::_('auctiondetails.countdownHtml',$item);

            if ( BidsHelperDateTime::getTimeStamp($item->end_date) <= time() ) {
                $item->expired = true;
            } else {
                $item->expired = false;
            }

            $item->start_date_text = JHTML::_('auctiondetails.startDateHtml', $item);
            $item->end_date_text = JHTML::_('auctiondetails.endDateHtml', $item);

            BidsHelperAuction::setAuctionStatus($item);

            if ($item->params->get('max_price', '1') == 0 || $item->auction_type == AUCTION_TYPE_PRIVATE) {
                $item->highest_bid = null;
            }

            $lists['bidderPaypalButton'][$item->id] = isset($item->wonBids) ? JHTML::_('auctiondetails.bidderPaypalButton',$item) : null;
        }

        $this->assign('positions', array());

        $filter_type = $model->getState('filters.filter_type');
        $filter_bidtype = $model->getState('filters.filter_bidtype');
        $filter_archive = $model->getState('filters.filter_archive');
        $filter_order = $model->getState('filters.filter_order');
        $filter_order_Dir = $model->getState('filters.filter_order_Dir');
        $pagination = $model->get('pagination');

        $lists['archive'] = JHTML::_('listauctions.selectMyFilter', $model->getState('filters.filter_archive'));
        $lists['filter_bidtype'] = JHTML::_('listauctions.selectBidType', $model->getState('filters.filter_bidtype') );
        $lists['orders'] = JHTML::_('listauctions.selectOrder',$filter_order);
        $lists['filter_order_asc'] = JHTML::_('listauctions.selectOrderDir', $filter_order_Dir);
        $lists['filter_cats'] = JHTML::_('listAuctions.selectCategory', $model->getState('filters.cat'));
        $lists['inputKeyword'] = JHTML::_('listAuctions.inputKeyword', $model->getState('filters.keyword'));
        $filters = $model->getFilters();
        $lists['inputsHiddenFilters'] = JHTML::_('listAuctions.inputsHiddenFilters', $filters );
        $lists['htmlLabelFilters'] = JHTML::_('listAuctions.htmlLabelFilters', $filters, false );
        $lists['resetFilters'] = JHTML::_('listAuctions.linkResetFilters', $model->getState('behavior'));

        $this->assign('lists', $lists);

        $uri = JFactory::getURI();
        $this->assign("action", JRoute::_(JFilterOutput::ampReplace($uri->toString())));
        $this->assign("auction_rows", $items);

        $this->assign("filter_type", $filter_type);
        $this->assign("filter_bidtype", $filter_bidtype);
        $this->assign("filter_order_Dir", $filter_order_Dir);
        $this->assign("reverseorder_Dir", $filter_order_Dir=='ASC' ? 'ASC' : 'DESC' );
        $this->assign("filter_order", $filter_order);
        $this->assign("filter_archive", $filter_archive);
        $this->assign("pagination", $pagination);

        JHTML::script( JURI::root().'components/com_bids/js/jquery/jquery.js' );
        JHTML::script( JURI::root().'components/com_bids/js/jquery/jquery.noconflict.js' );

        JHTML::script( JURI::root().'components/com_bids/js/ratings.js' );
        JHTML::script( JURI::root().'components/com_bids/js/startup.js' );

        JHTML::_('behavior.modal');
        JHTML::_('behavior.tooltip');

        BidsHelperHtml::loadCountdownJS();

        parent::display($tmpl);
    }
Ejemplo n.º 18
0
 		 </td>
 		 <?php if ($display_counter) { ?>
 		 <td>
			<span id="modulebidstime<?php echo $mid;?>_<?php echo $i;?>" >
                        <?php echo $row->countdown; ?>
                        </span>
 		 </td>
 		 <?php
 		 }
 		 ?>
 		 <td>
 		 	<?php
            $row->params = new JParameter($row->params);
 		 	if( $row->auction_type != AUCTION_TYPE_PRIVATE && $row->params->get('max_price') ){
 		 		if(is_null($row->maxBid)) {
 		 			$max_bid=JText::_("No bids");
 		 		} else {
 		 			$max_bid = BidsHelperAuction::formatPrice($row->maxBid)."&nbsp;".$row->currency;
 		 		}
 		 	}else {
 		 		$max_bid = JText::_("Private");
 		 	}
 		 	echo '<span class="hasTip" title="'. JText::_('COM_BIDS_HIGHEST_BID') . '">'. $max_bid . '</span>';;
 		 	?>
 		 </td>
 		</tr>
 		<?php
                $i++;
	}
?>
</table>
Ejemplo n.º 19
0
	function getDisplayTab($tab,$user,$ui){

		$database = &JFactory::getDBO();
		$my = JFactory::getUser();

        $params = $this->params;

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

        $queryCount = "SELECT COUNT(1) FROM #__bid_auctions WHERE userid=".$user->user_id;
        $database->setQuery($queryCount);
        $total = $database->loadResult();

		$query = "SELECT a.*,b.bid_price AS lastBid,u.username
			FROM #__bid_auctions AS a
			LEFT JOIN #__users u ON a.userid=u.id
			LEFT JOIN #__bids b ON a.id=b.auction_id
			WHERE a.userid = ".$database->quote($user->user_id)."
			GROUP BY a.id
			ORDER BY a.start_date DESC, b.id DESC";

		$limitstart=0;
		$pagingParams = $this->_getPaging( array(), array( "myauctions_" ) );
		if (isset($pagingParams["myauctions_limitstart"])) {
			$limitstart=$pagingParams["myauctions_limitstart"];
		}

		$database->setQuery($query,$limitstart, ITEMS_PER_PAGE);
		$myauctions = $database->loadObjectList();

		$pagingParams["limitstart"] = $limitstart;
		$pagingParams["limit"] = ITEMS_PER_PAGE;

		$return = "\t\t<div>\n";
		$return .="<table width='100%'>";
		$return .='<form name="topForm'.$tab->tabid.'" action="index.php" method="post">';
		$return .="<input type='hidden' name='option' value='com_comprofiler' />";
		$return .="<input type='hidden' name='task' value='userProfile' />";
		$return .="<input type='hidden' name='user' value='".$user->user_id."' />";
		$return .="<input type='hidden' name='tab' value='".$tab->tabid."' />";
		$return .="<input type='hidden' name='act' value='' />";

		if($myauctions) {


			$return	.= '<tr>';
			$return .= '<th class="list_ratings_header" width="15%">'.Jtext::_('COM_BIDS_bid_status').'</th>';
			$return .= '<th class="list_ratings_header" width="*%">'.Jtext::_('COM_BIDS_bid_title').'</th>';
			$return .= '<th class="list_ratings_header" width="15%">'.Jtext::_('COM_BIDS_start_date').'</th>';
			$return .= '<th class="list_ratings_header" width="15%">'.Jtext::_('COM_BIDS_end_date').'</th>';
			$return .= '<th class="list_ratings_header" width="10%">'.Jtext::_('COM_BIDS_initial_price').'</th>';

			if($my->id==$user->user_id){
				$return .= '<th class="list_ratings_header" width="10%">'.Jtext::_('COM_BIDS_last_bid').'</th>';
			}

			$return .= '</tr>';
			$k=0;
			foreach ($myauctions as $ma){
			    /*@var $ma JAuctions*/
                //hide unpublished or Banned auctions
                if (!$ma->published || $ma->close_by_admin) {
                    continue;
                }

    	       	$link_view_details = JRoute::_("index.php?option=com_comprofiler&task=userprofile&user=$ma->userid");
    			$link_view_auction = JHtml::_('auctiondetails.auctionDetailsURL', $ma, false);

    			$status="";
    			if ($ma->close_offer){
    			    $status=Jtext::_('COM_BIDS_closed');

    			}elseif(!$ma->published){
    			    $status=Jtext::_('COM_BIDS_unpublished');
    			}elseif(strtotime($ma->end_date) <= gmdate('Y-m-d H:i:s') ){
                    $status=Jtext::_('COM_BIDS_expired');
                }else{
                    $status=Jtext::_('COM_BIDS_published');
                }

    			 $return .='<tr class="mywatch'.$k.'">';
    			 $return .='<td>';
    			 $return .= $status;
    			 $return .='</td>';

    			 $return .='<td>';
    			 $return .= '<a href="'.$link_view_auction.'">'.$ma->title.'</a>';
    			 $return .='</td>';

    			 $return .='<td>';
    			 $return .= $this->printDate($ma->start_date);
    			 $return .='</td>';
    			 $return .='<td>';
    			 $return .= $this->printDate($ma->end_date);
    			 $return .='</td>';
    			 $return .='<td>';
    			 $return .= BidsHelperAuction::formatPrice($ma->initial_price).' '.$ma->currency;
    			 $return .='</td>';
    			 if($my->id==$user->user_id){
    			     if ($ma->lastBid) {
                         $return .= '<td>'.BidsHelperAuction::formatPrice($ma->lastBid).' '.$ma->currency.'</td>';
                     } else {
                         $return .= '<td>-</td>';
                     }

    			 }
    			 $return .= "</tr>";
    			 $k=1-$k;

			 }
		} else {

			$return .=	"".JText::_('COM_BIDS_NO_ITEMS')."";

		}

		$return .= "<tr height='20px'>";
		$return .= "<td colspan='3' align='center'>";
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "<tr>";
		$return .= "<td colspan='2' align='center'>";
		$return .= $this->_writePaging($pagingParams,"myauctions_", ITEMS_PER_PAGE, $total);
		$return .= "</td>";
		$return .= "</tr>";
		$return .= "</form>";
		$return .= "</table>";
		$return .= "</div>";

		return $return;
	}