<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
	require('load_this/load_bigware_11.php');
	require("../class_this/DeliveryTime.php");
  	$controller = new DeliveryTime($languages_id);
  if (isset($_GET['action'])){
  	switch ($_GET['action']){
  		case "add_option":
  			$controller->save_option($_POST['id'],$_POST['option']);
  		break;
  		case "update_option":
  			$controller->update_option($_POST['id'],$_POST['option']);
  		break;
  		case "delete_option":
  			$controller->update_option($_POST['id'],false);
  		break;
  		case "update_category":
  			$controller->update_category($_POST['category'],false);
  		break;
  		case "get_category_items":
  			$items = $controller->get_category_item($_POST['category_id']);
  			echo go_fetch_pull_down_menu('items_id',$items,'','required',true);
  		break;
  		case "add_product_option":
  			$items = $controller->add_product_option($_POST);
  		break;
  	} 
       if(empty($_POST['active'])) exit();  			
  }
	
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="load_this/style.css">
<link rel="stylesheet" type="text/css" href="jquery/css/overcast/jquery-ui.min.css">
	
<script language="javascript" src="load_this/menu.js"></script>
<script language="javascript" src="load_this/general.js"></script>
<script language="javascript" src="tiny_mce/tiny_mce.js"></script>
<script language="javascript" src="tiny_mce/tiny_mce_init.js"></script>
<script language="javascript" src="jquery/js/jquery.min.js"></script>
<script language="javascript" src="jquery/js/jquery-ui.min.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<?php 
	require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php');
	
 ?>
<br />	
<div id="tabs">
  <ul>
    <li><a href="#tabs-1"><?php echo PER_SITE;?></a></li>
    <li><a href="#tabs-2"><?php echo DELIVERY_TIME_OPTIONS;?></a></li>
    <li><a href="#tabs-3"><?php echo PER_CATEGORY;?></a></li>
    <li><a href="#tabs-4"><?php echo PER_PRODUCT;?></a></li>
  </ul>
    
<div id="tabs-1">	
<table border="0" width="100%" cellspacing="10" cellpadding="10">
  <tr>
</td>
     <td class="pageGeneralsign" valign="top">
<?php
 $languages = go_get_languages();
 $shippinginfo_text = "info_shipping";
 if (isset($_POST['flag'])) {
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
            $language_id = $languages[$i]['id']; 
            $sql_data_array = array('text'=>go_db_producing_input($_POST[$info_item_text.$language_id]),
            												'language_id' => $language_id);
    $existing_text = go_db_query("select id,language_id from {$shippinginfo_text}  where id=1 and language_id='".$language_id."'"); 
    if (go_db_fetch_array($existing_text)) {
        go_db_carry($shippinginfo_text, $sql_data_array, 'update', "id = 1 and language_id='".(int)$language_id."'");
     }else { 
         $sql_data_array_pages_id = array('id'=>1);
         $sql_data_array = array_merge($sql_data_array,$sql_data_array_pages_id);
          go_db_carry($info_gg_text, $sql_data_array);
			}
                             
   }//lang
  }//POST 
  $active = empty($_POST['active'])? 0: $_POST['active'];
?>
<form name="aboutusform" method="Post" action="">
 <tr>
  <td width="570" valign="top" style="font-family: Arial"><b><?php echo SITE_TITLE; ?></b></td>
 </tr>
 <tr>
  <td class="smallText" width="570"><?php echo TEXT_INFO; ?></td>
 </tr>        
<?php 
  $sql=go_db_query("SELECT * FROM {$shippinginfo_text} where id=1 ");
  $dd = array();
  while ( $row=go_db_fetch_array($sql)){
      	  $dd[$row['language_id']] =$row; 
  };
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	$language_id =  $languages[$i]['id'];
	$r = isset($dd[$language_id])?$dd[$language_id]:array() ;
	$text = isset($r['Text'])? $r['Text']: "" ;
	echo '<tr><td colspan="2">';
	echo go_picture(FOLDER_RELATIV_LANG_TEMPLATES . $languages[$i]['directory'] . '/picture/' . $languages[$i]['picture'], $languages[$i]['name']) . '&nbsp;';
	echo '</br>';
	echo '<textarea class="mce" name="'.$info_item_text.$languages[$i]['id'].'" cols="50" rows="15">'.$text.'</textarea>';
	echo '</td></tr>';
} 
?>
<tr>
  <td colspan="2">&nbsp;<input type="hidden" name="flag"></td>
</tr>
<tr>
          <td align="right" width="570"><?php echo go_picture_submit('button_update.gif', PICTURE_UPDATE); ?></td>
          <td width="413">&nbsp;</td>
</tr>
<tr>
  <td colspan="2">&nbsp;</td>
</tr>
</form>
</table>
</div>

<!--end of tabs-1 -->
<div id="tabs-2">
<?php echo '<div class="option_manager">'.$controller->render_option().'</div>'; ?>	
</div>
<div id="tabs-3">
	<fieldset>	
	<?php echo '<div class="option_manager">'.$controller->category_option().'</div>'; ?>
	</fieldset>		
</div>
<div id="tabs-4">
<?php echo '<div class="option_manager">'.$controller->product_option().'</div>'; ?>	

<?php	
?>	
</div>


</div>
<br>
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?>
<p>�</p>
<p>�</p><p><br>
</p>
<div id="statusBar">
	<div id="statusPanel">	
	<div id="statusText"></div>
</div>	
</div>	
  <script type="text/javascript">
  $(function() {
     var success_message = '<?php echo ICON_SUCCESS; ?>';	  
    $( "#tabs" ).tabs({active:<?php echo $active; ?>});//
    $('div.option_manager').on('click','button.option_action',function(event){
    	$.post(
    	 '?action='+event.target.id,	
    	$('form#option_form_'+ $(this).data('id')).serialize(),
    	function(response){
    	     window.notification.auto(success_message);
    	});
    	return false;	
    });
    $('select[name="category_id"]').on('change',function(event){
    	$('td#item_id_combo').load('?action=get_category_items',{category_id:event.target.value});
    });
	$('table').on('mouseenter mouseleave','tr.table_row',function(event){
		event.stopPropagation() ;
		$(this).toggleClass('tbCountData   tbCountDataOver');
	});
	$('table#item_lists').on('change','select',function(event){
		$.post(
    			 '?action=add_product_option',	
			$(this).next().addBack().serialize(),
			function(response){
    	     			window.notification.auto(success_message);
				if (!event.target.value.length) {
					$(event.target).parents('tr.table_row').remove();
					$('select[name="category_id"]').trigger('change');
				}
			}
		);	
	});
	window.notification = {
			timer:null,
			show:function(msg,icon){
				$("#statusText").html(msg);
				if ($("#statusPanel:hidden").length > 0 ) $("#statusPanel").slideToggle("slow");
			},
			replace:function(msg,icon){
				$("#statusText").html(msg);
			},
			auto:function(msg,icon){
				this.show(msg,icon);
				this.hide( );
			},		
			hide:function(msg,icon){
				if (msg) this.replace(msg,icon);
				if ( this.timer != null ) clearTimeout(this.timer);
				this.timer = setTimeout( function(){ $("#statusPanel").slideToggle("slow");}, 3000 );
			}		
	};
  });
  </script>
</body>
</html>
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); ?>
