foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='0' AND shop='".$this->shop."' ORDER BY position") as $compoint){
$ArrNav[$compoint[id]]="";
foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$compoint[id]."' AND shop='".$this->shop."' ORDER BY position") as $firstnav){
$ArrNav[$compoint[id]][$firstnav[id]]="";
foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$firstnav[id]."' AND shop='".$this->shop."' ORDER BY position") as $secnav){
foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$secnav[id]."' AND shop='".$this->shop."' ORDER BY position") as $thirdnav){
return $this->app->DB->Select("SELECT bezeichnung FROM shopnavigation WHERE id='".$id."' LIMIT 1");
}
function DelNav(){
$form = $this->app->Secure->GetPOST("form");
$formget = $this->app->Secure->GetGET("form");
if(count($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$this->actNavID."' AND shop='".$this->shop."'"))==0){
if(count($this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position > '".($this->actPos)."' AND shop='".$this->shop."'"))>0){
foreach($this->app->DB->SelectArr("SELECT id,position FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position >'".($this->actPos)."' AND shop='".$this->shop."' ORDER BY position") as $key => $id){
$this->app->DB->Update("UPDATE shopnavigation SET position='".($id[position]-1)."' WHERE id='".$id[id]."' AND shop='".$this->shop."'");
}
}
// seiten verknuepfung anpassen
// $this->app->DB->Update("UPDATE page SET nav_id='".$this->actCompoint."' WHERE nav='".$this->actNavID."'");
$this->app->DB->Delete("DELETE FROM shopnavigation WHERE id='".$formget[btnDel]."' AND shop='".$this->shop."' LIMIT 1");
$id = $this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position ='".($this->actPos-1)."' AND shop='".$this->shop."'");
if(is_numeric($id)){ $this->actNavID = $id;}
else {
if($this->actCompoint!=0){
$this->actNavID = $this->actCompoint;
}
else {
$this->actNavID = $this->app->DB->Select("SELECT id FROM shopnavigation WHERE AND position ='1' AND shop='".$this->shop."' LIMIT 1");
}
}
}else {
$this->Alert("Navigation ".$this->actBezeichnung." kann nicht gelöscht werden! Entfernen Sie zuerst alle Unternavigationen.");
}
}
function NewNav(){
$form = $this->app->Secure->GetPOST("form");
$formget = $this->app->Secure->GetGET("form");
if(count($this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position > '".($this->actPos)."' AND shop='".$this->shop."'"))>0){
foreach($this->app->DB->SelectArr("SELECT id,position FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position >'".($this->actPos)."' AND shop='".$this->shop."' ORDER BY position") as $key => $id){
$this->app->DB->Update("UPDATE shopnavigation SET position='".($id[position]+1)."' WHERE id='".$id[id]."' AND shop='".$this->shop."'");
}
}
// save plugin
$this->app->DB->Insert("INSERT INTO shopnavigation (id,parent,position,bezeichnung,plugin,shop) VALUES ('','".$this->actCompoint."','".($this->actPos+1)."','".$formget[btnNew]."','".$newPage."',".$this->shop.")");
$this->actNavID = $this->app->DB->GetInsertID();
// change page description and nav description = desc (page_id);
//$this->app->DB->Update("UPDATE page SET description='".$form[btnNew]."', nav_id='".$this->actNavID."' WHERE id='".$newPage."' LIMIT 1");
}
function SaveNav(){
$form = $this->app->Secure->GetPOST("form");
$this->app->DB->Update("UPDATE shopnavigation SET bezeichnung='".$form[bezeichnung]."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
$this->app->DB->Update("UPDATE shopnavigation SET bezeichnung_en='".$form[bezeichnung_en]."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
$this->app->DB->Update("UPDATE shopnavigation SET plugin='".$form[plugin]."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
if($form[plugin]=="artikel")
$this->app->DB->Update("UPDATE shopnavigation SET pluginparameter='".$form[parameter_artikel]."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
if($form[plugin]=="gruppe")
$this->app->DB->Update("UPDATE shopnavigation SET pluginparameter='".$form[parameter_gruppe]."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
if($form[plugin]=="PageID")
$this->app->DB->Update("UPDATE shopnavigation SET pluginparameter='".$form[parameter_inhalt]."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
if($form[plugin]=="Link")
$this->app->DB->Update("UPDATE shopnavigation SET pluginparameter='".$form['Link']."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
if($form[plugin]=="External")
$this->app->DB->Update("UPDATE shopnavigation SET pluginparameter='".$form['External']."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
}
function PosLeft(){
$form = $this->app->Secure->GetPOST("form");
if($this->actDeep > 1){
$newcompoint = $this->app->DB->Select("SELECT parent FROM shopnavigation WHERE id='".$this->actCompoint."' AND shop='".$this->shop."' LIMIT 1");
$newpos = $this->app->DB->Select("SELECT position FROM shopnavigation WHERE id='".$this->actCompoint."' AND shop='".$this->shop."' LIMIT 1")+1;
if($newpos!="" && $newcompoint!=""){
$tmppos = $newpos;
if(count($this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$newcompoint."' AND position >='".$tmppos."' AND shop='".$this->shop."'"))>0){
foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$newcompoint."' AND position >='".$tmppos."' AND shop='".$this->shop."' ORDER BY position") as $key => $id){
$tmppos++;
//echo "danach (main) id $id[0] com = $newcompoint position ".$tmppos."<br>";
$this->app->DB->Update("UPDATE shopnavigation SET position='".$tmppos."' WHERE id='".$id[id]."' AND shop='".$this->shop."'");
}
}
//echo "new position $newpos new com $newcompoint ".$this->actNavID."<br>";
$sql = "UPDATE shopnavigation SET position='".$newpos."',parent='".$newcompoint."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'";
$this->app->DB->Update($sql);
}
$pos = 0;
if(count($this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actNavID."' AND shop='".$this->shop."'"))>0){
foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$this->actNavID."' AND shop='".$this->shop."' ORDER BY position") as $key => $id){
$pos++;
//echo "unternav id $id[0] position ".$pos."<br>";
$this->app->DB->Update("UPDATE shopnavigation SET position='".$pos."' WHERE id='".$id[id]."' AND shop='".$this->shop."'");
}
}
if(count($this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position > '".$this->actPos."' AND shop='".$this->shop."'"))>0){
foreach($this->app->DB->SelectArr("SELECT id,position FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position > '".$this->actPos."' AND shop='".$this->shop."' ORDER BY position") as $key => $id){
$pos++;
//echo "danach anpassen (intern) id $id[0] position ".$pos." com ".$this->actNavID."<br>";
$this->app->DB->Update("UPDATE shopnavigation SET position='".$pos."', parent='".$this->actNavID."' AND shop='".$this->shop."' WHERE id='".$id[id]."'");
}
}
}
}
function PosRight(){
$form = $this->app->Secure->GetPOST("form");
$newcompoint = $this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position = '".($this->actPos-1)."' AND shop='".$this->shop."' LIMIT 1");
//echo "com ".$this->actCompoint." position ".($this->actPos)."<br>";
$newpos = $this->app->DB->Count("SELECT id FROM shopnavigation WHERE parent='".$newcompoint."' AND shop='".$this->shop."'") + 1;
//echo "newcompoint $newcompoint new position $newpos<br>";
if($newcompoint!=""){
if($newpos!="" && $newcompoint!=""){
$this->app->DB->Update("UPDATE shopnavigation SET position='".$newpos."', parent='".$newcompoint."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
//echo("UPDATE shopnavigation SET position='".$newpos."', parent='".$newcompoint."' WHERE id='".$this->actNavID."' AND shop='".$this->shop."'");
}
if(count($this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actNavID."' AND shop='".$this->shop."'")) > 0){
foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$this->actNavID."' AND shop='".$this->shop."' ORDER BY position") as $key => $id){
//echo "id {$id[id]} position ".++$newpos." newcom $newcompoint<br>";
//$this->app->DB->Update("UPDATE shopnavigation SET position='".(++$newpos)."',parent='".$newcompoint."' WHERE id='".$id[id]."' AND shop='".$this->shop."'");
}
}
if(count($this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position > '".$this->actPos."' AND shop='".$this->shop."'")) > 0){
$newpos = $this->actPos;
foreach($this->app->DB->SelectArr("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position > '".$this->actPos."' AND shop='".$this->shop."' ORDER BY position") as $key => $id){
//echo "id {$id[id]} position ".$newpos++."<br>";
$this->app->DB->Update("UPDATE shopnavigation SET position='".($newpos++)."' WHERE id='".$id[id]."' AND shop='".$this->shop."'");
//echo("UPDATE shopnavigation SET position='".($newpos++)."' WHERE id='".$id[id]."' AND shop='".$this->shop."'");
}
}
}
}
function PosUp(){
$form = $this->app->Secure->GetPOST("form");
// id where position > actPos
$pos = $this->app->DB->Select("SELECT position FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position = '".($this->actPos-1)."' AND shop='".$this->shop."' LIMIT 1");
$id = $this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position = '".($this->actPos-1)."' AND shop='".$this->shop."' LIMIT 1");
if(is_numeric($pos)){
$this->app->DB->Update("UPDATE shopnavigation SET position='".$this->actPos."' WHERE parent='".$this->actCompoint."' AND id='".$id."' AND shop='".$this->shop."'");
$this->app->DB->Update("UPDATE shopnavigation SET position='".$pos."' WHERE parent='".$this->actCompoint."' AND id='".$this->actNavID."' AND shop='".$this->shop."'");
}
}
function PosDown(){
$form = $this->app->Secure->GetPOST("form");
// id where position > actPos
$pos = $this->app->DB->Select("SELECT position FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position = '".($this->actPos+1)."' AND shop='".$this->shop."' LIMIT 1");
$id = $this->app->DB->Select("SELECT id FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position = '".($this->actPos+1)."' AND shop='".$this->shop."' LIMIT 1");
//echo "new position ".$pos." alt position ".$this->actPos;
if(is_numeric($pos)){
$this->app->DB->Update("UPDATE shopnavigation SET position='".$this->actPos."' WHERE parent='".$this->actCompoint."' AND id='".$id."' AND shop='".$this->shop."'");
$this->app->DB->Update("UPDATE shopnavigation SET position='".$pos."' WHERE parent='".$this->actCompoint."' AND id='".$this->actNavID."' AND shop='".$this->shop."'");
}
}
function SetVar(){
$form = $this->app->Secure->GetPOST("form");
if($this->actNavID!=""){
$this->actBezeichnung = $this->app->DB->Select("SELECT bezeichnung FROM shopnavigation WHERE id='".$this->actNavID."' AND shop='".$this->shop."' LIMIT 1");
$this->actBezeichnungEN = $this->app->DB->Select("SELECT bezeichnung_en FROM shopnavigation WHERE id='".$this->actNavID."' AND shop='".$this->shop."' LIMIT 1");
$this->actPos = $this->app->DB->Select("SELECT position FROM shopnavigation WHERE id='".$this->actNavID."' AND shop='".$this->shop."' LIMIT 1");
$this->actCompoint = $this->app->DB->Select("SELECT parent FROM shopnavigation WHERE id='".$this->actNavID."' AND shop='".$this->shop."' LIMIT 1");
$compoint = $this->actNavID;
$count = 0;
while($compoint > 0){
//sammel alle navigationen mit diesem compoint
$count++;
$compoint = $this->app->DB->Select("SELECT parent FROM shopnavigation WHERE id = '".$compoint."' AND shop='".$this->shop."'");
}
$this->actDeep = $count;
$this->actPlugin = $this->app->DB->Select("SELECT plugin FROM shopnavigation WHERE id='".$this->actNavID."' AND shop='".$this->shop."' LIMIT 1");
$this->actTarget = $this->app->DB->Select("SELECT target FROM shopnavigation WHERE id='".$this->actNavID."' AND shop='".$this->shop."' LIMIT 1");
$this->actPluginparameter = $this->app->DB->Select("SELECT pluginparameter FROM shopnavigation WHERE id='".$this->actNavID."' AND shop='".$this->shop."' LIMIT 1");
if(!is_numeric($this->app->DB->Select("SELECT position FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position = '".($this->actPos+1)."' AND shop='".$this->shop."' LIMIT 1")))$down = false;
if(!is_numeric($this->app->DB->Select("SELECT position FROM shopnavigation WHERE parent='".$this->actCompoint."' AND position = '".($this->actPos-1)."' AND shop='".$this->shop."' LIMIT 1")))$up = false;