Skip to content

Commit

Permalink
Display of publication numbers RRZE-Webteam#251 , implemented inside …
Browse files Browse the repository at this point in the history
…the PubByyear
  • Loading branch information
aajusah98 committed Aug 30, 2024
1 parent d7f6eb3 commit 8afb5db
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
12 changes: 11 additions & 1 deletion fau-cris.php
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,8 @@ private static function cris_shortcode_parameter($atts, $content = '', $tag = ''
'standardization' => '',
'projects_status'=>'',
'projects_start'=>'',
'author_position'=>''
'author_position'=>'',
'publicationsum'=>''
];

// Attributes
Expand Down Expand Up @@ -1291,6 +1292,7 @@ private static function cris_shortcode_parameter($atts, $content = '', $tag = ''
$sc_param['projects_status'] = sanitize_text_field($projects_status);
$sc_param['projects_start'] = sanitize_text_field($projects_start);
$sc_param['author_position'] = sanitize_text_field($author_position);
$sc_param['publicationsum'] = sanitize_text_field($publicationsum);

switch ($sortby) {
case 'created':
Expand Down Expand Up @@ -1417,6 +1419,14 @@ private static function cris_shortcode_parameter($atts, $content = '', $tag = ''
$sc_param['order1'] = '';
$sc_param['order2'] = '';

if (isset($sc_param['publicationsum']) && $sc_param['publicationsum'] != '') {
if (strpos($sc_param['publicationsum'], ',') !== false) {
$sc_param['publicationsum'] = str_replace(' ', '', $sc_param['publicationsum']);
$sc_param['publicationsum'] = explode(',', $sc_param['publicationsum']);
}

}

if (!empty($orderby)) {
if (strpos($orderby, ',') !== false) {
$orderby = str_replace(' ', '', $orderby);
Expand Down
32 changes: 29 additions & 3 deletions includes/Publikationen.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ public function pubNachJahr(
$language = $param['language'] ?: '';
$sortby = $param['sortby'] ?: 'virtualdate';
$authorPositionArray=$param['author_position'];
// it will use for showing number of publication by year or in total
if (!is_array($param['publicationsum'])) {
$publicationSumArray=array($param['publicationsum']);
}else{
$publicationSumArray=$param['publicationsum'];
}

// fetching the publication
$pubArray = $this->fetch_publications($year, $start, $end, $type, $subtype, $fau, $peerreviewed, $notable, $field, $language, $fsp, $project,$authorPositionArray );
Expand Down Expand Up @@ -249,15 +255,27 @@ public function pubNachJahr(
}
}
}
$shortcode_data .= do_shortcode('[collapse title="' . $array_year . '"' . $openfirst . ']' . $shortcode_data_inner . '[/collapse]');
$shortcode_data .= do_shortcode('[collapse title="' . $array_year.'('. count($publications). ')' . '"' . $openfirst . ']' . $shortcode_data_inner . '[/collapse]');
$openfirst = '';
}
$output .= do_shortcode('[collapsibles ' . $expandall . ']' . $shortcode_data . '[/collapsibles]');
} else {


$total_number_publication=0;
foreach ($pubList as $array_year => $publications) {
$number_of_pub=count($publications);

if (in_array('subtotal', $publicationSumArray) || (in_array('total', $publicationSumArray) && in_array('subtotal', $publicationSumArray))) {
$subtotal_publication_html = ' '.'('. $number_of_pub .' '.'Publications'. ')';
}
else{
$subtotal_publication_html='';
}
if (empty($year)) {
$output .= '<h3>' . $array_year . '</h3>';
$output .= '<h3>' . $array_year . $subtotal_publication_html .'</h3>';
}

$pubSubList = $subformatter->execute($publications);
foreach ($pubSubList as $array_subtype => $publications_sub) {
// Zwischenüberschrift
Expand All @@ -277,9 +295,17 @@ public function pubNachJahr(
}
}
}
$total_number_publication += $number_of_pub;
}
// To show total number of publication
if (in_array('total', $publicationSumArray) || (in_array('total', $publicationSumArray) && in_array('subtotal', $publicationSumArray))) {
$total_publication_html = '<h2>' . "Publications" . ' '.'('. $total_number_publication .')'.'</h2>';
}
else{
$total_publication_html='';
}
}
return $this->langdiv_open . $output . $this->langdiv_close;
return $this->langdiv_open . $total_publication_html .$output . $this->langdiv_close;
}
//End ::pubNachJahr

Expand Down

0 comments on commit 8afb5db

Please sign in to comment.