public static function changeFormField($aParams, &$aInputs, &$oDb) { $aInputs['module']['type'] = 'select'; $aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules()); $aInputs['module']['value'] = $aParams['module']; $aInputs['object']['type'] = 'select'; $aInputs['object']['value'] = $aParams['object']; $aInputs['object']['values'] = array(); $aForms = array(); $oDb->getForms(array('type' => 'by_module', 'value' => $aParams['module']), $aForms, false); if (!empty($aForms) && is_array($aForms)) { foreach ($aForms as $aForm) { $aInputs['object']['values'][$aForm['object']] = _t($aForm['title']); } asort($aInputs['object']['values']); } $aInputs['object']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_object')), $aInputs['object']['values']); $aInputs['name']['type'] = 'text'; $sTrlTypePostfix = '_translatable'; $sTrlCheckFuncPostfix = 'Translatable'; foreach ($aInputs as $sName => $aInput) { if (isset($aInput['type']) && stripos($aInput['type'], $sTrlTypePostfix) !== false) { $aInputs[$sName]['type'] = str_ireplace($sTrlTypePostfix, '', $aInput['type']); if (isset($aInput['checker']['func']) && stripos($aInput['checker']['func'], $sTrlCheckFuncPostfix) !== false) { $aInputs[$sName]['checker']['func'] = str_ireplace($sTrlCheckFuncPostfix, '', $aInput['checker']['func']); } } } $aFields = array('editable' => array('type' => 'switcher', 'name' => 'editable', 'caption' => _t('_bx_dev_frm_txt_field_title_editable'), 'info' => _t('_bx_dev_frm_txt_field_info_editable'), 'value' => '1', 'required' => '0', 'db' => array('pass' => 'Int')), 'deletable' => array('type' => 'switcher', 'name' => 'deletable', 'caption' => _t('_bx_dev_frm_txt_field_title_deletable'), 'info' => _t('_bx_dev_frm_txt_field_info_deletable'), 'value' => '1', 'required' => '0', 'db' => array('pass' => 'Int'))); $aInputs = BxDolStudioUtils::addInArray($aInputs, 'controls', $aFields, false); }
public static function changeFormField($aParams, &$aInputs, &$oDb) { $aInputs['module']['type'] = 'select'; $aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules()); $aInputs['module']['value'] = $aParams['module']; $aInputs['object']['type'] = 'select'; $aInputs['object']['value'] = $aParams['object']; $aInputs['object']['values'] = array(); $aForms = array(); $oDb->getForms(array('type' => 'by_module', 'value' => $aParams['module']), $aForms, false); if (!empty($aForms) && is_array($aForms)) { foreach ($aForms as $aForm) { $aInputs['object']['values'][$aForm['object']] = _t($aForm['title']); } asort($aInputs['object']['values']); } $aInputs['object']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_object')), $aInputs['object']['values']); $aInputs['name']['type'] = 'text'; $sTrlTypePostfix = '_translatable'; $sTrlCheckFuncPostfix = 'Translatable'; foreach ($aInputs as $sName => $aInput) { if (isset($aInput['type']) && stripos($aInput['type'], $sTrlTypePostfix) !== false) { $aInputs[$sName]['type'] = str_ireplace($sTrlTypePostfix, '', $aInput['type']); if (isset($aInput['checker']['func']) && stripos($aInput['checker']['func'], $sTrlCheckFuncPostfix) !== false) { $aInputs[$sName]['checker']['func'] = str_ireplace($sTrlCheckFuncPostfix, '', $aInput['checker']['func']); } } } }
public function performActionEdit() { $sAction = 'edit'; $sFormObject = $this->oModule->_oConfig->getObject('form_forms_prelist'); $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_prelist_edit'); $aList = $this->_getItem('getLists'); if ($aList === false) { $this->_echoResultJson(array()); exit; } bx_import('BxDolForm'); $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate); $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction; $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules()); $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_prelists_save'); $oForm->initChecker($aList); if ($oForm->isSubmittedAndValid()) { if ($oForm->update($aList['id']) !== false) { $aRes = array('grid' => $this->getCode(false), 'blink' => $aList['id']); } else { $aRes = array('msg' => _t('_bx_dev_frm_err_prelists_edit')); } $this->_echoResultJson($aRes, true); } else { bx_import('BxTemplStudioFunctions'); $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prelist-edit-popup', _t('_bx_dev_frm_txt_prelists_edit_popup', _t($aList['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_list.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction))); $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true); } }
public function performActionEdit() { $sAction = 'edit'; $sFormObject = $this->oModule->_oConfig->getObject('form_forms_form'); $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_form_edit'); $aIds = bx_get('ids'); if (!$aIds || !is_array($aIds)) { $iId = (int) bx_get('id'); if (!$iId) { $this->_echoResultJson(array()); exit; } $aIds = array($iId); } $iId = $aIds[0]; $aForm = array(); $this->oDb->getForms(array('type' => 'by_id', 'value' => $iId), $aForm, false); if (empty($aForm) || !is_array($aForm)) { $this->_echoResultJson(array()); exit; } bx_import('BxDolForm'); $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate); $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction; $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules()); $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_forms_save'); $aForm['form_attrs'] = BxDevFunctions::unserializeString($aForm['form_attrs']); $aForm['params'] = BxDevFunctions::unserializeString($aForm['params']); $oForm->initChecker($aForm); if ($oForm->isSubmittedAndValid()) { $sValue = BxDolForm::getSubmittedValue('form_attrs', $oForm->aFormAttrs['method']); $sValue = BxDevFunctions::serializeString($sValue); BxDolForm::setSubmittedValue('form_attrs', $sValue, $oForm->aFormAttrs['method']); $sValue = BxDolForm::getSubmittedValue('params', $oForm->aFormAttrs['method']); $sValue = BxDevFunctions::serializeString($sValue); BxDolForm::setSubmittedValue('params', $sValue, $oForm->aFormAttrs['method']); if ($oForm->update($iId) !== false) { $aRes = array('grid' => $this->getCode(false), 'blink' => $iId); } else { $aRes = array('msg' => _t('_bx_dev_frm_err_forms_edit')); } $this->_echoResultJson($aRes, true); } else { bx_import('BxTemplStudioFunctions'); $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-form-edit-popup', _t('_bx_dev_frm_txt_forms_edit_popup', _t($aForm['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_form.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction))); $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true); } }
public function performActionEdit() { $sAction = 'edit'; $sFormObject = $this->oModule->_oConfig->getObject('form_nav_set'); $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_nav_set_edit'); $aIds = bx_get('ids'); if (!$aIds || !is_array($aIds)) { $sId = bx_get('set_name'); if (!$sId) { $this->_echoResultJson(array()); exit; } $aIds = array($sId); } $sId = bx_process_input($aIds[0]); $aSet = array(); $this->oDb->getSets(array('type' => 'by_name', 'value' => $sId), $aSet, false); if (empty($aSet) || !is_array($aSet)) { $this->_echoResultJson(array()); exit; } bx_import('BxDolForm'); $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate); $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction; $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules()); $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_displays_save'); $oForm->initChecker($aSet); if ($oForm->isSubmittedAndValid()) { if ($oForm->update($sId) !== false) { $aRes = array('grid' => $this->getCode(false), 'blink' => $sId); } else { $aRes = array('msg' => _t('_bx_dev_nav_err_sets_edit')); } $this->_echoResultJson($aRes, true); } else { bx_import('BxTemplStudioFunctions'); $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-set-edit-popup', _t('_bx_dev_nav_txt_sets_edit_popup', _t($aSet['title'])), $this->_oTemplate->parseHtmlByName('nav_add_set.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction))); $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true); } }
protected function _fillDisplayForm(&$oForm, $sAction) { $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&object=' . $this->sObject; $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules()); $oForm->aInputs['module']['value'] = $this->sModule; $aForms = array(); $this->oDb->getForms(array('type' => 'by_module', 'value' => $this->sModule), $aForms, false); foreach ($aForms as $aForm) { $oForm->aInputs['object']['values'][$aForm['object']] = _t($aForm['title']); } asort($oForm->aInputs['object']['values']); $oForm->aInputs['object']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_object')), $oForm->aInputs['object']['values']); $oForm->aInputs['object']['value'] = $this->sObject; }
protected function onLoadBlock(&$oForm, &$aBlock) { $oForm->aFormAttrs['action'] = sprintf($this->sPageUrl, $this->sType, $this->sPage) . '&bp_action=' . $this->sActionBlockEdit; $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_bp_txt_select_module')), BxDolStudioUtils::getModules()); $aDBoxes = array(); $this->oDb->getDesignBoxes(array('type' => 'ordered'), $aDBoxes, false); foreach ($aDBoxes as $aDBox) { $oForm->aInputs['designbox_id']['values'][] = array('key' => $this->sSelectKeyPrefix . $aDBox['id'], 'value' => _t($aDBox['title'])); } $oForm->aInputs['visible_for']['value'] = $aBlock['visible_for_levels'] == BX_DOL_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED; $oForm->aInputs['visible_for']['values'] = array(array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_bx_dev_bp_txt_block_visible_for_all')), array('key' => BX_DOL_STUDIO_VISIBLE_SELECTED, 'value' => _t('_bx_dev_bp_txt_block_visible_for_selected'))); $oForm->aInputs['visible_for']['attrs']['onchange'] = $this->getPageJsObject() . '.onChangeVisibleFor(this)'; $oForm->aInputs['visible_for_levels']['tr_attrs']['style'] = $aBlock['visible_for_levels'] == BX_DOL_INT_MAX ? 'display:none' : ''; BxDolStudioUtils::getVisibilityValues($aBlock['visible_for_levels'], $oForm->aInputs['visible_for_levels']['values'], $oForm->aInputs['visible_for_levels']['value']); $aBlock['visible_for_levels'] = $oForm->aInputs['visible_for_levels']['value']; $oForm->aInputs = $this->addInArray($oForm->aInputs, 'visible_for_levels', $this->getBlockContent($aBlock)); $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_bp_btn_block_save'); $oForm->aInputs['controls'][2]['attrs']['onclick'] = $this->getPageJsObject() . ".deleteBlock(" . $aBlock['id'] . ")"; if ($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_SERVICE) { $aBlock['content'] = BxDevFunctions::unserializeString($aBlock['content']); } if ((int) $aBlock['designbox_id'] != 0) { $aBlock['designbox_id'] = $this->sSelectKeyPrefix . $aBlock['designbox_id']; } }
private function fillInSelects(&$aInputs) { $aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_nav_txt_select_module')), BxDolStudioUtils::getModules()); $aInputs['module']['value'] = $this->sModule; $aInputs['set_name']['value'] = $this->sSet; }
protected function getModules($bShowCustom = true, $bShowSystem = true) { return BxDolStudioUtils::getModules($bShowCustom, $bShowSystem); }
private function fillInSelects(&$aInputs) { $aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_nav_txt_select_module')), BxDolStudioUtils::getModules()); $aInputs['set_name']['values'] = array(array('key' => '', 'value' => _t('_bx_dev_nav_txt_menus_set_name_select'))); $aSets = array(); $this->oDb->getSets(array('type' => 'all'), $aSets, false); foreach ($aSets as $sSet) { $aInputs['set_name']['values'][] = array('key' => $sSet['name'], 'value' => _t($sSet['title'])); } $aInputs['template_id']['values'] = array(array('key' => '', 'value' => _t('_bx_dev_nav_txt_menus_template_id_select'))); $aTemplates = array(); $this->oDb->getTemplates(array('type' => 'all'), $aTemplates, false); foreach ($aTemplates as $aTemplate) { $aInputs['template_id']['values'][] = array('key' => $aTemplate['id'], 'value' => _t($aTemplate['title'])); } }