itemId = JRequest :: getUInt('Itemid', 0); $templateId = JRequest :: getString('templateId'); $notificationService = JRequest :: getString('notificationService'); $queryId = JRequest :: getString('queryId'); $resultId = JRequest :: getString('resultId'); $alertMode = JRequest :: getString('alertMode'); $batchPeriod = JRequest :: getString('batchPeriod'); $subscriber = JRequest :: getString('subscriber'); $user = JFactory :: getUser(); $alerts = $this -> getModel(self :: ALERTS); $piwik = $this -> getModel(self :: PIWIK); $application = JFactory :: getApplication(); if ($user -> guest) { $application -> redirect(JRoute :: _('index.php?option=com_users&view=login&Itemid=' . $this -> itemId . '&return=' . base64_encode(JRoute :: _('index.php?option=com_openaire&view=alerts&Itemid=' . $this -> itemId, FALSE)), FALSE)); return TRUE; } switch (JRequest :: getCmd('action')) { case 'add': if (($templateId != NULL) && ($notificationService != NULL) && ($queryId != NULL) && ($resultId != NULL) && ($alertMode != NULL) && ($batchPeriod != NULL)) { $piwik -> track('addAlert', 'template=' . urlencode($templateId) . '¬ificationService=' . urlencode($notificationService) . '&query=' . urlencode($queryId) . '&result=' . urlencode($resultId) . '&mode=' . urlencode($alertMode) . '&batch=' . urlencode($batchPeriod)); $alerts -> addSubscription($templateId, $notificationService, $queryId, $resultId, $alertMode, $batchPeriod, $user); } $application -> redirect(JRoute :: _('index.php?option=com_openaire&view=alerts&Itemid=' . $this -> itemId, FALSE)); return TRUE; case 'remove': if (($templateId != NULL) && ($notificationService != NULL) && ($queryId != NULL) && ($resultId != NULL) && ($alertMode != NULL) && ($subscriber != NULL)) { $piwik -> track('removeAlert', 'template=' . urlencode($templateId) . '¬ificationService=' . urlencode($notificationService) . '&query=' . urlencode($queryId) . '&result=' . urlencode($resultId) . '&mode=' . urlencode($alertMode) . '&subscriber=' . urlencode($subscriber)); $alerts -> removeSubscription($templateId, $notificationService, $queryId, $resultId, $alertMode, $subscriber, $user); } $application -> redirect(JRoute :: _('index.php?option=com_openaire&view=alerts&Itemid=' . $this -> itemId, FALSE)); return TRUE; default: JViewLegacy :: loadHelper('PiwikHelper'); PiwikHelper :: logPageView('viewAlerts', ''); $this -> subscriptions = $alerts -> getSubscriptions($user); $this -> alertModes = $alerts -> getAlertModes($user); } if (count($errors = $this -> get('Errors')) > 0) { JLog :: add('Error viewing alerts: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); return FALSE; } parent :: display($template); } }