Пример #1
0
 function render()
 {
     SpotTiming::start(__FUNCTION__);
     # Controleer de users' rechten
     $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_view_spots_index, '');
     # als een zoekopdracht is meegegevne, moeten er ook rechten zijn om te mogen zoeken
     if (!empty($this->_params['search'])) {
         $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_perform_search, '');
     }
     # if
     $spotsOverview = new SpotsOverview($this->_db, $this->_settings);
     # Zet the query parameters om naar een lijst met filters, velden,
     # en sorteringen etc
     $spotUserSystem = new SpotUserSystem($this->_db, $this->_settings);
     $parsedSearch = $spotsOverview->filterToQuery($this->_params['search'], array('field' => $this->_params['sortby'], 'direction' => $this->_params['sortdir']), $this->_currentSession, $spotUserSystem->getIndexFilter($this->_currentSession['user']['userid']));
     # Haal de offset uit de URL en zet deze als startid voor de volgende zoektocht
     # Als de offset niet in de url staat, zet de waarde als 0, het is de eerste keer
     # dat de index pagina wordt aangeroepen
     $pageNr = $this->_params['pagenr'];
     $nextPage = $pageNr + 1;
     if ($nextPage == 1) {
         $prevPage = -1;
     } else {
         $prevPage = max($pageNr - 1, 0);
     }
     # else
     # afhankelijk van wat er gekozen is, voer het uit
     if (isset($parsedSearch['filterValueList'][0]['fieldname']) && $parsedSearch['filterValueList'][0]['fieldname'] == "Watch") {
         # Controleer de users' rechten
         $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_keep_own_watchlist, '');
         switch ($this->_action) {
             case 'remove':
                 $this->_db->removeFromSpotStateList(SpotDb::spotstate_Watch, $this->_params['messageid'], $this->_currentSession['user']['userid']);
                 $spotsNotifications = new SpotNotifications($this->_db, $this->_settings, $this->_currentSession);
                 $spotsNotifications->sendWatchlistHandled($this->_action, $this->_params['messageid']);
                 break;
             case 'add':
                 $this->_db->addToSpotStateList(SpotDb::spotstate_Watch, $this->_params['messageid'], $this->_currentSession['user']['userid'], '');
                 $spotsNotifications = new SpotNotifications($this->_db, $this->_settings, $this->_currentSession);
                 $spotsNotifications->sendWatchlistHandled($this->_action, $this->_params['messageid']);
                 break;
             default:
         }
         # switch
     }
     # if
     # laad de spots
     $spotsTmp = $spotsOverview->loadSpots($this->_currentSession['user']['userid'], $pageNr, $this->_currentSession['user']['prefs']['perpage'], $parsedSearch);
     # als er geen volgende pagina is, ook niet tonen
     if (!$spotsTmp['hasmore']) {
         $nextPage = -1;
     }
     # if
     # zet de page title
     $this->_pageTitle = "overzicht";
     #- display stuff -#
     $this->template('spots', array('spots' => $spotsTmp['list'], 'quicklinks' => $this->_settings->get('quicklinks'), 'filters' => $this->_db->getFilterList($this->_currentSession['user']['userid'], 'filter'), 'nextPage' => $nextPage, 'prevPage' => $prevPage, 'parsedsearch' => $parsedSearch, 'data' => $this->_params['data']));
     SpotTiming::stop(__FUNCTION__);
 }
Пример #2
0
 function getNzb()
 {
     if ($this->_params['del'] == "1" && $this->_spotSec->allowed(SpotSecurity::spotsec_keep_own_watchlist, '')) {
         $spot = $this->_db->getFullSpot($this->_params['messageid'], $this->_currentSession['user']['userid']);
         if ($spot['watchstamp'] !== NULL) {
             $this->_db->removeFromWatchList($this->_params['messageid'], $this->_currentSession['user']['userid']);
             $spotsNotifications = new SpotNotifications($this->_db, $this->_settings, $this->_currentSession);
             $spotsNotifications->sendWatchlistHandled('remove', $this->_params['messageid']);
         }
         # if
     }
     # if
     header('Location: ' . $this->_tplHelper->makeBaseUrl("full") . '?page=getnzb&action=display&messageid=' . $this->_params['messageid'] . html_entity_decode($this->_tplHelper->makeApiRequestString()));
 }
Пример #3
0
 function render()
 {
     SpotTiming::start(__CLASS__ . '::' . __FUNCTION__);
     # Give an page title
     $this->_pageTitle = _("overview");
     /* 
      * Make sure the user has the appropriate permissions
      */
     $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_view_spots_index, '');
     /*
      * When the user wants to perform a search, it needs specific search rights
      * as well
      */
     if (!empty($this->_params['search'])) {
         $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_perform_search, '');
     }
     # if
     /*
      * We get a bunch of query parameters, so now change this to the actual
      * search query the user requested including the required sorting
      */
     $svcUserFilter = new Services_User_Filters($this->_daoFactory, $this->_settings);
     $svcSearchQp = new Services_Search_QueryParser($this->_daoFactory->getConnection());
     $parsedSearch = $svcSearchQp->filterToQuery($this->_params['search'], array('field' => $this->_params['sortby'], 'direction' => $this->_params['sortdir']), $this->_currentSession, $svcUserFilter->getIndexFilter($this->_currentSession['user']['userid']));
     /*
      * If any specific action was chosen, we perform that as well
      */
     if (isset($parsedSearch['filterValueList'][0]['fieldname']) && $parsedSearch['filterValueList'][0]['fieldname'] == "Watch") {
         # Make sure the appropriate permissions are set
         $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_keep_own_watchlist, '');
         $svcSpotStateListDao = new Services_Actions_SpotStateList($this->_daoFactory->getSpotStateListDao());
         switch ($this->_action) {
             case 'remove':
                 $svcSpotStateListDao->removeFromWatchList($this->_params['messageid'], $this->_currentSession['user']['userid']);
                 $spotsNotifications = new SpotNotifications($this->_daoFactory, $this->_settings, $this->_currentSession);
                 $spotsNotifications->sendWatchlistHandled($this->_action, $this->_params['messageid']);
                 break;
             case 'add':
                 $svcSpotStateListDao->addToWatchList($this->_params['messageid'], $this->_currentSession['user']['userid']);
                 $spotsNotifications = new SpotNotifications($this->_daoFactory, $this->_settings, $this->_currentSession);
                 $spotsNotifications->sendWatchlistHandled($this->_action, $this->_params['messageid']);
                 break;
             default:
         }
         # switch
     }
     # if
     /*
      * Get the offset from the URL, if none given, we default to zero
      */
     $pageNr = $this->_params['pagenr'];
     /* 
      * Actually fetch the spots, we always perform
      * this action even when the watchlist is editted
      */
     $svcProvSpotList = new Services_Providers_SpotList($this->_daoFactory->getSpotDao());
     $spotsTmp = $svcProvSpotList->fetchSpotList($this->_currentSession['user']['userid'], $pageNr, $this->_currentSession['user']['prefs']['perpage'], $parsedSearch);
     /*
      * If we are on the first page, we want to pass '-1' as the previous page,
      * so the templates can deduce we are on the first page.
      *
      * If there are no more spots, make sure we don't show
      * the nextpage link
      */
     if ($spotsTmp['hasmore']) {
         $nextPage = $pageNr + 1;
     } else {
         $nextPage = -1;
     }
     # else
     $prevPage = max($pageNr - 1, -1);
     #- display stuff -#
     $this->template('spots', array('spots' => $spotsTmp['list'], 'quicklinks' => $this->_settings->get('quicklinks'), 'filters' => $svcUserFilter->getFilterList($this->_currentSession['user']['userid'], 'filter'), 'nextPage' => $nextPage, 'prevPage' => $prevPage, 'parsedsearch' => $parsedSearch, 'data' => $this->_params['data']));
     SpotTiming::stop(__CLASS__ . '::' . __FUNCTION__);
 }