Okay- I got it to mostly work XD Im still havign issues though- For example I did the calling codes etc- but It still wont show me the amount-
Instead for my pet it says "Spooka has Trophies"
No number..I must be missing something...
Heres my adoptsview.php file-
PHP Code:
<?php
use Resource\Native\String;
use Resource\Collection\LinkedList;
use Resource\Collection\LinkedHashMap;
class MyadoptsView extends View{
/**
* @throws Exception
*/
public function index(){
$document = $this->document;
$document->setTitle($this->lang->title);
$groups = $this->getField('groups');
$document->add($this->getField('pet_storage_info'));
$pagination = $this->getField("pagination");
$stmt = $this->getField("stmt")->get();
if($stmt->rowCount() == 0){
$document->addLangvar($this->lang->empty);
return;
}
$adopts = $stmt->fetchAll(PDO::FETCH_CLASS,'OwnedAdoptable');
foreach ($adopts as $a)
{
if ($a->class == 'Colorful') {
$categoryArray[] = $a->type;
}
else{
$categoryArray[] = $a->class;
}
}
$categories = array_unique($categoryArray);
$document->add(new Comment('<div id="tabs" class="c-tabs no-js">',false));
foreach ($categories as $tab) {
$document->add(new Comment("<a href='#' class='c-tabs-nav__link'>$tab</a>", FALSE));
}
$i = 0;
// Style for inventory like display.
$document->add(new Comment('<style>
.sc_pet {
display: inline-table;
padding: 5px;
text-align: center;
font-family: "Trebuchet MS", Helvetica, sans-serif;
font-size: 14px;
margin-bottom: 3px;
height: 300px;
}
.s_pet_panel {
border-radius: 2px;
border: 1px solid #CCC;
}
</style>', FALSE));
$document->add(new Comment("<div class='c-tab is-active'>
<div class='c-tab__content'>", FALSE));
/*
$adoptTable = new TableBuilder("adopttable", 650);
$adoptTable->setAlign(new Align("center", "middle"));
$adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
*/
foreach ($adopts as $adopt) {
if ($adopts[$i]->class == 'Colorful') {
$adopts[$i]->class = $adopts[$i]->type;
$adopts[$i]->type = 'Colorful';
}
if ($i != 0 AND ($adopts[$i]->class != $adopts[$i-1]->class))
{
//$document->add($adoptTable);
$document->add(new Comment('</div></div>',false));
$document->add(new Comment('<div class="c-tab"><div class="c-tab__content">',false));
/*
$adoptTable = new TableBuilder("adopttable", 650);
$adoptTable->setAlign(new Align("center", "middle"));
$adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
*/
}
// Display Like Inventory System
$document->add(new Comment("<div class='s_pet_panel sc_pet'>"));
$document->add(new Comment("<em>{$adopt->getName()}</em>",false));
$document->add($adopt->getGender("gui"));
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "<br><img src='{$adopt->getImageFromWithin()}'>"));
$document->add(new Comment("<br>Total Clicks: {$adopt->getTotalClicks()} for Current Level: {$adopt->getCurrentLevel()}",false));
$document->add(new Comment("</div>", FALSE));
/* Table Display
$cells = new LinkedList;
$cells->add(new TCell($adopt->getGender("gui")));
$cells->add(new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}"));
$cells->add(new TCell(new Link("myadopts/manage/{$adopt->getAdoptID()}", "<img src='{$adopt->getImageFromWithin()}'>")));
$cells->add(new TCell($adopt->getTotalClicks()));
$cells->add(new TCell($adopt->getCurrentLevel()));
$adoptTable->buildRow($cells);
*/
$i++;
}
//$document->add($adoptTable);
$document->add(new Comment(
"</div></div><script src='/js/otherTabs.js'></script>
<script>
var myTabs = tabs({
el: '#tabs',
tabNavigationLinks: '.c-tabs-nav__link',
tabContentContainers: '.c-tab'
});
myTabs.init();
</script>", FALSE));
/* Old original display code
$adoptTable = new TableBuilder("adopttable", 650);
$adoptTable->setAlign(new Align("center", "middle"));
$adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
while($aid = $stmt->fetchColumn()){
$adopt = new OwnedAdoptable($aid);
$cells = new LinkedList;
$cells->add(new TCell($adopt->getGender("gui")));
$cells->add(new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}"));
$cells->add(new TCell(new Link("myadopts/manage/{$aid}", $adopt->getImage("gui"))));
$cells->add(new TCell($adopt->getTotalClicks()));
$cells->add(new TCell($adopt->getCurrentLevel()));
$adoptTable->buildRow($cells);
}
$document->add($adoptTable);
*/
$document->addLangvar($pagination->showPage());
}
public function manage(){
$mysidia = Registry::get("mysidia");
$aid = $this->getField("aid")->getValue();
$name = $this->getField("name")->getValue();
$image = $this->getField("image");
$document = $this->document;
$document->setTitle("Managing {$name}");
$document->add($image);
$document->add(new Comment("<br><br>This page allows you to manage {$name}. Click on an option below to change settings.<br>
<center>{$name} has {$trophies} trophies!</center><br>"));
$document->add(new Link("pet/profile/$aid", ' View Public Profile', TRUE));
$document->add(new Image("templates/icons/add.gif"));
$document->add(new Link("levelup/click/{$aid}", " Level Up {$name}", TRUE));
$document->add(new Image("templates/icons/stats.gif"));
$document->add(new Link("myadopts/stats/{$aid}", " Get Stats for {$name}", TRUE));
$document->add(new Image("templates/icons/bbcodes.gif"));
$document->add(new Link("myadopts/bbcode/{$aid}", " Get BBCodes / HTML Codes for {$name}", TRUE));
$document->add(new Image("templates/icons/title.gif"));
$document->add(new Link("myadopts/rename/{$aid}", " Rename {$name}", TRUE));
$document->add(new Image("templates/icons/trade.gif"));
$document->add(new Link("myadopts/trade/{$aid}", " Change Trade status for {$name}", TRUE));
$document->add(new Image("templates/icons/freeze.gif"));
$document->add(new Link("myadopts/freeze/{$aid}", " Freeze or Unfreeze {$name}", TRUE));
$document->add(new Image("templates/icons/delete.gif"));
$document->add(new Link("pound/pound/{$aid}", " Pound {$name}", TRUE));
}
public function stats(){
$mysidia = Registry::get("mysidia");
$adopt = $this->getField("adopt");
$image = $this->getField("image");
$stmt = $this->getField("stmt")->get();
$document = $this->document;
$document->setTitle($adopt->getName().$this->lang->stats);
$document->add($image);
$document->add($adopt->getStats());
$document->addLangvar("<h2>{$adopt->getName()}'s Voters:</h2><br>{$this->lang->voters}<br><br>");
$fields = new LinkedHashMap;
$fields->put(new String("username"), new String("getUsername"));
$fields->put(new String("date"), NULL);
$fields->put(new String("username::profile"), new String("getProfileImage"));
$fields->put(new String("username::message"), new String("getPMImage"));
$voterTable = new TableBuilder("voters", 500);
$voterTable->setAlign(new Align("center"));
$voterTable->buildHeaders("User", "Date Voted", "Profile", "PM");
$voterTable->setHelper(new UserTableHelper);
$voterTable->buildTable($stmt, $fields);
$document->add($voterTable);
}
public function bbcode(){
$mysidia = Registry::get("mysidia");
$adopt = $this->getField("adopt");
$document = $this->document;
$document->setTitle($this->lang->bbcode.$adopt->getName());
$document->addLangvar($this->lang->bbcode_info);
$document->add(new Comment("<br>"));
$forumComment = new Comment("Forum BBCode: ");
$forumComment->setUnderlined();
$forumcode = "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}[/img][/url]";
$forumArea = new TextArea("forumcode", $forumcode, 4, 50);
$forumArea->setReadOnly(TRUE);
$altComment = new Comment("Alternative BBCode: ");
$altComment->setUnderlined();
$altcode = "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}"[/img][/url]";
$altArea = new TextArea("altcode", $altcode, 4, 50);
$altArea->setReadOnly(TRUE);
$htmlComment = new Comment("HTML BBCode: ");
$htmlComment->setUnderlined();
$htmlcode = "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}' target='_blank'>
<img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}' border=0></a>";
$htmlArea = new TextArea("htmlcode", $htmlcode, 4, 50);
$htmlArea->setReadOnly(TRUE);
$document->add($forumComment);
$document->add($forumArea);
$document->add($altComment);
$document->add(($mysidia->settings->usealtbbcode == "yes")?$altArea:new Comment("The Admin has disabled Alt BBCode for this site."));
$document->add($htmlComment);
$document->add($htmlArea);
}
public function rename(){
$mysidia = Registry::get("mysidia");
$adopt = $this->getField("adopt");
$image = $this->getField("image");
$document = $this->document;
if($mysidia->input->post("submit")){
$document->setTitle($this->lang->rename_success_title);
$document->add($image);
$message = "<br>{$this->lang->rename_success}{$mysidia->input->post("adoptname")}.
You can now manage {$mysidia->input->post("adoptname")} on the";
$document->addLangvar($message);
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));
return;
}
$document->setTitle($this->lang->rename.$adopt->getName());
$document->add($image);
$document->addLangvar("<br />{$this->lang->rename_default}{$adopt->getName()}{$this->lang->rename_details}<br />");
$renameForm = new FormBuilder("renameform", "", "post");
$renameForm->buildTextField("adoptname")->buildButton("Rename Adopt", "submit", "submit");
$document->add($renameForm);
}
public function updatebio(){
$mysidia = Registry::get('mysidia');
$adopt = $this->getField('adopt');
$d = $this->document;
$d->setTitle($this->lang->updatebio . $adopt->getName());
$d->addLangvar('<form method="post"><textarea name="bio" rows="10" cols="50">'.$adopt->getBio().'</textarea><br><input type="submit" name="submit" value="Update Bio"></form>');
}
public function trade(){
$mysidia = Registry::get("mysidia");
$aid = $this->getField("aid")->getValue();
$image = $this->getField("image");
$message = $this->getField("message")->getValue();
$document = $this->document;
$document->setTitle($this->lang->trade);
$document->add($image);
$document->addLangvar($message);
}
public function freeze(){
$mysidia = Registry::get("mysidia");
$adopt = $this->getField("adopt");
$image = $this->getField("image");
$message = $this->getField("message")->getValue();
$document = $this->document;
$document->setTitle($this->lang->freeze);
if($mysidia->input->get("confirm") == "confirm"){
$document->addLangvar($message);
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));
}
else{
$document->add($image);
$document->add(new Comment("<br /><b>{$adopt->getName()}'s Current Status: "));
if($adopt->isfrozen() == "yes"){
$document->add(new Image("templates/icons/freeze.gif", "Frozen"));
$document->add(new Comment("Frozen<br<br>"));
$document->add(new Comment($this->lang->freeze));
$document->add(new Image("templates/icons/unfreeze.gif", "Unfreeze"));
$document->addLangvar("<form method='post''><input type='submit' name='confirm' value='Unfreeze {$adopt->getName()}' class='button'></form>");
//$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Unfreeze this Adoptable", TRUE));
}
else{
$document->add(new Image("templates/icons/unfreeze.gif", "Not Frozen"));
$document->add(new Comment("Not Frozen<br><br>"));
$document->add(new Comment($this->lang->freeze));
$document->add(new Image("templates/icons/freeze.gif", "Greeze"));
$document->addLangvar("<form method='post'><input type='submit' name='confirm' value='Freeze {$adopt->getName()}' class='button'></form>");
//$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Freeze this Adoptable", TRUE));
}
$document->add(new Comment("<br><br>"));
$document->add(new Image("templates/icons/warning.gif"));
$document->addLangvar($this->lang->freeze_warning);
}
}
public function release(){
$document = $this->document;
$document->setTitle($this->lang->released);
$document->addLangvar($this->lang->pet_released);
}
}
The other issue Is im trying to Add the trophies also to the Petview.php
But my coder added stuff and Im not sure how to do that.. I want it in the "Skills" Tab...
Here's my Petviewphp..
PHP Code:
<?php
class PetView extends View{
public function profile(){
$mysidia = Registry::get('mysidia');
$d = $this->document;
$adopt = $this->getField('adopt');
$isdead = $adopt->isdead;
$name = $adopt->getName();
$title = 'Viewing ';
if ($isdead) {
$title = '<img src="/picuploads/dead.png"> Here Lies ';
$name .= ' <img src="/picuploads/dead.png">';
}
else{
if ($adopt->getOwner() == 'SYSTEM') {
$title = '<img src="/picuploads/shackle.png"> ' . $title;
$name .= '<img src="/picuploads/shackle.png">';
}
}
if ($adopt->getOwner() == $mysidia->user->username) $title = 'Managing ';
$d->setTitle(' ');
$d->addLangVar('<table border=1px><tr><td valign="top">');
$d->addLangvar("<b>{$title}{$name}</b><hr>");
if ($isdead == false) {
if ($adopt->getOwner() == 'SYSTEM') {
$d->addLangVar("Owned by <a href='/profile/view/POUND'>The Pound</a><br><br>");
}else{
$d->addLangVar("Owned by <a href='/profile/view/{$adopt->getOwner()}'>{$adopt->getOwner()}</a><br><br>");
}
}
if ($isdead) {
$d->addLangvar("<div style='background:url({$mysidia->path->getAbsolute()}picuploads/paw.png); position:relative; height:248px; width:268px;'><div style='background:url({$mysidia->path->getAbsolute()}picuploads/wreath.png);height:248px; width:268px;position:absolute;z-index:30;'></div><div style='position:absolute;z-index:2;left:50px;bottom:10px'>".$adopt->getImage("gui") .'</div></div>');
}else{
if ($adopt->class == 'Colorful'){
$d->addLangvar($adopt->getImage('gui'));
}else{
$d->add($adopt->getImage('gui'));
}
}
if ($isdead){
$d->addLangvar('</div>');
}
if ($adopt->isdead == false){
if($adopt->isfrozen() == 'no'){
$d->addLangvar("<br><a href='/levelup/click/{$adopt->aid}'>Play</a>");
}else{
$d->addLangvar('<br>Frozen');
}
}
$freeze = 'Freeze';
if ($adopt->isFrozen() == 'yes') $freeze = 'Unfreeze';
if ($mysidia->user->username == $adopt->getOwner()){
$d->addLangVar(" | <a href='/myadopts/manage/{$adopt->aid}'>Manage</a> | <a href='/myadopts/bbcode/{$adopt->aid}'>Codes</a> | <a href='/myadopts/freeze/{$adopt->aid}'>$freeze</a><br><a href='/pound/pound/{$adopt->aid}'>Pound $name</a><br> <a href='/pet/release/{$adopt->aid}'>Release $name</a>");
}
$d->addLangVar('</td><td valign="top">');
$d->add(new Comment('<div id="tabs" class="c-tabs no-js"><div class="c-tabs-nav">',false));
if ($adopt->class != 'Colorful') {
$d->addLangVar("<a href='#' class='c-tabs-nav__link'>Bio</a><a href='#' class='c-tabs-nav__link'>About</a>");
$d->addLangVar("</div><div class='c-tab is-active'><div class='c-tab__content'>{$adopt->getBio()}</div></div><div class='c-tab'>
<div class='c-tab__content'>{$adopt->getDescription()}</div></div>");
}else{
$d->addLangVar("<a href='#' class='c-tabs-nav__link'>Bio</a><a href='#' class='c-tabs-nav__link'>Skills</a><a href='#' class='c-tabs-nav__link'>Lineage</a><a href='#' class='c-tabs-nav__link'>Offspring</a><a href='#' class='c-tabs-nav__link'>Stats</a>");
$d->addLangVar("</div><div class='c-tab is-active'>
<div class='c-tab__content'>");
if ($mysidia->user->username == $adopt->getOwner()){
$d->addLangvar('<a href="/myadopts/updatebio/'.$adopt->aid.'">Click Here to Update Bio</a><br><br>');
}
$d->addLangvar("{$adopt->getBio()}</div></div>
<div class='c-tab'><div class='c-tab__content'><b>Sense:</b> {$adopt->sense}<br>
<b>Speed:</b> {$adopt->speed}<br>
<b>Strength:</b> {$adopt->strength}<br>
<b>Stamina:</b> {$adopt->stamina}<br></div></div>");
// Lineage
include('pedigree.php');
$offspring = []; $parent = 'sire_id';
if ($adopt->getGender() == 'f') $parent = 'dam_id';
$offspring = $mysidia->db->select('owned_adoptables', [], "$parent = {$adopt->aid}")->fetchAll(PDO::FETCH_CLASS,'OwnedAdoptable');
$d->addLangVar("<div class='c-tab'><div class='c-tab__content'><b>Offspring</b>");
if (count($offspring) == 0) $d->addLangVar('<hr>None.');
foreach ($offspring as $baby) {
$d->addLangVar("<hr><a href='/pet/profile/{$baby->aid}'>{$baby->name}<br><img src='{$baby->getImage()}'></a>");
}
$d->addLangVar('</div></div>');
$d->addLangVar("<div class='c-tab'><div class='c-tab__content'>");
$d->addLangvar("<b>Personality:</b> {$adopt->personality()}<br>
<b>Happiness:</b> {$adopt->happiness}/50<br>
<b>Hunger:</b> {$adopt->hunger}/50<br>
<b>Thirst:</b> {$adopt->thirst}/50<br>
<b>Closeness:</b> {$adopt->closeness}/50<br>
");
$d->add($adopt->getStats());
if ($adopt->breeder != null) {
$d->addLangvar("<br><br><b>Breeder:</b> <a href='/profile/view/{$adopt->breeder}'>{$adopt->breeder}</a>");
}
$d->addLangvar("</div></div>");
}
$d->addLangVar('</td></tr></table>');
$d->add(new Comment(
"<script src='/js/otherTabs.js'></script>
<script>
var myTabs = tabs({
el: '#tabs',
tabNavigationLinks: '.c-tabs-nav__link',
tabContentContainers: '.c-tab'
});
myTabs.init();
</script>", FALSE));
}
public function release(){
$d = $this->document;
$adopt = $this->getField('adopt');
$d->setTitle($this->lang->release);
$d->addLangvar($adopt->getName().'<br>'.$adopt->getImage('gui').'<br><br>');
$d->addLangvar($this->lang->release_warning);
$d->addLangvar('<br><br><form method="post" action="/myadopts/release/'.$adopt->aid.'"><label for="password">Type your password below to confirm:</label><br><input type="password" name="password"><br><input type="submit" value="Release Pet?"></form>');
}
public function bio(){
$d = $this->document;
$adopt = $this->getField('adopt');
$d->setTitle('Update Bio');
$d->addLangvar($adopt->getName().'<br>'.$adopt->getImage('gui').'<br><br>');
$d->addLangvar('<form method="post"><textarea name="bio">'.$adopt->bio.'</textarea><br><input type="submit" value="Update Bio" name="submit"></form>');
}
}
Thanks in advance.. Sorry im such a noob