/**
  * Show IdP logins for one SP.
  *
  * @see BACKLOG-21
  */
 public function showIdpLoginsBySpAction()
 {
     $entityId = $this->getRequest()->getParam('eid', false);
     if (!$entityId) {
         throw new Exception('No entity ID provided!');
     }
     $this->_addExportParameter('eid', $entityId);
     $this->_searchParams->addSearchParam('entity_id', $entityId);
     $service = new EngineBlock_Service_LoginLog();
     $results = $service->searchIdpLoginsBySp($this->_searchParams);
     $this->view->entityId = $entityId;
     $this->view->ResultSet = $results->getResults();
 }
 /**
  * Get the number of logins for a provider type in given month.
  * 
  * @param Integer $timestamp timestamp to determine the month
  *                this KPI covers.
  * @param String $type Provider type (IdP or SP)
  * @return Integer
  */
 protected function _getProviderTypeLogins($timestamp, $type)
 {
     /**
      * Get logins for the month in timestamp.
      */
     $date = getdate($timestamp);
     $searchFields = array('year' => $date['year'], 'month' => $date['mon']);
     $params = Surfnet_Search_Parameters::create()->setSearchParams($searchFields);
     $service = new EngineBlock_Service_LoginLog();
     switch ($type) {
         case self::KPI_IDP:
             $logins = $service->searchCountByIdp($params)->getResults();
             break;
         case self::KPI_SP:
             $logins = $service->searchCountBySp($params)->getResults();
             break;
         default:
             throw new Exception("KPI Provider Type");
             break;
     }
     return $logins[0]["num"];
 }