kristhasirah
03-28-2017, 02:09 PM
this is not really a tip or a tutorial... I epic fail at those XD
this is noting so grand or hard coding, mostly is just a copy/paste of the myadopts code to the profile code, tried to do it in the class_userprofile.php but only manage to make the pages show, but not redirecting to the page, so i made a complete change to the profile.php and profileview.php I have the code of the daycare to display the adopts, you can change it to the original code in myadopts or to something else.
And here is my working code:
this goes in Profile.php
<?php
use Resource\Native\Integer;
use Resource\Native\String;
use Resource\Collection\LinkedHashMap;
class ProfileController extends AppController{
const PARAM = "user";
const PARAM2 = "confirm";
private $user;
private $profile;
private $adopt;
private $image;
public function __construct(){
parent::__construct();
$mysidia = Registry::get("mysidia");
if($mysidia->input->action() != "index"){
try{
$this->user = new Member($mysidia->input->get("user"));
$this->profile = $this->user->getprofile();
}
catch(MemberNotfoundException $mne){
throw new InvalidIDException("nonexist");
}
}
}
public function index(){
$mysidia = Registry::get("mysidia");
$total = $mysidia->db->select("users", array("uid"))->rowCount();
$pagination = new Pagination($total, 10, "profile");
$pagination->setPage($mysidia->input->get("page"));
$stmt = $mysidia->db->select("users", array("username", "usergroup"), "1 ORDER BY uid ASC LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
$users = new LinkedHashMap;
while($user = $stmt->fetchObject()){
$users->put(new String($user->username), new Integer($user->usergroup));
}
$this->setField("pagination", $pagination);
$this->setField("users", $users);
}
public function view(){
include("inc/tabs.php");
$mysidia = Registry::get("mysidia");
$total = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}'")->rowCount();
$pagination = new Pagination($total, 30, "profile/view/{$mysidia->input->get("user")}");
$pagination->setPage($mysidia->input->get("page"));
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}' ORDER BY type,currentlevel LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
$this->setField("pagination", $pagination);
$this->setField("stmt", new DatabaseStatement($stmt));
$vmessage = new VisitorMessage();
$vmessage->setrecipient($this->user->username);
if($mysidia->input->post("vmtext")) $vmessage->post();
$this->profile->formatusername($this->user)->getfavpet();
$mysidia->user->getstatus();
$this->user->getcontacts();
$this->user->formatcontacts();
$this->setField("user", $this->user);
$this->setField("profile", $this->profile);
}
}
?>
And this goes in profileview.php
<?php
use Resource\Native\String;
use Resource\Collection\LinkedHashMap;
use Resource\Collection\LinkedList;
use Resource\Collection\ArrayList;
class ProfileView extends View{
public function index(){
$pagination = $this->getField("pagination");
$users = $this->getField("users");
$document = $this->document;
$document->setTitle($this->lang->title);
$document->addLangvar($this->lang->memberlist);
$iterator = $users->iterator();
while($iterator->hasNext()){
$entry = $iterator->next();
$username = (string)$entry->getKey();
$usergroup = (string)$entry->getValue();
if(cancp($usergroup) == "yes") $document->add(new Image("templates/icons/star.gif"));
$document->add(new Link("profile/view/{$username}", $username, TRUE));
}
$document->addLangvar($pagination->showPage());
}
public function view(){
$mysidia = Registry::get("mysidia");
$user = $this->getField("user");
$profile = $this->getField("profile");
$document = $this->document;
$document->setTitle($this->lang->profile);
$pagination = $this->getField("pagination");
$stmt = $this->getField("stmt")->get();
$tabsList = new LinkedHashMap;
$tabsList->put(new String("Visitor Message"), new String("visitormessage"));
$tabsList->put(new String("Adoptables"), new String("adopts"));
$tabsList->put(new String("About Me"), new String("aboutme"));
$tabsList->put(new String("Friends"), new String("friends"));
$tabsList->put(new String("Contact Info"), new String("contactinfo"));
$tabs = new Tab(5, $tabsList, 2);
$tabs->createtab();
// Here we go with the first tab content: Visitor Message
$tabs->starttab(0);
$vmTitle = new Comment($mysidia->input->get("user").$this->lang->VM_member);
$vmTitle->setBold();
$vmTitle->setUnderlined();
$document->add($vmTitle);
$profile->display("vmessages");
if(!$mysidia->user->isloggedin) $document->addLangvar($this->lang->VM_guest);
elseif(!$mysidia->user->status->canvm) $document->addLangvar($this->lang->VM_banned);
else{
$document->addLangvar($this->lang->VM_post);
$vmForm = new Form("vmform", "{$mysidia->input->get("user")}", "post");
$vmForm->add(new PasswordField("hidden", "user", $user->username));
$vmForm->add(new TextArea("vmtext", "", 4, 50));
$vmForm->add(new Button("Post Comment", "submit", "submit"));
if($mysidia->input->post("vmtext")){
$reminder = new Paragraph;
$reminder->add(new Comment("You may now view your conversation with {$user->username} from ", FALSE));
$reminder->add(new Link("vmessage/view/{$mysidia->input->post("touser")}/{$mysidia->input->post("fromuser")}", "Here"));
$document->addLangvar($this->lang->VM_complete);
$document->add($reminder);
}
else $document->add($vmForm);
}
$tabs->endtab(0);
// Now the second tab: About me...
$tabs->starttab(2);
$profile->display("aboutme");
$tabs->endtab(2);
// The third tab: Adopts...
$tabs->starttab(1);
$profile->display("favadopt");
if($stmt->rowCount() == 0){
$document->addLangvar($mysidia->lang->noadopts);
}
$adoptTable = new Table("adoptwind", "", false);
$numAdoptsPerRow = 3;
$total = $stmt->rowCount();
$numTotalRows = ceil($total / $numAdoptsPerRow);
$index = 0;
for($row = 0; $row < $numTotalRows; $row++){//for cycle to write the rows
$aRow = new TRow("row{$row}");
for($column = 0; $column < $numAdoptsPerRow; $column++){//internal for cycle for the columns
$id = $stmt->fetchColumn();
$adopt = new OwnedAdoptable($id);
$cell = new ArrayList;
$cell->add(new Comment("<a href='/levelup/click/{$id}'><img src='{$adopt->getImage()}'></a>"));
$aCell = new TCell($cell, "cell{$index}");
$aCell->setAlign(new Align("center", "center"));
$aRow->add($aCell);
$index++;
if($index == $total) break;
}
$adoptTable->add($aRow);
}
$document->add($adoptTable);
$document->addLangvar($pagination->showPage());
$tabs->endtab(1);
// The fourth tab: Friends...
$tabs->starttab(3);
$profile->display("friends", $user);
$tabs->endtab(3);
// The last tab: Contact Info!
$tabs->starttab(4);
$user->getcontacts();
$user->formatcontacts();
$profile->display("contactinfo", $user->contacts);
$tabs->endtab(4);
}
}
?>
also need to add this to class_userprofile.php
[/php]
case "favadopt":
$this->favadopt();
break;
[/php]
it goes in the public function display($action = "", $data = "") I have mine below $this->showalladopts();
And add this:
private function favadopt(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$spotlight = new Comment(".:AdoptSpotlight:.");
$spotlight->setHeading(2);
$document->add($spotlight);
$document->add($this->favpet);
$document->add(new Comment($this->about));
}
after the full private function showalladopts(){
this is needed to show the favorite adopt, because with the edits to the code i made in profileview.php the favorite adopt stops showing, this is because i dont call the adopts info from the class_userprofile.php, so you need to make a new public function for the favpet so you can call only the favpet.
in case i dint explain well here is my class_userprofile.php
<?php
use Resource\Collection\LinkedList;
class UserProfile extends Model{
// The user profile class, it has dependency over class Member and cannot exist on its own
public $uid;
public $username;
protected $avatar;
protected $bio;
protected $color;
protected $about;
protected $favpet;
protected $gender;
protected $nickname;
public function __construct($uid){
// Fetch the basic profile params for users
$mysidia = Registry::get("mysidia");
$row = $mysidia->db->select("users_profile", array(), "uid ='{$uid}'")->fetchObject();
// loop through the anonymous object created to assign properties
foreach($row as $key => $val){
$this->$key = $val;
}
// Successfully instantiate user profile object
}
public function formatusername(){
$ccstats = cancp($this->usergroup);
$this->username = ($ccstat == "yes")?"<img src='templates/icons/star.gif' /> {$this->username}":$this->username;
return $this;
}
public function getAvatar(){
return $this->avatar;
}
public function getBio(){
return $this->bio;
}
public function getColor(){
return $this->color;
}
public function getFavpetID(){
return $this->favpet;
}
public function getFavpetInfo(){
return $this->about;
}
public function getFavpet(){
if(is_numeric($this->favpet)){
$this->favpet = ($this->favpet == 0)?new Comment("None Selected"):new Link("levelup/click/{$this->favpet}", new Image("levelup/siggy/{$this->favpet}"), TRUE);
}
return $this->favpet;
}
public function getGender(){
return $this->gender;
}
public function getNickname(){
return $this->nickname;
}
public function display($action = "", $data = ""){
switch($action){
case "vmessages":
$this->vmessages();
break;
case "aboutme":
$this->aboutme();
break;
case "adopts":
$this->showalladopts();
break;
case "favadopt":
$this->favadopt();
break;
case "friends":
$this->getfriends($data);
break;
case "contactinfo":
$this->contactinfo($data);
break;
default:
throw new Exception("Invalid profile tab...");
}
}
private function vmessages(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$stmt = $mysidia->db->select("visitor_messages", array(), "touser = '{$mysidia->input->get("user")}' ORDER BY vid DESC LIMIT 0, 15");
if($stmt->rowCount() == 0){
return;
}
$vmList = new TableBuilder("vmessages", 800, FALSE);
$vmList->setHelper(new MessageTableHelper);
while($vmessage = $stmt->fetchObject()){
$sender = $mysidia->db->join("users_profile", "users_profile.uid = users.uid")
->select("users", array(), constant("PREFIX")."users.username = '{$vmessage->fromuser}'")
->fetchObject();
$cells = new LinkedList;
$cells->add(new TCell($vmList->getHelper()->getAvatarImage($sender->avatar)));
$cells->add(new TCell($vmList->getHelper()->getVisitorMessage($vmessage)));
if(($mysidia->user instanceof Admin) or ($mysidia->user->username == $vmessage->fromuser)){
$cells->add(new TCell($vmList->getHelper()->getManageActions($vmessage->vid)));
}
$vmList->buildRow($cells);
}
$document->add($vmList);
}
private function aboutme(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$title = new Comment($mysidia->lang->basic.$mysidia->input->get("user"));
$title->setBold(TRUE);
$title->setUnderlined(TRUE);
$membersince = $mysidia->db->select("users", array("membersince"), "username = '{$mysidia->input->get("user")}'")->fetchColumn();
$basicinfo = "<br><strong>Member Since:</strong> {$membersince}<br>
Gender: {$this->gender}<br>
Favorite Color: {$this->color}<br>
Nickname: {$this->nickname}<br>
Bio: {$this->bio}";
$document->add($title);
$document->add(new Image($this->avatar, "avatar", 100));
$document->add(new Comment($basicinfo));
}
private function showalladopts(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$spotlight = new Comment(".:AdoptSpotlight:.");
$spotlight->setHeading(2);
$document->add($spotlight);
$document->add($this->favpet);
$document->add(new Comment($this->about));
$title = new Comment("{$mysidia->input->get("user")}'s Pets:");
$title->setBold(TRUE);
$title->setUnderlined(TRUE);
$document->add($title);
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}'");
while($id = $stmt->fetchColumn()){
$adopt = new OwnedAdoptable($id);
$document->add(new Link("levelup/click/{$adopt->getAdoptID()}", $adopt->getImage("gui")));
}
}
private function favadopt(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$spotlight = new Comment(".:AdoptSpotlight:.");
$spotlight->setHeading(2);
$document->add($spotlight);
$document->add($this->favpet);
$document->add(new Comment($this->about));
}
private function getfriends($user){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$friendlist = new Friendlist($user);
$document->add(new Comment("{$user->username} currently have {$friendlist->gettotal()} friends."));
$friendlist->display();
}
private function contactinfo($contacts){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$member = new Member($mysidia->input->get("user"));
$document->add(new Image("templates/icons/web.gif", "web"));
$document->add(new Comment($contacts->website));
$document->add(new Image("templates/icons/facebook.gif", "facebook"));
$document->add(new Comment($contacts->facebook));
$document->add(new Image("templates/icons/twitter.gif", "twitter"));
$document->add(new Comment($contacts->twitter));
$document->add(new Image("templates/icons/aim.gif", "aim"));
$document->add(new Comment($contacts->aim));
$document->add(new Image("templates/icons/msn.gif", "msn"));
$document->add(new Comment($contacts->msn));
$document->add(new Image("templates/icons/yahoo.gif", "yahoo"));
$document->add(new Comment($contacts->yim));
$document->add(new Image("templates/icons/skype.gif", "skype"));
$document->add(new Comment($contacts->skype));
$document->add(new Image("templates/icons/title.gif", "Write a PM"));
$document->add(new Link("messages/newpm/{$mysidia->input->get("user")}", "Send {$mysidia->input->get("user")} a Private Message", TRUE));
$document->add(new Image("templates/icons/fr.gif", "Send a Friend Request"));
$document->add(new Link("friends/request/{$member->uid}", "Send {$mysidia->input->get("user")} a Friend Request", TRUE));
$document->add(new Image("templates/icons/trade.gif", "Make a Trade Offer"));
$document->add(new Link("trade/offer/user/{$member->uid}", "Make {$mysidia->input->get("user")} a Trade Offer"));
}
protected function save($field, $value){
}
}
?>
Hope this can be useful for those that don't know how to code... like me XD i spend 3-4 days trying to archive this =p
i have it to display 30 adopts per page this can be changed in profile.php
and have it to display 3 adopts per row this can be changed in profileview.php
also they are ordered by type and currentlevel this can be changed in profile.php
just look/search for the number/words and edit it =)
Forgot to add:
You can copy paste the codes if you haven't changed/edited those pages, but if you already made changes try to see what i added/edited and try to make it work
this is noting so grand or hard coding, mostly is just a copy/paste of the myadopts code to the profile code, tried to do it in the class_userprofile.php but only manage to make the pages show, but not redirecting to the page, so i made a complete change to the profile.php and profileview.php I have the code of the daycare to display the adopts, you can change it to the original code in myadopts or to something else.
And here is my working code:
this goes in Profile.php
<?php
use Resource\Native\Integer;
use Resource\Native\String;
use Resource\Collection\LinkedHashMap;
class ProfileController extends AppController{
const PARAM = "user";
const PARAM2 = "confirm";
private $user;
private $profile;
private $adopt;
private $image;
public function __construct(){
parent::__construct();
$mysidia = Registry::get("mysidia");
if($mysidia->input->action() != "index"){
try{
$this->user = new Member($mysidia->input->get("user"));
$this->profile = $this->user->getprofile();
}
catch(MemberNotfoundException $mne){
throw new InvalidIDException("nonexist");
}
}
}
public function index(){
$mysidia = Registry::get("mysidia");
$total = $mysidia->db->select("users", array("uid"))->rowCount();
$pagination = new Pagination($total, 10, "profile");
$pagination->setPage($mysidia->input->get("page"));
$stmt = $mysidia->db->select("users", array("username", "usergroup"), "1 ORDER BY uid ASC LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
$users = new LinkedHashMap;
while($user = $stmt->fetchObject()){
$users->put(new String($user->username), new Integer($user->usergroup));
}
$this->setField("pagination", $pagination);
$this->setField("users", $users);
}
public function view(){
include("inc/tabs.php");
$mysidia = Registry::get("mysidia");
$total = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}'")->rowCount();
$pagination = new Pagination($total, 30, "profile/view/{$mysidia->input->get("user")}");
$pagination->setPage($mysidia->input->get("page"));
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}' ORDER BY type,currentlevel LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
$this->setField("pagination", $pagination);
$this->setField("stmt", new DatabaseStatement($stmt));
$vmessage = new VisitorMessage();
$vmessage->setrecipient($this->user->username);
if($mysidia->input->post("vmtext")) $vmessage->post();
$this->profile->formatusername($this->user)->getfavpet();
$mysidia->user->getstatus();
$this->user->getcontacts();
$this->user->formatcontacts();
$this->setField("user", $this->user);
$this->setField("profile", $this->profile);
}
}
?>
And this goes in profileview.php
<?php
use Resource\Native\String;
use Resource\Collection\LinkedHashMap;
use Resource\Collection\LinkedList;
use Resource\Collection\ArrayList;
class ProfileView extends View{
public function index(){
$pagination = $this->getField("pagination");
$users = $this->getField("users");
$document = $this->document;
$document->setTitle($this->lang->title);
$document->addLangvar($this->lang->memberlist);
$iterator = $users->iterator();
while($iterator->hasNext()){
$entry = $iterator->next();
$username = (string)$entry->getKey();
$usergroup = (string)$entry->getValue();
if(cancp($usergroup) == "yes") $document->add(new Image("templates/icons/star.gif"));
$document->add(new Link("profile/view/{$username}", $username, TRUE));
}
$document->addLangvar($pagination->showPage());
}
public function view(){
$mysidia = Registry::get("mysidia");
$user = $this->getField("user");
$profile = $this->getField("profile");
$document = $this->document;
$document->setTitle($this->lang->profile);
$pagination = $this->getField("pagination");
$stmt = $this->getField("stmt")->get();
$tabsList = new LinkedHashMap;
$tabsList->put(new String("Visitor Message"), new String("visitormessage"));
$tabsList->put(new String("Adoptables"), new String("adopts"));
$tabsList->put(new String("About Me"), new String("aboutme"));
$tabsList->put(new String("Friends"), new String("friends"));
$tabsList->put(new String("Contact Info"), new String("contactinfo"));
$tabs = new Tab(5, $tabsList, 2);
$tabs->createtab();
// Here we go with the first tab content: Visitor Message
$tabs->starttab(0);
$vmTitle = new Comment($mysidia->input->get("user").$this->lang->VM_member);
$vmTitle->setBold();
$vmTitle->setUnderlined();
$document->add($vmTitle);
$profile->display("vmessages");
if(!$mysidia->user->isloggedin) $document->addLangvar($this->lang->VM_guest);
elseif(!$mysidia->user->status->canvm) $document->addLangvar($this->lang->VM_banned);
else{
$document->addLangvar($this->lang->VM_post);
$vmForm = new Form("vmform", "{$mysidia->input->get("user")}", "post");
$vmForm->add(new PasswordField("hidden", "user", $user->username));
$vmForm->add(new TextArea("vmtext", "", 4, 50));
$vmForm->add(new Button("Post Comment", "submit", "submit"));
if($mysidia->input->post("vmtext")){
$reminder = new Paragraph;
$reminder->add(new Comment("You may now view your conversation with {$user->username} from ", FALSE));
$reminder->add(new Link("vmessage/view/{$mysidia->input->post("touser")}/{$mysidia->input->post("fromuser")}", "Here"));
$document->addLangvar($this->lang->VM_complete);
$document->add($reminder);
}
else $document->add($vmForm);
}
$tabs->endtab(0);
// Now the second tab: About me...
$tabs->starttab(2);
$profile->display("aboutme");
$tabs->endtab(2);
// The third tab: Adopts...
$tabs->starttab(1);
$profile->display("favadopt");
if($stmt->rowCount() == 0){
$document->addLangvar($mysidia->lang->noadopts);
}
$adoptTable = new Table("adoptwind", "", false);
$numAdoptsPerRow = 3;
$total = $stmt->rowCount();
$numTotalRows = ceil($total / $numAdoptsPerRow);
$index = 0;
for($row = 0; $row < $numTotalRows; $row++){//for cycle to write the rows
$aRow = new TRow("row{$row}");
for($column = 0; $column < $numAdoptsPerRow; $column++){//internal for cycle for the columns
$id = $stmt->fetchColumn();
$adopt = new OwnedAdoptable($id);
$cell = new ArrayList;
$cell->add(new Comment("<a href='/levelup/click/{$id}'><img src='{$adopt->getImage()}'></a>"));
$aCell = new TCell($cell, "cell{$index}");
$aCell->setAlign(new Align("center", "center"));
$aRow->add($aCell);
$index++;
if($index == $total) break;
}
$adoptTable->add($aRow);
}
$document->add($adoptTable);
$document->addLangvar($pagination->showPage());
$tabs->endtab(1);
// The fourth tab: Friends...
$tabs->starttab(3);
$profile->display("friends", $user);
$tabs->endtab(3);
// The last tab: Contact Info!
$tabs->starttab(4);
$user->getcontacts();
$user->formatcontacts();
$profile->display("contactinfo", $user->contacts);
$tabs->endtab(4);
}
}
?>
also need to add this to class_userprofile.php
[/php]
case "favadopt":
$this->favadopt();
break;
[/php]
it goes in the public function display($action = "", $data = "") I have mine below $this->showalladopts();
And add this:
private function favadopt(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$spotlight = new Comment(".:AdoptSpotlight:.");
$spotlight->setHeading(2);
$document->add($spotlight);
$document->add($this->favpet);
$document->add(new Comment($this->about));
}
after the full private function showalladopts(){
this is needed to show the favorite adopt, because with the edits to the code i made in profileview.php the favorite adopt stops showing, this is because i dont call the adopts info from the class_userprofile.php, so you need to make a new public function for the favpet so you can call only the favpet.
in case i dint explain well here is my class_userprofile.php
<?php
use Resource\Collection\LinkedList;
class UserProfile extends Model{
// The user profile class, it has dependency over class Member and cannot exist on its own
public $uid;
public $username;
protected $avatar;
protected $bio;
protected $color;
protected $about;
protected $favpet;
protected $gender;
protected $nickname;
public function __construct($uid){
// Fetch the basic profile params for users
$mysidia = Registry::get("mysidia");
$row = $mysidia->db->select("users_profile", array(), "uid ='{$uid}'")->fetchObject();
// loop through the anonymous object created to assign properties
foreach($row as $key => $val){
$this->$key = $val;
}
// Successfully instantiate user profile object
}
public function formatusername(){
$ccstats = cancp($this->usergroup);
$this->username = ($ccstat == "yes")?"<img src='templates/icons/star.gif' /> {$this->username}":$this->username;
return $this;
}
public function getAvatar(){
return $this->avatar;
}
public function getBio(){
return $this->bio;
}
public function getColor(){
return $this->color;
}
public function getFavpetID(){
return $this->favpet;
}
public function getFavpetInfo(){
return $this->about;
}
public function getFavpet(){
if(is_numeric($this->favpet)){
$this->favpet = ($this->favpet == 0)?new Comment("None Selected"):new Link("levelup/click/{$this->favpet}", new Image("levelup/siggy/{$this->favpet}"), TRUE);
}
return $this->favpet;
}
public function getGender(){
return $this->gender;
}
public function getNickname(){
return $this->nickname;
}
public function display($action = "", $data = ""){
switch($action){
case "vmessages":
$this->vmessages();
break;
case "aboutme":
$this->aboutme();
break;
case "adopts":
$this->showalladopts();
break;
case "favadopt":
$this->favadopt();
break;
case "friends":
$this->getfriends($data);
break;
case "contactinfo":
$this->contactinfo($data);
break;
default:
throw new Exception("Invalid profile tab...");
}
}
private function vmessages(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$stmt = $mysidia->db->select("visitor_messages", array(), "touser = '{$mysidia->input->get("user")}' ORDER BY vid DESC LIMIT 0, 15");
if($stmt->rowCount() == 0){
return;
}
$vmList = new TableBuilder("vmessages", 800, FALSE);
$vmList->setHelper(new MessageTableHelper);
while($vmessage = $stmt->fetchObject()){
$sender = $mysidia->db->join("users_profile", "users_profile.uid = users.uid")
->select("users", array(), constant("PREFIX")."users.username = '{$vmessage->fromuser}'")
->fetchObject();
$cells = new LinkedList;
$cells->add(new TCell($vmList->getHelper()->getAvatarImage($sender->avatar)));
$cells->add(new TCell($vmList->getHelper()->getVisitorMessage($vmessage)));
if(($mysidia->user instanceof Admin) or ($mysidia->user->username == $vmessage->fromuser)){
$cells->add(new TCell($vmList->getHelper()->getManageActions($vmessage->vid)));
}
$vmList->buildRow($cells);
}
$document->add($vmList);
}
private function aboutme(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$title = new Comment($mysidia->lang->basic.$mysidia->input->get("user"));
$title->setBold(TRUE);
$title->setUnderlined(TRUE);
$membersince = $mysidia->db->select("users", array("membersince"), "username = '{$mysidia->input->get("user")}'")->fetchColumn();
$basicinfo = "<br><strong>Member Since:</strong> {$membersince}<br>
Gender: {$this->gender}<br>
Favorite Color: {$this->color}<br>
Nickname: {$this->nickname}<br>
Bio: {$this->bio}";
$document->add($title);
$document->add(new Image($this->avatar, "avatar", 100));
$document->add(new Comment($basicinfo));
}
private function showalladopts(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$spotlight = new Comment(".:AdoptSpotlight:.");
$spotlight->setHeading(2);
$document->add($spotlight);
$document->add($this->favpet);
$document->add(new Comment($this->about));
$title = new Comment("{$mysidia->input->get("user")}'s Pets:");
$title->setBold(TRUE);
$title->setUnderlined(TRUE);
$document->add($title);
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->input->get("user")}'");
while($id = $stmt->fetchColumn()){
$adopt = new OwnedAdoptable($id);
$document->add(new Link("levelup/click/{$adopt->getAdoptID()}", $adopt->getImage("gui")));
}
}
private function favadopt(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$spotlight = new Comment(".:AdoptSpotlight:.");
$spotlight->setHeading(2);
$document->add($spotlight);
$document->add($this->favpet);
$document->add(new Comment($this->about));
}
private function getfriends($user){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$friendlist = new Friendlist($user);
$document->add(new Comment("{$user->username} currently have {$friendlist->gettotal()} friends."));
$friendlist->display();
}
private function contactinfo($contacts){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$member = new Member($mysidia->input->get("user"));
$document->add(new Image("templates/icons/web.gif", "web"));
$document->add(new Comment($contacts->website));
$document->add(new Image("templates/icons/facebook.gif", "facebook"));
$document->add(new Comment($contacts->facebook));
$document->add(new Image("templates/icons/twitter.gif", "twitter"));
$document->add(new Comment($contacts->twitter));
$document->add(new Image("templates/icons/aim.gif", "aim"));
$document->add(new Comment($contacts->aim));
$document->add(new Image("templates/icons/msn.gif", "msn"));
$document->add(new Comment($contacts->msn));
$document->add(new Image("templates/icons/yahoo.gif", "yahoo"));
$document->add(new Comment($contacts->yim));
$document->add(new Image("templates/icons/skype.gif", "skype"));
$document->add(new Comment($contacts->skype));
$document->add(new Image("templates/icons/title.gif", "Write a PM"));
$document->add(new Link("messages/newpm/{$mysidia->input->get("user")}", "Send {$mysidia->input->get("user")} a Private Message", TRUE));
$document->add(new Image("templates/icons/fr.gif", "Send a Friend Request"));
$document->add(new Link("friends/request/{$member->uid}", "Send {$mysidia->input->get("user")} a Friend Request", TRUE));
$document->add(new Image("templates/icons/trade.gif", "Make a Trade Offer"));
$document->add(new Link("trade/offer/user/{$member->uid}", "Make {$mysidia->input->get("user")} a Trade Offer"));
}
protected function save($field, $value){
}
}
?>
Hope this can be useful for those that don't know how to code... like me XD i spend 3-4 days trying to archive this =p
i have it to display 30 adopts per page this can be changed in profile.php
and have it to display 3 adopts per row this can be changed in profileview.php
also they are ordered by type and currentlevel this can be changed in profile.php
just look/search for the number/words and edit it =)
Forgot to add:
You can copy paste the codes if you haven't changed/edited those pages, but if you already made changes try to see what i added/edited and try to make it work