/**
  * Does the control for pub-actions and returns the html-response of the view of pubcontroller
  *
  * @return string - HTML-response of the view
  */
 public function doPub()
 {
     // Service class that talks to the db. Instance created here since admin-controller has
     // its own class called AdminFacade, dont want to create service-object if admin-action
     $service = new \model\Service();
     $pubs = $service->getPubs();
     $beers = $service->getBeers();
     $listPubsView = new \view\ListPubsView($pubs, $this->navView);
     $pubController = new \controller\PubController($listPubsView, $this->navView, $beers);
     $pubController->doControl();
     return $pubController->getView()->response();
 }
示例#2
0
 /**
  * Returns the list of services
  * @param model\Filter $filter (optional) filter to use
  * @return model\Service[]
  */
 public function getServices($filter = null)
 {
     $services = array();
     // Create the request
     $request = new client\Request('/api/mpegts/service/grid');
     if ($filter) {
         $request->setFilter($filter);
     }
     // Get the response
     $response = $this->_client->getResponse($request);
     $rawContent = $response->getContent();
     $content = json_decode($rawContent);
     foreach ($content->entries as $entry) {
         $services[] = model\Service::fromRawEntry($entry);
     }
     return $services;
 }