Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. require __DIR__ . '/Controller.php';
  4.  
  5. class Controller_Awards extends Controller {
  6.  
  7. public function handle() {
  8. $model = $this->_getMilpacModel();
  9.  
  10. if (isset($this->params['user_id'])) {
  11. $milpac = $model->getMilpacBase($this->params['user_id']);
  12. $awards = $model->getAwardsNew($milpac['relation_id']);
  13.  
  14. if (!isset($awards[0]['award_id'])) {
  15. return $this->respond($this->noMilpac($this->params['user_id']));
  16. }
  17.  
  18. foreach ($awards as $key => $award) {
  19. unset($awards[$key]['award_id']);
  20. }
  21.  
  22. return $this->respond($awards);
  23.  
  24. } else {
  25. $error = $this->noUserIDProvided();
  26. return $this->respond($error);
  27. }
  28. }
  29.  
  30. protected function _getMilpacModel() {
  31. return $this->createModel('Milpac');
  32. }
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement