Page MenuHomeGitPull.it

No OneTemporary

Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
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 @@
<?php
# it.wiki deletion bot in PHP
# Copyright (C) 2018 Valerio Bozzolan
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
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 @@
<!-- START DOCUMENTATION -->
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
<!-- START SPECIFIC EXAMPLE -->
-{{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 }}
<!-- START TEMPLATE -->
-{{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 @@
<!-- START DOCUMENTATION -->
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
<!-- START SPECIFIC EXAMPLE -->
-{{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 }}
<!-- START TEMPLATE -->
-{{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 }}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Nov 19, 05:30 (13 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264964
Default Alt Text
(5 KB)

Event Timeline