Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Active pet widget? (http://www.mysidiaadoptables.com/forum/showthread.php?t=5064)

Kyttias 03-20-2016 11:49 PM

Ok you've made some major changes to the code because those line numbers don't correlate to anything. =/ You'll have to send me the entire code with your changes for me to fix a basic syntax error, probably. (You have to be really carefully about making sure closing brackets and quotes are never ever broken or interrupted in any way.)

I've tested it now on my site and it IS working.
http://orig09.deviantart.net/166e/f/...as-d9w06wl.gif and http://orig11.deviantart.net/60b0/f/...as-d9w085i.png

I did make a couple tiny edits just now (just to fix the div surrounding the text, it would break when a message was not there and double up accidentally, and so I fixed both) - but should have nothing to do with whether or not you have a pet.

Ittermat 03-20-2016 11:53 PM

I just added in the items, the actual pet breeds and some more stuff for them to say 0.o

Code:

<?php

/**
 * The Sidebar Class, defines a standard HTML Sidebar component.
 * It extends from the Widget class, while adding its own implementation.
 * @category Resource
 * @package Widget
 * @author Hall of Famer
 * @copyright Mysidia Adoptables Script
 * @link http://www.mysidiaadoptables.com
 * @since 1.3.3
 * @todo Not much at this point.
 *
 */

class Sidebar extends Widget{

    /**
    * The moneyBar property, specifies the money/donation bar for members.
    * @access protected
    * @var Paragraph
    */
    protected $moneyBar;
   
    /**
    * The linksBar property, stores all useful links for members.
    * @access protected
    * @var Paragraph
    */
    protected $linksBar;
   
    /**
    * The wolBar property, determines the who's online url in the sidebar.
    * @access protected
    * @var Link
    */
    protected $wolBar;
   
    /**
    * The loginBar property, specifies the loginBar for guests.
    * @access protected
    * @var FormBuilder
    */
    protected $loginBar;

    /**
    * Constructor of Sidebar Class, it initializes basic sidebar properties   
    * @access public
    * @return Void
    */
    public function __construct(){
        parent::__construct(4, "sidebar");
    }
   
    /**
    * The setDivision method, setter method for property $division.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @param GUIComponent  $module
    * @access protected
    * @return Void
    */
    protected function setDivision(GUIComponent $module){
        if(!$this->division){
            $this->division = new Division;
            $this->division->setClass("sidebar");
        }   
        $this->division->add($module);
    }



    #
    #
    #
    /**** BEGIN: FOR THE FAVPET WIDGET ****/
    public function getFavPetSB(){
        return $this->FavPetSB;
    }

    protected function setFavPetSB(){
        $mysidia = Registry::get("mysidia");
        $profile = $mysidia->user->getprofile(); 
       
        /* IF THE USER DOES *NOT* HAVE A FAVPET: */
        if ($this->userfavpet == "0"){
            $this->FavPetSB = new Paragraph;
            $this->FavPetSB->add(new Comment("<b>No Favorite Pet Set</b>"));
        }

        /* IF THE USER *DOES* HAVE A FAVPET: */
        if ($profile->getFavpetID() != "0"){
            $favpet = new OwnedAdoptable($profile->getFavpetID());
            $this->FavPetSB = new Paragraph;
            $this->FavPetSB->add(new Comment("<b>Favorite Pet!</b>"));
            $this->FavPetSB->add(new Comment("<div class='speechbubble'>{$message}</div>"));
            $this->FavPetSB->add(new Comment("<a href='/myadopts/manage/{$favpet}'><img src='{$favpet->getImage()}'></a>"));

        #
        #
        #
        /**** BEGIN: CREATE RANDOM MESSAGES ****/
            $message = "<div class='speechbubble'>";

            $status_chance = mt_rand(1, 100); 
            if ($status_chance <= 1){ # One percent chance the pet will obtain a status effect.

                /* We would apply a status effect here...*/
                $message .= "Placeholder text: A status effect would have happened here!";
                #### We'll do this later!!!

            } else { # Ninety-nine percent chance the pet will not get a status effect. Will something else happen?
                $something_chance = mt_rand(1, 100);
                if ($something_chance <= 25){ # Twenty-five percent chance something will happen.
                    $gift_chance = mt_rand(1, 100);
                    if ($gift_chance <= 5){ # Five percent chance the user will receive a gift from their pet.
                        $item_chance = mt_rand(1, 100);
                        if ($item_chance <= 50){ # Fifty percent chance the gift from their pet will be an item.

                            /* The pet has found an item for you! */                           
                            $num = mt_rand(1,5); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                            switch ($num){
                                case 1: $item = "Ball of Yarn"; break;
                                case 2: $item = "Bernard plushie"; break;
                                case 3: $item = "Madeline plushie "; break;
                                case 4: $item = "Maria plushie"; break;
                                                                case 4: $item = "Honey comb"; break;
                            }
                            $message .= "I found a {$item} for you!";
                            $newitem = new StockItem($item);
                            $newitem->append(1, $mysidia->user->username);

                        } else { # Fifty percent chance the gift from their pet will be money.

                            /* The pet has found some money for you! */
                            $currency = $mysidia->settings->cost;
                            $amount = mt_rand(100, 1000); # Between 100 and 1000
                            $message .= "Found {$amount} {$currency}!";
                            $mysidia->user->changecash($amount);

                        }
                    } else { # Twenty percent chance the pet will talk but have no gift.
                        /* No gift will be given but a neat species-specific phrase can still be said! */

                        $species = $favpet->type;                       

                        switch ($species){
                            case "Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                                                               
                            case "silver tabby Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                               
                            case "ginger tabby Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                                                                                               
                            case "tuxedo tabby Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                                       
                            case "Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;
                                                       
                                                        case "Black and white Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;
                                                       
                                                case "brown and black Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;
                                                       
                                                        case "Black and white floopy eared Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;

                            default: # If the species isn't defined above, it'll choose one of these default phrases instead.
                                $num = mt_rand(1,6);               
                                switch ($num){
                                    case 1: $message .= "What an awesome day!"; break;
                                    case 2: $message .= "Hey, did you know you're amazing?!"; break;
                                    case 3: $message .= "Inner beauty is important!"; break;
                                    case 4: $message .= "You look fantastic today!"; break;
                                                                        case 5: $message .= "You're the best!!"; break;
                                                                        case 6: $message .= "I love adventure!!"; break;
                                }
                            break;
                        }

                    }
                } else { # Seventy-five percent chance nothing will happen whatsoever.
                    /* Nothing will happen with the pet at all. */
                    $message = "";
                }
            }

            $message .= "</div>";   
        /**** END: CREATE RANDOM MESSAGES ****/
        #
        #
        #

        }       
        $this->setDivision($this->FavPetSB);
    }
    /**** END: FOR THE FAVPET WIDGET ****/
    #
    #
    #









    /**
    * The getMoneyBar method, getter method for property $moneyBar.
    * @access public
    * @return Paragraph
    */
    public function getMoneyBar(){
        return $this->moneyBar;
    }
   
    /**
    * The setMoneyBar method, setter method for property $moneyBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setMoneyBar(){
        $mysidia = Registry::get("mysidia");
        $this->moneyBar = new Paragraph;
    $this->moneyBar->add(new Comment("You have <span id='cashonhand'>{$mysidia->user->money}</span> {$mysidia->settings->cost}.")); 
       
        $donate = new Link("donate");
        $donate->setText("Donate Money to Friends");
        $this->moneyBar->add($donate);
        $this->setDivision($this->moneyBar);       
    }

    /**
    * The getLinksBar method, getter method for property $linksBar.
    * @access public
    * @return Paragraph
    */
    public function getLinksBar(){
        return $this->linksBar;
    }
   
    /**
    * The setLinksBar method, setter method for property $linksBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setLinksBar(){
        $mysidia = Registry::get("mysidia");
        $this->linksBar = new Paragraph;
        $linkTitle = new Comment("{$mysidia->user->username}'s Links:");
        $linkTitle->setBold();
        $this->linksBar->add($linkTitle);
       
        $linksList = new LinksList("ul");
        $this->setLinks($linksList);
       
        $this->linksBar->add($linksList);
        $this->setDivision($this->linksBar);   
    }

    /**
    * The setLinks method, append all links to the LinksBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setLinks(LinksList $linksList){
        $mysidia = Registry::get("mysidia");
        $stmt = $mysidia->db->select("links", array("id", "linktext", "linkurl"), "linktype = 'sidelink' ORDER BY linkorder");
        if($stmt->rowCount() == 0) Throw new Exception("There is an error with sidebar links, please contact the admin immediately for help.");
       
        while($sideLink = $stmt->fetchObject()){
            $link = new Link($sideLink->linkurl);
            $link->setText($sideLink->linktext);
            if($sideLink->linkurl == "messages"){
                $num = $mysidia->db->select("messages", array("touser"), "touser='{$mysidia->user->username}' and status='unread'")->rowCount();
                if($num > 0) $link->setText("<b>{$link->getText()} ({$num})</b>");
            }
            $link->setListed(TRUE);
            $linksList->add($link); 
        }
       
        if($mysidia->user instanceof Admin){
            $adminCP = new Link("admincp/", FALSE, FALSE);
            $adminCP->setText("Admin Control Panel");
            $adminCP->setListed(TRUE); 
            $linksList->add($adminCP);           
        }
    }
   
    /**
    * The getWolBar method, getter method for property $wolBar.
    * @access public
    * @return LinksList
    */
    public function getWolBar(){
        return $this->wolBar;
    }
   
    /**
    * The setWolBar method, setter method for property $wolBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setWolBar(){
        $mysidia = Registry::get("mysidia");
        $this->wolBar = new Link("online");
        $online = $mysidia->db->select("online", array(), "username != 'Visitor'")->rowCount();
        $offline = $mysidia->db->select("online", array(), "username = 'Visitor'")->rowCount();
        $this->wolBar->setText("This site has {$online} members and {$offline} guests online.");
        $this->setDivision($this->wolBar);       
    }
   
    /**
    * The getLoginBar method, getter method for property $loginBar.
    * @access public
    * @return FormBuilder
    */
    public function getLoginBar(){
        return $this->loginBar;
    }
   
    /**
    * The setLoginBar method, setter method for property $loginBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setLoginBar(){
        $this->loginBar = new FormBuilder("login", "login", "post");
        $loginTitle = new Comment("Member Login:");
        $loginTitle->setBold();
        $loginTitle->setUnderlined();
        $this->loginBar->add($loginTitle);

        $this->loginBar->buildComment("username: ", FALSE)
                      ->buildTextField("username")
                      ->buildComment("password: ", FALSE)
                      ->buildPasswordField("password", "password", "", TRUE)   
                      ->buildButton("Log In", "submit", "submit")
                      ->buildComment("Don't have an account?");
                     
        $register = new Link("register");
        $register->setText("Register New Account");
        $register->setLineBreak(TRUE);
        $forgot = new Link("forgotpass");
        $forgot->setText("Forgot Password?");
       
        $this->loginBar->add($register);
        $this->loginBar->add($forgot);
        $this->setDivision($this->loginBar);   
    }
}
?>


Kyttias 03-21-2016 12:16 AM

Change line 85 to this:
PHP Code:

        if ($profile->getFavpetID() == "0"){ 

And change line 96 to this:
PHP Code:

$this->FavPetSB->add(new Comment("<a href='/myadopts/manage/{$profile->getFavpetID()}'><img src='{$favpet->getImage()}'></a>")); 

Using {$profile->getFavpetID()} instead of {$favpet} should help!! Sorry about this. Those two things should fix the errors, but--


Also! Two other things. I'd also change line 95 to:
PHP Code:

            $this->FavPetSB->add(new Comment("{$message}")); 

Because we're actually adding the div elsewhere now, oops.

And at 271, we should close the message like this now:
PHP Code:

            if ($message == "") { $message ""; } else { $message .= "</div>"; }
                
        
/**** END: CREATE RANDOM MESSAGES ****/ 


Ittermat 03-21-2016 12:19 AM

No need to apologize Kyttias!! Im more than anything grateful for all the work and help you're giving me!!

It showed up but I went to go to my account to change out my favorite pet to see if it worked without one- and It gave me this error...?


Fatal error: Cannot access protected property OwnedAdoptable::$type in /home/atrocity/public_html/classes/class_sidebar.php on line 144


Should I change it to Public? or something?

ah that seems to have worked! (The extra two you added XD)

THANK YOU KYTTIAS!! YOU ARE AMAZING <3

Kyttias 03-21-2016 12:22 AM

Yeah. I wasn't quite sure how to access it by default. So in classes/class_ownedadoptable.php see if $type is in the list of variables at the top, if it is, change it, or else add it.

PHP Code:

public $type

Also see my last post again for two other additional edits you should make, just in case you missed it. :happyc:

Ittermat 03-21-2016 12:25 AM

Its working now! no errors to be found currently! THANKS!

I will let you know if something comes up though <3

Kyttias 03-21-2016 12:26 AM

Great! I made the changes to post #26 so it should be relatively safe for anyone else who comes across this thread to use without too much trouble.

Ittermat 03-21-2016 08:17 AM

Im not sure if this is because of The active pet mod? But now I cant login? It gives me these... (I couldnt highlight all of the top one...) It says my login was successful but then It puts me back to the login screen...? To login again.

/class_cookies.php on line 85

Warning: Cannot modify header information - headers already sent by (output started at /home/atrocity/public_html/classes/class_sidebar.php:1) in /home/atrocity/public_html/classes/class_cookies.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/atrocity/public_html/classes/class_sidebar.php:1) in /home/atrocity/public_html/classes/class_cookies.php on line 90

Warning: Cannot modify header information - headers already sent by (output started at /home/atrocity/public_html/classes/class_sidebar.php:1) in /home/atrocity/public_html/classes/class_cookies.php on line 92

Kyttias 03-21-2016 09:28 AM

You can try to send me the file again but it really shouldn't be related (necessarily). I mean, I can log in and out just fine with my version. :hmmm:

Header errors can be caused by a file attempting to render anything not code. Check for blank space at the beginning and end of the file and remove any that you find. But this is caused by cookies, so it thinks? In which case I'm really not sure.

Ittermat 03-21-2016 10:04 AM

Heres my file- It works amazing when im logged in... but when im not and I try to log in it wont let me... same thing with logging out- I cant do either. 0.o

I have no idea if anyone else has this issue.

Code:

<?php

/**
 * The Sidebar Class, defines a standard HTML Sidebar component.
 * It extends from the Widget class, while adding its own implementation.
 * @category Resource
 * @package Widget
 * @author Hall of Famer
 * @copyright Mysidia Adoptables Script
 * @link http://www.mysidiaadoptables.com
 * @since 1.3.3
 * @todo Not much at this point.
 *
 */

class Sidebar extends Widget{

    /**
    * The moneyBar property, specifies the money/donation bar for members.
    * @access protected
    * @var Paragraph
    */
    protected $moneyBar;
   
    /**
    * The linksBar property, stores all useful links for members.
    * @access protected
    * @var Paragraph
    */
    protected $linksBar;
   
    /**
    * The wolBar property, determines the who's online url in the sidebar.
    * @access protected
    * @var Link
    */
    protected $wolBar;
   
    /**
    * The loginBar property, specifies the loginBar for guests.
    * @access protected
    * @var FormBuilder
    */
    protected $loginBar;

    /**
    * Constructor of Sidebar Class, it initializes basic sidebar properties   
    * @access public
    * @return Void
    */
    public function __construct(){
        parent::__construct(4, "sidebar");
    }
   
    /**
    * The setDivision method, setter method for property $division.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @param GUIComponent  $module
    * @access protected
    * @return Void
    */
    protected function setDivision(GUIComponent $module){
        if(!$this->division){
            $this->division = new Division;
            $this->division->setClass("sidebar");
        }   
        $this->division->add($module);
    }



    #
    #
    #
    /**** BEGIN: FOR THE FAVPET WIDGET ****/
    public function getFavPetSB(){
        return $this->FavPetSB;
    }

    public function setFavPetSB(){
        $mysidia = Registry::get("mysidia");
        $profile = $mysidia->user->getprofile(); 
       
        /* IF THE USER DOES *NOT* HAVE A FAVPET: */
            if ($profile->getFavpetID() == "0"){ 
            $this->FavPetSB = new Paragraph;
            $this->FavPetSB->add(new Comment("<b>No Favorite Pet Set</b>"));
        }

        /* IF THE USER *DOES* HAVE A FAVPET: */
        if ($profile->getFavpetID() != "0"){
            $favpet = new OwnedAdoptable($profile->getFavpetID());
            $this->FavPetSB = new Paragraph;
            $this->FavPetSB->add(new Comment("<b>Favorite Pet!</b>"));
            $this->FavPetSB->add(new Comment("{$message}")); 
            $this->FavPetSB->add(new Comment("<a href='/myadopts/manage/{$profile->getFavpetID()}'><img src='{$favpet->getImage()}'></a>")); 

        #
        #
        #
        /**** BEGIN: CREATE RANDOM MESSAGES ****/
            $message = "<div class='speechbubble'>";

            $status_chance = mt_rand(1, 100); 
            if ($status_chance <= 1){ # One percent chance the pet will obtain a status effect.

                /* We would apply a status effect here...*/
                $message .= "Placeholder text: A status effect would have happened here!";
                #### We'll do this later!!!

            } else { # Ninety-nine percent chance the pet will not get a status effect. Will something else happen?
                $something_chance = mt_rand(1, 100);
                if ($something_chance <= 25){ # Twenty-five percent chance something will happen.
                    $gift_chance = mt_rand(1, 100);
                    if ($gift_chance <= 5){ # Five percent chance the user will receive a gift from their pet.
                        $item_chance = mt_rand(1, 100);
                        if ($item_chance <= 50){ # Fifty percent chance the gift from their pet will be an item.

                            /* The pet has found an item for you! */                           
                            $num = mt_rand(1,5); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                            switch ($num){
                                case 1: $item = "Ball of Yarn"; break;
                                case 2: $item = "Bernard plushie"; break;
                                case 3: $item = "Madeline plushie "; break;
                                case 4: $item = "Maria plushie"; break;
                                                                case 5: $item = "Honey comb"; break;
                            }
                            $message .= "I found a {$item} for you!";
                            $newitem = new StockItem($item);
                            $newitem->append(1, $mysidia->user->username);

                        } else { # Fifty percent chance the gift from their pet will be money.

                            /* The pet has found some money for you! */
                            $currency = $mysidia->settings->cost;
                            $amount = mt_rand(100, 1000); # Between 100 and 1000
                            $message .= "Found {$amount} {$currency}!";
                            $mysidia->user->changecash($amount);

                        }
                    } else { # Twenty percent chance the pet will talk but have no gift.
                        /* No gift will be given but a neat species-specific phrase can still be said! */

                        $species = $favpet->type;                       

                        switch ($species){
                            case "Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                                                               
                            case "silver tabby Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                               
                            case "ginger tabby Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                                                                                               
                            case "tuxedo tabby Catari": # If the species name is "Cat" it will choose one these:
                                $num = mt_rand(1,7); # Chooses a number between 1 and 4. See how there are four cases below? Increase this number if you add more!!
                                switch ($num){
                                    case 1: $message .= "Meow!"; break;
                                    case 2: $message .= "*purr*"; break;
                                    case 3: $message .= "Do you have catnip?"; break;
                                    case 4: $message .= "I saw a squirrel today!"; break;
                                                                        case 5: $message .= "I should catch that mouse!"; break;
                                                                        case 6: $message .= "I love you!"; break;
                                                                        case 7: $message .= "I feel special being owned by you!"; break;
                                }
                            break;
                                                       
                            case "Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;
                                                       
                                                        case "Black and white Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;
                                                       
                                                case "brown and black Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;
                                                       
                                                        case "Black and white floopy eared Hounda":
                                $num = mt_rand(1,7);
                                switch ($num){
                                    case 1: $message .= "Woof!"; break;
                                    case 2: $message .= "Bark bark!!"; break;
                                    case 3: $message .= "Let's play fetch!"; break;
                                    case 4: $message .= "I will protect you!"; break;
                                                                        case 5: $message .= "what adventure are we going on today??!"; break;
                                                                        case 6: $message .= "Lets be best friends forever!!"; break;
                                                                        case 7: $message .= "Im the luckiest hounda ever!!"; break;
                                }
                            break;

                            default: # If the species isn't defined above, it'll choose one of these default phrases instead.
                                $num = mt_rand(1,6);               
                                switch ($num){
                                    case 1: $message .= "What an awesome day!"; break;
                                    case 2: $message .= "Hey, did you know you're amazing?!"; break;
                                    case 3: $message .= "Inner beauty is important!"; break;
                                    case 4: $message .= "You look fantastic today!"; break;
                                                                        case 5: $message .= "You're the best!!"; break;
                                                                        case 6: $message .= "I love adventure!!"; break;
                                }
                            break;
                        }

                    }
                } else { # Seventy-five percent chance nothing will happen whatsoever.
                    /* Nothing will happen with the pet at all. */
                    $message = "";
                }
            }

                  if ($message == "") { $message = ""; } else { $message .= "</div>"; }
               
        /**** END: CREATE RANDOM MESSAGES ****/ 
        #
        #
        #

        }       
        $this->setDivision($this->FavPetSB);
    }
    /**** END: FOR THE FAVPET WIDGET ****/
    #
    #
    #









    /**
    * The getMoneyBar method, getter method for property $moneyBar.
    * @access public
    * @return Paragraph
    */
    public function getMoneyBar(){
        return $this->moneyBar;
    }
   
    /**
    * The setMoneyBar method, setter method for property $moneyBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setMoneyBar(){
        $mysidia = Registry::get("mysidia");
        $this->moneyBar = new Paragraph;
    $this->moneyBar->add(new Comment("You have <span id='cashonhand'>{$mysidia->user->money}</span> {$mysidia->settings->cost}.")); 
       
        $donate = new Link("donate");
        $donate->setText("Donate Money to Friends");
        $this->moneyBar->add($donate);
        $this->setDivision($this->moneyBar);       
    }

    /**
    * The getLinksBar method, getter method for property $linksBar.
    * @access public
    * @return Paragraph
    */
    public function getLinksBar(){
        return $this->linksBar;
    }
   
    /**
    * The setLinksBar method, setter method for property $linksBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setLinksBar(){
        $mysidia = Registry::get("mysidia");
        $this->linksBar = new Paragraph;
        $linkTitle = new Comment("{$mysidia->user->username}'s Links:");
        $linkTitle->setBold();
        $this->linksBar->add($linkTitle);
       
        $linksList = new LinksList("ul");
        $this->setLinks($linksList);
       
        $this->linksBar->add($linksList);
        $this->setDivision($this->linksBar);   
    }

    /**
    * The setLinks method, append all links to the LinksBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setLinks(LinksList $linksList){
        $mysidia = Registry::get("mysidia");
        $stmt = $mysidia->db->select("links", array("id", "linktext", "linkurl"), "linktype = 'sidelink' ORDER BY linkorder");
        if($stmt->rowCount() == 0) Throw new Exception("There is an error with sidebar links, please contact the admin immediately for help.");
       
        while($sideLink = $stmt->fetchObject()){
            $link = new Link($sideLink->linkurl);
            $link->setText($sideLink->linktext);
            if($sideLink->linkurl == "messages"){
                $num = $mysidia->db->select("messages", array("touser"), "touser='{$mysidia->user->username}' and status='unread'")->rowCount();
                if($num > 0) $link->setText("<b>{$link->getText()} ({$num})</b>");
            }
            $link->setListed(TRUE);
            $linksList->add($link); 
        }
       
        if($mysidia->user instanceof Admin){
            $adminCP = new Link("admincp/", FALSE, FALSE);
            $adminCP->setText("Admin Control Panel");
            $adminCP->setListed(TRUE); 
            $linksList->add($adminCP);           
        }
    }
   
    /**
    * The getWolBar method, getter method for property $wolBar.
    * @access public
    * @return LinksList
    */
    public function getWolBar(){
        return $this->wolBar;
    }
   
    /**
    * The setWolBar method, setter method for property $wolBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setWolBar(){
        $mysidia = Registry::get("mysidia");
        $this->wolBar = new Link("online");
        $online = $mysidia->db->select("online", array(), "username != 'Visitor'")->rowCount();
        $offline = $mysidia->db->select("online", array(), "username = 'Visitor'")->rowCount();
        $this->wolBar->setText("This site has {$online} members and {$offline} guests online.");
        $this->setDivision($this->wolBar);       
    }
   
    /**
    * The getLoginBar method, getter method for property $loginBar.
    * @access public
    * @return FormBuilder
    */
    public function getLoginBar(){
        return $this->loginBar;
    }
   
    /**
    * The setLoginBar method, setter method for property $loginBar.
    * It is set internally upon object instantiation, cannot be accessed in client code.
    * @access protected
    * @return Void
    */
    protected function setLoginBar(){
        $this->loginBar = new FormBuilder("login", "login", "post");
        $loginTitle = new Comment("Member Login:");
        $loginTitle->setBold();
        $loginTitle->setUnderlined();
        $this->loginBar->add($loginTitle);

        $this->loginBar->buildComment("username: ", FALSE)
                      ->buildTextField("username")
                      ->buildComment("password: ", FALSE)
                      ->buildPasswordField("password", "password", "", TRUE)   
                      ->buildButton("Log In", "submit", "submit")
                      ->buildComment("Don't have an account?");
                     
        $register = new Link("register");
        $register->setText("Register New Account");
        $register->setLineBreak(TRUE);
        $forgot = new Link("forgotpass");
        $forgot->setText("Forgot Password?");
       
        $this->loginBar->add($register);
        $this->loginBar->add($forgot);
        $this->setDivision($this->loginBar);   
    }
}
?>



All times are GMT -5. The time now is 04:30 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.