Thread: Mys 1.3.1 Group sort
View Single Post
  #57  
Old 08-31-2018, 09:38 AM
draugluin's Avatar
draugluin draugluin is offline
Member
 
Join Date: Oct 2011
Location: germany
Posts: 120
Gender: Unknown/Other
Credits: 10,753
draugluin is on a distinguished road
Default

and here come's the part, which allows you, to assign a group (from the existing groups) to your adopt.

I hope, it works indeed for all

in myadopts.php ... after the closing tag ( } ) for the freeze-function


PHP Code:
public function changegroup(){        
    
$mysidia Registry::get("mysidia");
    
$this->setField("adopt"$this->adopt);  
    } 
and in myadoptsview.php after the closing tag ( } ) for the freeze-function

PHP Code:
public function changegroup(){
    
$mysidia Registry::get("mysidia");
    
$document $this->document;
    
$document->setTitle(" Change group ");
    
$adopt $this->getField("adopt");  
    
$username $mysidia->user->username;
    
$uid $mysidia->user->uid;
     
    
    
$stmt20 $mysidia->db->select("pet_groups", array(), "uid='{$uid}'");
            
            
$document->add(new Comment("
                <b>Choose a group:</b><br>
                 
                 <form method='post' action=''>
                        <select name='groups' id='groups'>
                        ^<option value='0'>choose</option>"
));
            
            while(
$row $stmt20->fetchObject()) {
                  
$id $row->id;
                  
$name $row->name;
                  
$document->add(new Comment("
                    <option value='
{$id}'>{$name}</option>"));
            }
            
$document->add(new Comment("
                        </select>  
                        <input type='submit' value='go'>
                    </form>
                      
                    "
FALSE));
                    
            if(
$mysidia->input->post("groups")){
            
$wahl $mysidia->input->post("groups");
            
$new $mysidia->db->select("pet_groups", array("name"), "id='{$wahl}'")->fetchcolumn();   
            
$mysidia->db->update("owned_adoptables", array("pet_groups" => $new), "aid ='{$adopt->getAdoptID()} ' and owner='{$mysidia->user->username}'");  
             
$document->add(new Comment("  Your adopt is now grouped to :{$new} <br>
                        <a href='/myadopts/manage/
{$adopt->getAdoptID()}'>back to the adopt</a>   ")); 
          }        
                    
        
          
    } 
and somewhere by the list of name, type etc.

PHP Code:
 <a href='/myadopts/changegroup/{$aid}'>(changegroup)</a

have fun
__________________
Reply With Quote