diff --git a/includes/class-PageYearMonthDayPDCsCount.php b/includes/class-PageYearMonthDayPDCsCount.php index 2b2e5e2..56e5eee 100644 --- a/includes/class-PageYearMonthDayPDCsCount.php +++ b/includes/class-PageYearMonthDayPDCsCount.php @@ -1,109 +1,118 @@ . 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 + * 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' * * @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 ); + $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 ); + $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() ? Template::get( 'PAGE_COUNT.entry.multiple_note' ) : '', + $pdc->isMultiple(), $pdc->getColor(), $i, $pdc->getType(), $pdc->getHumanDuration(), $this->getTitle(), - $pdc->getGotoActionLabel(), + $pdc->getGotoActionLabel() ] ); } }