Project

General

Profile

« Previous | Next » 

Revision 250f2a96

Added by Andreas Kohlbecker over 5 years ago

ref #7788 displaying registration date and institution - formatting the datetime

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
421 421
}
422 422

  
423 423
/**
424
 * Formats a mysql datatime as string
425
 *
426
 * @param $datetime
427
 * @param string $format
428
 *
429
 * @return
430
 *  the formatted string representation of the $datetime
431
 */
432
function format_datetime($datetime, $format = 'Y-m-d H:i:s'){
433
  return date($format, strtotime($datetime));
434
}
435

  
436
/**
424 437
 * Converts an ISO 8601 org.joda.time.Partial to a year.
425 438
 *
426 439
 * The function expects an ISO 8601 time representation of a
modules/cdm_dataportal/cdm_dataportal.module
1887 1887
  $render_array = array();
1888 1888
  $media_link_map = array();
1889 1889
  if($registration_dto->registrationDate){
1890
    $date_string = format_datetime($registration_dto->registrationDate);
1890 1891
    if(isset($registration_dto->institutionTitleCache)){
1891 1892
      $registration_date_insitute_markup =
1892 1893
        t("Registration at @date in @institution", array(
1893
          '@date' => $registration_dto->registrationDate,
1894
          '@date' => $date_string,
1894 1895
          '@institution' => $registration_dto->institutionTitleCache,
1895 1896
        ));
1896 1897
    } else {
1897 1898
      $registration_date_insitute_markup =
1898 1899
        t("Registration at @date", array(
1899
          '@date' => $registration_dto->registrationDate
1900
          '@date' => $date_string
1900 1901
        ));
1901 1902
    }
1902
    $render_array['publication_date_and_office'] = markup_to_render_array($registration_date_insitute_markup);
1903
    $render_array['publication_date_and_office'] = markup_to_render_array('<p>'.$registration_date_insitute_markup . '</p>');
1903 1904
  }
1904 1905
  $taggged_text_expanded = cdm_tagged_text_expand_entity_references($registration_dto->summaryTaggedText);
1905 1906
  foreach ($taggged_text_expanded  as $tagged_text){

Also available in: Unified diff