//get all auction templates
$auctionssql = SELECT . "predef_id, quantity, title, subtitle, c.name catname, cat1, startprice, binprice, duration,\n\tt.name typename FROM " . TABLE_AUCTION_PREDEFINITION . " p, " . TABLE_EBAY_CATEGORIES . " c, " . TABLE_EBAY_AUCTIONTYPE . " t\n\twhere\n\tp.cat1 = c.id and\n\tp.auction_type = t.id " . $ordersql;
$myauctions = olc_db_query($auctionssql);
/* define Table Heading */
$heading = array(array($name_text => AUCTIONS_TEXT_AUCTION_PREDEF_ID, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $predef_id_text, $sort0), $link_text => $file . $predef_id_text), array($name_text => AUCTIONS_TEXT_AUCTION_AMOUNT, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $product_id_text, $sort0), $link_text => $file . $product_id_text), array($name_text => AUCTIONS_TEXT_AUCTION_CAT, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $cat1_text, $sort0), $link_text => $file . $cat1_text), array($name_text => AUCTIONS_TEXT_AUCTION_START_PRICE, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $startprice_text, $sort0), $link_text => $file . $startprice_text), array($name_text => AUCTIONS_TEXT_AUCTION_BUYNOW_PRICE, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $binprice_text, $sort0), $link_text => $file . $binprice_text), array($name_text => AUCTIONS_TEXT_AUCTION_PREDEF_DURATION, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $duration_text, $sort0), $link_text => $file . $duration_text), array($name_text => AUCTIONS_TEXT_AUCTION_PREDEF_TYPE, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $typename_text, $sort0), $link_text => $file . $typename_text, array($name_text => HTML_NBSP)));
/* print table heading */
$main_content .= tableheading($heading);
$i = 0;
while ($auctions_values = olc_db_fetch_array($myauctions)) {
    /* define content array */
    $i++;
    if ($i % 2 == 0) {
        $class = $dataTableRow_1_text;
    } else {
        $class = $dataTableRow_text;
    }
    $startprice = $auctions_values[$startprice_text];
    $startprice = $startprice == 0 ? DASH : olc_format_price($startprice, 1, 1, 1);
    $binprice = $auctions_values[$binprice_text];
    $binprice = $binprice == 0 ? DASH : olc_format_price($binprice, 1, 1, 1);
    $content = array($cssclass_text => $class, $values_text => array(array($value_text => $auctions_values[$predef_id_text], $link_text => $getItem_text . $auctions_values[$predef_id_text], $linkattribute_text => $target_blank_text), array($value_text => $auctions_values[$quantity_text] . $x_text . $auctions_values[$title_text] . HTML_BR . $auctions_values[$subtitle_text]), array($value_text => $auctions_values[$catname_text] . HTML_BR . "(" . $auctions_values[$cat1_text] . RPAREN, $attributes_text => $align_right_text), array($value_text => $startprice, $attributes_text => $align_right_text), array($value_text => $binprice, $attributes_text => $align_right_text), array($value_text => $auctions_values[$duration_text] . AUCTIONS_TEXT_AUCTION_DURATION_DAYS), array($value_text => $auctions_values[$typename_text], $attributes_text => $align_right_text), array($value_text => olc_draw_form('edit_form', FILENAME_AUCTIONS_NEW) . olc_draw_hidden_field('id', $auctions_values[$predef_id_text]) . olc_draw_submit_button('edit', AUCTIONS_TEXT_AUCTION_PREDEF_ACCEPT) . '
		</form>', $attributes_text => $align_right_text)));
    /* print content table */
    $main_content .= tablecontent($content);
}
$page_header_title = AUCTIONS_TEXT_HEADER;
$page_header_subtitle = AUCTIONS_TEXT_SUB_HEADER_PREDEF;
$page_header_icon_image = HEADING_MODULES_ICON;
$show_column_right = true;
$no_left_menu = false;
require PROGRAM_FRAME;
        $resultstring = AUCTIONS_TEXT_AUCTION_LIST_STATUS_FAILED;
    }
    if ($resultstring) {
        $main_content = "<span class='smallText'>" . $resultstring . "</span><br/>";
    }
}
$orderby = "auction_id";
//Default order field
require_once DIR_WS_FUNCTIONS . 'list_sorting.php';
//show all auctions not ended and not sheduled
$mynewstarttime = toGMT(date(AUCTIONS_DATE_FORMAT));
$auctionssql = SELECT_ALL . TABLE_AUCTION_LIST . " where ended !=1 AND starttime <= '" . $mynewstarttime . "' " . $ordersql;
$myauctions = olc_db_query($auctionssql);
$main_content .= '
<p align="right">
' . olc_draw_form('pickup_form', $PHP_SELF) . olc_draw_submit_button('pickup', AUCTIONS_TEXT_AUCTION_LIST_STATUS_GET) . '
</form>
</p>
';
/* define Table Heading */
$heading = array(array($name_text => AUCTIONS_TEXT_AUCTION_AMOUNT, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $auction_title_text, $sort0), $link_text => $file . $auction_title_text), array($name_text => AUCTIONS_TEXT_AUCTION_LIST_EBAY_ID, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $auction_id_text, $sort0), $link_text => $file . $auction_id_text), array($name_text => AUCTIONS_TEXT_AUCTION_START_PRICE, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $startprice_text, $sort0), $link_text => $file . $startprice_text), array($name_text => AUCTIONS_TEXT_AUCTION_BUYNOW_PRICE, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $buynowprice_text, $sort0), $link_text => $file . $buynowprice_text), array($name_text => AUCTIONS_TEXT_AUCTION_LIST_START_TIME, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $starttime_text, $sort0), $link_text => $file . $starttime_text), array($name_text => AUCTIONS_TEXT_AUCTION_LIST_END_TIME, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $endtime_text, $sort0), $link_text => $file . $endtime_text), array($name_text => AUCTIONS_TEXT_AUCTION_LIST_BIDS, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $bidcount_text, $sort0), $link_text => $file . $bidcount_text), array($name_text => AUCTIONS_TEXT_AUCTION_LIST_HIGHEST_BID, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $bidprice_text, $sort0), $link_text => $file . $bidprice_text));
/* print table heading */
$main_content = tableheading($heading);
$i = 0;
while ($auctions_values = olc_db_fetch_array($myauctions)) {
    $mybidcount = $auctions_values[$bidcount_text];
    if ($mybidcount == 0) {
        $currentprice = DASH;
    } else {
        $currentprice = olc_format_price($auctions_values[$bidprice_text], 1, 1, 1);
    }
	      				<p>&nbsp;</p>
	      			</td>
  					</tr>
					</table>
        </form>
' . HTML_HR . olc_draw_form($export_text, $script, $export_parameter, 'POST', 'enctype="multipart/form-data"') . '
					<table width="100%" border="0" cellspacing="5" cellpadding="0">
					  <tr>
					    <td class="pageHeading">Export</td>
					  </tr>
					  <tr>
					    <td align="left" class="pageSubHeading">' . TEXT_EXPORT . '
					      <table align="center" width="100%" border="0" cellspacing="2" cellpadding="0">
					        <tr>
					          <td class="pageSubHeading">
' . HTML_BR . SELECT_MAP . HTML_BR . olc_draw_file_field($map_file_text) . HTML_BR . $map_file_display . HTML_BR . HTML_BR . olc_draw_submit_button('submit', BUTTON_EXPORT, 'class="button" onclick="javascript:this.blur();"') . '
					          </td>
					        </tr>
					        <tr>
					          <td colspan="2">&nbsp;</td>
					        </tr>
	      				</table>
	      			</td>
					  </tr>
					</table>
				</form>
         <table width="100%">
           <tr>
              <td class="pageSubHeading" align="left">
	              <a href="#" onclick="javascript:toggleBox(\'config\');">' . CSV_SETUP . '</a>
              </td>
}
$main_content .= HTML_HR . HTML_B_START . $content . HTML_B_END . HTML_BR . HTML_BR;
$main_content .= olc_draw_form('form1', HASH) . '
	<table border="0" cellpadding="0" cellspacing="2">';
$td_start = '<td class="dataTableContent"';
$td_start_left = $td_start . '>' . HTML_NBSP;
$td_start_right = $td_start . 'align="right">';
$td_end = "</td>";
$row_start = "<tr>" . $td_start_left;
$row_end = $td_end . "</tr>";
$name_text = 'name';
$id_text = 'id';
$leaf_text = 'leaf';
$lparen = LPAREN;
$rparen = RPAREN;
$submit = $td_end . $td_start_right . HASH . HTML_NBSP . $td_end . $td_start_left . HTML_NBSP . HTML_NBSP . olc_draw_submit_button('choosencat', AUCTIONS_TEXT_SUBMIT_SELECT, 'onclick="javascript:set_cat_info(\'#~\')" style="cursor:hand"');
$trailer = HTML_A_END . $td_end . $td_start_right . HASH . HTML_NBSP;
$tr_start_heading = '<tr class="dataTableHeadingContent" align="center"><td>';
$main_content .= $tr_start_heading . AUCTIONS_TEXT_CATEGORIES_CATEGORY . $td_end . '<td>' . AUCTIONS_TEXT_CATEGORIES_ID . $td_end . $row_end;
while ($row_name = olc_db_fetch_array($categories)) {
    $name = $row_name[$name_text];
    if ($name) {
        $id = $row_name[$id_text];
        $name = str_replace(BLANK, HTML_NBSP, $name);
        if ($row_name[$leaf_text]) {
            $content = $name . $submit;
            $desc = revertCategoryPath($path . $name);
        } else {
            $content = $a_start_cat . $name . $trailer;
            $desc = $name;
        }
$auctionssql = SELECT_ALL . TABLE_AUCTION_LIST . " l, " . TABLE_AUCTION_DETAILS . " d\nWHERE\nl.auction_id=d.auction_id AND\nd.order_number=0 " . $ordersql;
$myauctions = olc_db_query($auctionssql);
$orderby = "auction_id";
//Default order field
require_once DIR_WS_FUNCTIONS . 'list_sorting.php';
$main_content .= '
<table border="0" cellpadding="0" cellspacing="0" align="center">
	<tr>
		<td align="center">
' . olc_draw_form('getbuyerdata', FILENAME_AUCTIONS_LIST_SOLD) . olc_draw_submit_button('buyerdata', AUCTIONS_TEXT_AUCTION_SOLD_BUYER_DATA) . '
			</form>
		</td>
		<td>
		</td>
		<td align="center">
' . olc_draw_form('email', FILENAME_AUCTIONS_LIST_SOLD) . olc_draw_submit_button('sendemail', AUCTIONS_TEXT_AUCTION_SOLD_BUYER_INFORMATION) . '
			</form>
		</td>
	</tr>
</table>
<br/>
';
$auction_title_text = 'l.' . $auction_title_text;
$auction_id_text = 'l.' . $auction_id_text;
$buyer_id_text = 'd.buyer_id';
$buyer_land_text = 'd.buyer_land';
$auction_endprice_text = 'd.auction_endprice';
$endtime_text = 'd.endtime';
$basket_text = 'd.basket';
$heading = array(array($name_text => AUCTIONS_TEXT_AUCTION_AMOUNT, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $auction_title_text, $sort0), $link_text => $file . $auction_title_text), array($name_text => AUCTIONS_TEXT_AUCTION_LIST_EBAY_ID, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $auction_id_text, $sort0), $link_text => $file . $auction_id_text), array($name_text => AUCTIONS_TEXT_AUCTION_SOLD_BUYER, $attributes_text => $align_right_text, $sort_text => str_replace(HASH, $buyer_id_text, $sort0), $link_text => $file . $buyer_id_text), array($name_text => AUCTIONS_TEXT_AUCTION_SOLD_COUNTRY, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $buyer_land_text, $sort0), $link_text => $file . $buyer_land_text), array($name_text => AUCTIONS_TEXT_AUCTION_SOLD_PRICE, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, auction_endprice_text, $sort0), $link_text => $file . auction_endprice_text), array($name_text => AUCTIONS_TEXT_AUCTION_LIST_END_TIME, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $endtime_text, $sort0), $link_text => $file . $endtime_text), array($name_text => AUCTIONS_TEXT_AUCTION_SOLD_BASKET, $attributes_text => $align_center_text, $sort_text => str_replace(HASH, $basket_text, $sort0), $link_text => $file . $basket_text));
/* print table heading */
    display_section_header(AUCTIONS_TEXT_ARTICLE_PICS) . display_error_if($error_pic, sprintf(AUCTIONS_LIST_ERROR_PIC, EMPTY_STRING));
    display_section_content_line(AUCTIONS_TEXT_AUCTION_PIC_URL, EMPTY_STRING);
    display_section_content_line(EMPTY_STRING, $content_pic);
    if ($have_multi_pic_error) {
        for ($i = 0, $n = sizeof($multi_pic_error); $i < $n; $i++) {
            display_error_if(true, sprintf(AUCTIONS_LIST_ERROR_PIC, $i + 2 . DOT));
        }
    }
    display_section_header(AUCTIONS_TEXT_ARTICLE_OPTIONS);
    display_section_content_line(sprintf(AUCTIONS_TEXT_AUCTION_FONT_BOLD, $fees[$bold_text]), $content_bo);
    display_section_content_line(sprintf(AUCTIONS_TEXT_AUCTION_FONT_HIGHLIGHT, $fees[$highlight_text]), $content_hi);
    display_section_content_line(sprintf(AUCTIONS_TEXT_AUCTION_FONT_BORDER, $fees[$highlight_text]), $content_bd);
    display_error_if($error_gallerypic, sprintf(AUCTIONS_LIST_ERROR_PIC, AUCTIONS_LIST_ERROR_GALLERY_TEXT));
    display_section_content_line(AUCTIONS_TEXT_AUCTION_GALLERY_PIC_URL, $content_gp);
    display_section_header(AUCTIONS_TEXT_ARTICLE_PAYMENT) . display_error_if($error_payment, AUCTIONS_LIST_ERROR_PAYMENT);
    display_section_content_line(AUCTIONS_TEXT_AUCTION_PAYMENT_COD, $content_co);
    display_section_content_line(AUCTIONS_TEXT_AUCTION_PAYMENT_COP, $content_cp);
    display_section_content_line(AUCTIONS_TEXT_AUCTION_PAYMENT_CC, $content_cc);
    display_error_if($error_paypal, AUCTIONS_LIST_ERROR_PAYPAL);
    display_section_content_line(AUCTIONS_TEXT_AUCTION_PAYMENT_PAYPAL, $content_pp);
    display_section_header(AUCTIONS_TEXT_ARTICLE_SHIPMENT);
    display_section_content_line(AUCTIONS_TEXT_AUCTION_COUNTRY_DE, $content_de);
    display_section_content_line(AUCTIONS_TEXT_AUCTION_COUNTRY_AT, $content_at);
    display_section_content_line(AUCTIONS_TEXT_AUCTION_COUNTRY_CH, $content_ch);
    $content = HTML_BR . HTML_BR . olc_draw_submit_button("addItem", AUCTIONS_TEXT_AUCTION_ADD) . HTML_NBSP . HTML_NBSP . olc_draw_submit_button("saveItem", AUCTIONS_TEXT_AUCTION_NEW);
    $main_content .= display_section_content_line(EMPTY_STRING, $content) . $table_end_form_end . $form_end;
}
$show_column_right = true;
$no_left_menu = false;
$page_header_subtitle = AUCTIONS_TEXT_SUB_HEADER_AUCTION;
require PROGRAM_FRAME;