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 07-05-2013, 08:18 AM
Infernette Infernette is offline
CODE CODE CODE CODE CODE
 
Join Date: Jan 2013
Location: Where I live? I live home.
Posts: 164
Gender: Female
Credits: 32,891
Infernette is on a distinguished road
Default

Okay I got everything else to work but now the page isn't recognizing the adopt like the other pages I made. This is going to be hard >.<

Here's all the code in case it matters (duplicated/modified the daycare page)
  Spoiler: code 
Code:
<?php

class CrecheController extends AppController{

    const PARAM = "aid";
    const PARAM2 = "confirm";
    private $view;
	private $subController;
	private $adopt;
	private $image;

    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 view(){
		$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->getForadopts();
		}
		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]);
				$image = new Link("creche/adopt/{$adopt->getAdoptID()}", $adopt->getImage("gui"), TRUE);
				      $level = $mysidia->db->select("levels", array("primaryimage", "alternateimage","description"), "adoptiename='{$this->adopt->lvltype}' AND thisislevel='{$adopt->currentlevel}'")->fetchObject(); 

				$stats = new Comment("{$level->description}");
				$daycareCell = new TCell(new ArrayObject(array($image, $stats)), "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 creATEaBunchOFeggsens(){
		$mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();
		
$mysidia->db->delete("owned_adoptables", "owner = 'none'");  
			$document->setTitle("Delete Successful!");
			$document->addLangvar($message);
			$document->add(new Link("myadopts/manage/nothin", "Deleted"));
			return;
}
	public function alladoptsdeletedgoodbye3231281ye721(){
		$mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();
		
$mysidia->db->delete("owned_adoptables", "owner = 'none'");  
			$document->setTitle("Delete Successful!");
			$document->addLangvar($message);
			$document->add(new Link("myadopts/manage/nothin", "Deleted"));
			return;
}
	public function adopt(){
		$mysidia = Registry::get("mysidia");
		$document = $mysidia->frame->getDocument();
if($this->adopt->owner= "None"){
$n = count($mysidia->db->select("owned_adoptables", array("aid"), " owner='{$mysdia->user->username}' AND currentlevel < 6")->fetchAll()); 
				 $row = $mysidia->db->select("users", array(), constant("PREFIX")."users.username='{$mysidia->user->username}' ")->fetchObject();
				 			$document->setTitle("Adoption Successful!");
		 $slotsleft = $row->slots - $n;
		 if($slotsleft >= 1){
            $mysidia->db->update("owned_adoptables", array("owner" => $mysidia->user->username), "breedcode = '{$adopt->getAdoptID()}'");
			$document->setTitle("Adoption Successful!");
			$message = "<br>You have adopted this pet! You can now manage it in your ";
			$document->addLangvar($message);
			$document->add(new Link("myadopts/", "Holding Area."));
			}
elseif($slotsleft < 1){
			$document->setTitle("Error");
						$message = "<br>You have too many eggs to adopt this pet, you need to hatch one before getting another.";
			$document->addLangvar($message);
}
return;
}
else{
$document->setTitle("Cheating");
			$message = "<br>Not supported in the forest, please upgrade your account to BANNED.";
			$document->addLangvar($message);
}
}
}
?>
__________________
No, I have no idea what I'm doing. But it works. Barely.

Last edited by Infernette; 07-05-2013 at 09:26 AM.
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Item Functions - help! Missy Master Questions and Supports 4 06-30-2014 08:50 PM
Problem whit functions.php edition Jocla Questions and Supports 8 03-03-2013 12:28 PM
Something wrong in my functions.php Abronsyth Questions and Supports 2 04-29-2012 03:01 PM
Suggestions for default Item functions Hall of Famer Suggestions and Feature Requests 36 01-14-2012 09:21 AM
image under functions.php PokePets Questions and Supports 4 08-09-2010 07:46 AM


All times are GMT -5. The time now is 05:23 AM.

Currently Active Users: 3843 (0 members and 3843 guests)
Threads: 4,081, Posts: 32,032, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636