public function getPeriod() { return formatDateRange($this->getStartDate(), $this->getEndDate()); }
/** * Inserts a linked list to the archives. * * @param array $params * @param object $smarty * @return string */ function smarty_archive_list($params, &$smarty) { global $Archive_array, $PIVOTX; $params = cleanParams($params); $Current_weblog = getDefault($params['weblog'], $PIVOTX['weblogs']->getCurrent()); $format = getDefault($params['format'], "<a href=\"%url%\">%st_day% %st_monname% - %en_day% %en_monname% %st_year% </a><br />"); $unit = getDefault($params['unit'], "month"); $separator = getDefault($params['separator'], ""); // if not yet done, load / make the array of archive filenames (together // with at least one date) if (!isset($Archive_array)) { makeArchiveArray(false, $unit); } // If we use 'isactive', set up the $active_arc and $isactive vars. if (!empty($params['isactive'])) { $active_arc = $pagetype = $PIVOTX['parser']->modifier['archive']; $isactive = $params['isactive']; } else { $isactive = ""; } $output = array(); if (is_array($Archive_array[$Current_weblog])) { // maybe flip and reverse it. if ($params['order'] == 'descending' || $params['order'] == 'desc') { $mylist = $Archive_array[$Current_weblog]; } else { $mylist = array_reverse($Archive_array[$Current_weblog]); } // Iterate over the list, formatting output as we go. $counter = 0; foreach ($mylist as $date) { $counter++; $filelink = makeArchiveLink($date, $unit, $params['weblog']); // Check if the current archive is the 'active' one. if (!empty($isactive) && makeArchiveName($date, '', $unit) == $active_arc) { $thisactive = $isactive; } else { $thisactive = ""; } // fix the rest of the string.. list($start_date, $stop_date) = getDateRange($date, $unit); $this_output = formatDateRange($start_date, $stop_date, $format); $this_output = str_replace("%counter%", $counter, $this_output); $this_output = str_replace("%url%", $filelink, $this_output); $this_output = str_replace("%active%", $thisactive, $this_output); $output[] = "\n" . $this_output; } } return implode($separator, $output); }