|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 require('includes/application_top.php'); 00011 00012 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 00013 00014 if (zen_not_null($action)) { 00015 switch ($action) { 00016 case 'insert': 00017 $tax_class_title = zen_db_prepare_input($_POST['tax_class_title']); 00018 $tax_class_description = zen_db_prepare_input($_POST['tax_class_description']); 00019 00020 $db->Execute("insert into " . TABLE_TAX_CLASS . " 00021 (tax_class_title, tax_class_description, date_added) 00022 values ('" . zen_db_input($tax_class_title) . "', 00023 '" . zen_db_input($tax_class_description) . "', 00024 now())"); 00025 00026 zen_redirect(zen_href_link(FILENAME_TAX_CLASSES)); 00027 break; 00028 case 'save': 00029 $tax_class_id = zen_db_prepare_input($_GET['tID']); 00030 $tax_class_title = zen_db_prepare_input($_POST['tax_class_title']); 00031 $tax_class_description = zen_db_prepare_input($_POST['tax_class_description']); 00032 00033 $db->Execute("update " . TABLE_TAX_CLASS . " 00034 set tax_class_id = '" . (int)$tax_class_id . "', 00035 tax_class_title = '" . zen_db_input($tax_class_title) . "', 00036 tax_class_description = '" . zen_db_input($tax_class_description) . "', 00037 last_modified = now() 00038 where tax_class_id = '" . (int)$tax_class_id . "'"); 00039 00040 zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tax_class_id)); 00041 break; 00042 case 'deleteconfirm': 00043 // demo active test 00044 if (zen_admin_demo()) { 00045 $_GET['action']= ''; 00046 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 00047 zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'])); 00048 } 00049 $tax_class_id = zen_db_prepare_input($_POST['tID']); 00050 00051 $sql = "select tax_class_id from " . TABLE_TAX_RATES . " where tax_class_id='" . $tax_class_id . "'"; 00052 $result = $db->Execute($sql); 00053 if ($result->RecordCount() > 0) { 00054 $_GET['action']= ''; 00055 $messageStack->add_session(ERROR_TAX_RATE_EXISTS_FOR_CLASS, 'error'); 00056 } 00057 $sql = "select count(*) as count from " . TABLE_PRODUCTS . " where products_tax_class_id='" . $tax_class_id . "'"; 00058 $result = $db->Execute($sql); 00059 if ($result->fields['count'] > 0) { 00060 $_GET['action']= ''; 00061 $messageStack->add_session(sprintf(ERROR_TAX_RATE_EXISTS_FOR_PRODUCTS, $result->fields['count']), 'error'); 00062 } 00063 if ($_GET['action'] == 'deleteconfirm') { 00064 $db->Execute("delete from " . TABLE_TAX_CLASS . " 00065 where tax_class_id = '" . (int)$tax_class_id . "'"); 00066 } 00067 zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'])); 00068 break; 00069 } 00070 } 00071 ?> 00072 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00073 <html <?php echo HTML_PARAMS; ?>> 00074 <head> 00075 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00076 <title><?php echo TITLE; ?></title> 00077 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00078 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00079 <script language="javascript" src="includes/menu.js"></script> 00080 <script language="javascript" src="includes/general.js"></script> 00081 <script type="text/javascript"> 00082 <!-- 00083 function init() 00084 { 00085 cssjsmenu('navbar'); 00086 if (document.getElementById) 00087 { 00088 var kill = document.getElementById('hoverJS'); 00089 kill.disabled = true; 00090 } 00091 } 00092 // --> 00093 </script> 00094 </head> 00095 <body onLoad="init()"> 00096 <!-- header //--> 00097 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 00098 <!-- header_eof //--> 00099 00100 <!-- body //--> 00101 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00102 <tr> 00103 <!-- body_text //--> 00104 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00105 <tr> 00106 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00107 <tr> 00108 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00109 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 00110 </tr> 00111 </table></td> 00112 </tr> 00113 <tr> 00114 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00115 <tr> 00116 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00117 <tr class="dataTableHeadingRow"> 00118 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_CLASS_ID; ?></td> 00119 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_CLASSES; ?></td> 00120 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 00121 </tr> 00122 <?php 00123 $classes_query_raw = "select tax_class_id, tax_class_title, tax_class_description, last_modified, date_added from " . TABLE_TAX_CLASS . " order by tax_class_title"; 00124 $classes_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $classes_query_raw, $classes_query_numrows); 00125 $classes = $db->Execute($classes_query_raw); 00126 while (!$classes->EOF) { 00127 if ((!isset($_GET['tID']) || (isset($_GET['tID']) && ($_GET['tID'] == $classes->fields['tax_class_id']))) && !isset($tcInfo) && (substr($action, 0, 3) != 'new')) { 00128 $tcInfo = new objectInfo($classes->fields); 00129 } 00130 00131 if (isset($tcInfo) && is_object($tcInfo) && ($classes->fields['tax_class_id'] == $tcInfo->tax_class_id)) { 00132 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '\'">' . "\n"; 00133 } else { 00134 echo' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $classes->fields['tax_class_id']) . '\'">' . "\n"; 00135 } 00136 ?> 00137 <td class="dataTableContent"><?php echo $classes->fields['tax_class_id']; ?></td> 00138 <td class="dataTableContent"><?php echo $classes->fields['tax_class_title']; ?></td> 00139 <td class="dataTableContent" align="right"><?php if (isset($tcInfo) && is_object($tcInfo) && ($classes->fields['tax_class_id'] == $tcInfo->tax_class_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $classes->fields['tax_class_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> 00140 </tr> 00141 <?php 00142 $classes->MoveNext(); 00143 } 00144 ?> 00145 <tr> 00146 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00147 <tr> 00148 <td class="smallText" valign="top"><?php echo $classes_split->display_count($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_TAX_CLASSES); ?></td> 00149 <td class="smallText" align="right"><?php echo $classes_split->display_links($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> 00150 </tr> 00151 <?php 00152 if (empty($action)) { 00153 ?> 00154 <tr> 00155 <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_tax_class.gif', IMAGE_NEW_TAX_CLASS) . '</a>'; ?></td> 00156 </tr> 00157 <?php 00158 } 00159 ?> 00160 </table></td> 00161 </tr> 00162 </table></td> 00163 <?php 00164 $heading = array(); 00165 $contents = array(); 00166 00167 switch ($action) { 00168 case 'new': 00169 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TAX_CLASS . '</b>'); 00170 00171 $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&action=insert')); 00172 $contents[] = array('text' => TEXT_INFO_INSERT_INTRO); 00173 $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . zen_draw_input_field('tax_class_title', '', zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_title'))); 00174 $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . zen_draw_input_field('tax_class_description', '', zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_description'))); 00175 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00176 break; 00177 case 'edit': 00178 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TAX_CLASS . '</b>'); 00179 00180 $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=save')); 00181 $contents[] = array('text' => TEXT_INFO_EDIT_INTRO); 00182 $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . zen_draw_input_field('tax_class_title', htmlspecialchars($tcInfo->tax_class_title, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_title'))); 00183 $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . zen_draw_input_field('tax_class_description', htmlspecialchars($tcInfo->tax_class_description, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_description'))); 00184 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00185 break; 00186 case 'delete': 00187 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TAX_CLASS . '</b>'); 00188 00189 $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('tID', $tcInfo->tax_class_id)); 00190 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); 00191 $contents[] = array('text' => '<br><b>' . $tcInfo->tax_class_title . '</b>'); 00192 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00193 break; 00194 default: 00195 if (isset($tcInfo) && is_object($tcInfo)) { 00196 $heading[] = array('text' => '<b>' . $tcInfo->tax_class_title . '</b>'); 00197 00198 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 00199 $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($tcInfo->date_added)); 00200 $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($tcInfo->last_modified)); 00201 $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . $tcInfo->tax_class_description); 00202 } 00203 break; 00204 } 00205 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 00206 echo ' <td width="25%" valign="top">' . "\n"; 00207 00208 $box = new box; 00209 echo $box->infoBox($heading, $contents); 00210 00211 echo ' </td>' . "\n"; 00212 } 00213 ?> 00214 </tr> 00215 </table></td> 00216 </tr> 00217 </table></td> 00218 <!-- body_text_eof //--> 00219 </tr> 00220 </table> 00221 <!-- body_eof //--> 00222 00223 <!-- footer //--> 00224 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 00225 <!-- footer_eof //--> 00226 <br> 00227 </body> 00228 </html> 00229 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>