diff --git a/includes/class-PageYearMonthDayPDCsCount.php b/includes/class-PageYearMonthDayPDCsCount.php index 41de3ce..820d891 100644 --- a/includes/class-PageYearMonthDayPDCsCount.php +++ b/includes/class-PageYearMonthDayPDCsCount.php @@ -1,117 +1,122 @@ . namespace itwikidelbot; /** * Abstraction of a page containing PDCs' log of the day */ class PageYearMonthDayPDCsCount extends PageYearMonthDayPDCs { /** * Template name of this page * * @override CategoryTemplated::TEMPLATE_NAME */ const TEMPLATE_NAME = 'PAGE_COUNT'; /** * Get the template arguments: * 1: page title * 2: temperature * 3: '1' if it's multiple * 4: color associated to the PDC e.g. '#fff' * 5: number of the row * 6: PDC type e.g. 'consensuale' * 7: duration e.g. 'un giorno' * 8: title of the log page - * 9: goto action label e.g. 'pagina di discussione' + * 9: human date 'year monthname day' * * @override PageTemplated::getTemplateArguments() * @return array */ public function getTemplateArguments() { $sections = []; // runnings $i = 0; $entries = []; foreach( $this->getRunningPDCsByType() as $type => $pdcs ) { foreach( $pdcs as $pdc ) { $entries[] = $this->createPDCEntryContent( ++$i, $pdc ); } } if( $entries ) { $sections[] = Template::get( self::TEMPLATE_NAME . '.RUNNING.section', [ implode( "\n", $entries ) ] ); } // endeds $i = 0; $entries = []; foreach( $this->getEndedPDCsByType() as $type => $pdcs ) { foreach( $pdcs as $pdc ) { $entries[] = $this->createPDCEntryContent( ++$i, $pdc ); } } if( $entries ) { $sections[] = Template::get( self::TEMPLATE_NAME . '.ENDED.section', [ implode( "\n", $entries ) ] ); } $args = parent::getTemplateArguments(); // Does it have content? if( $sections ) { $args[] = implode( "\n", $sections ); } else { $args[] = Template::get( self::TEMPLATE_NAME . '.empty' ); } return $args; } /** * Get the PDC entry content * * @param $pdc PDC * @param $i Ordinal number passed from the count page * @return string */ public function createPDCEntryContent( $i, PDC $pdc ) { $template_name = self::TEMPLATE_NAME; $template_name .= $pdc->isProtected() ? '.ENDED.entry' : '.RUNNING.entry'; return Template::get( $template_name, [ $pdc->getTitleSubject(), $pdc->getTemperature(), $pdc->isMultiple(), '', // TODO: Ex color. Now unuseful. $i, $pdc->getHumanType(), $pdc->getHumanDuration(), - $this->getTitle() + $this->getTitle(), + sprintf( '%d %s %d', + $this->getYear(), + $this->getMonthName(), + $this->getDay() + ) ] ); } } diff --git a/templates/PAGE_COUNT.ENDED.entry.tpl b/templates/PAGE_COUNT.ENDED.entry.tpl index e2cde36..a16f801 100644 --- a/templates/PAGE_COUNT.ENDED.entry.tpl +++ b/templates/PAGE_COUNT.ENDED.entry.tpl @@ -1,19 +1,19 @@ This is the template for a single ended PDC in the daily counting page. Placeholders: %1$s: page title %2$d: temperature %3$s: '1' if this PDC is multiple %4$s: color associated to the PDC e.g. #fff %5$d: number of the row %6$s: PDC type e.g. 'consensuale' %7$s: duration %8$s: title of the log page - %9$s: goto action label e.g. 'pagina di discussione' + %9$s: date -{{Conteggio cancellazioni/Concluse/Voce|i = 0 |voce = ASD |tipo = consensuale |durata = 3 giorni |multipla = 1 }} +{{Conteggio cancellazioni/Concluse/Voce|i = 0 |voce = ASD |tipo = consensuale |data = %9$s |durata = 3 giorni |multipla = 1 }} -{{Conteggio cancellazioni/Concluse/Voce|i = %5$d |voce = %1$s |tipo = %6$s |durata = %7$s |multipla = %3$s }} +{{Conteggio cancellazioni/Concluse/Voce|i = %5$d |voce = %1$s |tipo = %6$s |data = %9$s |durata = %7$s |multipla = %3$s }} diff --git a/templates/PAGE_COUNT.RUNNING.entry.tpl b/templates/PAGE_COUNT.RUNNING.entry.tpl index fcd9c5b..9f2fe55 100644 --- a/templates/PAGE_COUNT.RUNNING.entry.tpl +++ b/templates/PAGE_COUNT.RUNNING.entry.tpl @@ -1,20 +1,20 @@ This is the template for a single running PDC in the daily counting page. Placeholders: %1$s: page title %2$d: temperature %3$s: '1' if it's multiple %4$s: color associated to the PDC e.g. '#fff' %5%d: number of the row %6$s: PDC type e.g. 'consensuale' %7%s: duration e.g. 'un giorno' see the template DURATION_*.tpl %8%s: title of the log page - %9$s: goto action label e.g. 'pagina di discussione' + %9$s: human date -{{Conteggio cancellazioni/In corso/Voce|i = 1 |voce = ASD |tipo = votazione |multipla = 1 |temperatura = 42 }} +{{Conteggio cancellazioni/In corso/Voce|i = 1 |voce = ASD |tipo = votazione |data = 2018 maggio 3 |multipla = 1 |temperatura = 42 }} -{{Conteggio cancellazioni/In corso/Voce|i = %5$d |voce = %1$s |tipo = %6$s |multipla = %3$s |temperatura = %2$d }} +{{Conteggio cancellazioni/In corso/Voce|i = %5$d |voce = %1$s |tipo = %6$s |data = %9$s |multipla = %3$s |temperatura = %2$d }}