Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2016, 11:06 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default Display different stats on Stats page

The title essentially says it all.

I would like to display an adoptable's "trophies" under the stats page. Trophies are stored in the owned_adoptables table as "trophies".

Right now in class_ownedadoptables.php all I have is this, but it is not calling the trophies;
PHP Code:
public function getTrophies(){
        return 
$this->trophies;

So I am not really sure what to do ^^; If anyone has any insight I'd greatly appreciate it!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 11-06-2016, 11:45 AM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,621
Dinocanid is on a distinguished road
Default

Well just putting the function in the class file alone won't make it show up, you have to go to the view file for that. Then you could add something like:
PHP Code:
$document->add(new Comment("Trophies: {$adopt->getTrophies()}")); 
If you're talking about the stats page that shows the random adoptables (I get it mixed up with levelup sometimes ^^;), then you would add something like:
PHP Code:
<?php

use Resource\Native\String;
use 
Resource\Collection\LinkedList;

class 
StatsView extends View{
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;        
        
$document->setTitle($this->lang->title);
        
$document->addLangvar($this->lang->default.$this->lang->top10.$this->lang->top10_text);
        
$document->add($this->getTable("top10"$this->getField("top10")));
        
$document->addLangvar($this->lang->random.$this->lang->random_text);
        
$document->add($this->getTable("rand5"$this->getField("rand5")));        
    } 

    private function 
getTable($nameLinkedList $list){
        
$table = new TableBuilder($name);
        
$table->setAlign(new Align("center""middle"));
        
$table->buildHeaders("Adoptable Image""Adoptable Name""Adoptable Owner""Total Clicks""Current Level""Trophies");    #edited this part
        
$table->setHelper(new AdoptTableHelper);
        
        
$iterator $list->iterator();
        while(
$iterator->hasNext()){
            
$adopt $iterator->next();
            
$cells = new LinkedList;
            
$cells->add(new TCell($table->getHelper()->getLevelupLink($adopt)));
            
$cells->add(new TCell($adopt->getName()));
            
$cells->add(new TCell($table->getHelper()->getOwnerProfile($adopt->getOwner())));
            
$cells->add(new String($adopt->getTotalClicks()));
            
$cells->add(new TCell($adopt->getCurrentLevel()));
            
$cells->add(new TCell($adopt->getTrophies())); #added this part
            
$table->buildRow($cells);            
        }
        return 
$table;
    }    
}
?>
(No need to replace everything, just the parts I commented)
__________________

Last edited by Dinocanid; 11-06-2016 at 11:50 AM.
Reply With Quote
  #3  
Old 11-06-2016, 03:03 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default

I do already have it in the statsview.php file, but for some reason it is unable to call the trophies.

An excerpt of my getTable function within statsview.php:
PHP Code:
    private function getTable($nameLinkedList $list){
        
$table = new TableBuilder($name);
        
$table->setAlign(new Align("center""middle"));
        
$table->buildHeaders("Image""Name""Owner""Total Clicks""Trophies");    
        
$table->setHelper(new AdoptTableHelper);
        
        
$iterator $list->iterator();
        while(
$iterator->hasNext()){
            
$adopt $iterator->next();
            
$cells = new LinkedList;
            
$cells->add(new TCell($table->getHelper()->getLevelupLink($adopt)));
            
$cells->add(new TCell($adopt->getName()));
            
$cells->add(new TCell($table->getHelper()->getOwnerProfile($adopt->getOwner())));
            
$cells->add(new String($adopt->getTotalClicks()));
            
$cells->add(new TCell($adopt->getTrophies));
            
$table->buildRow($cells);            
        }
        return 
$table;
    } 
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #4  
Old 11-06-2016, 03:06 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,621
Dinocanid is on a distinguished road
Default

Ahh, I think I see the possible problem. Did you try changing:
PHP Code:
$cells->add(new TCell($adopt->getTrophies)); 
into:
PHP Code:
$cells->add(new TCell($adopt->getTrophies())); 
__________________
Reply With Quote
  #5  
Old 11-17-2016, 04:17 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default

Only just saw your reply!

Trying it now...and I am getting this error:
Code:
Fatal error: Call to a member function select() on null in /home/inekelmy/public_html/classes/class_ownedadoptable.php on line 89
Lines 88-90 in class_ownedadoptable.php looks like this:
PHP Code:
    public function getTrophies(){
        return 
$this->trophies;
    } 
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #6  
Old 11-17-2016, 04:25 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,667
Abronsyth is on a distinguished road
Default

Wait a minute, I may have figured it out. I added this (copied from totalclicks and such) and modified it under the get function:
PHP Code:
    public function setTrophies($trophies$assignMode ""){
        if(
$assignMode == Model::UPDATE$this->save("trophies"$trophies);
        
$this->trophies $trohpies;
    } 
Yes!! It is working 8D:


This is great!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:46 AM.

Currently Active Users: 444 (0 members and 444 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636