本文整理汇总了PHP中BxTemplStudioFormView::updateWithVisibility方法的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplStudioFormView::updateWithVisibility方法的具体用法?PHP BxTemplStudioFormView::updateWithVisibility怎么用?PHP BxTemplStudioFormView::updateWithVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxTemplStudioFormView
的用法示例。
在下文中一共展示了BxTemplStudioFormView::updateWithVisibility方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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);
}
}