23 public function _setupActionForm()
26 $this->mActionForm->prepare();
29 public function isEnableCreate()
39 public function executeViewInput(&$controller, &$xoopsUser, &$render)
42 $render->setTemplateName(
'customblock_edit.html');
43 $render->setAttribute(
'actionForm', $this->mActionForm);
48 $this->mObject->loadModule();
50 $render->setAttribute(
'object', $this->mObject);
55 $handler =& xoops_gethandler(
'module');
56 $moduleArr[0] =& $handler->create();
57 $moduleArr[0]->set(
'mid', -1);
58 $moduleArr[0]->set(
'name', _AD_LEGACY_LANG_TOPPAGE);
60 $moduleArr[1] =& $handler->create();
61 $moduleArr[1]->set(
'mid', 0);
62 $moduleArr[1]->set(
'name', _AD_LEGACY_LANG_ALL_MODULES);
65 $criteria->add(
new Criteria(
'hasmain', 1));
66 $criteria->add(
new Criteria(
'isactive', 1));
68 $t_Arr =& $handler->getObjects($criteria);
69 $moduleArr = array_merge($moduleArr, $t_Arr);
70 $render->setAttribute(
'moduleArr', $moduleArr);
72 $handler =& xoops_getmodulehandler(
'columnside');
73 $columnSideArr =& $handler->getObjects();
74 $render->setAttribute(
'columnSideArr', $columnSideArr);
76 $handler =& xoops_gethandler(
'group');
77 $groupArr =& $handler->getObjects();
78 $render->setAttribute(
'groupArr', $groupArr);
83 $handler =& xoops_gethandler(
'cachetime');
84 $cachetimeArr =& $handler->getObjects();
85 $render->setAttribute(
'cachetimeArr', $cachetimeArr);
90 $handler =& xoops_getmodulehandler(
'blockctype');
91 $ctypeArr =& $handler->getObjects();
92 $render->setAttribute(
'ctypeArr', $ctypeArr);
95 public function executeViewCancel(&$controller, &$xoopsUser, &$render)
97 if ($this->mObject->isNew()) {
98 $controller->executeForward(
'./index.php?action=BlockInstallList');
100 $controller->executeForward(
'./index.php?action=BlockList');
104 public function execute(&$controller, &$xoopsUser)
106 if (
null === $this->mObject) {
107 return LEGACY_FRAME_VIEW_ERROR;
110 if (
null !== xoops_getrequest(
'_form_control_preview')) {
111 $this->mActionForm->load($this->mObject);
113 $this->mActionForm->fetch();
114 $this->mActionForm->validate();
116 return LEGACY_FRAME_VIEW_PREVIEW;
118 return parent::execute($controller, $xoopsUser);
121 public function executeViewPreview(&$controller, &$xoopsUser, &$render)
123 $this->executeViewInput($controller, $xoopsUser, $render);
125 $bid = !empty(xoops_getrequest(
'bid')) ? intval(xoops_getrequest(
'bid')) : 0;
127 $myblock =
new XoopsBlock($bid);
129 $myblock =
new XoopsBlock();
130 $myblock->setVar(
'block_type',
'C');
133 $myblock->setVar(
'content', $myts->stripSlashesGPC(xoops_getrequest(
'content')));
134 restore_error_handler();
135 $original_level = error_reporting( E_ALL );
136 $preview = $myblock->getContent(
'S', xoops_getrequest(
'c_type'));
137 error_reporting( $original_level );
138 $render->setAttribute(
'content_preview', $preview);