Blame | Letzte Änderung | Log anzeigen | RSS feed
<?php/*** @package Content-management* @author Webagentur Niewerth <tiefland@weban.de>* @copyright 2011 Webagentur Niewerth* @license propietary http://www.weban.de* @version $Rev: 3931 $* @filesource**//**** @package Content-management* @author Webagentur Niewerth <tiefland@weban.de>* @copyright 2011 Webagentur Niewerth*/// SVN: $Id: optionen_kopieren.php 3931 2011-09-16 08:17:57Z tiefland $require_once "../toolbox/common.php";if ( isset( $_POST["dir"] ) ){$dir = filter_input( INPUT_POST, "dir", FILTER_VALIDATE_INT );foreach ( $_POST["Option"] as $opt_id => $active ){if ( $active ){$sum[$opt_id] = array_sum( $_POST["Value"][$opt_id] );}else{$sum[$opt_id] = 0;}}$sql = "SELECTa.IDFROMartikel aWHEREFather=$dirANDLanguage='" . $_SESSION["language"] . "'";$res = mysql_query( $sql );while ( $row = mysql_fetch_assoc( $res ) ){$a_id = $row["ID"];$sql_d = "DELETE FROMFeature_to_WareWHEREWare = $a_id";$res_d = mysql_query( $sql_d );foreach ( $sum as $option_id => $value ){if ( $value ){$sql_i = "INSERT INTOFeature_to_Ware(Ware,Feature,Feature_options)VALUES($a_id,$option_id,$value)";$res_i = mysql_query( $sql_i );}}}//exit;header( "Location: directory.php?action=edit&ID=" . $dir );} elseif ( isset( $_GET["dir"] ) ){$dir = filter_input( INPUT_GET, "dir", FILTER_VALIDATE_INT );$sql = "SELECTf.ID,f.NameFROMFeatures fWHEREf.Language='" . $_SESSION["language"] . "'";$res = mysql_query( $sql );while ( $feature = mysql_fetch_assoc( $res ) ){$sql_fo = "SELECTValue,bitFROMFeature_optionsWHEREFeature=" . $feature["ID"] . "ORDER BYID,bit";$res_fo = mysql_query( $sql_fo );while ( $row_fo = mysql_fetch_assoc( $res_fo ) ){$row_fo["bit_input"]= 1 << $row_fo["bit"];$feature["options"][] = $row_fo;}$features[] = $feature;}$GLOBALS["ui"]->assign( "features", $features );if ( !is_null( $dir ) ){$sort = $_SESSION["tree.php"]["output"]["artikel_sort"];$sql = "SELECTa.ID,a.kurzbezeichnungFROMartikel a";if ( stristr( $_SESSION[$self]["output"]["artikel_sort"],"hersteller" ) ){$sql .= ", Herstellerkatalog hk";}$sql .= "WHEREFather=$dirANDlanguage='" . $_SESSION["language"] . "'";if ( stristr( $_SESSION["tree.php"]["output"]["artikel_sort"],"hersteller" ) ){$sql .= "AND((hk.ID=a.hersteller)OR(a.hersteller=0))";$sort = "hk.Name," . $_SESSION["tree.php"]["output"]["artikel_sort"];}$sql .= "ORDER BY$sortLIMIT 1";$res = mysql_query( $sql );$row = mysql_fetch_assoc( $res );if ( is_array( $row ) ){foreach ( $features as $f_id => $feature ){$i = $feature["ID"];$sql_fw = "SELECTFeature,Feature_options AS bitsFROMFeature_to_WareWHEREWare=" . $row["ID"] . "ANDFeature = $iORDER BYFeature";$res_fw = mysql_query( $sql_fw );$row_fw = mysql_fetch_assoc( $res_fw );foreach ( $feature["options"] as $data ){if ( $row_fw["bits"] & $data["bit_input"] ){$row_fw["values"][] = $data["bit_input"];}else{$row_fw["values"][] = null;}}$row["features"][$row_fw["Feature"]] = $row_fw;}$GLOBALS["ui"]->assign( "artikel", $row );$GLOBALS["ui"]->assign( "dir", $dir );}else{$GLOBALS["ui"]->assign( "error", true );$GLOBALS["ui"]->assign( "meld", "Keine Artikel in diesem Ordner" );}}$GLOBALS["ui"]->assign( "tpl_f", "optionen_kopieren.tpl" );$GLOBALS["ui"]->display( "page.tpl" );}?>