Skip to content

Commit c143949

Browse files
committed
version 2 for xoopsconfirm
1 parent 4c71310 commit c143949

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

admin/modules.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@
190190
$GLOBALS['xoopsTpl']->assign('error', $modulesObj->getHtmlErrors());
191191
}
192192
} else {
193-
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm();
194-
$xoopsconfirm->hiddens = ['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'];
195-
$xoopsconfirm->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER');
196-
$xoopsconfirm->object = $modulesObj->getVar('mod_name');
193+
$xoopsconfirm = new \XoopsModules\Modulebuilder\Common\XoopsConfirm(
194+
['ok' => 1, 'mod_id' => $modId, 'op' => 'delete'],
195+
\Xmf\Request::getString('REQUEST_URI', '', 'SERVER'),
196+
$modulesObj->getVar('mod_name')
197+
);
197198
$form = $xoopsconfirm->getFormXoopsConfirm();
198199
$GLOBALS['xoopsTpl']->assign('form', $form->render());
199200
}

class/Common/XoopsConfirm.php

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,28 @@
3030
/**
3131
* Class Object XoopsConfirm
3232
*/
33-
class XoopsConfirm extends \XoopsObject
33+
class XoopsConfirm
3434
{
35-
public $hiddens = [];
36-
public $action = '';
37-
public $title = '';
38-
public $label = '';
39-
public $object = '';
35+
private $hiddens = [];
36+
private $action = '';
37+
private $title = '';
38+
private $label = '';
39+
private $object = '';
4040

4141
/**
4242
* @public function constructor class
4343
*
4444
* @param null
4545
*/
46-
public function __construct()
46+
public function __construct($hiddens, $action, $object, $title = '', $label = '')
4747
{
48+
$this->hiddens = $hiddens;
49+
$this->action = $action;
50+
$this->object = $object;
51+
$this->title = $title;
52+
$this->label = $label;
4853
}
4954

50-
/**
51-
* @static function &getInstance
52-
*
53-
* @param null
54-
*/
55-
public static function getInstance()
56-
{
57-
static $instance = false;
58-
if (!$instance) {
59-
$instance = new self();
60-
}
61-
}
62-
63-
6455
/**
6556
* @public function getXoopsConfirm
6657
* @param bool $action
@@ -85,7 +76,7 @@ public function getFormXoopsConfirm()
8576
}
8677

8778
xoops_load('XoopsFormLoader');
88-
$form = new \XoopsThemeForm($this->title, 'form', $this->action, 'post', true);
79+
$form = new \XoopsThemeForm($this->title, 'formXoopsConfirm', $this->action, 'post', true);
8980
$form->setExtra('enctype="multipart/form-data"');
9081
$form->addElement(new \XoopsFormLabel($this->label, $this->object));
9182
//hiddens

0 commit comments

Comments
 (0)