1
|
<?php
|
2
|
|
3
|
defined( '_JEXEC' ) or die('Access denied');
|
4
|
|
5
|
jimport('joomla.application.component.view');
|
6
|
jimport('joomla.document.document');
|
7
|
jimport('joomla.environment.request');
|
8
|
jimport('joomla.environment.uri');
|
9
|
jimport('joomla.event.dispatcher' );
|
10
|
jimport('joomla.methods');
|
11
|
jimport('joomla.log.log');
|
12
|
|
13
|
class OpenaireViewClaims extends JViewLegacy{
|
14
|
|
15
|
function display($tpl = null) {
|
16
|
$document = JFactory::getDocument();
|
17
|
$application = JFactory :: getApplication();
|
18
|
$this->itemId = JFactory :: getApplication()->input->get('itemId', '');
|
19
|
if (JFactory :: getUser()->guest) {
|
20
|
JFactory :: getApplication()->redirect(JRoute :: _('index.php?option=com_users&view=login&Itemid=' . $this->itemId . '&return=' . base64_encode(JRoute :: _('index.php?option=com_openaire&view=claims&Itemid=' . $this->itemId, FALSE)), FALSE));
|
21
|
return TRUE;
|
22
|
}
|
23
|
|
24
|
|
25
|
$model = $this->getModel('claim');
|
26
|
|
27
|
$from = urldecode(JRequest::getString('fromDate', urlencode(date('d/m/Y', time() - 7*24*60*60))));
|
28
|
$to = urldecode(JRequest::getString('toDate', urlencode(date('d/m/Y'))));
|
29
|
|
30
|
$orderBy = JFactory :: getApplication()->input->get('orderBy', 'title');
|
31
|
$action = JFactory :: getApplication()->input->get('action', '');
|
32
|
if ($action == 'removeSelected') {
|
33
|
$toDelete = JRequest :: getString('toRemove', '');
|
34
|
$toDeleteEmails = JRequest :: getString('toRemoveEmails', '');
|
35
|
$ids = explode(",", $toDelete);
|
36
|
$emails = explode(",", $toDeleteEmails);
|
37
|
for ($i = 0; $i < count($ids); $i++) {
|
38
|
$email = '';
|
39
|
$model->deleteClaim($emails[$i], $ids[$i]);
|
40
|
}
|
41
|
$application->redirect(JRoute :: _('index.php?option=com_openaire&view=claims&fromDate=' . $from . '&toDate=' . $to . '&Itemid=' . $this->itemId, FALSE));
|
42
|
}
|
43
|
$claims = $model->getClaimedDocsByTime($from, $to);
|
44
|
$this->assignRef('claims', $claims);
|
45
|
$this->assignRef('fromDate', $from);
|
46
|
$this->assignRef('toDate', $to);
|
47
|
|
48
|
parent::display($tpl);
|
49
|
}
|
50
|
}
|
51
|
?>
|