本文整理汇总了PHP中BxTemplStudioFormView::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplStudioFormView::getCode方法的具体用法?PHP BxTemplStudioFormView::getCode怎么用?PHP BxTemplStudioFormView::getCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxTemplStudioFormView
的用法示例。
在下文中一共展示了BxTemplStudioFormView::getCode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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);
}
}
示例4: performActionExport
public function performActionExport()
{
$sContentInsert = $sContentDelete = "";
$aForm = $this->_getItem('getForms');
if ($aForm === false) {
$this->_echoResultJson(array());
exit;
}
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_objects_form', array($aForm), "Dumping data for '" . $aForm['object'] . "' form");
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_objects_form', 'object', array($aForm), "Deleting data for '" . $aForm['object'] . "' form");
$aDisplays = array();
$this->oDb->getDisplays(array('type' => 'by_object', 'value' => $aForm['object']), $aDisplays, false);
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_form_displays', $aDisplays, false, array('id', 'name'));
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_form_displays', 'object', array($aForm), false);
$aFields = array();
$this->oDb->getInputs(array('type' => 'dump_inputs', 'value' => $aForm['object']), $aFields, false);
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_form_inputs', $aFields);
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_form_inputs', 'object', array($aForm), false);
$aConnections = array();
$this->oDb->getInputs(array('type' => 'dump_connections', 'value' => $aForm['object']), $aConnections, false);
$sContentInsert .= $this->oModule->_oDb->getQueryInsert('sys_form_display_inputs', $aConnections);
$sContentDelete .= $this->oModule->_oDb->getQueryDelete('sys_form_display_inputs', 'display_name', $aDisplays);
$aFormStructure = array('form_attrs' => array(), 'inputs' => array('insert' => array('type' => 'textarea', 'name' => 'insert', 'caption' => _t('_bx_dev_frm_txt_forms_export_insert'), 'value' => $sContentInsert), 'delete' => array('type' => 'textarea', 'name' => 'delete', 'caption' => _t('_bx_dev_frm_txt_forms_export_delete'), 'value' => $sContentDelete), 'done' => array('type' => 'button', 'name' => 'done', 'value' => _t('_bx_dev_frm_btn_forms_done'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()"))));
$oForm = new BxTemplStudioFormView($aFormStructure);
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-form-export-popup', _t('_bx_dev_frm_txt_forms_export_popup', _t($aForm['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_export.html', array('content' => $oForm->getCode())));
$this->_echoResultJson(array('popup' => $sContent), true);
}
示例5: performActionEdit
public function performActionEdit()
{
$sAction = 'edit';
$aValue = $this->_getItem('getValues');
if ($aValue === false) {
$this->_echoResultJson(array());
exit;
}
$aList = array();
$this->oDb->getLists(array('type' => 'by_key', 'value' => $this->sList), $aList, false);
$bUseInSets = (int) $aList['use_for_sets'] == 1;
bx_import('BxTemplStudioFormView');
$aForm = array('form_attrs' => array('id' => 'adm-form-list-edit', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&list=' . $this->sList, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_form_pre_values', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $aValue['id'], 'db' => array('pass' => 'Int')), 'LKey' => array('type' => 'text_translatable', 'name' => 'LKey', 'caption' => _t('_adm_form_txt_pre_values_lkey'), 'info' => _t('_adm_form_dsc_pre_values_lkey'), 'value' => $aValue['lkey'], 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'LengthTranslatable', 'params' => array(3, 100, 'LKey'), 'error' => _t('_adm_form_err_pre_values_lkey'))), 'Empty' => array('type' => 'checkbox', 'name' => 'Empty', 'caption' => _t('_adm_form_txt_pre_values_empty'), 'info' => _t('_adm_form_dsc_pre_values_empty'), 'value' => 'on', 'checked' => empty($aValue['value']) ? '1' : '0', 'required' => '0'), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_form_btn_pre_lists_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_form_btn_pre_lists_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$aAdd = array();
$bEmpty = $oForm->getCleanValue('Empty') == 'on';
if ($bEmpty && !empty($aValue['value'])) {
$aAdd['Value'] = 0;
} else {
if (!$bEmpty && empty($aValue['value'])) {
$aAdd['Value'] = $this->_getAvailableSetValue($this->sList);
}
}
if (!empty($aAdd) && $bUseInSets) {
$mixedValue = $aAdd['Value'];
if (!$this->canUseForSet($mixedValue)) {
if ($this->oDb->isListUsedInSet($this->sList)) {
$this->_echoResultJson(array('msg' => _t('_adm_form_err_pre_values_create_forbidden', BX_DOL_STUDIO_FIELD_PRE_VALUE_INT_MAX)), true);
return;
}
$this->oDb->updateList($aList['id'], array('use_for_sets' => '0'));
}
}
if ($oForm->update($aValue['id'], $aAdd) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $aValue['id']);
} else {
$aRes = array('msg' => _t('_adm_form_err_pre_values_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-form-pre-value-edit-popup', _t('_adm_form_txt_pre_values_edit_popup', _t($aValue['lkey'])), $this->_oTemplate->parseHtmlByName('form_add_value.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);
}
}
示例6: performActionShowTo
public function performActionShowTo()
{
$sAction = 'show_to';
$aItem = $this->_getItem('getItems');
if ($aItem === false) {
$this->_echoResultJson(array());
exit;
}
$aForm = array('form_attrs' => array('id' => 'adm-nav-item-create', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&set=' . $this->sSet, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_menu_items', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $aItem['id'], 'db' => array('pass' => 'Int')), 'visible_for' => array('type' => 'select', 'name' => 'visible_for', 'caption' => _t('_adm_nav_txt_items_visible_for'), 'info' => '', 'value' => $aItem['visible_for_levels'] == BX_DOL_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED, 'values' => array(array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_adm_nav_txt_items_visible_for_all')), array('key' => BX_DOL_STUDIO_VISIBLE_SELECTED, 'value' => _t('_adm_nav_txt_items_visible_for_selected'))), 'required' => '0', 'attrs' => array('onchange' => $this->getJsObject() . '.onChangeVisibleFor(this)'), 'db' => array('pass' => 'Xss')), 'visible_for_levels' => array('type' => 'checkbox_set', 'name' => 'visible_for_levels', 'caption' => _t('_adm_nav_txt_items_visible_for_levels'), 'info' => _t('_adm_nav_dsc_items_visible_for_levels'), 'value' => '', 'values' => array(), 'tr_attrs' => array('style' => $aItem['visible_for_levels'] == BX_DOL_INT_MAX ? 'display:none' : ''), 'db' => array('pass' => 'Int')), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_nav_btn_items_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_nav_btn_items_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
BxDolStudioUtils::getVisibilityValues($aItem['visible_for_levels'], $aForm['inputs']['visible_for_levels']['values'], $aForm['inputs']['visible_for_levels']['value']);
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
if ($oForm->updateWithVisibility($aItem['id']) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $aItem['id']);
} else {
$aRes = array('msg' => _t('_adm_nav_err_items_show_to'));
}
$this->_echoResultJson($aRes, true);
} else {
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-item-hide-from-popup', _t('_adm_nav_txt_items_show_to_popup', _t($aItem['title'])), $this->_oTemplate->parseHtmlByName('nav_add_item.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => $sContent), true);
}
}
示例7: getPageCaptionActions
protected function getPageCaptionActions()
{
if (empty($this->aActions)) {
return "";
}
$aForm = array('form_attrs' => array('id' => 'adm-page-actions', 'name' => 'adm-page-actions', 'action' => '', 'method' => 'post'), 'params' => array(), 'inputs' => array());
foreach ($this->aActions as $aAction) {
$aInput = array('type' => $aAction['type'], 'name' => $aAction['name'], 'caption' => _t($aAction['caption']));
switch ($aAction['type']) {
case 'switcher':
$aInput['checked'] = $aAction['checked'];
$aInput['attrs']['onchange'] = $aAction['onchange'];
break;
}
$aForm['inputs'][$aInput['name']] = $aInput;
}
$oForm = new BxTemplStudioFormView($aForm);
return BxDolStudioTemplate::getInstance()->parseHtmlByName('page_caption_actions.html', array('content' => $oForm->getCode()));
}
示例8: getSettingsCache
protected function getSettingsCache($aPage, $bCreate = true, $bInputsOnly = false)
{
$aForm = array('form_attrs' => array('id' => 'adm-bp-settings-cache'), 'params' => array('remove_form' => '1', 'csrf' => array('disable' => true)), 'inputs' => parent::getSettingsCache($aPage, $bCreate, true));
unset($aForm['inputs']['cache_lifetime']['attrs']);
$aForm['inputs']['cache_editable'] = array('type' => 'switcher', 'name' => 'cache_editable', 'caption' => _t('_bx_dev_bp_txt_page_cache_editable'), 'info' => '', 'value' => '1', 'checked' => (int) $this->aPageRebuild['cache_editable'] == 1, 'required' => '', 'db' => array('pass' => 'Int'));
if ($bInputsOnly) {
return $aForm['inputs'];
}
$oForm = new BxTemplStudioFormView($aForm);
return $oForm->getCode();
}
示例9: getSettingsSeo
protected function getSettingsSeo($aPage = array(), $bCreate = true, $bInputsOnly = false)
{
$aForm = array('form_attrs' => array('id' => 'adm-bp-settings-seo'), 'params' => array('remove_form' => '1', 'csrf' => array('disable' => true)), 'inputs' => array('meta_description' => array('type' => 'textarea', 'name' => 'meta_description', 'caption' => _t('_adm_bp_txt_page_meta_description'), 'info' => _t('_adm_bp_dsc_page_meta_description'), 'value' => isset($aPage['meta_description']) ? $aPage['meta_description'] : '', 'db' => array('pass' => 'Xss')), 'meta_keywords' => array('type' => 'textarea', 'name' => 'meta_keywords', 'caption' => _t('_adm_bp_txt_page_meta_keywords'), 'info' => _t('_adm_bp_dsc_page_meta_keywords'), 'value' => isset($aPage['meta_keywords']) ? $aPage['meta_keywords'] : '', 'db' => array('pass' => 'Xss')), 'meta_robots' => array('type' => 'text', 'name' => 'meta_robots', 'caption' => _t('_adm_bp_txt_page_meta_robots'), 'info' => _t('_adm_bp_dsc_page_meta_robots'), 'value' => isset($aPage['meta_robots']) ? $aPage['meta_robots'] : '', 'required' => '0', 'db' => array('pass' => 'Xss'))));
if ($bInputsOnly) {
return $aForm['inputs'];
}
$oForm = new BxTemplStudioFormView($aForm);
return $oForm->getCode();
}
示例10: 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);
}
}
示例11: performActionShowTo
public function performActionShowTo()
{
$sAction = 'show_to';
$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];
$aField = array();
$this->oDb->getInputs(array('type' => 'by_object_id', 'object' => $this->sObject, 'id' => (int) $iId), $aField, false);
if (empty($aField) || !is_array($aField)) {
$this->_echoResultJson(array());
exit;
}
$aForm = array('form_attrs' => array('id' => 'adm-form-field-visibility', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&object=' . $this->sObject . '&display=' . $this->sDisplay, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_form_display_inputs', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('id' => array('type' => 'hidden', 'name' => 'id', 'value' => $iId, 'db' => array('pass' => 'Int')), 'visible_for' => array('type' => 'select', 'name' => 'visible_for', 'caption' => _t('_adm_form_txt_field_visible_for'), 'info' => '', 'value' => $aField['visible_for_levels'] == BX_DOL_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED, 'values' => array(array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_adm_form_txt_field_visible_for_all')), array('key' => BX_DOL_STUDIO_VISIBLE_SELECTED, 'value' => _t('_adm_form_txt_field_visible_for_selected'))), 'required' => '0', 'attrs' => array('onchange' => $this->getJsObject() . '.onChangeVisibleFor(this)'), 'db' => array('pass' => 'Xss')), 'visible_for_levels' => array('type' => 'checkbox_set', 'name' => 'visible_for_levels', 'caption' => _t('_adm_form_txt_field_visible_for_levels'), 'info' => _t('_adm_form_dsc_field_visible_for_levels'), 'value' => '', 'values' => array(), 'tr_attrs' => array('style' => $aField['visible_for_levels'] == BX_DOL_INT_MAX ? 'display:none' : ''), 'db' => array('pass' => 'Int')), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_form_btn_field_save')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_form_btn_field_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
BxDolStudioUtils::getVisibilityValues($aField['visible_for_levels'], $aForm['inputs']['visible_for_levels']['values'], $aForm['inputs']['visible_for_levels']['value']);
bx_import('BxTemplStudioFormView');
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
if ($oForm->updateWithVisibility($iId) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_adm_form_err_field_show_to'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-form-field-show-to-popup', _t('_adm_form_txt_field_show_to_popup', _t($aField['caption_system'])), $this->_oTemplate->parseHtmlByName('form_add_field.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => $sContent), true);
}
}
示例12: 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);
}
示例13: 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);
}