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; }
</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)." ".$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>
echo $row->nr_pix > 0 ? $row->nr_pix : '-'; ?> </td> <td align="center"> <?php echo BidsHelperAuction::formatDate($row->start_date); ?> </td> <td align="center"> <?php echo $row->initial_price == 0 ? ' - ' : BidsHelperAuction::formatPrice($row->initial_price) . " " . $row->currency; ?> </td> <td align="center"> <?php echo $row->BIN_price > 0 ? BidsHelperAuction::formatPrice($row->BIN_price) . " " . $row->currency : '-'; ?> </td> <td align="center"> <?php if ($max_bid) { echo number_format($max_bid, 2) . " " . $row->currency; } ?> </td> <td align="center"> <?php echo JHTML::link('index.php?option=' . APP_EXTENSION . '&task=bidshistory&tmpl=component&id=' . $row->id, $nr_bids, 'class="modal" rel="{handler: \'iframe\'}"'); ?> </td>
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()) . ' ' . $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 . ' </td>'; $html .= '<td>' . number_format($sp->price, 2) . ' ' . $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; }
<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>
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']) . '" /> <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); }
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 . ' ' . 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; }
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; }
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 . ' ' . ($nocss ? '' : '<span class="'.$cssCurrency.'">') .$currency. ($nocss ? '' : '</span>'); } else { return '-'; } }
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; }
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; }