2 namespace wcf\acp\form
;
3 use wcf\data\cronjob\Cronjob
;
4 use wcf\data\cronjob\CronjobAction
;
5 use wcf\form\AbstractForm
;
6 use wcf\system\exception\IllegalLinkException
;
7 use wcf\system\language\I18nHandler
;
11 * Shows the cronjob edit form.
13 * @author Alexander Ebert
14 * @copyright 2001-2018 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @package WoltLabSuite\Core\Acp\Form
18 class CronjobEditForm
extends CronjobAddForm
{
22 public $activeMenuItem = 'wcf.acp.menu.link.maintenance';
28 public $cronjobID = 0;
34 public $cronjob = null;
39 public function readParameters() {
40 parent
::readParameters();
42 if (isset($_REQUEST['id'])) $this->cronjobID
= intval($_REQUEST['id']);
43 $this->cronjob
= new Cronjob($this->cronjobID
);
44 if (!$this->cronjob
->cronjobID
) {
45 throw new IllegalLinkException();
48 $this->packageID
= $this->cronjob
->packageID
;
54 public function save() {
57 $this->description
= 'wcf.acp.cronjob.description.cronjob'.$this->cronjob
->cronjobID
;
58 if (I18nHandler
::getInstance()->isPlainValue('description')) {
59 I18nHandler
::getInstance()->remove($this->description
);
60 $this->description
= I18nHandler
::getInstance()->getValue('description');
63 I18nHandler
::getInstance()->save('description', $this->description
, 'wcf.acp.cronjob', $this->cronjob
->packageID
);
67 $data = array_merge($this->additionalFields
, [
68 'className' => $this->className
,
69 'description' => $this->description
,
70 'startMinute' => $this->startMinute
,
71 'startHour' => $this->startHour
,
72 'startDom' => $this->startDom
,
73 'startMonth' => $this->startMonth
,
74 'startDow' => $this->startDow
77 $this->objectAction
= new CronjobAction([$this->cronjobID
], 'update', ['data' => $data]);
78 $this->objectAction
->executeAction();
82 // show success message
83 WCF
::getTPL()->assign('success', true);
89 public function readData() {
93 I18nHandler
::getInstance()->setOptions('description', $this->cronjob
->packageID
, $this->cronjob
->description
, 'wcf.acp.cronjob.description.cronjob\d+');
95 $this->className
= $this->cronjob
->className
;
96 $this->description
= $this->cronjob
->description
;
97 $this->startMinute
= $this->cronjob
->startMinute
;
98 $this->startHour
= $this->cronjob
->startHour
;
99 $this->startDom
= $this->cronjob
->startDom
;
100 $this->startMonth
= $this->cronjob
->startMonth
;
101 $this->startDow
= $this->cronjob
->startDow
;
108 public function assignVariables() {
109 parent
::assignVariables();
111 I18nHandler
::getInstance()->assignVariables(!empty($_POST));
113 WCF
::getTPL()->assign([
114 'cronjobID' => $this->cronjobID
,