本文整理汇总了PHP中BxTemplStudioFunctions类的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplStudioFunctions类的具体用法?PHP BxTemplStudioFunctions怎么用?PHP BxTemplStudioFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BxTemplStudioFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performActionEdit
public function performActionEdit()
{
$sAction = 'edit';
$sFormObject = $this->oModule->_oConfig->getObject('form_forms_prevalue');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_prevalue_edit');
$aValue = $this->_getItem('getValues');
if ($aValue === 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 . '&list=' . $this->sList;
$this->onLoad($oForm->aInputs);
$oForm->initChecker($aValue);
if ($oForm->isSubmittedAndValid()) {
if ($oForm->update($aValue['id']) !== false) {
$this->onSave($oForm);
$aRes = array('grid' => $this->getCode(false), 'blink' => $aValue['id']);
} else {
$aRes = array('msg' => _t('_bx_dev_frm_err_prevalues_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prevalue-edit-popup', _t('_bx_dev_frm_txt_prevalues_edit_popup', _t($aValue['lkey'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_value.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);
}
}
示例2: getPageCaption
public function getPageCaption()
{
if (empty($this->aPage) || !is_array($this->aPage)) {
return '';
}
$oTemplate = BxDolStudioTemplate::getInstance();
$oFunctions = BxTemplStudioFunctions::getInstance();
$sHelp = $this->getPageCaptionHelp();
if (($bHelp = strlen($sHelp)) > 0) {
$sHelp = $oFunctions->transBox('bx-std-pcap-menu-popup-help', $sHelp, true);
}
$sActions = $this->getPageCaptionActions();
if (($bActions = strlen($sActions)) > 0) {
$sActions = $oFunctions->transBox('bx-std-pcap-menu-popup-actions', $sActions, true);
}
$oTemplate->addInjection('injection_header', 'text', $sHelp . $sActions);
//--- Menu Left ---//
$aItems = array('back' => array('name' => 'back', 'icon' => 'th', 'link' => BX_DOL_URL_STUDIO . 'launcher.php', 'title' => '_adm_txt_back_to_launcher'));
$oMenu = new BxTemplStudioMenu(array('template' => 'menu_top_toolbar.html', 'menu_items' => $aItems));
$sMenuLeft = $oMenu->getCode();
//--- Menu Right ---//
$aItems = array();
if ($bHelp) {
$aItems['help'] = array('name' => 'help', 'icon' => 'question-circle', 'onclick' => BX_DOL_STUDIO_PAGE_JS_OBJECT . ".togglePopup('help', this)", 'title' => '_adm_txt_show_help');
}
if ($bActions) {
$aItems['actions'] = array('name' => 'actions', 'icon' => 'cog', 'onclick' => BX_DOL_STUDIO_PAGE_JS_OBJECT . ".togglePopup('actions', this)", 'title' => '_adm_txt_show_help');
}
$oMenu = new BxTemplStudioMenu(array('template' => 'menu_top_toolbar.html', 'menu_items' => $aItems));
$sMenuRight = $oMenu->getCode();
$aTmplVars = array('menu_left' => $sMenuLeft, 'caption' => _t($this->aPage['caption']), 'menu_right' => $sMenuRight);
return $oTemplate->parseHtmlByName('page_caption.html', $aTmplVars);
}
示例3: performActionEdit
public function performActionEdit($bUpdateGrid = false)
{
$sAction = 'edit';
$sFormObject = $this->oModule->_oConfig->getObject('form_nav_item');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_nav_item_edit');
$aItem = $this->_getItem('getItems');
if ($aItem === 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 . '&set=' . $this->sSet;
$oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_nav_btn_items_save');
$this->fillInSelects($oForm->aInputs);
$oForm->initChecker($aItem);
if ($oForm->isSubmittedAndValid()) {
if ($oForm->update($aItem['id']) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $aItem['id']);
} else {
$aRes = array('msg' => _t('_bx_dev_nav_err_items_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-item-edit-popup', _t('_bx_dev_nav_txt_items_edit_popup', _t($aItem['title_system'])), $this->oModule->_oTemplate->parseHtmlByName('nav_add_item.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);
}
}
示例4: performActionEdit
public function performActionEdit()
{
$sAction = '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();
$iSet = $this->oDb->getSets(array('type' => 'by_name', 'value' => $sId), $aSet);
if ($iSet != 1 || empty($aSet)) {
$this->_echoResultJson(array());
exit;
}
$aForm = array('form_attrs' => array('id' => 'adm-nav-set-edit', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_menu_sets', 'key' => 'set_name', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('set_name' => array('type' => 'hidden', 'name' => 'set_name', 'value' => $sId, 'db' => array('pass' => 'Xss')), 'title' => array('type' => 'text_translatable', 'name' => 'title', 'caption' => _t('_adm_nav_txt_sets_title'), 'info' => _t('_adm_nav_dsc_sets_title'), 'value' => $aSet['title'], 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'LengthTranslatable', 'params' => array(3, 100, 'title'), 'error' => _t('_adm_nav_err_sets_title'))), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_nav_btn_menus_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_nav_btn_menus_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
if ($oForm->update($sId) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $sId);
} else {
$aRes = array('msg' => _t('_adm_nav_err_sets_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-set-edit-popup', _t('_adm_nav_txt_sets_edit_popup', _t($aSet['title'])), $this->_oTemplate->parseHtmlByName('nav_add_set.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例5: processActions
function processActions()
{
if (($sAction = bx_get($this->sParamPrefix . '_action')) !== false) {
$sAction = bx_process_input($sAction);
$aResult = array('code' => 1, 'message' => _t('_adm_' . $this->sLangPrefix . '_err_cannot_process_action'));
switch ($sAction) {
case 'uninstall':
$sPageName = bx_process_input(bx_get($this->sParamPrefix . '_page_name'));
if (empty($sPageName)) {
break;
}
bx_import('BxDolModuleQuery');
$aModule = BxDolModuleQuery::getInstance()->getModuleByName($sPageName);
if (empty($aModule) || !is_array($aModule)) {
break;
}
if (($iWidgetId = (int) bx_get($this->sParamPrefix . '_widget_id')) != 0 && (int) bx_get($this->sParamPrefix . '_confirmed') != 1) {
$aResult['message'] = $this->getPopupConfirm($iWidgetId, $aModule);
break;
}
bx_import('BxDolStudioInstallerUtils');
$aResult = BxDolStudioInstallerUtils::getInstance()->perform($aModule['path'], 'uninstall');
if (!empty($aResult['message'])) {
$aResult['message'] = $this->getPopupResult($aResult['message']);
}
break;
}
if (!empty($aResult['message'])) {
bx_import('BxTemplStudioFunctions');
$aResult['message'] = BxTemplStudioFunctions::getInstance()->transBox('', $aResult['message']);
}
echo json_encode($aResult);
exit;
}
}
示例6: performActionEdit
public function performActionEdit()
{
$sAction = '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];
$aEtemplate = array();
$this->oDb->getEtemplates(array('type' => 'by_id', 'value' => $iId), $aEtemplate, false);
if (empty($aEtemplate) || !is_array($aEtemplate)) {
$this->_echoResultJson(array());
exit;
}
$aForm = array('form_attrs' => array('id' => 'adm-pgt-etemplate-edit', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_email_templates', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('ID' => array('type' => 'hidden', 'name' => 'id', 'value' => $iId, 'db' => array('pass' => 'Int')), 'NameSystem' => array('type' => 'text_translatable', 'name' => 'NameSystem', 'caption' => _t('_adm_pgt_txt_etemplates_name_system'), 'info' => _t('_adm_pgt_dsc_etemplates_name_system'), 'value' => $aEtemplate['name_system'], 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'LengthTranslatable', 'params' => array(3, 100, 'NameSystem'), 'error' => _t('_adm_pgt_err_etemplates_name_system'))), 'Subject' => array('type' => 'text_translatable', 'name' => 'Subject', 'caption' => _t('_adm_pgt_txt_etemplates_subject'), 'info' => _t('_adm_pgt_dsc_etemplates_subject'), 'value' => $aEtemplate['subject'], 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'AvailTranslatable', 'params' => array('Subject'), 'error' => _t('_adm_pgt_err_etemplates_subject'))), 'Body' => array('type' => 'textarea_translatable', 'name' => 'Body', 'caption' => _t('_adm_pgt_txt_etemplates_body'), 'info' => _t('_adm_pgt_dsc_etemplates_body'), 'value' => $aEtemplate['body'], 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'AvailTranslatable', 'params' => array('Body'), 'error' => _t('_adm_pgt_err_etemplates_body'))), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_pgt_btn_etemplates_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_pgt_btn_etemplates_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
if ($oForm->update($iId) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_adm_pgt_err_etemplates_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-pgt-etemplate-edit-popup', _t('_adm_pgt_txt_etemplates_edit_popup', _t($aEtemplate['name_system'])), $this->_oTemplate->parseHtmlByName('pgt_new_etemplate.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例7: performActionOptions
public function performActionOptions()
{
if ((int) $this->iLevel == 0) {
$this->iLevel = (int) bx_get('IDLevel');
}
$aIds = bx_get('ids');
if (!$aIds || !is_array($aIds)) {
$iId = (int) bx_get('IDAction');
if (!$iId) {
$this->_echoResultJson(array());
exit;
}
$aIds = array($iId);
}
$sAction = 'options';
$iId = $aIds[0];
if (strpos($iId, $this->sParamsDivider) !== false) {
list($this->iLevel, $iId) = explode($this->sParamsDivider, urldecode($iId));
}
$aOption = array();
$iOption = $this->oDb->getOptions(array('type' => 'by_level_action_ids', 'level_id' => $this->iLevel, 'action_id' => $iId), $aOption);
if ($iOption != 1 || empty($aOption)) {
$this->_echoResultJson(array());
exit;
}
$aForm = array('form_attrs' => array('id' => 'adm-prm-action-options', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_acl_matrix', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('IDLevel' => array('type' => 'hidden', 'name' => 'IDLevel', 'value' => $this->iLevel, 'db' => array('pass' => 'Int')), 'IDAction' => array('type' => 'hidden', 'name' => 'IDAction', 'value' => $iId, 'db' => array('pass' => 'Int')), 'AllowedCount' => array('type' => 'text', 'name' => 'AllowedCount', 'caption' => _t('_adm_prm_txt_actions_number'), 'info' => _t('_adm_prm_dsc_actions_number'), 'value' => $aOption['allowed_count'], 'db' => array('pass' => 'Int')), 'AllowedPeriodLen' => array('type' => 'text', 'name' => 'AllowedPeriodLen', 'caption' => _t('_adm_prm_txt_actions_reset'), 'info' => _t('_adm_prm_dsc_actions_reset'), 'value' => $aOption['allowed_period_len'], 'db' => array('pass' => 'Int')), 'AllowedPeriodStart' => array('type' => 'datetime', 'name' => 'AllowedPeriodStart', 'caption' => _t('_adm_prm_txt_actions_avail_start'), 'info' => _t('_adm_prm_dsc_actions_avail'), 'value' => $aOption['allowed_period_start'], 'attrs' => array('allow_input' => 'true'), 'db' => array('pass' => 'Xss')), 'AllowedPeriodEnd' => array('type' => 'datetime', 'name' => 'AllowedPeriodEnd', 'caption' => _t('_adm_prm_txt_actions_avail_end'), 'info' => _t('_adm_prm_dsc_actions_avail'), 'value' => $aOption['allowed_period_end'], 'attrs' => array('allow_input' => 'true'), 'db' => array('pass' => 'Xss')), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_prm_btn_actions_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_prm_btn_actions_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
if ((int) $aOption['action_countable'] != 1) {
unset($aForm['inputs']['AllowedCount'], $aForm['inputs']['AllowedPeriodLen']);
}
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$aUpdate = array();
foreach ($aForm['inputs'] as $sName => $aInput) {
if (in_array($aInput['type'], array('hidden', 'input_set'))) {
continue;
}
$aUpdate[$sName] = $oForm->getCleanValue($sName);
if (empty($aUpdate[$sName])) {
$aUpdate[$sName] = null;
}
}
$this->oDb->updateOptions((int) $oForm->getCleanValue('IDLevel'), (int) $oForm->getCleanValue('IDAction'), $aUpdate);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-prm-action-options-popup', _t('_adm_prm_txt_actions_options_popup', _t($aOption['action_title'])), $this->_oTemplate->parseHtmlByName('prm_edit_option.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例8: genInputTranslatable
function genInputTranslatable(&$aInput, $sType = 'text')
{
$iValueLength = 20;
$sInputIdPrefix = 'bx-form-input-';
$aInputMethod = array('text' => 'genInputStandard', 'textarea' => 'genInputTextarea');
$sInput = '';
$sInputName = $aInput['name'];
$aInputAttrs = isset($aInput['attrs']) && is_array($aInput['attrs']) ? $aInput['attrs'] : array();
bx_import('BxTemplStudioFunctions');
$oFunctions = BxTemplStudioFunctions::getInstance();
bx_import('BxDolStudioLanguagesUtils');
$oLanguage = BxDolStudioLanguagesUtils::getInstance();
$sLanguage = $oLanguage->getCurrentLangName(false);
$aLanguages = $oLanguage->getLanguagesInfo();
$aStrings = $oLanguage->getLanguageString($aInput['value']);
$aInput['type'] = 'hidden';
$aInput['attrs'] = array_merge($aInputAttrs, array('id' => $sInputIdPrefix . $aInput['name']));
$sInput .= $this->genInputStandard($aInput);
$aTmplVars = array();
foreach ($aLanguages as $aLanguage) {
$bLanguage = $aLanguage['name'] == $sLanguage;
$sValue = '';
if (($bValue = key_exists($aLanguage['id'], $aStrings)) === true) {
$sValue = $aStrings[$aLanguage['id']]['string'];
} else {
if (isset($aInput['values'][$aLanguage['name']])) {
$sValue = $aInput['values'][$aLanguage['name']];
}
}
$aInput['type'] = $sType;
$aInput['name'] = $sInputName . '-' . $aLanguage['name'];
$aInput['value'] = $sValue;
$aInput['attrs'] = array_merge($aInputAttrs, array('id' => $sInputIdPrefix . $aInput['name'], 'style' => !$bLanguage ? 'display:none;' : ''));
$sInput .= $this->{$aInputMethod}[$sType]($aInput);
$aTmplVarValue = array('condition' => $bValue, 'content' => array('value' => strmaxtextlen($sValue, $iValueLength)));
$aTmplVarMissing = array('condition' => !$bValue || empty($sValue), 'content' => array());
$aTmplVars[] = array('name' => $sInputName, 'lang_name' => $aLanguage['name'], 'lang_flag' => $aLanguage['icon'], 'lang_title' => $aLanguage['title'], 'bx_if:hide_active' => array('condition' => !$bLanguage, 'content' => array()), 'bx_if:act_value' => $aTmplVarValue, 'bx_if:act_missing' => $aTmplVarMissing, 'bx_if:hide_passive' => array('condition' => $bLanguage, 'content' => array()), 'bx_if:pas_value' => $aTmplVarValue, 'bx_if:pas_missing' => $aTmplVarMissing);
}
$sPopup = $this->oTemplate->parseHtmlByName('form_view_translator.html', array('bx_repeat:languages' => $aTmplVars));
$sPopup = $oFunctions->transBox('bx-form-field-translator-popup-' . $sInputName, $sPopup, true);
$aLanguage = $oLanguage->getLanguageInfo($sLanguage);
$sControl = $this->oTemplate->parseHtmlByName('form_view_translatable.html', array('flag' => $aLanguage['icon'], 'title' => $aLanguage['title'], 'name' => $sInputName, 'popup' => $sPopup));
return $sInput . $sControl;
}
示例9: performActionEdit
public function performActionEdit()
{
$oTemplate = BxDolStudioTemplate::getInstance();
$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];
$sAction = 'edit';
$aLanguages = array();
$iLanguages = $this->oDb->getLanguagesBy(array('type' => 'all_key_id'), $aLanguages);
$aKey = $this->oDb->getKeyFullInfo($iId);
$aForm = array('form_attrs' => array('id' => 'adm-lang-edit-key-form', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_localization_keys', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iId, 'db' => array('pass' => 'Int'))));
foreach ($aLanguages as $aLanguage) {
$sName = 'language_' . $aLanguage['id'];
$aForm['inputs'][$sName] = array('type' => 'textarea', 'name' => $sName, 'caption' => $aLanguage['title'], 'value' => isset($aKey['strings'][$aLanguage['name']]) ? $aKey['strings'][$aLanguage['name']]['string'] : '', 'db' => array('pass' => 'XssHtml'));
}
$aForm['inputs'] = array_merge($aForm['inputs'], array('languages' => array('type' => 'hidden', 'name' => 'languages', 'value' => implode(',', array_keys($aLanguages)), 'db' => array('pass' => 'Xss')), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_pgt_btn_nkp_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_pgt_btn_nkp_close'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
bx_import('BxTemplStudioFormView');
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$mixedResult = $this->edit($oForm);
if (is_int($mixedResult)) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $mixedResult);
} else {
$aRes = array('msg' => $mixedResult);
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-lang-edit-key-popup', _t('_adm_pgt_txt_nkp_edit_popup', $aKey['key']), $this->_oTemplate->parseHtmlByName('pgt_new_key.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例10: performActionEdit
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);
}
}
示例11: performActionEdit
public function performActionEdit()
{
$sAction = '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];
$aPrice = array();
$iPrice = $this->oDb->getPrices(array('type' => 'by_id', 'value' => $iId), $aPrice);
if ($iPrice != 1 || empty($aPrice)) {
$this->_echoResultJson(array());
exit;
}
if ((int) $this->iLevel == 0) {
$this->iLevel = (int) $aPrice['level_id'];
}
$aForm = array('form_attrs' => array('id' => 'adm-prm-price-edit', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_acl_level_prices', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iId, 'db' => array('pass' => 'Int')), 'IDLevel' => array('type' => 'hidden', 'name' => 'IDLevel', 'value' => $aPrice['level_id'], 'db' => array('pass' => 'Int')), 'Days' => array('type' => 'text', 'name' => 'Days', 'caption' => _t('_adm_prm_txt_price_add_days'), 'info' => _t('_adm_prm_dsc_price_add_days'), 'value' => $aPrice['days'], 'db' => array('pass' => 'Int')), 'Price' => array('type' => 'text', 'name' => 'Price', 'caption' => _t('_adm_prm_txt_price_add_price'), 'info' => '', 'value' => round($aPrice['price'], 2), 'db' => array('pass' => 'Float')), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_prm_btn_price_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_prm_btn_price_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$iId = $oForm->getCleanValue('id');
$aPrice = array();
$iPrice = $this->oDb->getPrices(array('type' => 'by_level_id_duration', 'level_id' => $oForm->getCleanValue('IDLevel'), 'days' => $oForm->getCleanValue('Days')), $aPrice);
if ($iPrice != 0 && !empty($aPrice) && $aPrice['id'] != $iId) {
$this->_echoResultJson(array('msg' => _t('_adm_prm_err_price_duplicate')), true);
return;
}
if ((int) $oForm->update($iId) > 0) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_adm_prm_err_price_update'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-prm-price-edit-popup', _t('_adm_prm_txt_price_edit_popup', $aPrice['days']), $this->_oTemplate->parseHtmlByName('prm_add_price.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例12: performActionExport
public function performActionExport()
{
$sContentInsert = $sContentDelete = "";
$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];
$aList = array();
$this->oDb->getLists(array('type' => 'by_id', 'value' => $iId), $aList, false);
if (!is_array($aList) || empty($aList)) {
$this->_echoResultJson(array());
exit;
}
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_form_pre_lists', array($aList), "Dumping data for '" . $aList['key'] . "' data list");
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_form_pre_lists', 'key', array($aList), "Deleting data for '" . $aList['key'] . "' data list");
$aValues = array();
$this->oDb->getValues(array('type' => 'by_key', 'value' => $aList['key']), $aValues, false);
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_form_pre_values', $aValues, false, array('id', 'key', 'value', 'lkey', 'lkey2', 'order'));
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_form_pre_values', 'Key', array(array('Key' => $aList['key'])), false);
$aFormStructure = array('form_attrs' => array(), 'inputs' => array('insert' => array('type' => 'textarea', 'name' => 'insert', 'caption' => _t('_bx_dev_frm_txt_prelists_export_insert'), 'value' => $sContentInsert), 'delete' => array('type' => 'textarea', 'name' => 'delete', 'caption' => _t('_bx_dev_frm_txt_prelists_export_delete'), 'value' => $sContentDelete), 'done' => array('type' => 'button', 'name' => 'done', 'value' => _t('_bx_dev_frm_btn_prelists_done'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()"))));
$oForm = new BxTemplStudioFormView($aFormStructure);
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prelist-export-popup', _t('_bx_dev_frm_txt_prelists_export_popup', _t($aList['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_export.html', array('content' => $oForm->getCode())));
$this->_echoResultJson(array('popup' => $sContent), true);
}
示例13: performActionEdit
public function performActionEdit()
{
$sAction = 'edit';
$aMenu = $this->_getItem('getMenus');
if ($aMenu === false) {
$this->_echoResultJson(array());
exit;
}
$oForm = $this->_getFormObject($sAction, $aMenu);
if ($oForm->isSubmitted() && isset($oForm->aInputs['set_name'])) {
$this->updateSetFields($oForm);
}
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
//--- New Set Creation
if ($oForm->getCleanValue('set_name') == $this->sCreateNew) {
$sSetTitleValue = $oForm->getCleanValue('set_title');
$sSetName = 'custom_' . $this->getSystemName($sSetTitleValue);
$sSetTitleKey = '_adm_nav_txt_set_' . $sSetName;
if ($this->oDb->addSet(array('set_name' => $sSetName, 'module' => BX_DOL_STUDIO_MODULE_CUSTOM, 'title' => $sSetTitleKey, 'deletable' => 1))) {
bx_import('BxDolStudioLanguagesUtils');
BxDolStudioLanguagesUtils::getInstance()->addLanguageString($sSetTitleKey, $sSetTitleValue);
BxDolForm::setSubmittedValue('set_name', $sSetName, $oForm->aFormAttrs['method']);
}
}
unset($oForm->aInputs['set_title']);
if ($oForm->update($aMenu['id']) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $aMenu['id']);
} else {
$aRes = array('msg' => _t('_adm_nav_err_menus_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-menu-edit-popup', _t('_adm_nav_txt_menus_edit_popup', _t($aMenu['title'])), $this->_oTemplate->parseHtmlByName('nav_add_menu.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);
}
}
示例14: actionBlockEdit
protected function actionBlockEdit()
{
$iId = (int) bx_get('id');
if (!$iId) {
return array();
}
$aBlock = array();
$this->oDb->getBlocks(array('type' => 'by_id', 'value' => $iId), $aBlock, false);
if (empty($aBlock) || !is_array($aBlock)) {
return array('msg' => _t('_bx_dev_bp_err_block_not_found'));
}
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance('mod_dev_bp_block', 'mod_dev_bp_block_edit');
$this->onLoadBlock($oForm, $aBlock);
$oForm->initChecker($aBlock);
if ($oForm->isSubmittedAndValid()) {
$this->onSaveBlock($oForm, $aBlock);
if ($oForm->update($iId) !== false) {
return array('eval' => $this->getPageJsObject() . '.onEditBlock(oData)');
} else {
return array('msg' => _t('_bx_dev_bp_err_block_edit'));
}
}
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->aHtmlIds['edit_block_popup_id'], _t('_bx_dev_bp_txt_block_edit_popup', _t($aBlock['title'])), $this->oModule->_oTemplate->parseHtmlByName('bp_add_block.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true))));
return array('popup' => $sContent);
}
示例15: performActionExport
public function performActionExport()
{
$sContentInsert = $sContentDelete = "";
$aMenu = $this->_getItem('getMenus');
if ($aMenu === false) {
$this->_echoResultJson(array());
exit;
}
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_objects_menu', array($aMenu), "Dumping data for '" . $aMenu['object'] . "' menu");
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_objects_menu', 'object', array($aMenu), "Deleting data for '" . $aMenu['object'] . "' menu");
$aSet = array();
$this->oDb->getSets(array('type' => 'dump_by_name', 'value' => $aMenu['set_name']), $aSet, false);
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_menu_sets', array($aSet), false, array('name'));
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_menu_sets', 'set_name', array($aSet), false);
$aItems = array();
$this->oDb->getItems(array('type' => 'by_set_name', 'value' => $aMenu['set_name']), $aItems, false);
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_menu_items', $aItems);
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_menu_items', 'set_name', array($aSet), false);
$aFormStructure = array('form_attrs' => array(), 'inputs' => array('insert' => array('type' => 'textarea', 'name' => 'insert', 'caption' => _t('_bx_dev_nav_txt_menus_export_insert'), 'value' => $sContentInsert), 'delete' => array('type' => 'textarea', 'name' => 'delete', 'caption' => _t('_bx_dev_nav_txt_menus_export_delete'), 'value' => $sContentDelete), 'done' => array('type' => 'button', 'name' => 'done', 'value' => _t('_bx_dev_nav_btn_menus_done'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()"))));
$oForm = new BxTemplStudioFormView($aFormStructure);
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-menu-export-popup', _t('_bx_dev_nav_txt_menus_export_popup', _t($aMenu['title'])), $this->oModule->_oTemplate->parseHtmlByName('nav_export.html', array('content' => $oForm->getCode())));
$this->_echoResultJson(array('popup' => $sContent), true);
}