From: Matthias Schmidt Date: Fri, 26 Jun 2015 16:38:20 +0000 (+0200) Subject: Add TReasonedBulkProcessingAction X-Git-Tag: 3.0.0_Beta_1~2236 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aab4747a1d0cd178458dde108ce74edbf37612ef;p=GitHub%2FWoltLab%2FWCF.git Add TReasonedBulkProcessingAction --- diff --git a/wcfsetup/install/files/acp/templates/reasonedBulkProcessingAction.tpl b/wcfsetup/install/files/acp/templates/reasonedBulkProcessingAction.tpl new file mode 100644 index 0000000000..7f17e466ea --- /dev/null +++ b/wcfsetup/install/files/acp/templates/reasonedBulkProcessingAction.tpl @@ -0,0 +1,10 @@ + +
+
+ + + {if $errorField == $reasonFieldName} + {lang}wcf.global.form.error.{$errorType}{/lang} + {/if} +
+ diff --git a/wcfsetup/install/files/lib/system/bulk/processing/TReasonedBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/TReasonedBulkProcessingAction.class.php new file mode 100644 index 0000000000..2df21eb8d6 --- /dev/null +++ b/wcfsetup/install/files/lib/system/bulk/processing/TReasonedBulkProcessingAction.class.php @@ -0,0 +1,53 @@ + + * @package com.woltlab.wcf + * @subpackage system.bulk.processing + * @category Community Framework + */ +trait TReasonedBulkProcessingAction { + /** + * reason + * @var string + */ + protected $reason = ''; + + /** + * @see \wcf\system\bulk\processing\IBulkProcessingAction::getHTML() + */ + public function getHTML() { + return WCF::getTPL()->fetch('reasonedBulkProcessingAction', 'wcf', [ + 'reason' => $this->reason, + 'reasonFieldName' => $this->getReasonFieldName() + ]); + } + + /** + * Returns the name of the reason field. + * + * @return string + */ + abstract protected function getReasonFieldName(); + + /** + * @see \wcf\system\bulk\processing\IBulkProcessingAction::readFormParameters() + */ + public function readFormParameters() { + if (isset($_POST[$this->getReasonFieldName()])) $this->reason = StringUtil::trim($_POST[$this->getReasonFieldName()]); + } + + /** + * @see \wcf\system\bulk\processing\IBulkProcessingAction::reset() + */ + public function reset() { + $this->reason = ''; + } +}