diff --git a/pages/UI.php b/pages/UI.php index 855fbdd682..44113d1670 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -193,68 +193,6 @@ function DisplaySearchSet($oP, $oFilter, $bSearchForm = true, $sBaseClass = '', } } -/** - * Displays a form (checkboxes) to select the objects for which to apply a given action - * Only the objects for which the action is valid can be checked. By default all valid objects are checked - * - * @param WebPage $oP WebPage The page for output - * @param \DBSearch $oFilter DBSearch The filter that defines the list of objects - * @param string $sNextOperation string The next operation (code) to be executed when the form is submitted - * @param ActionChecker $oChecker ActionChecker The helper class/instance used to check for which object the action is valid - * @param array $aExtraFormParams - * @param array $aDisplayParams - * - * @since 3.0.0 $aDisplayParams parameter - * - * @throws \ApplicationException - * @throws \ArchivedObjectException - * @throws \CoreException - */ -function DisplayMultipleSelectionForm(WebPage $oP, DBSearch $oFilter, string $sNextOperation, ActionChecker $oChecker, array $aExtraFormParams = [], array $aDisplayParams = []) -{ - $oAppContext = new ApplicationContext(); - $iBulkActionAllowed = $oChecker->IsAllowed(); - $aExtraParams = ['selection_type' => 'multiple', 'selection_mode' => true, 'display_limit' => false, 'menu' => false]; - if ($iBulkActionAllowed == UR_ALLOWED_DEPENDS) { - $aExtraParams['selection_enabled'] = $oChecker->GetAllowedIDs(); - } else { - if (UR_ALLOWED_NO) { - throw new ApplicationException(Dict::Format('UI:ActionNotAllowed')); - } - } - - $oForm = new Form(); - $oForm->SetAction('./UI.php'); - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', $sNextOperation)); - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $oFilter->GetClass())); - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('filter', utils::HtmlEntities($oFilter->Serialize()))); - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId())); - foreach ($aExtraFormParams as $sName => $sValue) { - $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden($sName, $sValue)); - } - $oForm->AddSubBlock($oAppContext->GetForFormBlock()); - $oDisplayBlock = new DisplayBlock($oFilter, 'list', false); - //by default all the elements are selected - $aExtraParams['selectionMode'] = 'negative'; - if (array_key_exists('icon', $aDisplayParams) || array_key_exists('title', $aDisplayParams)) { - $aExtraParams['surround_with_panel'] = true; - if (array_key_exists('icon', $aDisplayParams)) { - $aExtraParams['panel_icon'] = $aDisplayParams['icon']; - } - if (array_key_exists('title', $aDisplayParams)) { - $aExtraParams['panel_title'] = $aDisplayParams['title']; - } - } - $oForm->AddSubBlock($oDisplayBlock->GetDisplay($oP, 1, $aExtraParams)); - $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); - $oToolbarButtons->AddCSSClass('ibo-toolbar--button'); - $oForm->AddSubBlock($oToolbarButtons); - $oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel')->SetOnClickJsCode('window.history.back()')); - $oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), 'next', Dict::S('UI:Button:Next'), true)); - - $oP->AddUiBlock($oForm); -} - /** * @param $oP * @param $aResults diff --git a/sources/Controller/UI.php b/sources/Controller/UI.php index feda122319..ac84828ecd 100644 --- a/sources/Controller/UI.php +++ b/sources/Controller/UI.php @@ -102,7 +102,9 @@ class UI 'selectObj' => $sSelectedObj, ); cmdbAbstractObject::DoBulkModify($oP, $sClass, $aSelectedObj, 'preview_or_modify_all', $bPreview, $sCancelUrl, $aContext); - }/** + } + + /** * Displays a form (checkboxes) to select the objects for which to apply a given action * Only the objects for which the action is valid can be checked. By default all valid objects are checked * @@ -133,7 +135,7 @@ class UI } $oForm = new Form(); - $oForm->SetAction( utils::GetAbsoluteUrlAppRoot().'pages/UI.php'); + $oForm->SetAction(utils::GetAbsoluteUrlAppRoot().'pages/UI.php'); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', $sNextOperation)); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $oFilter->GetClass())); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('filter', utils::HtmlEntities($oFilter->Serialize())));