class csl_date_part in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 modules/CiteProc/CSL.inc \csl_date_part
- 7 modules/CiteProc/CSL.inc \csl_date_part
Hierarchy
- class \csl_collection
- class \csl_element
- class \csl_rendering_element
- class \csl_format
- class \csl_date_part
- class \csl_format
- class \csl_rendering_element
- class \csl_element
Expanded class hierarchy of csl_date_part
File
- modules/
CiteProc/ CSL.inc, line 954
View source
class csl_date_part extends csl_format {
function render($date, $mode = NULL) {
$text = '';
switch ($this->name) {
case 'year':
$text = isset($date[0]) ? $date[0] : '';
if ($text > 0 && $text < 500) {
$text = $text . $this->citeproc
->get_locale('term', 'ad');
}
elseif ($text < 0) {
$text = $text * -1;
$text = $text . $this->citeproc
->get_locale('term', 'bc');
}
//return ((isset($this->prefix))? $this->prefix : '') . $date[0] . ((isset($this->suffix))? $this->suffix : '');
break;
case 'month':
$text = isset($date[1]) ? $date[1] : '';
if (empty($text) || $text < 1 || $text > 12) {
return;
}
// $form = $this->form;
switch ($this->form) {
case 'numeric':
break;
case 'numeric-leading-zeros':
if ($text < 10) {
$text = '0' . $text;
break;
}
break;
case 'short':
$month = 'month-' . sprintf('%02d', $text);
$text = $this->citeproc
->get_locale('term', $month, 'short');
break;
default:
$month = 'month-' . sprintf('%02d', $text);
$text = $this->citeproc
->get_locale('term', $month);
break;
}
break;
case 'day':
$text = isset($date[2]) ? $date[2] : '';
break;
}
return $this
->format($text);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
csl_collection:: |
protected | property | ||
csl_collection:: |
function | |||
csl_date_part:: |
function |
Overrides csl_rendering_element:: |
||
csl_element:: |
protected | property | ||
csl_element:: |
protected | property | ||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | 5 | ||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_format:: |
protected | property | 1 | |
csl_format:: |
protected | property | ||
csl_format:: |
function |
Overrides csl_collection:: |
1 | |
csl_format:: |
function | 5 | ||
csl_format:: |
function |
Overrides csl_element:: |
2 |