PHP Code:
?php
use Resource\Collection\ArrayList;
use Resource\Utility\Curl;
class LevelupView extends View{
public function click(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$adopt = $this->getField("adopt");
$reward = $this->getField("reward")->getValue();
$document->setTitle("{$this->lang->gave} {$adopt->getName()} one {$this->lang->unit}");
$image = $adopt->getImage("gui");
$image->setLineBreak(TRUE);
$summary = new Division;
$summary->setAlign(new Align("center"));
$summary->add($image);
$summary->add(new Comment("{$this->lang->gave}{$adopt->getName()} one {$this->lang->unit}."));
$summary->add(new Comment($this->lang->encourage));
$summary->add(new Comment("<br> You have earned {$reward} {$mysidia->settings->cost} for leveling up this adoptable. "));
$summary->add(new Comment("You now have {$mysidia->user->getcash()} {$mysidia->settings->cost}"));
$document->add($summary);
}
public function siggy(){
}
public function daycare(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle($this->lang->daycare_title);
$document->addLangvar($this->lang->daycare, TRUE);
$daycare = $this->getField("daycare");
$adopts = $daycare->getAdopts();
$daycareTable = new Table("daycare", "", FALSE);
$daycareTable->setBordered(FALSE);
$total = $daycare->getTotalAdopts();
$index = 0;
for($row = 0; $row < $daycare->getTotalRows(); $row++){
$daycareRow = new TRow("row{$row}");
for($column = 0; $column < $daycare->getTotalColumns(); $column++){
$adopt = new OwnedAdoptable($adopts[$index]);
$cell = new ArrayList;
$cell->add(new Link("levelup/click/{$adopt->getAdoptID()}", $adopt->getImage("gui"), TRUE));
$cell->add(new Comment($daycare->getStats($adopt)));
$daycareCell = new TCell($cell, "cell{$index}");
$daycareCell->setAlign(new Align("center", "center"));
$daycareRow->add($daycareCell);
$index++;
if($index == $total) break;
}
$daycareTable->add($daycareRow);
}
$document->add($daycareTable);
if($pagination = $daycare->getPagination()) $document->addLangvar($pagination->showPage());
}
public function publicprofile(){
$mysidia = Registry::get("mysidia");
$adopt = $this->getField("adopt");
$adoptcurrentlevel = $adopt->currentlevel;
$document = $this->document;
$document->setTitle("Viewing {$adopt->getName()}'s profile");
if($adopt->hasNextLevel()){
$nextLevel = $adopt->getNextLevel();
#$requiredClicks = $nextLevel->getRequiredClicks();
$gender_lookup = $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
if ($gender_lookup == "m") { $gender = "Male"; $pronoun = "him"; } else { $gender = "Female"; $pronoun = "her"; }
$alternates_lookup = $mysidia->db->select("owned_adoptables", array("usealternates"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
if ($mysidia->user->username == $adopt->getOwner()){ $manage_btn = "<a class='btn btn-sm btn-info' href='../../myadopts/manage/{$adopt->getAdoptID()}'><i class='fa fa-gear'></i> Manage</a>"; } else { $manage_btn = ""; }
if($adopt->hasNextLevel()){
$level = $adopt->getNextLevel();
$levelupClicks = $adopt->getLevelupClicks();
$document->add(new Comment("(LVL ".$level->getLevel()." in ".$levelupClicks." more EXP)"));
}
else { $document->add(new Comment("(MAX)")); }
if($adopt->getTradeStatus() == "fortrade") { $tradestatus = "<b>For Trade</b>"; }
else { $tradestatus = "<b>Not For Trade</b>"; }
// If you've already seen the pet today:
if ($adopt->hasVoter($mysidia->user, $date)){
$document->add(new Comment("<a class='btn btn-sm btn-info disabled' href='../../levelup/click/{$adopt->getAdoptID()}'><i class='fa fa-paw'></i> Already Fed</a>"));
}
// If you haven't seen the pet today:
else {
$document->add(new Comment("<a class='btn btn-sm btn-info' href='../../levelup/click/{$adopt->getAdoptID()}'><i class='fa fa-paw'></i> Feed</a>"));
};
}
$document->add(new Link("myadopts", $adopt->getImage("gui")));
$adoptabletype = $mysidia->db->select("adoptables", array(), "type='{$adopt->getType()}'")->fetchObject();
$level = $adopt->getCurrentLevel();
$bio = $adopt->getPetbio();
$document->add(new Comment("<ul>
<li>Lives With: <a href='/profile/view/{$adopt->getOwner()}'>{$adopt->getOwner()}</a></li>
<li>Species: {$adopt->getType()}</li>
<li>Gender: {$gender}</li>
<li>LVL: {$adopt->getCurrentLevel()} {$toNext}</li>
<li>Total EXP: {$adopt->getTotalClicks()}</li>
<li>Trade Status: {$tradestatus}</li>
<li>Bio: {$bio}</li>
")) ;
}
}
?>
Here it is. I'm also trying to figure out how to put a button in on the lvl up page (you've fed blah blah and earned this much cash) that links to the public profile as well as it's only available if you've already fed them.