function getDisplayTab($tab, $user, $ui) {

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

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

        $componentPath = JPATH_SITE . DS . 'components' . DS . 'com_bids';

        require_once($componentPath.DS.'options.php');
        $cfg = new BidConfig();

        require_once($componentPath . DS . 'helpers' . DS . 'tools.php');
        require_once($componentPath . DS . 'thefactory' . DS . 'front.userprofile.php');
        require_once($componentPath . DS . 'helpers' . DS . 'profile.php');


        JModel::addIncludePath($componentPath . DS . 'models');

        $bidsUserModel = JModel::getInstance('user','bidsModel');
        $bidsUserModel->loadUser($my->id);
        $bidsProfile = $bidsUserModel->get('profile');

        $balance = $bidsUserModel->getBalance();

        //here begins output
        $html =
        '<div>
            <table width="100%">
                <tr>
                    <td colspan="4">';

                        if($cfg->bid_opt_enable_acl) {
                            $sellerImg = JURI::root() . 'components/com_bids/images/f_can_sell'.( !empty($bidsProfile->isSeller) ? '1':'2').'.gif';
                            $html .= '<div style="width:120px;float:left;">'.
                                           JHTML::image($sellerImg,'','style="margin-right:50px;" border="0"').
                                       '</div>';
                            $bidderImg = JURI::root() . 'components/com_bids/images/f_can_buy'.( !empty($bidsProfile->isBidder) ? '1':'2').'.gif';
                            $html .= '<div style="width:120px;float:left;">'.
                                           JHTML::image($bidderImg,'','style="margin-right:60px;" border="0"').
                                       '</div>';
                        }
                        elseif(!empty($bidsProfile->powerseller)) {
                            $sellerImg = JURI::root() . 'components/com_bids/images/f_can_sell'.( !empty($bidsProfile->isSeller) ? '1':'2').'.gif';
                            $html .= '<div style="width:120px;float:left;">'.
                                           JHTML::image($sellerImg,'','style="margin-right:50px;" border="0"').
                                       '</div>';
                        }

                        $verifiedImg = JURI::root() . 'components/com_bids/images/verified_'.( !empty($bidsProfile->verified) ? '1':'0').'.gif';
                        $html .= '<div style="width:120px;float:left;">'.
                                       JHTML::image($verifiedImg,'','style="margin-right:50px;" border="0"').
                                   '</div>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">';

                        if($cfg->bid_opt_enable_acl) {
                            if (!empty($bidsProfile->isSeller)){
                                $html .= "<div style='width:120px;float:left;'>" . Jtext::_('COM_BIDS_acl_group_seller') . ":" . ($bidsProfile->powerseller ? JText::_('Powerseller') : JText::_('Seller'))  . "</div>";
                            } else {
                                $html .= "<div style='width:120px;float:left;'>" . Jtext::_('COM_BIDS_acl_group_seller') . ":" . ($bidsProfile->isSeller ? Jtext::_('COM_BIDS_YES') : Jtext::_('COM_BIDS_no') ) . "</div>";
                            }
                            $html .= "<div style='width:120px;float:left;'>" . Jtext::_('COM_BIDS_acl_group_bidder') . ":" . ($bidsProfile->isBidder ? Jtext::_('COM_BIDS_YES') : Jtext::_('COM_BIDS_no') ) . "</div>";
                        }
                        elseif(!empty($bidsProfile->powerseller)) {
                            $html .= "<div style='width:120px;float:left;'>" . Jtext::_('COM_BIDS_acl_group_seller') . ":" . ($bidsProfile->powerseller ? JText::_('Powerseller') : JText::_('Seller'))  . "</div>";
                        }
                        $html .= "<div style='width:120px;float:left;'>" . Jtext::_('COM_BIDS_user_verified') . ":" . ( (isset($bidsProfile->verified) && $bidsProfile->verified) ? Jtext::_('COM_BIDS_YES') : Jtext::_('COM_BIDS_no') ) . "</div>".

                    '</td>
                </tr>
                <tr>
                    <td colspan="4">';

        $tasklist = array(
            'newauction' => 'f_newauction.png',
            'myauctions' => 'f_myauctions.png ',
            'mybids' => 'f_mybids.png',
            'mywonbids' => 'f_mywonbids.png',
            'mywatchlist' => 'f_mywatchlist.png',
            'listcats' => 'f_listcats.png',
            'listauctions' => 'f_listauctions.png',
            'search' => 'f_search.png'
        );
        $keys = array_keys($tasklist);

        $html .= '<table width="100%">
                    <tr>';
                    for ($i = 0; $i < count($keys) / 2; $i++) {
                        $f_task = JRoute::_("index.php?option=com_bids&task=" . $keys[$i]);
                        $html .= "<td width='100'><a href='$f_task'><img src='" . JURI::root() . "components/com_bids/images/menu/" . $tasklist[$keys[$i]] . "' border=0></a></td>";
                    }
        $html .=    '</tr>
                    <tr>';

                    for ($i = count($keys) / 2; $i < count($keys); $i++) {
                        $f_task = JRoute::_("index.php?option=com_bids&task=" . $keys[$i]);
                        $html .= "<td width='100'><a href='$f_task'><img src='" . JURI::root() . "components/com_bids/images/menu/" . $tasklist[$keys[$i]] . "' border=0></a></td>";
                    }
        $html .=    '</tr>
                </table>
            </td>
        </tr>';

        $html .= '<tr>
            <td>
                <div class="auction_credits">'.
                    JText::_('COM_BIDS_YOUR_CURRENT_BALANCE_IS').'&nbsp'.
                    $balance->balance.'&nbsp;'.$balance->currency.
                '</div>
                <div>
                    <a href="'.BidsHelperRoute::getAddFundsRoute().'">'.
                     JText::_('COM_BIDS_ADD_FUNDS_TO_YOUR_BALANCE').
                     '</a>
                </div>
                 <div>
                     <a href="'.BidsHelperRoute::getPaymentsHistoryRoute().'">'.
                      JText::_('COM_BIDS_SEE_MY_PAYMENTS_HISTORY').
                      '</a>
                 </div>
            </td>
        </tr>';


        $html .=
            '</table>
        </div>';

        return $html;
    }
Exemple #2
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);
    }