View Single Post
  #2  
Old 04-25-2017, 08:18 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 152,288
Abronsyth is on a distinguished road
Default

Oh lords, I just typed out a bunch of information for you and the internet glitched and ate my entire post.

Okay, I'll edit this post in a moment, just adding the codes that you'll need at the moment.


Edit:

You will need to create two new files, one where the base files for your site are (adopt.php, account.php, etc):

personality.php
PHP Code:
<?php

class PersonalityController extends AppController{

    public function 
index(){
        
$mysidia Registry::get("mysidia");        
    }

}
?>
...and one in the view folder:

personalityview.php
PHP Code:
<?php 

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

class 
PersonalityView extends View
     
    public function 
index(){ 
        
$mysidia Registry::get("mysidia"); 
        
$document $this->document;         
        
$document->setTitle("New Personality Trait"); 
        
    if(
$mysidia->input->post("add")){
        
$mysidia->db->insert("personalities", array("id" => NULL"pers" => $mysidia->input->post("type")));                
        
$document->add(new Comment"You have added the personality type {$mysidia->input->post("type")}.")); 
        
$document->add(new Comment("<meta http-equiv='refresh' content='1;url=personality' />")); 
        return 
TRUE;        
    }
            
        if(
$mysidia->user instanceof Admin){ 
        
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
        
$document->add(new Comment"<h2>Add New Personality Types</h2>")); 
             
$document->add(new Comment"Adding new possible personality types is easy! Just type it in the box and hit submit, then new adoptables have a chance of ending up with that personality type.<br><br>{$adoptablepersonality}<br><br>")); 
         
        
$persForm = new Form("addform""""post");
        
$persForm->add(new Comment("<br><u>Create A New Personality:</u><br>"TRUE"b"));
        
$persForm->add(new Comment("Type:"));
        
$persForm->add(new TextField("type"));
        
$persForm->add(new Button("Add""add""submit"));
        
$document->add($persForm);    
                     
                     
$document->add(new Comment"<hr>"));
        }
                else{ 
$document->add(new Comment"You do not have permission to access this page.")); 
}
          
        
            
            
     }
     
}
?>
With that done we need to go into the database and add one new table to the database called adopts_personalities with two columns. The two columns will need this data entered:
name: id
type: int(20)
null: No
default: None
extra: AUTO_INCREMENT

name: pers
type: varchar(100)
collation: latin1_swedish_ci
null: Yes
default: Null

Now move on over to owned_adoptables and add a new column with the following info:
name: personality
type: varchar(100)
collation: latin1_swedish_ci
null: No
default: Easy Going

Now for the tedious part. You will need to make the same edits, more or less, to the following five files:
adopt.php
classes/class_breeding.php
classes/class_promocode.php
classes/class_stockadopt.php
admincp/ownedadopt.php

Find the insert line in each file that starts like this:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL...

At the end of that, before the closing )); add a comma behind whatever is last, and then add this:
PHP Code:
"personality" => $adoptablepersonality 
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 04-25-2017 at 08:38 PM.
Reply With Quote