本文整理汇总了PHP中BxTemplStudioFormView::getCleanValue方法的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplStudioFormView::getCleanValue方法的具体用法?PHP BxTemplStudioFormView::getCleanValue怎么用?PHP BxTemplStudioFormView::getCleanValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxTemplStudioFormView
的用法示例。
在下文中一共展示了BxTemplStudioFormView::getCleanValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例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: actionBlockCreate
protected function actionBlockCreate()
{
$sJsObject = $this->getPageJsObject();
$oTemplate = BxDolStudioTemplate::getInstance();
$sSelected = BX_DOL_STUDIO_BP_SKELETONS;
$aForm = array('form_attrs' => array('id' => 'adm-bp-block-create', 'action' => sprintf($this->sPageUrl, $this->sType, $this->sPage) . '&bp_action=' . $this->sActionBlockCreate, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_pages_blocks', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('blocks' => array('type' => 'custom', 'name' => 'blocks', 'content' => '', 'db' => array('pass' => 'Int'))));
$aMenu = array(BX_DOL_STUDIO_BP_SKELETONS => array('name' => BX_DOL_STUDIO_BP_SKELETONS, 'icon' => 'qrcode', 'title' => '_sys_block_types_skeletons', 'selected' => $sSelected == BX_DOL_STUDIO_BP_SKELETONS), BX_DOL_STUDIO_MODULE_SYSTEM => array('name' => BX_DOL_STUDIO_MODULE_SYSTEM, 'icon' => 'cog', 'title' => '_sys_block_types_system', 'selected' => $sSelected == BX_DOL_STUDIO_MODULE_SYSTEM), BX_DOL_STUDIO_MODULE_CUSTOM => array('name' => BX_DOL_STUDIO_MODULE_CUSTOM, 'icon' => 'wrench', 'title' => '_sys_block_types_custom', 'selected' => $sSelected == BX_DOL_STUDIO_MODULE_CUSTOM));
bx_import('BxDolModuleQuery');
$aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules'));
$aModulesWithBlocks = $this->oDb->getModulesWithCopyableBlocks();
foreach ($aModules as $aModule) {
$sName = $aModule['name'];
if (!in_array($sName, $aModulesWithBlocks)) {
continue;
}
if (!empty($aMenu[$sName])) {
$aMenu[$sName] = array_merge($aMenu[$sName], $aModule);
} else {
$aMenu[$sName] = $aModule;
}
if (empty($aMenu[$sName]['icon'])) {
$aMenu[$sName]['icon'] = BxDolStudioUtils::getModuleIcon($aModule, 'menu', false);
}
}
foreach ($aMenu as $sKey => $aItem) {
$aMenu[$sKey]['onclick'] = $sJsObject . '.onChangeModule(\'' . $aItem['name'] . '\', this);';
}
bx_import('BxTemplStudioMenu');
$oMenu = new BxTemplStudioMenu(array('template' => 'menu_side.html', 'menu_items' => $aMenu));
$aTmplParams = array('menu' => $oMenu->getCode(), 'html_block_lists_id' => $this->aHtmlIds['block_lists_id'], 'blocks' => $this->getBlockList($sSelected));
$aForm['inputs']['blocks']['content'] = $oTemplate->parseHtmlByName('bp_add_block_form.html', $aTmplParams);
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$aIds = $oForm->getCleanValue('blocks');
$aBlocks = array();
$this->oDb->getBlocks(array('type' => 'by_ids', 'value' => $aIds), $aBlocks, false);
bx_import('BxDolStudioLanguagesUtils');
$oLanguage = BxDolStudioLanguagesUtils::getInstance();
bx_import('BxDolStorage');
$oStorege = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
$bResult = true;
foreach ($aBlocks as $aBlock) {
$sTitleKey = $this->getSystemName($aBlock['title'] . '_' . time());
$sTitleValue = _t($aBlock['title']);
unset($aBlock['id']);
$aBlock['object'] = $this->sPage;
$aBlock['cell_id'] = 1;
$aBlock['module'] = $this->getBlockModule($aBlock);
$aBlock['title'] = $sTitleKey;
$aBlock['copyable'] = 0;
$aBlock['deletable'] = 1;
//--- Process Lang copy
$sContentKey = $sContentValue = "";
if ($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_LANG && $aBlock['content'] != '') {
$sContentKey = $this->getSystemName($aBlock['content'] . '_' . time());
$sContentValue = _t($aBlock['content']);
$aBlock['content'] = $sContentKey;
$oLanguage->addLanguageString($sContentKey, $sContentValue);
}
//--- Process Image copy
$iImageId = $sImageAlign = "";
if ($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_IMAGE && $aBlock['content'] != '') {
list($iImageId, $sImageAlign) = explode($this->sParamsDivider, $aBlock['content']);
$aBlock['content'] = "";
if (is_numeric($iImageId) && (int) $iImageId != 0 && ($iImageId = $oStorege->storeFileFromStorage(array('id' => $iImageId))) !== false) {
$aBlock['content'] = implode($this->sParamsDivider, array($iImageId, $sImageAlign));
}
}
if (!$this->oDb->insertBlock($aBlock)) {
if ($sContentKey != "") {
$oLanguage->deleteLanguageString($sContentKey);
}
if ($iImageId != "") {
$oStorege->deleteFile((int) $iImageId, 0);
}
$bResult = false;
break;
}
$oLanguage->addLanguageString($sTitleKey, $sTitleValue);
}
if ($bResult) {
return array('eval' => $sJsObject . '.onCreateBlock(oData)');
} else {
return array('msg' => _t('_adm_bp_err_block_added'));
}
}
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->aHtmlIds['create_block_popup_id'], _t('_adm_bp_txt_new_block_popup'), $oTemplate->parseHtmlByName('bp_add_block.html', array('action' => 'create', 'form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true))));
return array('popup' => $sContent);
}