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 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']); } } } }
protected function getIcon(&$aWidget) { $oTemplate = BxDolStudioTemplate::getInstance(); $sUrl = $oTemplate->getIconUrl($aWidget['icon']); if (empty($sUrl)) { $aModule = BxDolModuleQuery::getInstance()->getModuleByName($aWidget['module']); $sUrl = BxDolStudioUtils::getIconDefault($aModule['type']); } return $sUrl; }
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 addInArray($aInput, $sKey, $aValues) { bx_import('BxDolStudioUtils'); return BxDolStudioUtils::addInArray($aInput, $sKey, $aValues); }
protected function addInArray($aInput, $sKey, $aValues) { return BxDolStudioUtils::addInArray($aInput, $sKey, $aValues); }
protected function getBlockList($sModule) { if (empty($sModule)) { return ''; } $sJsObject = $this->getPageJsObject(); $oTemplate = BxDolStudioTemplate::getInstance(); $oForm = new BxTemplStudioFormView(array()); $aInputCheckbox = array('type' => 'checkbox', 'name' => 'blocks[]', 'attrs' => array('onChange' => 'javascript:' . $sJsObject . '.onSelectBlock(this);'), 'value' => ''); $aTmplParams = array('html_block_list_id' => $this->aHtmlIds['block_list_id'] . $sModule, 'bx_repeat:blocks' => array()); $aBlocks = $this->getBlocks($sModule); foreach ($aBlocks as $aBlock) { list($sIcon, $sIconUrl) = $this->getBlockIcon($aBlock); $aInputCheckbox['value'] = $aBlock['id']; $aTmplParams['bx_repeat:blocks'][] = array('js_object' => $sJsObject, 'html_id' => $this->aHtmlIds['block_id'] . $aBlock['id'], 'bx_if:is_inactive' => array('condition' => false, 'content' => array()), 'bx_if:show_link' => array('condition' => false, 'content' => array()), 'bx_if:show_text' => array('condition' => true, 'content' => array('title' => _t($aBlock['title']))), 'bx_if:image' => array('condition' => (bool) $sIconUrl, 'content' => array('icon_url' => $sIconUrl)), 'bx_if:icon' => array('condition' => (bool) $sIcon, 'content' => array('icon' => $sIcon)), 'module' => $this->getModuleTitle($aBlock['module']), 'visible_for' => _t('_adm_bp_txt_visible_for', BxDolStudioUtils::getVisibilityTitle($aBlock['visible_for_levels'])), 'bx_if:show_checkbox' => array('condition' => true, 'content' => array('content' => $oForm->genRow($aInputCheckbox))), 'bx_if:show_drag_handle' => array('condition' => false, 'content' => array())); } return $oTemplate->parseHtmlByName('bp_blocks_list.html', $aTmplParams); }
protected function displayUpdates($aItems, $aParams = array()) { if (!is_array($aItems)) { return $aItems; } if (empty($aItems)) { return MsgBox(_t('_Empty')); } $sJsObject = $this->getPageJsObject(); $oTemplate = BxDolStudioTemplate::getInstance(); $sResult = ''; foreach ($aItems as $aItem) { $bDownloadable = (int) $aItem['is_file'] == 1; $sIcon = !empty($aItem['thumbnail']['big']) ? $aItem['thumbnail']['big'] : BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE); $bIcon = strpos($sIcon, '.') === false; $sResult .= $oTemplate->parseHtmlByName('str_update_v2.html', array('js_object' => $sJsObject, 'id' => $aItem['id'], 'name' => $aItem['name'], 'url' => $aItem['url'], 'bx_if:icon' => array('condition' => $bIcon, 'content' => array('icon' => $sIcon)), 'bx_if:image' => array('condition' => !$bIcon, 'content' => array('icon_url' => $sIcon)), 'title' => $aItem['title'], 'vendor' => $aItem['author'], 'versions' => _t('_adm_str_txt_update_from_to', $aItem['file_version'], $aItem['file_version_to']), 'bx_if:show_download' => array('condition' => $bDownloadable, 'content' => array('caption' => _t($this->bAuthAccessUpdates ? '_adm_btn_download_submit' : '_adm_btn_install_submit'), 'on_click' => $sJsObject . "." . ($this->bAuthAccessUpdates ? "getFile(" . $aItem['file_id'] . ", this)" : "getUpdateAndInstall('" . $aItem['name'] . "', this)"))))); } return $sResult; }
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 _getCellVisibleForLevels($mixedValue, $sKey, $aField, $aRow) { $mixedValue = $this->_oTemplate->parseHtmlByName('bx_a.html', array('href' => 'javascript:void(0)', 'title' => _t('_adm_nav_txt_manage_visibility'), 'bx_repeat:attrs' => array(array('key' => 'bx_grid_action_single', 'value' => 'show_to'), array('key' => 'bx_grid_action_data', 'value' => $aRow['id'])), 'content' => BxDolStudioUtils::getVisibilityTitle($aRow['visible_for_levels']))); return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); }
protected function getTranslationsKey($sType, $sName, $sValue) { $iRand = time(); $sPrefixDefault = "_sys_form_input"; $sName = BxDolStudioUtils::getSystemName(trim($sName)); $sResult = ''; switch ($sType) { case 'insert': $sValue = !empty($sValue) ? BxDolStudioUtils::getSystemName($sValue) : $sPrefixDefault; $sResult = $sValue . '_' . $sName . '_' . $iRand; break; case 'update': $sResult = !empty($sValue) ? $sValue : $sPrefixDefault . '_' . $sName . '_' . $iRand; break; } return $sResult; }
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'])); } }
protected function getMenuIcon($sGroup, &$aType) { bx_import('BxDolStudioUtils'); if (empty($aType['icon']) || ($sUrl = BxDolStudioTemplate::getInstance()->getIconUrl($aType['icon'])) == "") { switch ($sGroup) { case BX_DOL_STUDIO_STG_GROUP_MODULES: $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE); break; case BX_DOL_STUDIO_STG_GROUP_LANGUAGES: $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_LANGUAGE); break; case BX_DOL_STUDIO_STG_GROUP_TEMPLATES: $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_TEMPLATE); break; } } return $aType['icon']; }
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']; } }
protected function getModules($bShowCustom = true, $bShowSystem = true) { return BxDolStudioUtils::getModules($bShowCustom, $bShowSystem); }
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 addInArray($aInput, $sKey, $aValues, $bAddAfter = true) { return BxDolStudioUtils::addInArray($aInput, $sKey, $aValues, $bAddAfter); }