Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2023
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.23 KB | None | 0 0
  1. <?php
  2.  
  3. namespace View\Main;
  4. use Resource\Collection\LinkedList;
  5. use Resource\Core\Registry;
  6. use Resource\Core\View;
  7. use Resource\GUI\Component\Image;
  8. use Resource\GUI\Component\Link;
  9. use Resource\GUI\Component\TextArea;
  10. use Resource\GUI\Container\TCell;
  11. use Resource\GUI\Document\Comment;
  12. use Resource\GUI\Element\Align;
  13. use Service\Builder\FormBuilder;
  14. use Service\Builder\TableBuilder;
  15. use Service\Helper\UserTableHelper;
  16.  
  17. class MyadoptsView extends View{
  18.  
  19. public function index(){
  20. $document = $this->document;
  21. $document->setTitle($this->lang->title);
  22.  
  23. $pagination = $this->getField("pagination");
  24. $ownedAdopts = $this->getField("ownedAdopts");
  25.  
  26. $adoptTable = new TableBuilder("adopttable", 650);
  27. $adoptTable->setAlign(new Align("center", "middle"));
  28. $adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Level", "Clicks");
  29. $ownedAdoptsIterator = $ownedAdopts->iterator();
  30. while($ownedAdoptsIterator->hasNext()){
  31. $ownedAdopt = $ownedAdoptsIterator->next();
  32. $cells = new LinkedList;
  33. $cells->add(new TCell($ownedAdopt->getGenderImage()));
  34. $cells->add(new TCell($ownedAdopt->getTypeAndName()));
  35. $cells->add(new TCell($ownedAdopt->getManageLink()));
  36. $cells->add(new TCell($ownedAdopt->getCurrentLevel()));
  37. $cells->add(new TCell($ownedAdopt->getTotalClicks()));
  38. $adoptTable->buildRow($cells);
  39. }
  40. $document->add($adoptTable);
  41. $document->addLangvar($pagination->showPage());
  42. }
  43.  
  44. public function manage(){
  45. $document = $this->document;
  46. $ownedAdopt = $this->getField("ownedAdopt");
  47. $image = $this->getField("image");
  48. $document->setTitle("Managing {$ownedAdopt->getName()}");
  49. $document->add($image);
  50. $document->add(new Comment("<br><br>This page allows you to manage {$ownedAdopt->getName()}. Click on an option below to change settings.<br>"));
  51.  
  52. $document->add(new Image("templates/icons/add.gif"));
  53. $document->add(new Link("levelup/click/{$ownedAdopt->getID()}", " Level Up {$ownedAdopt->getName()}", TRUE));
  54. $document->add(new Image("templates/icons/stats.gif"));
  55. $document->add(new Link("myadopts/stats/{$ownedAdopt->getID()}", " Get Stats for {$ownedAdopt->getName()}", TRUE));
  56. $document->add(new Image("templates/icons/bbcodes.gif"));
  57. $document->add(new Link("myadopts/bbcode/{$ownedAdopt->getID()}", " Get BBCodes / HTML Codes for {$ownedAdopt->getName()}", TRUE));
  58. $document->add(new Image("templates/icons/title.gif"));
  59. $document->add(new Link("myadopts/rename/{$ownedAdopt->getID()}", " Rename {$ownedAdopt->getName()}", TRUE));
  60. $document->add(new Image("templates/icons/trade.gif"));
  61. $document->add(new Link("myadopts/trade/{$ownedAdopt->getID()}", " Change Trade status for {$ownedAdopt->getName()}", TRUE));
  62. $document->add(new Image("templates/icons/freeze.gif"));
  63. $document->add(new Link("myadopts/freeze/{$ownedAdopt->getID()}", " Freeze or Unfreeze {$ownedAdopt->getName()}", TRUE));
  64. $document->add(new Image("templates/icons/delete.gif"));
  65. $document->add(new Link("pound/pound/{$ownedAdopt->getID()}", " Pound {$ownedAdopt->getName()}", TRUE));
  66. }
  67.  
  68. public function stats(){
  69. $ownedAdopt = $this->getField("ownedAdopt");
  70. $votes = $this->getField("votes");
  71.  
  72. $document = $this->document;
  73. $document->setTitle($ownedAdopt->getName() . $this->lang->stats);
  74. $document->add($ownedAdopt->getAdoptImage());
  75. $document->add($ownedAdopt->getStats());
  76. $document->addLangvar("<h2>{$ownedAdopt->getName()}'s Voters:</h2><br>{$this->lang->voters}<br><br>");
  77.  
  78. $helper = new UserTableHelper;
  79. $voterTable = new TableBuilder("voters", 500);
  80. $voterTable->setAlign(new Align("center"));
  81. $voterTable->buildHeaders("User", "Date Voted", "Profile", "PM");
  82. $voterTable->setHelper($helper);
  83. $votesIterator = $votes->iterator();
  84. while($votesIterator->hasNext()){
  85. $vote = $votesIterator->next();
  86. $cells = new LinkedList;
  87. $cells->add(new TCell($helper->getUsername($vote->getUsername())));
  88. $cells->add(new TCell($vote->getDate("Y-m-d")));
  89. $cells->add(new TCell($helper->getProfileImage($vote->getUserID())));
  90. $cells->add(new TCell($helper->getPMImage($vote->getUserID())));
  91. $voterTable->buildRow($cells);
  92. }
  93. $document->add($voterTable);
  94. }
  95.  
  96. public function bbcode(){
  97. $mysidia = Registry::get("mysidia");
  98. $adopt = $this->getField("adopt");
  99. $document = $this->document;
  100. $document->setTitle($this->lang->bbcode . $adopt->getName());
  101. $document->addLangvar($this->lang->bbcode_info);
  102. $document->add(new Comment("<br>"));
  103.  
  104. $forumComment = new Comment("Forum BBCode: ");
  105. $forumComment->setUnderlined();
  106. $forumcode = "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}[/img][/url]";
  107. $forumArea = new TextArea("forumcode", $forumcode, 4, 50);
  108. $forumArea->setReadOnly(TRUE);
  109.  
  110. $altComment = new Comment("Alternative BBCode: ");
  111. $altComment->setUnderlined();
  112. $altcode = "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}.gif\"[/img][/url]";
  113. $altArea = new TextArea("altcode", $altcode, 4, 50);
  114. $altArea->setReadOnly(TRUE);
  115.  
  116. $htmlComment = new Comment("HTML BBCode: ");
  117. $htmlComment->setUnderlined();
  118. $htmlcode = "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}' target='_blank'>
  119. <img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}' border=0></a>";
  120. $htmlArea = new TextArea("htmlcode", $htmlcode, 4, 50);
  121. $htmlArea->setReadOnly(TRUE);
  122.  
  123. $document->add($forumComment);
  124. $document->add($forumArea);
  125. $document->add($altComment);
  126. $document->add(($mysidia->settings->usealtbbcode == "yes") ? $altArea : new Comment("The Admin has disabled Alt BBCode for this site."));
  127. $document->add($htmlComment);
  128. $document->add($htmlArea);
  129. }
  130.  
  131. public function rename(){
  132. $mysidia = Registry::get("mysidia");
  133. $adopt = $this->getField("adopt");
  134. $image = $this->getField("image");
  135. $document = $this->document;
  136.  
  137. if($mysidia->input->post("submit")){
  138. $document->setTitle($this->lang->rename_success_title);
  139. $document->add($image);
  140. $message = "<br>{$this->lang->rename_success}{$adopt->getName()}.
  141. You can now manage {$adopt->getName()} on the";
  142. $document->addLangvar($message);
  143. $document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));
  144. return;
  145. }
  146.  
  147. $document->setTitle($this->lang->rename . $adopt->getName());
  148. $document->add($image);
  149. $document->addLangvar("<br />{$this->lang->rename_default}{$adopt->getName()}{$this->lang->rename_details}<br />");
  150.  
  151. $renameForm = new FormBuilder("renameform", "", "post");
  152. $renameForm->buildTextField("adoptname")->buildButton("Rename Adopt", "submit", "submit");
  153. $document->add($renameForm);
  154. }
  155.  
  156. public function trade(){
  157. $adopt = $this->getField("adopt");
  158. $image = $this->getField("image");
  159. $confirm = $this->getField("confirm");
  160. $document = $this->document;
  161. $document->setTitle($this->lang->trade . $adopt->getName());
  162. $document->add($image);
  163.  
  164. if($confirm) $document->addLangvar(($adopt->getTradeStatus() == "fortrade") ? $this->lang->trade_allow : $this->lang->trade_disallow);
  165. else{
  166. $document->addLangvar("Are you sure you wish to change the trade status of this adoptable?
  167. <center><b><a href='{$adopt->getAdoptID()}/confirm'>Yes I'd like to change its trade status</a></b><br /><br />
  168. <b><a href='../../myadopts'>Nope I change my mind! Go back to the previous page.</a></b></center><br />");
  169. }
  170. }
  171.  
  172. public function index(){
  173. $document = $this->document;
  174. $document->setTitle($this->lang->title);
  175.  
  176. $pagination = $this->getField("pagination");
  177. $ownedAdopts = $this->getField("ownedAdopts");
  178.  
  179. $ownedAdoptsIterator = $ownedAdopts->iterator();
  180. while($ownedAdoptsIterator->hasNext()){
  181. $ownedAdopt = $ownedAdoptsIterator->next();
  182. $document->add(new Comment("<a href='http://emotidogs.online/myadopts/manage/{$ownedAdopt->getID()}'><img src='/picuploads/dog_images/adult/{$ownedAdopt->getID()}.png?{$ownedAdopt->getImgLastUpdate()}' width='300px'></a>"));
  183.  
  184. }
  185. $document->addLangvar($pagination->showPage());
  186. }
  187.  
  188. public function freeze(){
  189. $adopt = $this->getField("adopt");
  190. $image = $this->getField("image");
  191. $confirm = $this->getField("confirm");
  192. $document = $this->document;
  193. $document->setTitle($this->lang->freeze . $adopt->getName());
  194. $document->add($image);
  195.  
  196. if($confirm){
  197. $document->addLangvar(($adopt->isFrozen() == "yes") ? $this->lang->freeze_success : $this->lang->freeze_reverse);
  198. $document->addLangvar("<br>You may now manage {$adopt->getName()} on the ");
  199. $document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));
  200. }
  201. else{
  202. $document->add(new Comment("<br /><b>{$adopt->getName()}'s Current Status: "));
  203.  
  204. if($adopt->isfrozen() == "yes"){
  205. $document->add(new Image("templates/icons/freeze.gif", "Frozen"));
  206. $document->add(new Comment("Frozen<br<br>"));
  207. $document->add(new Comment($this->lang->freeze));
  208. $document->add(new Image("templates/icons/unfreeze.gif", "Unfreeze"));
  209. $document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Unfreeze this Adoptable", TRUE));
  210. }
  211. else{
  212. $document->add(new Image("templates/icons/unfreeze.gif", "Not Frozen"));
  213. $document->add(new Comment("Not Frozen<br><br>"));
  214. $document->add(new Comment($this->lang->freeze));
  215. $document->add(new Image("templates/icons/freeze.gif", "Greeze"));
  216. $document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Freeze this Adoptable", TRUE));
  217. }
  218. $document->add(new Comment("<br><br>"));
  219. $document->add(new Image("templates/icons/warning.gif"));
  220. $document->addLangvar($this->lang->freeze_warning);
  221. }
  222. }
  223. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement