本文整理汇总了PHP中BxTemplStudioFormView::update方法的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplStudioFormView::update方法的具体用法?PHP BxTemplStudioFormView::update怎么用?PHP BxTemplStudioFormView::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxTemplStudioFormView
的用法示例。
在下文中一共展示了BxTemplStudioFormView::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
示例4: actionPageEdit
protected function actionPageEdit()
{
$sJsObject = $this->getPageJsObject();
$oTemplate = BxDolStudioTemplate::getInstance();
$aForm = array('form_attrs' => array('id' => 'adm-bp-page-edit', 'action' => sprintf($this->sPageUrl, $this->sType, $this->sPage) . '&bp_action=' . $this->sActionPageEdit, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_objects_page', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('settings' => array('type' => 'custom', 'name' => 'settings', 'content' => $oTemplate->parseHtmlByName('bp_edit_page_form.html', $this->_getTmplVarsPageSettings($this->aPageRebuild, false)))));
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
unset($oForm->aInputs['settings']);
foreach ($this->aPageSettings as $aSetting) {
$oForm->aInputs = array_merge($oForm->aInputs, $this->{'getSettings' . $this->getClassName($aSetting['name']) . 'Fields'}($this->aPageRebuild, false));
}
$iVisibleFor = BxDolStudioUtils::getVisibilityValue($oForm->getCleanValue('visible_for'), $oForm->getCleanValue('visible_for_levels'));
BxDolForm::setSubmittedValue('visible_for_levels', $iVisibleFor, $aForm['form_attrs']['method']);
unset($oForm->aInputs['visible_for']);
if ($oForm->update($this->aPageRebuild['id'])) {
$iLevelId = $oForm->getCleanValue('layout_id');
if (!empty($iLevelId) && $iLevelId != $this->aPageRebuild['layout_id']) {
$aLayoutOld = array();
$this->oDb->getLayouts(array('type' => 'by_id', 'value' => $this->aPageRebuild['layout_id']), $aLayoutOld, false);
$aLayoutNew = array();
$this->oDb->getLayouts(array('type' => 'by_id', 'value' => $iLevelId), $aLayoutNew, false);
if ($aLayoutOld['cells_number'] > $aLayoutNew['cells_number'] && $this->oDb->resetBlocksByPage($this->sPage, $aLayoutNew['cells_number']) === false) {
return array('msg' => _t('_adm_bp_err_save'));
}
return array('eval' => $sJsObject . '.onSaveSettings()');
}
return array();
} else {
return array('msg' => _t('_adm_bp_err_save'));
}
}
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->aHtmlIds['edit_popup_id'], _t('_adm_bp_txt_settings_popup'), $oTemplate->parseHtmlByName('bp_edit_page.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true))));
return array('popup' => $sContent);
}
示例5: 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);
}
}