To make a favpet display inthe sidebar, first in the AdminCP you'll create a
module (surprisingly not a widget):
Then in
classes/class_sidebar.php you'll need to add these functions:
PHP Code:
public function getFavPetSB(){
return $this->FavPetSB;
}
protected function setFavPetSB(){
$mysidia = Registry::get("mysidia");
$userfavpet = $mysidia->db->select("users_profile", array("favpet"), "username = '{$mysidia->user->username}'")->fetchColumn();
if ($this->userfavpet == "0"){
$this->FavPetSB = new Paragraph;
$this->FavPetSB->add(new Comment("<b>No Favorite Pet Set</b>"));
}
else{
$adopt = new OwnedAdoptable($userfavpet);
$this->FavPetSB = new Paragraph;
$this->FavPetSB->add(new Comment("<b>Favorite Pet!</b> <br/>
<a href='/myadopts/manage/{$userfavpet}'><img src='{$adopt->getImage()}'></a>
"));
}
$this->setDivision($this->FavPetSB);
}
Using "$adopt = new OwnedAdoptable($userfavpet);" you can also pull up data like {$adopt->getName()} and {$adopt->getCurrentLevel()} - these are functions found in classes/class_ownedadoptable.php, but you should also be able to use {$adopt->type} (which is not a function) to pull raw data from the database from the 'type' column - this holds the species.
But I'll get back to that. Let me know if you can at least get the pet into the sidebar and then I'll be back later help you set up a switch statement to display random phrases for pets to say.