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