Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require __DIR__ . '/Controller.php';
- class Controller_Awards extends Controller {
- public function handle() {
- $model = $this->_getMilpacModel();
- if (isset($this->params['user_id'])) {
- $milpac = $model->getMilpacBase($this->params['user_id']);
- $awards = $model->getAwardsNew($milpac['relation_id']);
- if (!isset($awards[0]['award_id'])) {
- return $this->respond($this->noMilpac($this->params['user_id']));
- }
- foreach ($awards as $key => $award) {
- unset($awards[$key]['award_id']);
- }
- return $this->respond($awards);
- } else {
- $error = $this->noUserIDProvided();
- return $this->respond($error);
- }
- }
- protected function _getMilpacModel() {
- return $this->createModel('Milpac');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement