Spring Theme

Forum
Last Post
Threads / Messages

Hwona

Member
Member
Joined
Mar 1, 2013
Messages
620
Points
0
Mysidian Dollar
31,589
Yes, I know it's terrible, but I didn't know how to explain how to style the levelup page, so I decided to simply make an adeit of the "main" theme with that included. :3
Preview:


Upload this file: Spring Theme.zip
to your "templates" folder. Go to your site ACP, name the theme, and for the "folder path"(something like that) just type in "Spring Theme".

Now, IF you're using v.1.3.3 and have followed the ENTIRE stat/skill modification guide(note, you will have to edit all the "statname" to match your site's stats), save a back up of your files and replace your entire "levelup.php" file with this: http://www.mysidiaadoptables.com/forum/showthread.php?t=4563
Replace your entire levelup.php file with this:
PHP:
<?php

class LevelupController extends AppController{

    const PARAM = "aid";
    private $view;
	private $subController;
	private $adopt;

    public function __construct(){
        parent::__construct();
		$mysidia = Registry::get("mysidia");
		if($mysidia->input->action() == "click" or $mysidia->input->action() == "siggy") $this->adopt = new OwnedAdoptable($mysidia->input->get("aid"));
		if($mysidia->user instanceof Member){
		    $status = $mysidia->user->getstatus();   
			if($status->canlevel == "no") throw new InvalidActionException($mysidia->lang->banned);
		}	
    }
	
	public function index(){
	    $mysidia = Registry::get("mysidia");
		throw new InvalidActionException($mysidia->lang->global_action);
	}
	
	public function click(){
	    $mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();		
		$date = new DateTime;
		$ip = secure($_SERVER['REMOTE_ADDR']);
		$gender = $this->adopt->getGender($fetchMode = "");
		$owner = $this->adopt->getOwner();
		$adoptablename = $this->adopt->getName();
		$totalclicks = $this->adopt->getTotalClicks();
		$tradestatus = $this->adopt->getTradeStatus();
                $adoptablestatname = $this->adopt->getAdoptstatname();
	        $statnamemedalstatus = $this->adopt->getAdoptStatNameMedalStatus();
	
        if($this->adopt->hasVoter($mysidia->user, $date)){
	        // The user has leveled up this adoptable today, show error message
	        	     
$message = "<div id='adoptable'><img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$this->adopt->getAdoptID()}'><br>
Name: {$adoptablename}<br>
Owner: <a href='{$mysidia->path->getAbsolute()}profile/view/{$owner}'>{$owner}</a><br>
Gender: <img src='{$mysidia->path->getAbsolute()}picuploads/{$gender}.png'><br>
Total Clicks: {$totalclicks}<br>
Trade Status: {$tradestatus}<br></div><div id='training'>
<h4>Training</h4>
Obedience: {$obedience}<br>
<img src='{$mysidia->path->getAbsolute()}picuploads/awards/statnamemedalstatus{$statnamemedalstatus}.png'>
</div>";
$message = $message .= (($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest);
		    $document->setTitle($mysidia->lang->already_leveled_title);
	        $document->addLangvar($message);
	    }
		elseif($this->adopt->isFrozen() == "yes"){
		$message = $message .= "<div id='adoptable'><img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$this->adopt->getAdoptID()}'><br>
Name: {$adoptablename}<br>
Owner: <a href='{$mysidia->path->getAbsolute()}profile/view/{$owner}'>{$owner}</a><br>
Gender: <img src='{$mysidia->path->getAbsolute()}picuploads/{$gender}.png'><br>
Total Clicks: {$totalclicks}<br>
Trade Status: {$tradestatus}<br></div><div id='training'>
<h4>Training</h4>
Obedience: {$obedience}<br>
<img src='{$mysidia->path->getAbsolute()}picuploads/awards/statnamemedalstatus{$statnamemedalstatus}.png'>
</div><br>
We're sorry, but you cannot add clicks to this adoptable at this time because its owner has chosen to freeze it.  Frozen adoptables do not accept new clicks and do not level up.  Thanks anyway for the click though, but the owner of this adoptable wants to keep this adoptable young so it will not be counted.";
		    $document->setTitle($mysidia->lang->frozen_title);
	        $document->addLangvar($message);
	        
	        
	        
		}
		else{
		$message = $message .= "<br><text align ='center'><div id='clickpagelink'><a href='{$mysidia->path->getAbsolute()}levelup/click/{$this->adopt->getAdoptID()}'>Click here to visit {$adoptablename}</a><br><a href='{$mysidia->path->getAbsolute()}profile/view/{$owner}'>Click here to return to {$owner}'s profile</a></div>";
		    $newClicks = $this->adopt->getTotalClicks() + 1;
			$this->adopt->setTotalClicks($newClicks, "update");
	        $mysidia->db->insert("vote_voters", array("void" => NULL, "date" => $date->format('Y-m-d'), "username" => $mysidia->user->username, "ip" => $ip, "adoptableid" => $mysidia->input->get("aid")));		 
			
			if($this->adopt->hasNextLevel()){
                // A higher level does exist, so we see if it is time to level up
	            $nextLevel = $this->adopt->getNextLevel();
				$requiredClicks = $nextLevel->getRequiredClicks();
	            if($requiredClicks and $newClicks >= $requiredClicks) $this->adopt->setCurrentLevel($nextLevel->getLevel(), "update");
	        }
			
			$document->setTitle("{$mysidia->lang->gave} {$this->adopt->getName()} one {$mysidia->lang->unit}");
			$reward = $mysidia->user->clickreward($mysidia->settings->rewardmoney);
		    $mysidia->user->changecash($reward);			
	        $image = $this->adopt->getImage("gui");        
			$image->setLineBreak(TRUE);	
			
		    $summary = new Division;
			$summary->setAlign(new Align("center"));
            $summary->add($image);	
            $summary->add(new Comment("{$mysidia->lang->gave}{$this->adopt->getName()} one {$mysidia->lang->unit}."));
            $summary->add(new Comment($mysidia->lang->encourage));
            $summary->add(new Comment("<br>"));
            $summary->add(new Comment(" 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);
            $document->addLangvar($message);			
		}
	}

	public function siggy(){
	    $mysidia = Registry::get("mysidia");
        // The adoptable is available, let's collect its info
	    $usingimage = "no";
	    $image = $this->adopt->getImage(); 
	  
	    $usegd = $mysidia->settings->gdimages;
	    $imageinfo = @getimagesize($image);
	    $imagemime = $imageinfo["mime"]; // Mime type of the image file, should be a .gif file...

	    if(function_exists('imagegif') and $usegd == "yes" and $imagemime == "image/gif"){
	        $usingimage = "yes"; //Turn the template system off
            $type = $this->adopt->getType();
            list($width, $height, $type, $attr) = getimagesize($image); // The size of the original adoptable image

	        // Lets create the new target image, with a size big enough for the text for the adoptable
	        $newheight = $height + 72;
            $newwidth = ($newwidth < 250)?250:$width;
            $img_temp = imagecreatetruecolor($newwidth, $newheight); 
            $alphablending = true;  
		 
    	    // Lets create the image and save its transparency  
            $img_old = @imagecreatefromgif($image);  
            imagealphablending($img_old, true);  
            imagesavealpha($img_old, true);
   
            // Lets copy the old image into the new image with  
            ImageCopyResampled($img_temp, $img_old, 0, 0, 0, 0, $width, $height, $width, $height);    
	        $textheight = $width + 2;
	        $image = $img_temp;
            $bgi = imagecreatetruecolor($newwidth, $newheight);
            $color = imagecolorallocate($bgi, 51, 51, 51);
		 
		    // Build text for siggy
            $str1 = "Name: ".$this->adopt->getName();
            $str2 = "Owner: ".$this->adopt->getOwner();
	        $str3 = "Click Here to Feed Me!";
	        $str4 = "More Adopts at:";
	        $str5 = "www.".constant("DOMAIN");

            // Renger Image
	        imagestring ($image, 12, 0, $textheight,  $str1, $color);
	        imagestring ($image, 12, 0, $textheight + 13,  $str2, $color);
	        imagestring ($image, 12, 0, $textheight + 26,  $str3, $color);
	        imagestring ($image, 12, 0, $textheight + 42,  $str4, $color);
	        imagestring ($image, 12, 0, $textheight + 55,  $str5, $color);
	        $background = imagecolorallocate($image, 0, 0, 0);  
            ImageColorTransparent($image, $background);  
 
            // At the very last, let's clean up temporary files
	        header("Content-Type: image/GIF");
	        ImageGif ($image);
	        imagedestroy($image);
	        imagedestroy($img_temp);
	        imagedestroy($img_old);
	        imagedestroy($bgi);

	    }
	    else{  	
	            // We are going to try and get this image the old fashioned way...
            $extList = array();
	        $extList['gif'] = 'image/gif';
	        $extList['jpg'] = 'image/jpeg';
	        $extList['jpeg'] = 'image/jpeg';
	        $extList['png'] = 'image/png';

	        //Define the output file type
	        $contentType = 'Content-type: '.$extList[ $imageinfo['extension'] ];

	        if($imageinfo['extension'] =! "image/gif" and $imageinfo['extension'] =! "image/jpeg" and $imageinfo['extension'] =! "image/png"){	         
	            throw new InvalidIDException("The file Extension is not allowed!");
	        }
	        else{
                // File type is allowed, so proceed
	            $status = "";
	            header($contentType);
                $curl = new Curl($image);
				$curl->setHeader();
				$curl->exec();
				$curl->close();
	        } 
	    }
	}
	
	public function daycare(){
		$mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();
        $document->setTitle($mysidia->lang->daycare_title);
        $document->addLangvar($mysidia->lang->daycare, TRUE);
		
		try{
		    $daycare = new Daycare;
			$adopts = $daycare->getAdopts();
		}
		catch(DaycareException $dae){
		    $message = $dae->getmessage();
		    $document->addLangvar($mysidia->lang->{$message});
			return;
		}
		
		$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 Comment("<a href='/levelup/click/{$adopt->getAdoptID()}' target='iframe'><img src='{$adopt->getImage()}'></a>"));
                $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);
        $document->add(new Comment("<iframe name='iframe' src=''></iframe>"));  
		if($pagination = $daycare->getPagination()) $document->addLangvar($pagination->showPage());
	}
}

?>
Enjoy! :3
 
Last edited:
Just added this to one of my sites and wow this is sooooo cute! :) Thanks for sharing!!
 
Hii!
I'm trying to use this theme and edit it here and there, but was wondering, how do you shift this whole menu (The portion where they say , "You have 19734234 Cash." And then there's a <Your name>'s Links), from the right to left?
Thanks!
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,048
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top