View Single Post
  #5  
Old 04-17-2015, 09:22 AM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,385
kristhasirah
Default

yes im trying to prevent users from adopting more eggs...
I think im doing something wrong because i only get a blank page when i click the submit botton... and when i look at my owned adopts the adopt is there...

PHP Code:
<?php

class AdoptView extends View{
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $this->document;
         
        if(
$mysidia->input->post("submit")){
    
$number 5/* You want users to have no more than THIS ($number) many pets with...*/
    
$level 6/* ...a level less than or equal to THIS ($level) number! */
    
$petsAtLevel $mysidia->db->select("owned_adoptables", array(), "owner = '{$mysidia->user->username}' AND currentlevel <= $level")->rowCount();
    if (
$petsAtLevel $number){ /* If the number of pets at this level is greater than number... */
        
$document->setTitle("Too Many Eggs!");
        
$document->add(new Comment("You've got too many eggs and should wait until you've hatched one."FALSE));
    }
    else { 
        
            
$aid $this->getField("aid")->getValue();
            
$name $this->getField("name")->getValue();
            
$eggImage $this->getField("eggImage")->getValue();
            
$image = new Image($eggImage);
            
$image->setLineBreak(TRUE);    
            
            
$document->setTitle("{$name} adopted successfully");            
            
$document->add($image);
            
$document->addLangvar("Congratulations!  You just adopted {$name}.  You can now manage {$name} on the ");
            
$document->add(new Link("myadopts""Myadopts Page."));
            
$document->add(new Comment(""));
            
$document->add(new Link("myadopts/manage/{$aid}""Click Here to Manage {$name}"));
            
$document->add(new Comment(""));
            
$document->add(new Link("myadopts/bbcode/{$aid}""Click Here to get BBCodes/HTML Codes for {$name}"));
            
$document->add(new Comment(""));
            
$document->addLangvar("Be sure and");
            
$document->add(new Link("levelup/click/{$aid}""feed "));
            
$document->addLangvar("{$name} with clicks so that they grow!");
            return;
        }
}
        
$document->setTitle($mysidia->lang->title);
        
$document->addLangvar((!$mysidia->user->isloggedin)?$mysidia->lang->guest:$mysidia->lang->member); 

        
        
$adoptForm = new Form("form""adopt""post");
        
$adoptTitle = new Comment("Available Adoptables");
        
$adoptTitle->setHeading(3);
        
$adoptForm->add($adoptTitle);
        
$adoptTable = new Table("table"""FALSE);
         
        
$adopts $this->getField("adopts");
        for(
$i 0$i $adopts->length(); $i++){
            
$row = new TRow;
            
$idCell = new TCell(new RadioButton("""id"$adopts[$i]->getID()));                
            
$imageCell = new TCell(new Image($adopts[$i]->getEggImage(), $adopts[$i]->getType()));
            
$imageCell->setAlign(new Align("center"));
                
            
$type = new Comment($adopts[$i]->getType());
            
$type->setBold();
            
$description = new Comment($adopts[$i]->getDescription(), FALSE);
            
$typeCell = new TCell;
            
$typeCell->add($type);
            
$typeCell->add($description);            

            
$row->add($idCell);
            
$row->add($imageCell);
            
$row->add($typeCell);
            
$adoptTable->add($row);
        }
        
        
$adoptForm->add($adoptTable);        
        
$adoptSubtitle = new Comment("Adopt");
        
$adoptSubtitle->setHeading(3);
        
$adoptForm->add($adoptSubtitle);
        
$adoptForm->add(new Comment("Adoptable Name: "FALSE));
        
$adoptForm->add(new TextField("name"));
        
$adoptForm->add(new Comment(""));
        
$adoptForm->add(new Button("Create this Adoptable""submit""submit"));
        
$document->add($adoptForm);
    }
}

?>
no idea what im doing wrong... and im have 0 experience at coding... only know how to install mods and make small changes... so no idea how to do the wrapping of if statement for the submit botton...
__________________
Reply With Quote