Execute($zones_sql);
if (!$result->RecordCount()) {
$geo_zone_name = $geo_zone_id;
} else {
$zones = $result->fields;
$geo_zone_name = $zones['geo_zone_name'];
}
return $geo_zone_name;
}
$nsPage = (!isset($_GET['spage']) || !is_numeric($_GET['spage'])) ? 1 : intval($_GET['spage']);
$nzPage = (!isset($_GET['zpage']) || !is_numeric($_GET['zpage'])) ? 1 : intval($_GET['zpage']);
$saction = (isset($_GET['saction']) ? $_GET['saction'] : '');
if (oos_is_not_null($saction)) {
switch ($saction) {
case 'insert_sub':
$zID = oos_db_prepare_input($_GET['zID']);
$zone_country_id = oos_db_prepare_input($_POST['zone_country_id']);
$zone_id = oos_db_prepare_input($_POST['zone_id']);
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$dbconn->Execute("INSERT INTO $zones_to_geo_zonestable (zone_country_id, zone_id, geo_zone_id, date_added) VALUES ('" . oos_db_input($zone_country_id) . "', '" . oos_db_input($zone_id) . "', '" . oos_db_input($zID) . "', now())");
$new_subzone_id = $dbconn->Insert_ID();
oos_redirect_admin(oos_href_link_admin($aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $nsPage . '&sID=' . $new_subzone_id));
break;
case 'save_sub':
$sID = oos_db_prepare_input($_GET['sID']);
$zID = oos_db_prepare_input($_GET['zID']);
$zone_country_id = oos_db_prepare_input($_POST['zone_country_id']);
$zone_id = oos_db_prepare_input($_POST['zone_id']);
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$dbconn->Execute("UPDATE $zones_to_geo_zonestable SET geo_zone_id = '" . oos_db_input($zID) . "', zone_country_id = '" . oos_db_input($zone_country_id) . "', zone_id = " . ((oos_db_input($zone_id)) ? "'" . oos_db_input($zone_id) . "'" : 'null') . ", last_modified = now() WHERE association_id = '" . oos_db_input($sID) . "'");
oos_redirect_admin(oos_href_link_admin($aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $nsPage . '&sID=' . $_GET['sID']));
break;
case 'deleteconfirm_sub':
$sID = oos_db_prepare_input($_GET['sID']);
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$dbconn->Execute("DELETE FROM $zones_to_geo_zonestable WHERE association_id = '" . oos_db_input($sID) . "'");
oos_redirect_admin(oos_href_link_admin($aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $nsPage));
break;
}
}
$action = (isset($_GET['action']) ? $_GET['action'] : '');
if (!empty($action)) {
switch ($action) {
case 'insert_zone':
$geo_zone_name = oos_db_prepare_input($_POST['geo_zone_name']);
$geo_zone_description = oos_db_prepare_input($_POST['geo_zone_description']);
$geo_zonestable = $oostable['geo_zones'];
$dbconn->Execute("INSERT INTO $geo_zonestable (geo_zone_name, geo_zone_description, date_added) VALUES ('" . oos_db_input($geo_zone_name) . "', '" . oos_db_input($geo_zone_description) . "', now())");
$new_zone_id = $dbconn->Insert_ID();
oos_redirect_admin(oos_href_link_admin($aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $new_zone_id));
break;
case 'save_zone':
$zID = oos_db_prepare_input($_GET['zID']);
$geo_zone_name = oos_db_prepare_input($_POST['geo_zone_name']);
$geo_zone_description = oos_db_prepare_input($_POST['geo_zone_description']);
$geo_zonestable = $oostable['geo_zones'];
$dbconn->Execute("UPDATE $geo_zonestable SET geo_zone_name = '" . oos_db_input($geo_zone_name) . "', geo_zone_description = '" . oos_db_input($geo_zone_description) . "', last_modified = now() WHERE geo_zone_id = '" . oos_db_input($zID) . "'");
oos_redirect_admin(oos_href_link_admin($aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID']));
break;
case 'deleteconfirm_zone':
$zID = oos_db_prepare_input($_GET['zID']);
$geo_zonestable = $oostable['geo_zones'];
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$dbconn->Execute("DELETE FROM $geo_zonestable WHERE geo_zone_id = '" . oos_db_input($zID) . "'");
$dbconn->Execute("DELETE FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . oos_db_input($zID) . "'");
oos_redirect_admin(oos_href_link_admin($aContents['geo_zones'], 'zpage=' . $nzPage));
break;
}
}
require 'includes/header.php';
if (isset($_GET['zID']) && (($saction == 'edit') || ($saction == 'new'))) {
?>
-
' . HEADER_TITLE_TOP . ''; ?>
-
' . BOX_HEADING_LOCATION_AND_TAXES . ''; ?>
-
|
|
|
Execute($zones_result_raw);
while ($zones = $zones_result->fields) {
$rows++;
if ((!isset($_GET['sID']) || (isset($_GET['sID']) && ($_GET['sID'] == $zones['association_id']))) && !isset($sInfo) && (substr($saction, 0, 3) != 'new')) {
$sInfo = new objectInfo($zones);
}
if (isset($sInfo) && is_object($sInfo) && ($zones['association_id'] == $sInfo->association_id)) {
echo ' ' . "\n";
} else {
echo ' ' . "\n";
}
?>
|
|
association_id) ) { echo ''; } else { echo ''; } ?> |
MoveNext();
}
?>
display_count($zones_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, $nsPage, TEXT_DISPLAY_NUMBER_OF_COUNTRIES); ?> |
display_links($zones_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $nsPage, 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=list', 'spage'); ?> |
|
' . oos_button(IMAGE_BACK) . ' ' . oos_button(BUTTON_INSERT) . ''; ?> |
|
|
Execute($zones_result_raw);
while ($zones = $zones_result->fields) {
if ((!isset($_GET['zID']) || (isset($_GET['zID']) && ($_GET['zID'] == $zones['geo_zone_id']))) && !isset($zInfo) && (substr($action, 0, 3) != 'new')) {
$zInfo = new objectInfo($zones);
}
if (isset($zInfo) && is_object($zInfo) && ($zones['geo_zone_id'] == $zInfo->geo_zone_id) ) {
echo ' ' . "\n";
} else {
echo ' ' . "\n";
}
?>
' . $zones['geo_zone_name']; ?> |
geo_zone_id) ) { echo ''; } else { echo ''; } ?> |
MoveNext();
}
?>
display_count($zones_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, $nzPage, TEXT_DISPLAY_NUMBER_OF_TAX_ZONES); ?> |
display_links($zones_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $nzPage, '', 'zpage'); ?> |
|
geo_zone_id . '&action=new_zone') . '">' . oos_button(BUTTON_INSERT) . ''; ?> |
|
'' . TEXT_INFO_HEADING_NEW_SUB_ZONE . '');
$contents = array('form' => oos_draw_form('id', 'zones', $aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $nsPage . '&sID=' . $_GET['sID'] . '&saction=insert_sub', 'post', FALSE));
$contents[] = array('text' => TEXT_INFO_NEW_SUB_ZONE_INTRO);
$contents[] = array('text' => '
' . TEXT_INFO_COUNTRY . '
' . oos_draw_pull_down_menu('zone_country_id', oos_get_countries(TEXT_ALL_COUNTRIES), '', 'onChange="update_zone(this.form);"'));
$contents[] = array('text' => '
' . TEXT_INFO_COUNTRY_ZONE . '
' . oos_draw_pull_down_menu('zone_id', oos_prepare_country_zones_pull_down()));
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_INSERT) . ' ' . BUTTON_CANCEL . '');
break;
case 'edit':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_EDIT_SUB_ZONE . '');
$contents = array('form' => oos_draw_form('id', 'zones', $aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $nsPage . '&sID=' . $sInfo->association_id . '&saction=save_sub', 'post', FALSE));
$contents[] = array('text' => TEXT_INFO_EDIT_SUB_ZONE_INTRO);
$contents[] = array('text' => '
' . TEXT_INFO_COUNTRY . '
' . oos_draw_pull_down_menu('zone_country_id', oos_get_countries(TEXT_ALL_COUNTRIES), $sInfo->zone_country_id, 'onChange="update_zone(this.form);"'));
$contents[] = array('text' => '
' . TEXT_INFO_COUNTRY_ZONE . '
' . oos_draw_pull_down_menu('zone_id', oos_prepare_country_zones_pull_down($sInfo->zone_country_id), $sInfo->zone_id));
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_UPDATE) . ' ' . BUTTON_CANCEL . '');
break;
case 'delete':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_SUB_ZONE . '');
$contents = array('form' => oos_draw_form('id', 'zones', $aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $nsPage . '&sID=' . $sInfo->association_id . '&saction=deleteconfirm_sub', 'post', FALSE));
$contents[] = array('text' => TEXT_INFO_DELETE_SUB_ZONE_INTRO);
$contents[] = array('text' => '
' . $sInfo->countries_name . '');
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_DELETE) . ' ' . BUTTON_CANCEL . '');
break;
default:
if (isset($sInfo) && is_object($sInfo)) {
$heading[] = array('text' => '' . $sInfo->countries_name . '');
$contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_EDIT) . ' ' . oos_button(BUTTON_DELETE) . '');
$contents[] = array('text' => '
' . TEXT_INFO_DATE_ADDED . ' ' . oos_date_short($sInfo->date_added));
if (oos_is_not_null($sInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . oos_date_short($sInfo->last_modified));
}
break;
}
} else {
switch ($action) {
case 'new_zone':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_NEW_ZONE . '');
$contents = array('form' => oos_draw_form('id', 'zones', $aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $_GET['zID'] . '&action=insert_zone', 'post', FALSE));
$contents[] = array('text' => TEXT_INFO_NEW_ZONE_INTRO);
$contents[] = array('text' => '
' . TEXT_INFO_ZONE_NAME . '
' . oos_draw_input_field('geo_zone_name'));
$contents[] = array('text' => '
' . TEXT_INFO_ZONE_DESCRIPTION . '
' . oos_draw_input_field('geo_zone_description'));
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_INSERT) . ' ' . BUTTON_CANCEL . '');
break;
case 'edit_zone':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_EDIT_ZONE . '');
$contents = array('form' => oos_draw_form('id', 'zones', $aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $zInfo->geo_zone_id . '&action=save_zone', 'post', FALSE));
$contents[] = array('text' => TEXT_INFO_EDIT_ZONE_INTRO);
$contents[] = array('text' => '
' . TEXT_INFO_ZONE_NAME . '
' . oos_draw_input_field('geo_zone_name', $zInfo->geo_zone_name));
$contents[] = array('text' => '
' . TEXT_INFO_ZONE_DESCRIPTION . '
' . oos_draw_input_field('geo_zone_description', $zInfo->geo_zone_description));
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_UPDATE) . ' ' . BUTTON_CANCEL . '');
break;
case 'delete_zone':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_ZONE . '');
$contents = array('form' => oos_draw_form('id', 'zones', $aContents['geo_zones'], 'zpage=' . $nzPage . '&zID=' . $zInfo->geo_zone_id . '&action=deleteconfirm_zone', 'post', FALSE));
$contents[] = array('text' => TEXT_INFO_DELETE_ZONE_INTRO);
$contents[] = array('text' => '
' . $zInfo->geo_zone_name . '');
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_DELETE) . ' ' . BUTTON_CANCEL . '');
break;
default:
if (isset($zInfo) && is_object($zInfo)) {
$heading[] = array('text' => '' . $zInfo->geo_zone_name . '');
$contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_EDIT) . ' ' . oos_button(BUTTON_DELETE) . '');
$contents[] = array('text' => '
' . TEXT_INFO_DATE_ADDED . ' ' . oos_date_short($zInfo->date_added));
if (oos_is_not_null($zInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . oos_date_short($zInfo->last_modified));
$contents[] = array('text' => '
' . TEXT_INFO_ZONE_DESCRIPTION . '
' . $zInfo->geo_zone_description);
}
break;
}
}
if ( (oos_is_not_null($heading)) && (oos_is_not_null($contents)) ) {
?>
infoBox($heading, $contents);
?>
|