<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/

?>

<?php
if ($messageStack->size('ticket') > 0) {
  echo $messageStack->output('ticket');
}
?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

  <!-- Naglowek BOF -->
  <tr>
    <td>
      <?php
      $info_box_contents = array();
      $info_box_contents[] = array('text' => sprintf(HEADING_TITLE));
      new contentBoxHeading($info_box_contents);
      ?>
    </td>
  </tr>
  <tr>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
  </tr>
  <!-- Naglowek EOF -->

  <?php
  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
    ?>
    <tr>
      <td>
        <fieldset>
          <legend><?php echo TICKET_FORM_SUCCESS; ?></legend>
          <table border="0" width="100%" cellspacing="0" cellpadding="2">
            <tr>
              <td class="main"><?php echo TEXT_SUCCESS; ?></td>
            </tr>
            <tr>
              <td class="main"><?php echo TEXT_YOUR_TICKET_ID . ' ' . $HTTP_GET_VARS['tlid']; ?></td>
            </tr>
            <tr>
              <td class="main"><?php echo TEXT_CHECK_YOUR_TICKET . '<br><a href="' . tep_href_link(FILENAME_TICKET_VIEW, 'tlid=' . $HTTP_GET_VARS['tlid'], 'NONSSL',false,false) . '">' . tep_href_link(FILENAME_TICKET_VIEW, 'tlid=' . $HTTP_GET_VARS['tlid'], 'NONSSL',false,false) . '</a>'; ?></td>
            </tr>
          </table>
        </fieldset>
      </td>
    </tr>
    <!-- Przyciski BOF -->
    <tr>
      <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
    </tr>
    <tr>
      <td colspan="2">
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            <td valign ="bottom" align="right"><a href="<?php echo tep_href_link(FILENAME_DEFAULT); ?>"><?php echo tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></a></td>
            <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
          </tr>
        </table>
      </td>
    </tr>
    <!-- Przyciski EOF -->
    <?php
  } else {
    if (tep_session_is_registered('customer_id')) {
      echo tep_draw_form('contact_us', tep_href_link(FILENAME_TICKET_CREATE, 'action=send')); ?>
      <tr>
        <td>
          <fieldset>
            <legend><?php echo TICKET_FORM_TITLE; ?></legend>
            <table border="0" width="100%" cellspacing="0" cellpadding="4">
              <tr>
                <td class="main" align="left" width="50%"><?php echo ENTRY_NAME; ?></td>
                <td class="main">
                  <?php
                  echo tep_draw_hidden_field('name',$customer['customers_firstname'] . ' ' . $customer['customers_lastname']) . $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
                  ?>
                </td>
              </tr>
              <tr>
                <td class="main" align="left" width="50%"><?php echo ENTRY_EMAIL; ?></td>
                <td class="main">
                  <?php
                  echo tep_draw_hidden_field('email',$customer['customers_email_address']) . $customer['customers_email_address'];
                  ?>
                </td>
              </tr>
              <tr>
                <td class="main" align="left" width="50%"><?php echo ENTRY_SUBJECT; ?></td>
                <td class="main"><?php  echo tep_draw_input_field('subject', ($error ? $subject : $subject), 'size="35"') . '&nbsp;<span class="inputRequirement">'.ENTRY_LAST_NAME_TEXT.'</span>'; if ($error_subject) echo ENTRY_ERROR_NO_SUBJECT; ?></td>
              </tr>
              <?php
              if (TICKET_SHOW_CUSTOMERS_ORDER_IDS == 'true' && tep_session_is_registered('customer_id')) {
                $customers_orders_query = tep_db_query("select orders_id, date_purchased from " . TABLE_ORDERS . " where customers_id = '" . tep_db_input($customer_id) . "'");
                if (isset($HTTP_GET_VARS['ticket_order_id'])) $ticket_preselected_order_id = $HTTP_GET_VARS['ticket_order_id'];
                $orders_array[] = array('id' => '', 'text' => ' -- ' );
                while ($customers_orders = tep_db_fetch_array($customers_orders_query)) {
                  $orders_array[] = array('id' => $customers_orders['orders_id'], 'text' => $customers_orders['orders_id'] . "  (" . tep_date_short($customers_orders['date_purchased']) . ")" );
                }
                ?>
                <tr>
                  <td class="main"><?php echo ENTRY_ORDER; ?></td>
                  <td class="main"><?php echo  tep_draw_pull_down_menu('ticket_customers_orders_id', $orders_array, $ticket_preselected_order_id, 'style="width:170px"'); ?></td>
                </tr>
                <?php
              }
              if (TICKET_CATALOG_USE_DEPARTMENT == 'true') {
                ?>
                <tr>
                  <td class="main"><?php echo ENTRY_DEPARTMENT; ?></td>
                  <td class="main"><?php echo tep_draw_pull_down_menu('department', $ticket_departments, ($department ? $department : TICKET_DEFAULT_DEPARTMENT_ID), 'style="width:170px"' ); ?></td>
                </tr>
                <?php
              } else {
                echo tep_draw_hidden_field('department', TICKET_DEFAULT_DEPARTMENT_ID);
              }
              if (TICKET_CATALOG_USE_PRIORITY == 'true') {
                ?>
                <tr>
                  <td class="main"><?php echo ENTRY_PRIORITY; ?></td>
                  <td class="main"><?php echo tep_draw_pull_down_menu('priority', $ticket_prioritys, ($priority ? $priority : TICKET_DEFAULT_PRIORITY_ID), 'style="width:170px"' ); ?></td>
                </tr>
                <?php
              } else {
                echo tep_draw_hidden_field('priority', TICKET_DEFAULT_PRIORITY_ID);
              }
              ?>
              <tr>
                <td colspan="2" class="main"><?php echo ENTRY_ENQUIRY; ?><span class="inputRequirement"><?php echo ENTRY_LAST_NAME_TEXT; ?></span></td>
              </tr>
              <tr>
                <td colspan="2" align="center" class="main"><?php echo tep_draw_textarea_field('enquiry', 'soft', 80, 15, $enquiry); ?><br><?php if ($error_enquiry) echo ENTRY_ERROR_NO_ENQUIRY; ?></td>
              </tr>
            </table>
          </fieldset>
        </td>
      </tr>
      <!-- Przyciski BOF -->
      <tr>
        <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
      </tr>
      <tr>
        <td colspan="2">
          <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              <td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
              <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            </tr>
          </table>
        </td>
      </tr>
      <!-- Przyciski EOF -->
      </form>
      <?php
    } else {
      ?>
      <tr>
        <td>
          <fieldset>
            <legend><?php echo TICKET_FORM_TITLE; ?></legend>
            <table border="0" width="100%" cellspacing="0" cellpadding="4">
              <tr>
                <td class="main" align="left" width="100%" colspan="2">
                <?php
                if (!tep_session_is_registered('customer_id')) {
                  echo sprintf(TEXT_LOGIN, tep_href_link(FILENAME_TICKET_CREATE, 'login=yes', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
                }
                ?>
              </td>
              </tr>
            </table>
          </fieldset>
        </td>
      </tr>
      <!-- Przyciski BOF -->
      <tr>
        <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
      </tr>
      <tr>
        <td colspan="2">
          <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              <td valign ="bottom" align="right"><a href="<?php echo tep_href_link(FILENAME_DEFAULT); ?>"><?php echo tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></a></td>
              <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            </tr>
          </table>
        </td>
      </tr>
      <!-- Przyciski EOF -->
      <?php
    }
  }
  ?>

</table>