Project

General

Profile

« Previous | Next » 

Revision 40569

in refine area of browse/ search pages: when filter by funder show 'also funded by' filter and use only the next level of funding streams

View differences:

modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/helpers/filterhelper.php
14 14
	// $baseUrl the base URL to use for links
15 15
	// $fragment the URL fragment to use for links
16 16
	// return a string containing the full HTML for the filters or an empty string if any errors occur
17
	public static function formatFilters($filters, $statistics, $baseUrl, $fragment) {
17
	/*public static function formatFilters($filters, $statistics, $baseUrl, $fragment) {
18 18
		$filters = ($filters == NULL) ? NULL : array_filter(array_map(function ($filter) use ($filters, $statistics, $baseUrl, $fragment) {return FilterHelper :: _formatFilter($filter, $statistics, $filters, $baseUrl, $fragment);}, $filters));
19 19
		return ($filters == NULL) ? '' : ('<h2>' . JText :: _('CURRENT_SELECTIONS') . '</h2><div class="selectorCollections">' . implode('', $filters) . ((count($filters) > 1) ? ('<div class="flowWrapper"><a href="' . JRoute :: _($baseUrl . $fragment) . '" class="clearFilters" title="' . JText :: _('CLEAR_ALL_FILTERS') . '">' . JText :: _('CLEAR_ALL') . '</a></div>') : '') . '</div>');
20 20
	}
......
27 27
                mb_internal_encoding('UTF-8');
28 28
		return (($statistics == NULL) || (!array_key_exists($filter -> name, $statistics)) || ($statistics[$filter -> name] -> data == NULL) || (!array_key_exists($filterValue, $statistics[$filter -> name] -> data))) ? '' : '<div class="element"><div class="flowWrapper"><a href="' . JRoute :: _($baseUrl . (($filters == NULL) ? '' : ('&amp;' . implode('&amp;', $filters))) . $fragment) . '"class="selectorRemove" title="' . $statistics[$filter -> name] -> data[$filterValue] -> name . '"><span class="fieldName">' . $statistics[$filter -> name] -> title . ':</span> ' . ((strlen($statistics[$filter -> name] -> data[$filterValue] -> name) > FilterHelper :: MAX_ROW) ? (mb_substr($statistics[$filter -> name] -> data[$filterValue] -> name, 0, FilterHelper :: MAX_ROW - strlen('...')) . '...') : $statistics[$filter -> name] -> data[$filterValue] -> name) . '</a></div></div>';
29 29
	}
30
        */
31
        public static function formatFilters($filters, $statistics, $baseUrl, $fragment) {
32
		$filtersRows = ($filters == NULL) ? NULL : array();
33
                $funders= array();
34
                foreach($filters as $filter){
35
                   if(strpos($filter -> name, 'funder') !== FALSE){
36
                        if($filter -> value != NULL && (strpos($filter -> value, ',') !== FALSE)){                       
37
                            foreach(split(',',$filter -> value) as $id){
38
                                if(!empty($id)){
39
                                    $filtersRows[]=FilterHelper :: _formatFunderFilter($id, $filter -> name, $statistics, $filters, $baseUrl, $fragment);
40
                                }    
41
                            }
42
                        }else{
43
                            $filtersRows[]=FilterHelper :: _formatFilter($filter, $statistics, $filters, $baseUrl, $fragment);
44
                        }                        
45
                    }else{
46
                        $filtersRows[]=FilterHelper :: _formatFilter($filter, $statistics, $filters, $baseUrl, $fragment);
47
                    }
48
                }
49
		return ($filtersRows == NULL) ? '' : ('<h2>' . JText :: _('CURRENT_SELECTIONS') . '</h2><div class="selectorCollections">' . implode('', $filtersRows) . ((count($filtersRows) > 1 ) ? ('<div class="flowWrapper"><a href="' . JRoute :: _($baseUrl . $fragment) . '" class="clearFilters" title="' . JText :: _('CLEAR_ALL_FILTERS') . '">' . JText :: _('CLEAR_ALL') . '</a></div>') : '') . '</div>');
50
	}
51
	
52
	public static function _formatFunderFilter($id, $filterName, $statistics, $filters, $baseUrl, $fragment) {
53
                $filterValue = ($id === TRUE) ? 'true' : (($id === FALSE) ? 'false' : $id);
54
		$filters = ($filters == NULL) ? NULL : array_filter(array_map(function ($otherFilter) use ($filterName,$id) {return ($otherFilter -> name == $filterName) ?  self::_f($filterName,$id,$otherFilter) : (urlencode($otherFilter -> name) . '=' . urlencode(($otherFilter -> value === TRUE) ? 'true' : (($otherFilter -> value === FALSE) ? 'false' : $otherFilter -> value)));}, $filters));
55
		// TODO JRoute :: _ keeps decoding urlencoded values, so this is just a hack to cope with this
56
                mb_internal_encoding('UTF-8');
57
		return (($statistics == NULL) || (!array_key_exists($filterName, $statistics)) || ($statistics[$filterName] -> data == NULL) || (!array_key_exists($filterValue, $statistics[$filterName] -> data))) ? '' : '<div class="element"><div class="flowWrapper"><a href="' . JRoute :: _($baseUrl . (($filters == NULL) ? '' : ('&amp;' . implode('&amp;', $filters))) . $fragment) . '"class="selectorRemove" title="' . $statistics[$filterName] -> data[$filterValue] -> name . '"><span class="fieldName">' . $statistics[$filterName] -> title . ':</span> ' . ((strlen($statistics[$filter -> name] -> data[$filterValue] -> name) > FilterHelper :: MAX_ROW) ? (mb_substr($statistics[$filterName] -> data[$filterValue] -> name, 0, FilterHelper :: MAX_ROW - strlen('...')) . '...') : $statistics[$filterName] -> data[$filterValue] -> name) . '</a></div></div>';                
58
        }
59
        public static function _f($name, $value, $otherfilter) {
60
                    $temp='';
61
                    if($name== $otherfilter -> name && (strpos($name, 'funder') !== FALSE)){   
62
                       if($otherfilter -> value != NULL && (strpos($otherfilter -> value, ',') !== FALSE)){                                                  
63
                           foreach(split(',', $otherfilter -> value) as $id){
64
                               if(!empty($id) && $id!==$value){
65
                                  $temp.=$id.',' ;
66
                               }
67
                           }
68
                           $temp=$name.'='.substr($temp, 0, -1);                           
69
                       }                       
70
                    }
71
                    return $temp;
72
        }     
73
        public static function _formatFilter($filter, $statistics, $filters, $baseUrl, $fragment) {
74
                $filterName = $filter -> name;
75
		$filterValue = ($filter -> value === TRUE) ? 'true' : (($filter -> value === FALSE) ? 'false' : $filter -> value);
76
		$filters = ($filters == NULL) ? NULL : array_filter(array_map(function ($otherFilter) use ($filterName) {return ($otherFilter -> name == $filterName) ? '' : (urlencode($otherFilter -> name) . '=' . urlencode(($otherFilter -> value === TRUE) ? 'true' : (($otherFilter -> value === FALSE) ? 'false' : $otherFilter -> value)));}, $filters));
77
		// TODO JRoute :: _ keeps decoding urlencoded values, so this is just a hack to cope with this
78
                mb_internal_encoding('UTF-8');
79
		return (($statistics == NULL) || (!array_key_exists($filter -> name, $statistics)) || ($statistics[$filter -> name] -> data == NULL) || (!array_key_exists($filterValue, $statistics[$filter -> name] -> data))) ? '' : '<div class="element"><div class="flowWrapper"><a href="' . JRoute :: _($baseUrl . (($filters == NULL) ? '' : ('&amp;' . implode('&amp;', $filters))) . $fragment) . '"class="selectorRemove" title="' . $statistics[$filter -> name] -> data[$filterValue] -> name . '"><span class="fieldName">' . $statistics[$filter -> name] -> title . ':</span> ' . ((strlen($statistics[$filter -> name] -> data[$filterValue] -> name) > FilterHelper :: MAX_ROW) ? (mb_substr($statistics[$filter -> name] -> data[$filterValue] -> name, 0, FilterHelper :: MAX_ROW - strlen('...')) . '...') : $statistics[$filter -> name] -> data[$filterValue] -> name) . '</a></div></div>';                
80
	}
81
        
30 82
}
31 83

  
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/helpers/statistichelper.php
7 7
// This helper formats statistics.
8 8
abstract class StatisticHelper {
9 9
	const MAX_ROWS = 5;
10
	const MAX_ROW = 22;
10
	const MAX_ROW = 25;
11 11

  
12 12
	// Format statistics.
13 13
	// $statistics the statistics to format
......
15 15
	// $baseUrl the base URL to use for links
16 16
	// $fragment the URL fragment to use for links
17 17
	// return a string containing the full HTML for the statistics or an empty string if any errors occur
18
	public static function formatStatistics($statistics, $filters, $baseUrl, $fragment) {
18
	public static function formatStatistics($statistics, $filters, $baseUrl, $fragment) {               
19 19
		$statistics = ($statistics == NULL) ? NULL : array_filter(array_map(function ($statistic) use ($filters, $baseUrl, $fragment) {return StatisticHelper :: _formatStatistic($statistic, $filters, $baseUrl, $fragment);}, $statistics));
20 20
		return ($statistics == NULL) ? '' : ('<h2>' . JText :: _('REFINE_BY') . '</h2><div class="selectorAvailable">' . implode('', $statistics) . '</div>');
21 21
	}
22
	
22
                       
23 23
	public static function _formatStatistic($statistic, $filters, $baseUrl, $fragment) {
24
		$data = (($statistic -> data == NULL) || array_key_exists($statistic -> id, $filters)) ? NULL : array_filter(array_map(function ($row) use ($statistic, $filters, $baseUrl, $fragment) {return StatisticHelper :: _formatRow($row, $statistic -> id, $filters, $baseUrl, $fragment);}, $statistic -> data));		
25
		return ($data == NULL) ? '' : ('<div class="element"><h3>' . $statistic -> title . '</h3><div class="flowWrapper">' . implode('<br />', array_slice($data, 0, StatisticHelper :: MAX_ROWS)) . ((count($data) > StatisticHelper :: MAX_ROWS) ? ('<br /><span class="viewmore">' . JText :: _('VIEW_MORE') . '</span><div style="display: none;"><div class="viewallpop" id="' . $statistic -> id . 'More"><div class="header"><h5>' . $statistic -> title . '</h5></div><p>' . implode('<br />', $data) . '</p></div></div>') : '') . '</div></div>');
24
            $hasExtraFunder=(array_key_exists($statistic -> id, $filters) && strpos($statistic -> id, 'funder') !== FALSE);
25
		$data = (($statistic -> data == NULL) || (array_key_exists($statistic -> id, $filters)&& strpos($statistic -> id, 'funder') === FALSE)) ? NULL : array_filter(array_map(function ($row) use ($statistic, $filters, $baseUrl, $fragment,$hasExtraFunder) {return ($hasExtraFunder)?StatisticHelper :: _formatRowForFunder($row, $statistic -> id, $filters, $baseUrl, $fragment):StatisticHelper :: _formatRow($row, $statistic -> id, $filters, $baseUrl, $fragment);}, $statistic -> data));		
26
		return ($data == NULL) ? '' : ('<div class="element"><h3>' .(($hasExtraFunder)?JText :: _('ALSO_FUNDED_BY'): $statistic -> title ). '</h3><div class="flowWrapper">' . implode('<br />', array_slice($data, 0, StatisticHelper :: MAX_ROWS)) . ((count($data) > StatisticHelper :: MAX_ROWS) ? ('<br /><span class="viewmore">' . JText :: _('VIEW_MORE') . '</span><div style="display: none;"><div class="viewallpop" id="' . $statistic -> id . 'More"><div class="header"><h5>' . $statistic -> title . '</h5></div><p>' . implode('<br />', $data) . '</p></div></div>') : '') . '</div></div>');
26 27
	}
27
	
28
            
28 29
	public static function _formatRow($row, $statisticId, $filters, $baseUrl, $fragment) {
29 30
		$filters = ($filters == NULL) ? NULL : array_filter(array_map(function ($filter) use ($statisticId) {return ($filter -> name == $statisticId) ? '' : (urlencode($filter -> name) . '=' . urlencode(($filter -> value === TRUE) ? 'true' : (($filter -> value === FALSE) ? 'false' : $filter -> value)));}, $filters));
30 31
		// TODO JRoute :: _ keeps decoding urlencoded values, so this is just a hack to cope with this
31 32
                mb_internal_encoding('UTF-8');
32 33
                //encode '&' to '%26' otherwise it takes it as a parameter
33 34
                $row -> id= str_replace('&','%26',$row -> id);
34
		return '<a href="' . JRoute :: _( $baseUrl . (($filters == NULL) ? '' : ('&' . implode('&', $filters))) . '&' . urlencode($statisticId) . '=' . urlencode($row -> id) . $fragment) . '" class="selectorAdd" title="' . $row -> name . '">' . ((strlen($row -> name) > StatisticHelper :: MAX_ROW) ? (mb_substr($row -> name, 0, StatisticHelper :: MAX_ROW - strlen('...')) . '...') : $row -> name ) . '</a>&nbsp;<span>(' . $row -> count . ')</span>';
35
		return '<a href="' . JRoute :: _( $baseUrl . (($filters == NULL) ? '' : ('&' . implode('&', $filters))) . '&' . urlencode($statisticId) . '=' . urlencode($row -> id) . $fragment) . '" class="selectorAdd" title="' . $row -> name . '">' . ((strlen($row -> name.'(' . $row -> count . ')') > StatisticHelper :: MAX_ROW) ? (mb_substr($row -> name, 0, StatisticHelper :: MAX_ROW - strlen('...(' . $row -> count . ')')) . '...') : $row -> name ) . '</a>&nbsp;<span>(' . $row -> count . ')</span>';
35 36
	}
37
        public static function _formatRowForFunder($row, $statisticId, $filters, $baseUrl, $fragment) {
38
                $funderId=($filters['funder']!==null)?'funder':'funderFilter';
39
                $funders=($filters[$funderId]==null)?'':$filters[$funderId] -> name.'='.$filters[$funderId] -> value;
40
		$filters = ($filters == NULL) ? NULL : array_filter(array_map(function ($filter) use ($statisticId) {return ($filter -> name == $statisticId) ? '' : (urlencode($filter -> name) . '=' . urlencode(($filter -> value === TRUE) ? 'true' : (($filter -> value === FALSE) ? 'false' : $filter -> value)));}, $filters));
41
		// TODO JRoute :: _ keeps decoding urlencoded values, so this is just a hack to cope with this
42
                mb_internal_encoding('UTF-8');
43
                //encode '&' to '%26' otherwise it takes it as a parameter
44
                $row -> id= str_replace('&','%26',$row -> id);
45
                
46
		return (strpos($funders, $row -> id) !== FALSE)?'':'<a href="' . JRoute :: _( $baseUrl . (($filters == NULL) ? '' : ('&' . implode('&', $filters))) . '&'.(empty($funders)? urlencode($statisticId) . '=':$funders.',')  . urlencode($row -> id) . $fragment) . '" class="selectorAdd" title="' . $row -> name . '">' . ((strlen($row -> name.'(' . $row -> count . ')') > StatisticHelper :: MAX_ROW) ? (mb_substr($row -> name, 0, StatisticHelper :: MAX_ROW - strlen('...(' . $row -> count . ')')) . '...') : $row -> name ) . '</a>&nbsp;<span>(' . $row -> count . ')</span>';
47
	}
36 48
}
37 49

  
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/language/en-GB/en-GB.com_openaire.ini
17 17
ALL="All"
18 18
ALL_FIELDS="all fields"
19 19
ALL_WORDS="all words"
20
ALSO_FUNDED_BY="Also funded by"
20 21
AN_ERROR_OCCURRED_PLEASE_TRY_AGAIN="An error occurred. Please try again."
21 22
ANY="any"
22 23
ANY_WORDS="any words"
......
408 409
PROJECT="Project"
409 410
PROJECTS="Projects"
410 411
PROJECTS_="Projects:"
412
PROJECTS_FUNDED_BY="Projects funded by"
411 413
CONCEPTS="Contexts"
412 414
CONCEPTS_="Contexts:"
413 415
PROJECT_CODE_="Project Code:"
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/models/search.php
100 100
    const DATASET_AUTHOR_ID = 'relpersonid';
101 101
    const DATASET_ID = 'objIdentifier';
102 102
    const PROJECT_QUERY = '(oaftype exact project)';
103
    const PROJECT = 'project';
103 104
    const PROJECT_FUNDER = 'funderid';
104 105
    const PROJECT_FUNDING_STREAM = 'fundinglevel0_id';
105 106
    const PROJECT_SCIENTIFIC_AREA = 'fundinglevel1_id';
......
212 213
    // Retrieve publication statistics using cache if enabled.
213 214
    // $locale the locale to use
214 215
    // return statistics (object)
215
    public function getPublicationStatistics($locale) {
216
    public function getPublicationStatistics($locale,$allFunders) {
216 217
        if ($this->cache->getCaching()) {
217
            $cacheId = self :: PUBLICATION_STATISTICS_CACHE_ID . '.' . $locale;
218
            $cacheId = self :: PUBLICATION_STATISTICS_CACHE_ID . '.' . $locale.'.'.$allFunders;
218 219
            $statistics = $this->cache->get($cacheId, self :: CACHE_GROUP);
219 220
            if ($statistics === FALSE) {
220
                $statistics = $this->_getPublicationStatistics($locale);
221
                $statistics = $this->_getPublicationStatistics($locale,$allFunders);
221 222
                if ($statistics !== NULL)
222 223
                    $this->cache->store($statistics, $cacheId, self :: CACHE_GROUP);
223 224
            }
224 225
        } else
225
            $statistics = $this->_getPublicationStatistics($locale);
226
            $statistics = $this->_getPublicationStatistics($locale,$allFunders);
226 227
        return $statistics;
227 228
    }
228 229

  
......
231 232
    // return statistics (object)
232 233
    public function getDatasetStatistics($locale) {
233 234
        if ($this->cache->getCaching()) {
234
            $cacheId = self :: DATASET_STATISTICS_CACHE_ID . '.' . $locale;
235
            $cacheId = self :: DATASET_STATISTICS_CACHE_ID . '.' . $locale.'.'. $allFunders;
235 236
            $statistics = $this->cache->get($cacheId, self :: CACHE_GROUP);
236 237
            if ($statistics === FALSE) {
237
                $statistics = $this->_getDatasetStatistics($locale);
238
                $statistics = $this->_getDatasetStatistics($locale,  $allFunders);
238 239
                if ($statistics !== NULL)
239 240
                    $this->cache->store($statistics, $cacheId, self :: CACHE_GROUP);
240 241
            }
241 242
        } else
242
            $statistics = $this->_getDatasetStatistics($locale);
243
            $statistics = $this->_getDatasetStatistics($locale, $allFunders);
243 244
        return $statistics;
244 245
    }
245 246

  
246 247
    // Retrieve project statistics using cache if enabled.
247 248
    // $locale the locale to use
248 249
    // return statistics (object)
249
    public function getProjectStatistics($locale) {
250
    public function getProjectStatistics($locale,  $allFunders) {
250 251
        if ($this->cache->getCaching()) {
251
            $cacheId = self :: PROJECT_STATISTICS_CACHE_ID . '.' . $locale;
252
            $cacheId = self :: PROJECT_STATISTICS_CACHE_ID . '.' . $locale.'.'. $allFunders;
252 253
            $statistics = $this->cache->get($cacheId, self :: CACHE_GROUP);
253 254
            if ($statistics === FALSE) {
254
                $statistics = $this->_getProjectStatistics($locale);
255
                $statistics = $this->_getProjectStatistics($locale,  $allFunders);
255 256
                if ($statistics !== NULL)
256 257
                    $this->cache->store($statistics, $cacheId, self :: CACHE_GROUP);
257 258
            }
258 259
        } else
259
            $statistics = $this->_getProjectStatistics($locale);
260
            $statistics = $this->_getProjectStatistics($locale, $allFunders);
260 261
        return $statistics;
261 262
    }
262 263

  
......
1035 1036
            $organizations = $this->_quickSearchOrganizations($keyword, $limit, $locale);
1036 1037
        return $organizations;
1037 1038
    }
1038

  
1039
   
1039 1040
    // Retrieve publication statistics.
1040 1041
    // $locale the locale to use
1042
    // $allFunders get all fields for funders
1041 1043
    // return statistics (object)
1042
    private function _getPublicationStatistics($locale) {
1043
        try {
1044
    private function _getPublicationStatistics($locale, $allFunders=false) {
1045
    try {
1044 1046
            $time = microtime(TRUE);
1045 1047
            $query = self :: PUBLICATION_QUERY;
1046 1048
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
......
1055 1057
            if ($document->loadXML($response->body) == FALSE)
1056 1058
                throw new Exception('invalid XML response');
1057 1059
            $xpath = new DOMXPath($document);
1058
            /* $statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'project', 'year', 'accessMode', 'datasource', 'community'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'CONTEXT'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND',
1059
              'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PROJECT_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_CONTEXT_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self :: PUBLICATION_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE, self :: PUBLICATION_CONTEXT));
1060

  
1061
             */
1062
            $statistics = $this->createStatistics($xpath, 
1060
            $statistics=null;
1061
            if($allFunders){
1062
                $statistics = $this->createStatistics($xpath, 
1063 1063
                    array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'fundingStreamLevel2', 'year', 'accessMode', 'datasource', 'community'),
1064 1064
                    array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'FUNDING_STREAM_LEVEL_2', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'), 
1065 1065
                    array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND',
1066 1066
                'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_FUNDING_STREAM_LEVEL2_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_COMMUNITY_STATISTICS_FOUND'), 
1067 1067
                    array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self :: PUBLICATION_FUNDING_STREAM_LEVEL2,  self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, 'resultcollectedfromdatasourceid' , self :: PUBLICATION_CONTEXT));
1068
            }else{
1069
                $statistics = $this->createStatistics($xpath, 
1070
                    array('type', 'languageFilter', 'funder',  'year', 'accessMode', 'datasource', 'community'),
1071
                    array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER',  'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITIES'), 
1072
                    array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND',
1073
                'NO_FUNDER_STATISTICS_FOUND',   'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND', 'NO_COMMUNITY_STATISTICS_FOUND'), 
1074
                    array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, 'resultcollectedfromdatasourceid' , self :: PUBLICATION_CONTEXT));
1068 1075
             
1076
            }                
1069 1077
            JLog :: add('Retrieved publication statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
1070 1078
            return $statistics;
1071 1079
        } catch (Exception $e) {
......
1074 1082
        }
1075 1083
    }
1076 1084

  
1085
                
1077 1086
    // Retrieve dataset statistics.
1078 1087
    // $locale the locale to use
1079 1088
    // return statistics (object)
1080
    private function _getDatasetStatistics($locale) {
1089
    private function _getDatasetStatistics($locale, $allFunders=false) {
1081 1090
        try {
1082 1091
            $time = microtime(TRUE);
1083 1092
            $query = self :: DATASET_QUERY;
......
1091 1100
            if ($document->loadXML($response->body) == FALSE)
1092 1101
                throw new Exception('invalid XML response');
1093 1102
            $xpath = new DOMXPath($document);
1094
            $statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('TYPE', 'LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
1103
            $statistics=null;
1104
            if($allFunders){
1105
                $statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('TYPE', 'LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
1106
            }else{
1107
                $statistics = $this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'year', 'accessMode', 'datasource'), array('TYPE', 'LANGUAGE', 'FUNDER',   'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND',  'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER,   self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
1108
            }                        
1095 1109
            JLog :: add('Retrieved dataset statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
1096 1110
            return $statistics;
1097 1111
        } catch (Exception $e) {
......
1103 1117
    // Retrieve project statistics.
1104 1118
    // $locale the locale to use
1105 1119
    // return statistics (object)
1106
    private function _getProjectStatistics($locale) {
1120
    private function _getProjectStatistics($locale, $allFunders) {
1107 1121
        try {
1108 1122
            $time = microtime(TRUE);
1109 1123
            $query = self :: PROJECT_QUERY;
1110 1124
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
1111 1125
            if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_FUNDING_STREAM . '&fields=' . self :: PROJECT_SCIENTIFIC_AREA . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
1126
            //if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL)
1112 1127
                throw new Exception('no HTTP response');
1113 1128
            if ($response->code != self :: HTTP_OK)
1114 1129
                throw new Exception('HTTP response code ' . $response->code);
......
1116 1131
            $document->recover = TRUE;
1117 1132
            if ($document->loadXML($response->body) == FALSE)
1118 1133
                throw new Exception('invalid XML response');
1134
            $statistics=null;
1119 1135
            $xpath = new DOMXPath($document);
1120
            $statistics = $this->createStatistics($xpath, 
1136
            if( $allFunders){
1137
                $statistics = $this->createStatistics($xpath, 
1121 1138
                    array('funder', 'fundingStream', 'scientificArea', 'startYear', 'endYear', 'sc39'),
1122 1139
                    array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), 
1123 1140
                    array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), 
1124 1141
                    array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
1142
            }else{
1143
                $statistics = $this->createStatistics($xpath, 
1144
                    array('funder',   'startYear', 'endYear', 'sc39'),
1145
                    array('FUNDER',   'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), 
1146
                    array('NO_FUNDER_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), 
1147
                    array(self :: PROJECT_FUNDER,  self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
1148
            }
1125 1149
            JLog :: add('Retrieved project statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
1126 1150
            return $statistics;
1127 1151
        } catch (Exception $e) {
......
1329 1353
            $query .= ($types == NULL) ? '' : (' and (' . $types . ')');
1330 1354
            $query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")');
1331 1355
            $query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")');
1332
            $query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
1356
             if($funder != NULL && (strpos($funder, ',') !== FALSE)){
1357
                $temp='';
1358
                foreach(split(',',$funder) as $id){
1359
                    if(!empty($id)){
1360
                        $temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and';
1361
                    }
1362
                   
1363
                }
1364
                $query .=  (' and (' . substr($temp, 0, -3). ')');
1365
            }else{
1366
                $query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
1367
            }
1368
            //$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
1333 1369
            $query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
1334 1370
            $query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
1335 1371
            $query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
......
1341 1377
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
1342 1378
            $completeQuery='search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size .  '&locale=' . str_replace('-', '_', $locale);
1343 1379
            if($isRefine){
1344
                $completeQuery='search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale);
1380
                $completeQuery='search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PUBLICATION) . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale);
1345 1381
            }
1346 1382
            //if (($response = $this->performGet('search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_PROJECT . '&locale=' . str_replace('-', '_', $locale))) == NULL)
1347 1383
            if (($response = $this->performGet($completeQuery)) == NULL)
......
1358 1394
            $result->totalDatasets = 0;
1359 1395
            $result->publications = $this->parsePublications($xpath);
1360 1396
            $result->statistics = $isRefine? $this->createStatisticsForPublications($xpath):NULL;
1397
            $result->statistics = self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
1361 1398
                    //$this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'fundingStreamLevel2', 'project', 'year', 'accessMode', 'datasource'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA','FUNDING_STREAM_LEVEL2', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND','NO_FUNDING_STREAM_LEVEL2_STATISTICS_FOUND', 'NO_PROJECT_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self::PUBLICATION_FUNDING_STREAM_LEVEL2, self :: PUBLICATION_FUNDING_STREAM_LEVEL2, self :: PUBLICATION_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE));
1362 1399
            JLog :: add('Simple search retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', articles: ' . ($articles ? 'true' : 'false') . ', books: ' . ($books ? 'true' : 'false') . ', theses: ' . ($theses ? 'true' : 'false') . ', reports: ' . ($reports ? 'true' : 'false') . ', type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
1363 1400
            return $result;
......
1435 1472
            $query .= ($accessMode == NULL) ? '' : (' and (' . self :: DATASET_ACCESS_MODE . ' exact "' . $accessMode . '")');
1436 1473
            $query .= ($datasource == NULL) ? '' : (' and (' . self :: DATASET_DATASOURCE . ' exact "' . $datasource . '")');
1437 1474
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
1438
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE . '&fields=' . self :: DATASET_FUNDER . '&fields=' . self :: DATASET_FUNDING_STREAM . '&fields=' . self :: DATASET_SCIENTIFIC_AREA .'&fields=' . self :: DATASET_FUNDING_STREAM_LEVEL2. '&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
1475
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE .  $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::DATASET) . '&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
1439 1476
                    'search?action=search&sTransformer=results_openaire&query=' . urlencode('(' . $query . ')') . '&page=' . $page . '&size=' . $size  . '&locale=' . str_replace('-', '_', $locale);
1440 1477
            if (($response = $this->performGet($completeQuery)) == NULL)
1441 1478
                throw new Exception('no HTTP response');
......
1450 1487
            $result->totalDatasets = $this->parseTotalResults($xpath);
1451 1488
            $result->datasets = $this->parseDatasets($xpath);
1452 1489
            $result->statistics = $isRefine?$this->createStatisticsForDatasets($xpath):NULL;
1490
            $result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
1453 1491
                    //createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('DATASET_TYPE', 'DATASET_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
1454 1492
            JLog :: add('Simple search retrieved ' . count($result->datasets) . ' datasets in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
1455 1493
            return $result;
......
1484 1522
            $query .= ($endYear == NULL) ? '' : (' and (' . self :: PROJECT_END_YEAR . ' exact ' . $endYear . ')');
1485 1523
            $query .= ($sc39 === NULL) ? '' : (' and (' . self :: PROJECT_SC39 . ' exact ' . ($sc39 ? 'true' : 'false') . ')');
1486 1524
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
1487
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_FUNDING_STREAM . '&fields=' . self :: PROJECT_SCIENTIFIC_AREA .'&fields=' . self :: PROJECT_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
1525
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size .    $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PROJECT) . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
1488 1526
                    :'search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
1489 1527
            if (($response = $this->performGet($completeQuery)) == NULL)
1490 1528
                throw new Exception('no HTTP response');
......
1499 1537
            $result->totalProjects = $this->parseTotalResults($xpath);
1500 1538
            $result->projects = $this->parseProjects($xpath);
1501 1539
            $result->statistics = $isRefine?$this->createStatisticsForProjects($xpath,''):NULL;
1540
            $result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
1502 1541
                    //createStatistics($xpath, array('funder', 'fundingStream', 'scientificArea', 'startYear', 'endYear', 'sc39'), array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
1503 1542
            JLog :: add('Simple search retrieved ' . count($result->projects) . ' projects in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', start year: ' . (($startYear == NULL) ? 'null' : $startYear) . ', end year: ' . (($endYear == NULL) ? 'null' : $endYear) . ', SC-39: ' . (($sc39 === NULL) ? 'null' : ($sc39 ? 'true' : 'false')) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
1504 1543
            return $result;
......
1739 1778
            $query = self :: PUBLICATION_QUERY;
1740 1779
            $query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")');
1741 1780
            $query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")');
1742
            $query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
1781
            if($funder != NULL && (strpos($funder, ',') !== FALSE)){
1782
                $temp='';
1783
                foreach(split(',',$funder) as $id){
1784
                    if(!empty($id)){
1785
                        $temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and';
1786
                    }
1787
                   
1788
                }
1789
                $query .=  (' and (' . substr($temp, 0, -3). ')');
1790
            }else{
1791
                $query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
1792
            }
1743 1793
            $query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
1744 1794
            $query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
1745 1795
            $query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
......
1750 1800
            $query .= ($author == NULL) ? '' : (' and (' . self :: PUBLICATION_AUTHOR_ID . ' exact "' . $author . '")');
1751 1801
            $query .= ($community == NULL) ? '' : (' and (' . self :: PUBLICATION_CONTEXT . ' exact "' . $community . '")');
1752 1802
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
1753
             $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . ($refineFields!=null?$refineFields:'&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE .  '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2.'&fields=' . self :: PUBLICATION_PROJECT . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT ). '&locale=' . str_replace('-', '_', $locale):
1803
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . ($refineFields!=null?$refineFields:'&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE .  $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PUBLICATION).'&fields=' . self :: PUBLICATION_PROJECT . '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&fields=' . self :: PUBLICATION_CONTEXT ). '&locale=' . str_replace('-', '_', $locale):
1754 1804
                'search?action=search&sTransformer=results_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size  . '&locale=' . str_replace('-', '_', $locale);
1755 1805
            if (($response = $this->performGet($completeQuery)) == NULL)
1756 1806
                throw new Exception('no HTTP response');
......
1765 1815
            $result->totalPublications = $this->parseTotalResults($xpath);
1766 1816
            $result->publications = $this->parsePublications($xpath);
1767 1817
            $result->statistics = $isRefine?$this->createStatisticsForPublications($xpath):NULL;
1818
            $result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
1768 1819
                    //$this->createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'fundingStreamLevel2', 'project', 'year', 'accessMode', 'datasource', 'community'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA','FUNDING_STREAM_LEVEL_2', 'PROJECT', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE', 'COMMUNITY'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_FUNDING_STREAM_LEVEL_2_STATISTICS_FOUND', 'NO_PROJECT_STATISTICS_FOUND', 'NO_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_CONTEXT_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self::PUBLICATION_FUNDING_STREAM_LEVEL2, self :: PUBLICATION_PROJECT, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE, self :: PUBLICATION_CONTEXT));
1769 1820
            $result->totalDatasets = 0;
1770 1821
            JLog :: add('Browse retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', community: ' . (($community == NULL) ? 'null' : $community) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ', project: ' . (($project == NULL) ? 'null' : $project) . ', author: ' . (($author == NULL) ? 'null' : $author) . ')', JLog :: INFO, self :: LOG);
......
1773 1824
            JLog :: add('Error performing publication browse (type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', community: ' . (($community == NULL) ? 'null' : $community) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ', project: ' . (($project == NULL) ? 'null' : $project) . ', author: ' . (($author == NULL) ? 'null' : $author) . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG);
1774 1825
            return NULL;
1775 1826
        }
1776
    }    
1777
    public function browsePublicationsRaw($query) {
1827
    }
1828
    public static function pruningStatisticsForFunders($statistics, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2,$filter){
1829
        return self::_pruningStatisticsForFunders($statistics, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2,$filter);
1830
    }
1831
    private static function _pruningStatisticsForFunders($statistics, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2,$filter=''){
1832
        if($statistics==NULL){
1833
            return NULL;
1834
        }
1835
        if($fundingStreamLevel1!=NULL){
1836
           $newData= array(); 
1837
           foreach ($statistics["fundingStreamLevel2".$filter]->data as $data){
1838
               if(strpos($data->id,$fundingStreamLevel1)!==FALSE){
1839
                   $newData[$data->id]=$data;
1840
               }               
1841
           }
1842
           $statistics["fundingStreamLevel2".$filter]->data=$newData;
1843
         }
1844
        if($fundingStream!=NULL){
1845
           $newData= array(); 
1846
           foreach ($statistics["fundingStreamLevel1".$filter]->data as $data){
1847
               if(strpos($data->id,$fundingStream)!==FALSE){
1848
                   $newData[$data->id]=$data;
1849
               }               
1850
           }
1851
           $statistics["fundingStreamLevel1".$filter]->data=$newData;
1852
        }           
1853
        if($funder!=NULL){
1854
           $newData= array(); 
1855
           if(strpos($funder, ',') !== FALSE){
1856
                foreach ($statistics["fundingStream".$filter]->data as $data){                  
1857
                   foreach(split(',',$funder) as $id){               
1858
                       if(!empty($id) && (strpos($data->id,$id)!==FALSE)){
1859
                        $newData[$data->id]=$data;                           
1860
                       }
1861
                   }
1862
               }
1863
           }else{
1864
               foreach ($statistics["fundingStream".$filter]->data as $data){
1865
                    if(strpos($data->id,$funder)!==FALSE){
1866
                        $newData[$data->id]=$data;
1867
                    }               
1868
                }
1869
           }
1870
           $statistics["fundingStream".$filter]->data=$newData;
1871
            
1872
        }
1873
        return $statistics;
1874
    }
1875
    //Reduces the Funding Fields 
1876
    //$funder filter for funder
1877
    //$fundingStream filter for funding stream
1878
    //$fundingStreamLevel1 filter for fundingStreamLevel1
1879
    //$fundingStreamLevel2 filter  for fundingStreamLevel2
1880
    private static function _getFundingFields($funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2, $type){
1881
            $field = self::_getFundingFieldsPerType($type);
1882
            $f = array();
1883
             $f[0]=true;
1884
            for($i=1;$i<4;$i++){
1885
                $f[$i]=false;
1886
            }                
1887
            if($fundingStreamLevel2 !== null && !empty($fundingStreamLevel2)){
1888
                $f[3]=true;
1889
           }if($fundingStreamLevel1 !== NULL && strlen($fundingStreamLevel1)>0){
1890
               $f[2]=true;
1891
               $f[3]=true;             
1892
            } if($fundingStream !== NULL && strlen($fundingStream)>0){
1893
                $f[1]=true;
1894
                $f[2]=true;
1895
            } if($funder !== NULL && strlen($funder)>0){
1896
                $f[0]=true;
1897
                $f[1]=true;
1898
            }
1899
            $returnedFields='';
1900
            $none=true;
1901
            for($i=0;$i<4;$i++){
1902
                if($f[$i]){
1903
                    $returnedFields.=($f[$i])?$field[$i]:'';
1904
                    $none=false;
1905
                }                
1906
            }
1907
            $returnedFields=($none)?$field[0].$field[1]:$returnedFields;                
1908
            return $returnedFields;            
1909
        }
1910

  
1911
        private function _getFundingFieldsPerType($type){
1912
            $field=array();
1913
             switch ($type) {
1914
                case self::PUBLICATION:
1915
                    $field[3]='&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2;
1916
                    $field[2]='&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA;
1917
                    $field[1]='&fields=' . self :: PUBLICATION_FUNDING_STREAM;
1918
                    $field[0]='&fields=' . self :: PUBLICATION_FUNDER;
1919
                    break;
1920
                case self::DATASET:
1921
                    $field[3]='&fields=' . self :: DATASET_FUNDING_STREAM_LEVEL2;
1922
                    $field[2]='&fields=' . self :: DATASET_SCIENTIFIC_AREA;
1923
                    $field[1]='&fields=' . self :: DATASET_FUNDING_STREAM;
1924
                    $field[0]='&fields=' . self :: DATASET_FUNDER;
1925
                    break;
1926
                case self::PROJECT:
1927
                    $field[3]='&fields=' . self :: PROJECT_FUNDING_STREAM_LEVEL2;
1928
                    $field[2]='&fields=' . self :: PROJECT_SCIENTIFIC_AREA;
1929
                    $field[1]='&fields=' . self :: PROJECT_FUNDING_STREAM;
1930
                    $field[0]='&fields=' . self :: PROJECT_FUNDER;
1931
                    break;
1932
             }
1933
             
1934
             return $field;
1935
        }
1936
    public static function browsePublicationsRaw($query) {
1778 1937
        try {
1779 1938
            $time = microtime(TRUE);
1780 1939
            
......
1836 1995
            $query .= ($project == NULL) ? '' : (' and (' . self :: DATASET_PROJECT . ' exact "' . $project . '")');
1837 1996
            $query .= ($author == NULL) ? '' : (' and (' . self :: DATASET_AUTHOR_ID . ' exact "' . $author . '")');
1838 1997
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
1839
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE . '&fields=' . self :: DATASET_FUNDER . '&fields=' . self :: DATASET_FUNDING_STREAM . '&fields=' . self :: DATASET_SCIENTIFIC_AREA . '&fields=' . self :: DATASET_FUNDING_STREAM_LEVEL2 . '&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
1998
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: DATASET_TYPE . '&fields=' . self :: DATASET_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::DATASET) .'&fields=' . self :: DATASET_YEAR . '&fields=' . self :: DATASET_ACCESS_MODE . '&fields=' . self :: DATASET_DATASOURCE . '&locale=' . str_replace('-', '_', $locale):
1840 1999
                    'search?action=search&sTransformer=results_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
1841 2000
            if (($response = $this->performGet($completeQuery)) == NULL)
1842 2001
                throw new Exception('no HTTP response');
......
1851 2010
            $result->totalDatasets = $this->parseTotalResults($xpath);
1852 2011
            $result->datasets = $this->parseDatasets($xpath);
1853 2012
            $result->statistics = $isRefine?$this->createStatisticsForDatasets($xpath):NULL;
2013
            $result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');          
1854 2014
                    //createStatistics($xpath, array('type', 'languageFilter', 'funder', 'fundingStream', 'scientificArea', 'year', 'accessMode', 'datasource'), array('DATASET_TYPE', 'DATASET_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DATASET_TYPE_STATISTICS_FOUND', 'NO_DATASET_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: DATASET_TYPE, self :: DATASET_LANGUAGE, self :: DATASET_FUNDER, self :: DATASET_FUNDING_STREAM, self :: DATASET_SCIENTIFIC_AREA, self :: DATASET_YEAR, self :: DATASET_ACCESS_MODE, self :: DATASET_DATASOURCE));
1855 2015
            JLog :: add('Browse retrieved ' . count($result->datasets) . ' datasets in ' . (microtime(TRUE) - $time) . ' s (type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ', project: ' . (($project == NULL) ? 'null' : $project) . ', author: ' . (($author == NULL) ? 'null' : $author) . ')', JLog :: INFO, self :: LOG);
1856 2016
            return $result;
......
1875 2035
        try {
1876 2036
            $time = microtime(TRUE);
1877 2037
            $query = self :: PROJECT_QUERY;
1878
            $query .= ($funder == NULL) ? '' : (' and (' . self :: PROJECT_FUNDER . ' exact "' . $funder . '")');
2038
            if($funder != NULL && (strpos($funder, ',') !== FALSE)){
2039
                $temp='';
2040
                foreach(split(',',$funder) as $id){
2041
                    if(!empty($id)){
2042
                        $temp.='(' . self :: PROJECT_FUNDER . ' exact "' . $id . '") and';
2043
                    }
2044
                   
2045
                }
2046
                $query .=  (' and (' . substr($temp, 0, -3). ')');
2047
            }else{
2048
                $query .= ($funder == NULL) ? '' : (' and (' . self :: PROJECT_FUNDER . ' exact "' . $funder . '")');
2049
            }
1879 2050
            $query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PROJECT_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
1880 2051
            $query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PROJECT_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
1881 2052
            $query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PROJECT_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
......
1883 2054
            $query .= ($endYear == NULL) ? '' : (' and (' . self :: PROJECT_END_YEAR . ' exact ' . $endYear . ')');
1884 2055
            $query .= ($sc39 === NULL) ? '' : (' and (' . self :: PROJECT_SC39 . ' exact ' . ($sc39 ? 'true' : 'false') . ')');
1885 2056
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
1886
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PROJECT_FUNDER . '&fields=' . self :: PROJECT_FUNDING_STREAM . '&fields=' . self :: PROJECT_SCIENTIFIC_AREA . '&fields=' . self :: PROJECT_FUNDING_STREAM_LEVEL2. '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
2057
            $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=projects_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PROJECT) . '&fields=' . self :: PROJECT_START_YEAR . '&fields=' . self :: PROJECT_END_YEAR . '&fields=' . self :: PROJECT_SC39 . '&locale=' . str_replace('-', '_', $locale)
1887 2058
                    :'search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale);
1888 2059
            if (($response = $this->performGet($completeQuery)) == NULL)
1889 2060
                throw new Exception('no HTTP response');
......
1898 2069
            $result->totalProjects = $this->parseTotalResults($xpath);
1899 2070
            $result->projects = $this->parseProjects($xpath);
1900 2071
            $result->statistics = $isRefine? $this->createStatisticsForProjects($xpath):NULL;
2072
            $result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,'');
1901 2073
                    //createStatistics($xpath, array('funder', 'fundingStream', 'scientificArea', 'startYear', 'endYear', 'sc39'), array('FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'START_YEAR', 'END_YEAR', 'SPECIAL_CLAUSE_39'), array('NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_START_YEAR_STATISTICS_FOUND', 'NO_END_YEAR_STATISTICS_FOUND', 'NO_SPECIAL_CLAUSE_39_STATISTICS_FOUND'), array(self :: PROJECT_FUNDER, self :: PROJECT_FUNDING_STREAM, self :: PROJECT_SCIENTIFIC_AREA, self :: PROJECT_START_YEAR, self :: PROJECT_END_YEAR, self :: PROJECT_SC39));
1902 2074
            JLog :: add('Browse retrieved ' . count($result->projects) . ' projects in ' . (microtime(TRUE) - $time) . ' s (funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', start year: ' . (($startYear == NULL) ? 'null' : $startYear) . ', end year: ' . (($endYear == NULL) ? 'null' : $endYear) . ', SC-39: ' . (($sc39 === NULL) ? 'null' : ($sc39 ? 'true' : 'false')) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
1903 2075
            return $result;
......
2223 2395
                            }, $datasources)) . ')');
2224 2396
            $query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")');
2225 2397
            $query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")');
2226
            $query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
2398
            //$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
2399
              if($funder != NULL && (strpos($funder, ',') !== FALSE)){
2400
                $temp='';
2401
                foreach(split(',',$funder) as $id){
2402
                    if(!empty($id)){
2403
                        $temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and';
2404
                    }
2405
                   
2406
                }
2407
                $query .=  (' and (' . substr($temp, 0, -3). ')');
2408
            }else{
2409
                $query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")');
2410
            }
2227 2411
            $query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM . ' exact "' . $fundingStream . '")');
2228 2412
            $query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")');
2229 2413
            $query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")');
......
2231 2415
            $query .= ($accessMode == NULL) ? '' : (' and (' . self :: PUBLICATION_ACCESS_MODE . ' exact "' . $accessMode . '")');
2232 2416
            $query .= ($datasource == NULL) ? '' : (' and (' . self :: PUBLICATION_DATASOURCE . ' exact "' . $datasource . '")');
2233 2417
            JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG);
2234
            if (($response = $this->performGet('search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . '&fields=' . self :: PUBLICATION_FUNDER . '&fields=' . self :: PUBLICATION_FUNDING_STREAM . '&fields=' . self :: PUBLICATION_SCIENTIFIC_AREA . '&fields=' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2. '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&locale=' . str_replace('-', '_', $locale))) == NULL)
2418
            if (($response = $this->performGet('search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE .   $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PUBLICATION). '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: PUBLICATION_DATASOURCE . '&locale=' . str_replace('-', '_', $locale))) == NULL)
2235 2419
                throw new Exception('no HTTP response');
2236 2420
            if ($response->code != self :: HTTP_OK)
2237 2421
                throw new Exception('HTTP response code ' . $response->code);
......
2244 2428
            $result->totalPublications = $this->parseTotalResults($xpath);
2245 2429
            $result->publications = $this->parsePublications($xpath);
2246 2430
            $result->statistics =$this->createStatisticsForPublications($xpath,'Filter');
2431
            $result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,"Filter");
2247 2432
                    //$this->createStatistics($xpath, array('typeFilter', 'languageFilter', 'funderFilter', 'fundingStreamFilter', 'scientificAreaFilter', 'yearFilter', 'accessModeFilter', 'datasourceFilter'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: PUBLICATION_DATASOURCE));
2248 2433
            JLog :: add('Advanced search retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (keywords: [' . implode(', ', $keywords) . '], fields: [' . implode(', ', $fields) . '], constraints: [' . implode(', ', $constraints) . '], types: [' . implode(', ', $types) . '], languages: [' . implode(', ', $languages) . '], funders: [' . implode(', ', $funders) . '], funding streams: [' . implode(', ', $fundingStreams) . '], scientific areas: [' . implode(', ', $scientificAreas) . '], date: ' . $date . ', from month: ' . $fromMonth . ', from year: ' . $fromYear . ', to month: ' . $toMonth . ', to year: ' . $toYear . ', access modes: [' . implode(', ', $accessModes) . '], datasources: [' . implode(', ', $datasources) . '], type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG);
2249 2434
            return $result;
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchprojects/view.html.php
74 74
		$this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE);
75 75
		$this -> size = JRequest :: getUInt('size', self :: DEFAULT_SIZE);
76 76
		if ($this -> keyword == NULL)
77
			$this -> statistics = $model -> getProjectStatistics($locale);
77
			$this -> statistics = $model -> getProjectStatistics($locale,false);
78 78
		else {
79 79
			JViewLegacy:: loadHelper('PiwikHelper');
80 80
			PiwikHelper :: logPageView('searchProjects', 'keyword=' . urlencode($this -> keyword) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream) . '&fundingStreamLevel1=' . urlencode($fundingStreamLevel1)   . '&startYear=' . urlencode($startYear) . '&endYear=' . urlencode($endYear) . '&sc39=' . urlencode($sc39) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale));
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchpublications/view.html.php
92 92
		$this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE);
93 93
		$this -> size = JRequest :: getUInt('size', self :: DEFAULT_SIZE);
94 94
		if ($this -> keyword == NULL)
95
			$this -> statistics = $model -> getPublicationStatistics($locale);
95
			$this -> statistics = $model -> getPublicationStatistics($locale,false);
96 96
		else {
97 97
			JViewLegacy:: loadHelper('PiwikHelper');
98 98
			PiwikHelper :: logPageView('searchPublications', 'keyword=' . urlencode($this -> keyword) . '&articles=' . urlencode($this -> articles) . '&books=' . urlencode($this -> books) . '&theses=' . urlencode($this -> theses) . '&reports=' . urlencode($this -> reports) . '&type=' . urlencode($type) . '&language=' . urlencode($language) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream) . '&fundingStreamLevel2=' . urlencode($fundingStreamLevel2) . '&year=' . urlencode($year) . '&accessMode=' . urlencode($accessMode) . '&datasource=' . urlencode($datasource) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale));
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/claiminline/view.html.php
38 38
        
39 39
        $this->funder = JRequest :: getString('funder');
40 40
        $this -> fields_layout = JRequest :: getString('fields_layout', 'horizontal');
41
        $statistics = $searchModel->getProjectStatistics($locale);
41
        $statistics = $searchModel->getProjectStatistics($locale,true);
42 42
        $this->funders = ($statistics == NULL) ? NULL : $statistics['funder']->data;
43 43
        $this->contexts = $claimModel->getContexts();
44 44

  
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchpublicationsraw/view.raw.php
17 17
		$locale = JFactory :: getLanguage() -> getTag();
18 18
		$this -> keyword = JRequest :: getString('keyword');
19 19
		$this -> itemId = JRequest :: getString('Itemid');
20
		$this -> result = ($this -> keyword == NULL) ? $model -> getPublicationStatistics($locale) : $model -> searchPublications($this -> keyword, FALSE, FALSE, FALSE, FALSE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale,NULL,FALSE);
20
		$this -> result = ($this -> keyword == NULL) ? $model -> getPublicationStatistics($locale,false) : $model -> searchPublications($this -> keyword, FALSE, FALSE, FALSE, FALSE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale,NULL,FALSE);
21 21
		if (count($errors = $this -> get('Errors')) > 0) {
22 22
			JLog :: add('Error viewing raw search publications: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
23 23
			return FALSE;
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchdatasets/view.html.php
76 76
		$this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE);
77 77
		$this -> size = JRequest :: getUInt('size', self :: DEFAULT_SIZE);
78 78
		if ($this -> keyword == NULL)
79
			$this -> statistics = $model -> getDatasetStatistics($locale);
79
			$this -> statistics = $model -> getDatasetStatistics($locale, false);
80 80
		else {
81 81
			JViewLegacy:: loadHelper('PiwikHelper');
82 82
			PiwikHelper :: logPageView('searchDatasets', 'keyword=' . urlencode($this -> keyword) . '&type=' . urlencode($type) . '&language=' . urlencode($language) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream) . '&fundingStreamLevel1=' . urlencode($fundingStreamLevel1) . '&year=' . urlencode($year) . '&accessMode=' . urlencode($accessMode) . '&datasource=' . urlencode($datasource) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale));
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/search/view.html.php
18 18
		$this -> itemId = JRequest :: getUInt('Itemid', 0);
19 19
		$this -> keyword = JRequest :: getString('keyword');
20 20
		if ($this -> keyword == NULL) {
21
			$this -> publications = $model -> getPublicationStatistics($locale);
22
			$this -> datasets = $model -> getDatasetStatistics($locale);
23
			$this -> projects = $model -> getProjectStatistics($locale);
21
			$this -> publications = $model -> getPublicationStatistics($locale,false);
22
			$this -> datasets = $model -> getDatasetStatistics($locale,false);
23
			$this -> projects = $model -> getProjectStatistics($locale,false);
24 24
			$this -> people = $model -> getPeopleStatistics($locale);
25 25
			$this -> organizations = $model -> getOrganizationStatistics($locale);
26 26
			$this -> datasources = $model -> getDatasourceStatistics($locale);
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/claim1/view.html.php
32 32
        $projectId = JRequest :: getString('projectId');
33 33
        $this->funder = JRequest :: getString('funder');
34 34
        $this -> fields_layout = JRequest :: getString('fields_layout', 'horizontal');
35
        $statistics = $searchModel->getProjectStatistics($locale);
35
        $statistics = $searchModel->getProjectStatistics($locale,true);
36 36
        $this->funders = ($statistics == NULL) ? NULL : $statistics['funder']->data;
37 37
         usort($this->funders, function ($funder1, $funder2) { return strcmp($funder1->name , $funder2-> name); });
38 38
        $this->contexts = $claimModel->getContexts();
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/claims/tmpl/default.php
427 427
 
428 428

  
429 429
  
430
<?php
431
/*
432
ini_set('auto_detect_line_endings', true);
433
$row = 1;
434
$dois= array();
435
if (($handle = fopen(JPATH_COMPONENT . DS ."test.csv", "r")) !== FALSE) {
436
    while (($data = fgetcsv($handle,1000,",")) !== FALSE) {
437
        $num = count($data);
438
       // echo "<p> $num fields in line $row: <br /></p>\n";
439
        $row++;
440
        $doi=$data[0];*/
441
        //$pattern1 = '#\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])\S)+)\b#';
442
        //$pattern2 = '#\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])[[:graph:]])+)\b#';
443
         /*if($doi!==''&&(preg_match($pattern1, $doi) || preg_match($pattern2, $doi))){
444
             $dois[]=$data[0];
445
         }
446
         
447
         
448
    }
449
     $unique_dois =array_unique($dois);
450
     echo("Unique dois:".sizeof($unique_dois)."<br>");
451
     foreach($unique_dois as $doi){
452
         echo($doi."<br>");
453
     }
454
    fclose($handle);
455
}*/
456
?>
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchdatasetsraw/view.raw.php
18 18
		$this -> keyword = JRequest :: getString('keyword');
19 19
		$this -> itemId = JRequest :: getString('Itemid');
20 20
		$this -> size = self :: SIZE;
21
		$this -> result = ($this -> keyword == NULL) ? $model -> getDatasetStatistics($locale) : $model -> searchDatasets($this -> keyword, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale,FALSE);
21
		$this -> result = ($this -> keyword == NULL) ? $model -> getDatasetStatistics($locale, false) : $model -> searchDatasets($this -> keyword, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale,FALSE);
22 22
		if (count($errors = $this -> get('Errors')) > 0) {
23 23
			JLog :: add('Error viewing raw search datasets: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
24 24
			return FALSE;
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchprojectsraw/view.raw.php
17 17
		$locale = JFactory :: getLanguage() -> getTag();
18 18
		$this -> keyword = JRequest :: getString('keyword');
19 19
		$this -> itemId = JRequest :: getString('Itemid');
20
		$this -> result = ($this -> keyword == NULL) ? $model -> getProjectStatistics($locale) : $model -> searchProjects($this -> keyword, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale, FALSE);
20
		$this -> result = ($this -> keyword == NULL) ? $model -> getProjectStatistics($locale,false) : $model -> searchProjects($this -> keyword, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale, FALSE);
21 21
		if (count($errors = $this -> get('Errors')) > 0) {
22 22
			JLog :: add('Error viewing raw search projects: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
23 23
			return FALSE;
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchprojectsraw/tmpl/default_browse.php
18 18
		<?php } else {
19 19
			$baseUrl = 'index.php?option=com_openaire&view=browseprojects&Itemid=' . $this -> itemId;
20 20
			echo(BrowseHelper :: formatStatistic($this -> result['funder'], $baseUrl,"Project"));
21
			echo(BrowseHelper :: formatStatistic($this -> result['fundingStream'], $baseUrl,"Project"));
21
			//echo(BrowseHelper :: formatStatistic($this -> result['fundingStream'], $baseUrl,"Project"));
22 22
			echo(BrowseHelper :: formatStatistic($this -> result['startYear'], $baseUrl,"Project"));
23 23
			echo(BrowseHelper :: formatStatistic($this -> result['endYear'], $baseUrl,"Project"));
24 24
		} ?>
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/advancedsearchprojects/view.html.php
29 29
	function display($template = NULL) {
30 30
		$locale = JFactory :: getLanguage() -> getTag();
31 31
		$model = $this -> getModel(self :: MODEL);
32
		$this -> statistics = $model -> getProjectStatistics($locale);
32
		$this -> statistics = $model -> getProjectStatistics($locale,true);
33 33
		$this -> minStartYear = ($this -> statistics['startYear'] -> data == NULL) ? date('Y') : min(array_keys($this -> statistics['startYear'] -> data));
34 34
		$this -> maxStartYear = ($this -> statistics['startYear'] -> data == NULL) ? date('Y') : max(array_keys($this -> statistics['startYear'] -> data));
35 35
		$this -> minEndYear = ($this -> statistics['endYear'] -> data == NULL) ? date('Y') : min(array_keys($this -> statistics['endYear'] -> data));
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/advancedsearchpublications/view.html.php
30 30
	function display($template = NULL) {
31 31
		$locale = JFactory :: getLanguage() -> getTag();
32 32
		$model = $this -> getModel(self :: MODEL);
33
		$this -> statistics = $model -> getPublicationStatistics($locale);
33
		$this -> statistics = $model -> getPublicationStatistics($locale,true);
34 34
		$this -> minYear = ($this -> statistics['year'] -> data == NULL) ? date('Y') : min(array_keys($this -> statistics['year'] -> data));
35 35
		$this -> maxYear = ($this -> statistics['year'] -> data == NULL) ? date('Y') : max(array_keys($this -> statistics['year'] -> data));
36 36
		$input = JFactory :: getApplication() -> input;
......
113 113
			JViewLegacy :: loadHelper('PiwikHelper');
114 114
			PiwikHelper :: logPageView('advancedSearchPublications', 'keywords=' . urlencode(implode(',', $this -> keywords)) . '&fields=' . urlencode(implode(',', $this -> fields)) . '&constraints=' . urlencode(implode(',', $this -> constraints)) . '&types=' . urlencode(implode(',', $this -> types)) . '&languages=' . urlencode(implode($this -> languages)) . '&funders=' . urlencode(implode(',', $this -> funders)) . '&fundingStreams=' . urlencode(implode(',', $this -> fundingStreams)) . '&scientificAreas=' . urlencode(implode(',', $this -> scientificAreas)). '&fundingStreamLevel2=' . urlencode(implode(',', $this -> fundingStreamsLevel2)) . '&date=' . urlencode($this -> date) . '&fromMonth=' . urlencode($this -> fromMonth) . '&fromYear=' . urlencode($this -> fromYear) . '&toMonth=' . urlencode($this -> toMonth) . '&toYear=' . urlencode($this -> toYear) . '&accessModes=' . urlencode(implode(',', $this -> accessModes)) . '&datasources=' . urlencode(implode($this -> datasources)) . '&type=' . urlencode($type) . '&language=' . urlencode($language) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream) . '&fundingStreamLevel1=' . urlencode($scientificArea). '&fundingStreamLevel2=' . urlencode($fundingStreamLevel2) . '&year=' . urlencode($year) . '&accessMode=' . urlencode($accessMode) . '&datasource=' . urlencode($datasource) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale));
115 115
			$this -> result = $model -> advancedSearchPublications($this -> keywords, $this -> fields, $this -> constraints, $this -> types, $this -> languages, $this -> funders, $this -> fundingStreams, $this -> scientificAreas,$this -> fundingStreamsLevel2, $this -> date, $this -> fromMonth, $this -> fromYear, $this -> toMonth, $this -> toYear, $this -> accessModes, $this -> datasources, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $this -> page, $this -> size, $locale);
116
			$this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPublications / $this -> size);
116
 			$this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPublications / $this -> size);
117 117
			if ($this -> totalPages == NULL)
118 118
				$this -> totalPages = 1;
119 119
                        $this -> page = ($this -> page > $this -> totalPages)? $this -> totalPages:$this -> page;
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/browsepublications/view.html.php
90 90
		$this -> author = JRequest :: getString('author');
91 91
		JViewLegacy :: loadHelper('PiwikHelper');
92 92
		PiwikHelper :: logPageView('browsePublications', 'type=' . urlencode($type) . '&language=' . urlencode($language) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream)  . '&scientificArea=' . urlencode($fundingStreamLevel1) . '&year=' . urlencode($year) . '&accessMode=' . urlencode($accessMode) . '&datasource=' . urlencode($community) . '&community=' . urlencode($datasource) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale) . '&project=' . urlencode($this -> project) . '&author=' . urlencode($this -> author));
93
 		$this -> result = $model -> browsePublications($type, $language, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2, $year, $accessMode, $datasource, $community, $this -> page, $this -> size, $locale, $this -> project, $this -> author,TRUE); 		                
93
 		$this -> result = $model -> browsePublications($type, $language, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2, $year, $accessMode, $datasource, $community, $this -> page, $this -> size, $locale, $this -> project, $this -> author,TRUE,NULL); 		                
94
                /*$this ->result-> funders=null;
95
                if($funder!=null){
96
                    $this ->result-> funders = $model ->getPublicationStatisticsForFunders($locale); 		
97
                }*/
94 98
                $this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPublications / $this -> size);
95 99
                if ($this -> totalPages == NULL)
96 100
			$this -> totalPages = 1;
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/browsepublications/tmpl/default.php
21 21
			<div class="refineBox">
22 22
				<?php $baseUrl = 'index.php?option=com_openaire&view=browsepublications&Itemid=' . $this -> itemId  . (($this -> author == NULL) ? '' : ('&author=' . $this -> author));
23 23
				echo(FilterHelper :: formatFilters($this -> filters, $this -> result -> statistics, $baseUrl, ''));
24
                                /*if($this -> result -> funders!=null){
25
                                    echo(StatisticHelper :: _formatStatistics($this -> result -> funders,  array(), $baseUrl, '#publtab')); 
26
                                }*/
24 27
				echo(StatisticHelper :: formatStatistics($this -> result -> statistics, $this -> filters, $baseUrl, '')); ?>
25 28
			</div>
26 29
		</div>

Also available in: Unified diff