SelectMode funktioniert nicht

Xching

Erfahrenes Mitglied
Hallo Zusammen,

Ich habe Problem, dass $selectMode 0 und 1 nicht funktioniert,wenn ich so schreibe aber wenn ich umgekehrt die Funktion Movegruppe2 anstatt Movegruppe einsetze, wird dann $selectMode 3 und 4 nicht funktioniert, ich hoffe dass ihr mir weiter helfen könntet.

PHP:
    if ($id==$id2 || $_SESSION['selectbox']==0) {
	// Gruppe ändern
	$seats=$saalplan->selectGruppe($id,$id2);
      

      } elseif ($id<>'' && $id2<>'') {
	// Verschieben
	if($selectMode==3 && $selectMode==4){
	
	$seats=$saalplan->moveGruppe($id,$id2,$dx,$dy);
	
	}elseif($selectMode==0 && $selectMode==1){
	
	$seats=$saalplan->moveGruppe2($id,$id2,$dx,$dy);
	
	}else 
        $seats=$saalplan->moveGruppe2($id,$id2,$dx,$dy);
	
      }

ClasssaalplanEdit.php
PHP:
  function moveGruppe($id,$id2,$dx,$dy) {

     debug_log($this->selectSeats,"sel");
    // Alte Position
    $pos1=$this->getCoord($id2);
    // Neue Position
    $pos2=$this->getCoord($id);
    
 $erg=$this->selectSeat($pos1['row'],$pos1['col']);
 
 
if ($_SESSION['selectbox.minx']>0) {
      // Originalposition setzen
      $pos1['row']=$_SESSION['selectbox.minx'];
      $pos1['col']=$_SESSION['selectbox.miny'];
     }
     $diffx=$pos2['row']-$pos1['row']-$dx;
     $diffy=$pos2['col']-$pos1['col']-$dy;
    
 if(is_array($grid)){
      foreach($grid as $nr => $grid) {
  
      // Alte Plätze lÃÂÂschen
      $this->delete($grid);
      // Plätze verschieben
      $this->moveGr($grid,$diffx,$diffy);
      $this->moveSeats($grid,$diffx,$diffy);
      // Neue Plätze zeichnen
      $this->draw($grid);
      
      }
 }
elseif(is_array($_SESSION['groupid.select']['grid'])) {
      if (in_array($erg['grid'],$_SESSION['groupid.select']['grid'])) {
       // Zu bewegende Reihe inner halb der Selketion
        $grids=$_SESSION['groupid.select']['grid'];
      }elseif ($grid==0) {
      // $erg=$this->selectSeat($pos1['row'],$pos1['col']);
       $grids=array($erg['grid']);
     }
     else {
        //$erg=$this->selectSeat($pos1['row'],$pos1['col']);
        $grids=array($erg['grid']);
       }
       $grids=explode(",",$grid);
       
    $erg=$this->selectSeat($pos1['row'],$pos1['col']); 
      
    debug_log($this->selectSeats,"sel");
    
   if (is_array($grids)) {
      foreach($grids as $nr => $grid) {
      
      // Alte Plaetze loeschen
      $this->delete($grid);
      // Plaetze verschieben
      $this->moveGr($grid,$diffx,$diffy);
      $this->moveSeats($grid,$diffx,$diffy);
      // Neue Plaetze zeichnen
      $this->draw($grid);
      }
    }
}
 //debug_log("4","mv2.log"
 elseif(is_array($_SESSION['groupid.select']['spid'])) {
   if(in_array($erg['spid'],$_SESSION['groupid.select']['spid']) ) {
         // Zu bewegende Reihe inner halb der Selketion
        $seats = $this->getSeats($_SESSION['groupid.select']['spid'],1,1);
        debug_log($seats,'mv.log');
       }else 
        // $this->deselect1();
         $seats=array($erg['spid']);
       
     debug_log($this->selectSeats,"sel");

      // debug_log($seats,'mv.log');
    foreach($seats as $nr => $spid){
      // Selection loeschen

      debug_log("1","mv2.log");

      $this->delete1($spid['spid']);
      // Pleatze verschieben
      debug_log("2","mv2.log");
      $this->moveSeats1($spid['spid'],$diffx,$diffy);
      // Selektion zeichnen
      debug_log("3","mv2.log");
      $this->draw1($spid['spid']);
      debug_log("4","mv2.log");

     }
    }
 
    $ret=array('select'=>$this->selectSeats,
		 'draw'=>$this->drawSeats,
		 'delete'=>$this->deleteSeats,
     'deselect'=>$this->deselectSeats,
		 'group'=>$this->group,
		 'call'=>$this->jsCall,
		 'jscript'=>$this->jscript,
		 );
    debug_log($ret,'mv.log');
    
    return $ret;
}
  
function moveGruppe2($id,$id2,$dx,$dy) {
     // Alte Position
     $pos1=$this->getCoord($id2);
     // Neue Position
     $pos2=$this->getCoord($id);
     
      // Gruppe auswählen
     //AB//
     if (is_array($_SESSION['groupid.select']['grid'])) {
       $grids=$_SESSION['groupid.select']['grid'];
       }
       //EAB//
       elseif ($_SESSION['selectbox']>0) {
       $grids=array($_SESSION['selectbox']);
     } elseif ($grid==0) {
       $erg=$this->selectSeat($pos1['row'],$pos1['col']);
       $grids=array($erg['grid']);
     } elseif ($this->selected>0) {
       $grids=array($this->selected);
     } else {
       $grids=explode(",",$grid);
     }
     
     //debug_log($grids,'mv.log');
    
    if ($_SESSION['selectbox.minx']>0) {
       // Originalposition setzen
       $pos1['row']=$_SESSION['selectbox.minx'];
       $pos1['col']=$_SESSION['selectbox.miny'];
       
    }
    
     $diffx=$pos2['row']-$pos1['row']-$dx;
     $diffy=$pos2['col']-$pos1['col']-$dy;
    
     if (is_array($grids)) {
     foreach($grids as $nr => $grid) {
      
       // Alte Plätze lÃÂschen
       $this->delete($grid);
       // Plätze verschieben
       $this->moveGr($grid,$diffx,$diffy);
       $this->moveSeats($grid,$diffx,$diffy);
       // Neue Plätze zeichnen
       $this->draw($grid);
     }
     }
 elseif(is_array($_SESSION['groupid.select']['spid'])) {
  if(in_array($erg['spid'],$_SESSION['groupid.select']['spid']) ) {
         // Zu bewegende Reihe inner halb der Selketion
        $seats = $this->getSeats($_SESSION['groupid.select']['spid'],1,1);
        debug_log($seats,'mv.log');
       }else 
        // $this->deselect1();
         $seats=array($erg['spid']);
       
     debug_log($this->selectSeats,"sel");

      // debug_log($seats,'mv.log');
    foreach($seats as $nr => $spid){
      // Selection loeschen

      debug_log("1","mv2.log");

      $this->delete1($spid['spid']);
      // Pleatze verschieben
      debug_log("2","mv2.log");
      $this->moveSeats1($spid['spid'],$diffx,$diffy);
      // Selektion zeichnen
      debug_log("3","mv2.log");
      $this->draw1($spid['spid']);
      debug_log("4","mv2.log");

     }
    }
     
      return array('select'=>$this->selectSeats,
      'draw'=>$this->drawSeats,
      'delete'=>$this->deleteSeats,
      'deselect'=>$this->deselectSeats,
      'group'=>$this->group,
      'call'=>$this->jsCall,
      'jscript'=>$this->jscript,
      );
    
   }
 
Zurück