本文整理汇总了PHP中BxDolForm::getObjectInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolForm::getObjectInstance方法的具体用法?PHP BxDolForm::getObjectInstance怎么用?PHP BxDolForm::getObjectInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolForm
的用法示例。
在下文中一共展示了BxDolForm::getObjectInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performActionDelete
public function performActionDelete($aParams = array())
{
$iProfileId = $this->_oModule->getProfileId();
$mixedAllowed = $this->_oModule->isAllowedDeleteRequest($iProfileId);
if ($mixedAllowed !== true) {
$this->_echoResultJson(array('msg' => $mixedAllowed));
exit;
}
$iAffected = 0;
$aIds = bx_get('ids');
if (!$aIds || !is_array($aIds)) {
$this->_echoResultJson(array());
exit;
}
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance($this->_oModule->_oConfig->getObject('form_request'), $this->_oModule->_oConfig->getObject('form_display_request_send'));
$aIdsAffected = array();
foreach ($aIds as $iId) {
if (!$oForm->delete($iId)) {
continue;
}
$this->_oModule->isAllowedDeleteRequest($iProfileId, true);
$aIdsAffected[] = $iId;
$iAffected++;
}
$this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t('_bx_invites_err_delete_request')));
}
示例2: serviceLoginForm
public function serviceLoginForm($sParams = '', $sForceRelocate = '')
{
if (isLogged()) {
return false;
}
// get all auth types
$aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
$oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
$sCustomHtmlBefore = '';
$sCustomHtmlAfter = '';
bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
$oForm->aInputs['relocate']['value'] = $sForceRelocate;
} elseif ('homepage' == $sForceRelocate) {
$oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
}
$sFormCode = $oForm->getCode();
$sJoinText = '';
if (strpos($sParams, 'no_join_text') === false) {
$sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div class="bx-def-font-align-center">' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
}
BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
$sAuth = $this->serviceMemberAuthCode($aAuthTypes);
return $sCustomHtmlBefore . $sAuth . $sFormCode . $sCustomHtmlAfter . $sJoinText;
}
示例3: deleteConvo
public function deleteConvo($iConversationId, $iProfileId = 0)
{
$aContentInfo = $this->getContentInfoById($iConversationId);
if (!$aContentInfo) {
return true;
}
// delete convo
$sWhere = '';
if ($iProfileId) {
$sWhere = $this->prepare(" AND `collaborator` = ?", $iProfileId);
}
$sQuery = $this->prepare("DELETE FROM `" . $this->getPrefix() . "conv2folder` WHERE `conv_id` = ?", $iConversationId);
if (!$this->query($sQuery . $sWhere)) {
return false;
}
// delete whole conversation if there is no refencences to the conversation in conv2folder table
$sQuery = $this->prepare("SELECT `id` FROM `" . $this->getPrefix() . "conv2folder` WHERE `conv_id` = ?", $iConversationId);
if (!$this->getOne($sQuery)) {
$CNF =& $this->_oConfig->CNF;
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
return $oForm->delete((int) $iConversationId, $aContentInfo);
}
return true;
}
示例4: performActionEdit
public function performActionEdit()
{
$sAction = 'edit';
$sFormObject = $this->oModule->_oConfig->getObject('form_forms_prelist');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_prelist_edit');
$aList = $this->_getItem('getLists');
if ($aList === 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;
$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_prelists_save');
$oForm->initChecker($aList);
if ($oForm->isSubmittedAndValid()) {
if ($oForm->update($aList['id']) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $aList['id']);
} else {
$aRes = array('msg' => _t('_bx_dev_frm_err_prelists_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prelist-edit-popup', _t('_bx_dev_frm_txt_prelists_edit_popup', _t($aList['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_list.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);
}
}
示例5: 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);
}
}
示例6: serviceLoginForm
public function serviceLoginForm($sParams = '', $sForceRelocate = '')
{
if (isLogged()) {
return false;
}
// get all auth types
$aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
// define additional auth types
if ($aAuthTypes) {
$aAddInputEl[''] = _t('_Basic');
// procces all additional menu's items
foreach ($aAuthTypes as $iKey => $aItems) {
$aAddInputEl[$aItems['Link']] = _t($aItems['Title']);
}
$aAuthTypes = array('type' => 'select', 'caption' => _t('_Auth type'), 'values' => $aAddInputEl, 'value' => '', 'attrs' => array('onchange' => 'if (this.value) { location.href = "' . BX_DOL_URL_ROOT . '" + this.value }'));
} else {
$aAuthTypes = array('type' => 'hidden');
}
$oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
$sCustomHtmlBefore = '';
$sCustomHtmlAfter = '';
bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
$oForm->aInputs['relocate']['value'] = $sForceRelocate;
} elseif ('homepage' == $sForceRelocate) {
$oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
}
$sFormCode = $oForm->getCode();
$sJoinText = '';
if (strpos($sParams, 'no_join_text') === false) {
$sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div>' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
}
BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
return $sCustomHtmlBefore . $sFormCode . $sCustomHtmlAfter . $sJoinText;
}
示例7: addCssJs
/**
* Add comments CSS/JS
*/
public function addCssJs()
{
$this->_oTemplate->addCss(array('cmts.css'));
$this->_oTemplate->addJs(array('jquery.anim.js', 'jquery.form.min.js', 'BxDolCmts.js'));
$oForm = BxDolForm::getObjectInstance($this->_sFormObject, $this->_sFormDisplayPost);
$oForm->addCssJs();
}
示例8: _performAction
protected function _performAction($sAction, $sDisplay, $iId = 0)
{
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance('bx_antispam_ip_table_form', $sDisplay);
// get form instance for specified form object and display
if (!$oForm) {
$this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
exit;
}
$oForm->addMarkers(array('grid_object' => $this->_sObject, 'grid_action' => $sAction));
$aIpTableDirective = array();
if ($iId) {
bx_import('BxDolModule');
$oModule = BxDolModule::getInstance('bx_antispam');
$oAntispamIp = bx_instance('BxAntispamIP', array(), $oModule->_aModule);
$aIpTableDirective = $oAntispamIp->getIpTableDirective($iId);
$aIpTableDirective['From'] = long2ip($aIpTableDirective['From']);
$aIpTableDirective['To'] = long2ip($aIpTableDirective['To']);
}
$oForm->initChecker($aIpTableDirective);
if ($oForm->isSubmittedAndValid()) {
// if form is submitted and all fields are valid
$aCustomValues = array('From' => sprintf("%u", ip2long($oForm->getCleanValue('From'))), 'To' => sprintf("%u", ip2long($oForm->getCleanValue('To'))));
if ($iId) {
if ($oForm->update($iId, $aCustomValues)) {
// update record
$iRecentId = $iId;
}
} else {
$iRecentId = $oForm->insert($aCustomValues, true);
// insert new record
}
if ($iRecentId) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iRecentId);
} else {
$aRes = array('msg' => _t('_sys_txt_error_occured'));
}
// if record adding failed, display error message
$this->_echoResultJson($aRes, true);
} else {
// if form is not submitted or some fields are invalid, display popup with form
bx_import('BxTemplFunctions');
$s = BxTemplFunctions::getInstance()->popupBox($oForm->getId() . '_form', _t('_bx_antispam_form_ip_table_add'), $oForm->getCode() . '
<script>
$(document).ready(function () {
$("#' . $oForm->getId() . '").ajaxForm({
dataType: "json",
beforeSubmit: function (formData, jqForm, options) {
bx_loading($("#' . $oForm->getId() . '"), true);
},
success: function (data) {
$(".bx-popup-applied:visible").dolPopupHide();
glGrids.' . $this->_sObject . '.processJson(data, "' . $sAction . '");
}
});
});
</script>');
$this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例9: 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);
}
}
示例10: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$sMsg = $this->_oModule->isAllowedAdd();
if ($sMsg !== CHECK_ACTION_RESULT_ALLOWED) {
$this->_echoResultJson(array('msg' => $sMsg), true);
return;
}
$oForm = BxDolForm::getObjectInstance('bx_sites', 'bx_sites_site_add');
if (!$oForm) {
$this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
return;
}
$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
$oForm->initChecker();
if (!$oForm->isSubmittedAndValid()) {
$sContent = BxTemplFunctions::getInstance()->popupBox('bx-sites-site-create-popup', _t('_bx_sites_grid_browse_popup_create'), $this->_oModule->_oTemplate->parseHtmlByName('block_create.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);
return;
}
$sDomain = $oForm->getCleanValue('domain');
if ($this->_oModule->_oDb->isAccount(array('domain' => $sDomain))) {
$this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_exists')), true);
return;
}
$iAccountId = $oForm->insert(array('owner_id' => bx_get_logged_profile_id(), 'created' => time(), 'status' => BX_SITES_ACCOUNT_STATUS_UNCONFIRMED));
if (!$iAccountId) {
$this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_creation')), true);
return;
}
$oAccount = $this->_oModule->getObject('Account');
$oAccount->onAccountCreated($iAccountId);
$sUrl = $this->_oModule->startSubscription($iAccountId);
$this->_echoResultJson(array('eval' => 'window.open(\'' . $sUrl . '\', \'_self\');', 'popup_not_hide' => 1), true);
}
示例11: performActionEdit
public function performActionEdit()
{
$sAction = 'edit';
$sFormObject = $this->oModule->_oConfig->getObject('form_forms_form');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_form_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];
$aForm = array();
$this->oDb->getForms(array('type' => 'by_id', 'value' => $iId), $aForm, false);
if (empty($aForm) || !is_array($aForm)) {
$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_forms_save');
$aForm['form_attrs'] = BxDevFunctions::unserializeString($aForm['form_attrs']);
$aForm['params'] = BxDevFunctions::unserializeString($aForm['params']);
$oForm->initChecker($aForm);
if ($oForm->isSubmittedAndValid()) {
$sValue = BxDolForm::getSubmittedValue('form_attrs', $oForm->aFormAttrs['method']);
$sValue = BxDevFunctions::serializeString($sValue);
BxDolForm::setSubmittedValue('form_attrs', $sValue, $oForm->aFormAttrs['method']);
$sValue = BxDolForm::getSubmittedValue('params', $oForm->aFormAttrs['method']);
$sValue = BxDevFunctions::serializeString($sValue);
BxDolForm::setSubmittedValue('params', $sValue, $oForm->aFormAttrs['method']);
if ($oForm->update($iId) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_bx_dev_frm_err_forms_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-form-edit-popup', _t('_bx_dev_frm_txt_forms_edit_popup', _t($aForm['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_form.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);
}
}
示例12: actionDeleteProfileImg
public function actionDeleteProfileImg($iFileId, $iContentId, $sFieldPicture)
{
$aResult = array();
$CNF =& $this->_oConfig->CNF;
$oSrorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
if (!($aFile = $oSrorage->getFile((int) $iFileId)) || !($aContentInfo = $this->_oDb->getContentInfoById($iContentId)) || $aContentInfo[$sFieldPicture] != (int) $iFileId) {
$aResult = array('error' => 1, 'msg' => _t('_sys_storage_err_file_not_found'));
}
if (!$aResult && !isLogged() || !$aResult && $aFile['profile_id'] != bx_get_logged_profile_id() && !$this->_isModerator()) {
$aResult = array('error' => 2, 'msg' => _t('_Access denied'));
}
$oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD'], $this->_oTemplate);
if (!$aResult && !$oForm->_deleteFile($iContentId, $sFieldPicture, (int) $iFileId, true)) {
$aResult = array('error' => 3, 'msg' => _t('_Failed'));
} elseif (!$aResult) {
$aResult = array('error' => 0, 'msg' => '');
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($aResult);
}
示例13: 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);
}
}
示例14: serviceGetBlockForm
/**
* SERVICE METHODS
*/
public function serviceGetBlockForm()
{
$aDefaultFields = array('name', 'email', 'subject', 'body', 'do_submit');
$mixedAllowed = $this->isAllowedContact();
if ($mixedAllowed !== true) {
return array('content' => MsgBox($mixedAllowed));
}
$sResult = '';
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject('form_contact'), $this->_oConfig->getObject('form_display_contact_send'), $this->_oTemplate);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$iId = $oForm->insert(array('uri' => $oForm->generateUri(), 'date' => time()));
if ($iId !== false) {
$sCustomFields = '';
$aCustomFields = array();
foreach ($oForm->aInputs as $aInput) {
if (in_array($aInput['name'], $aDefaultFields)) {
continue;
}
$aCustomFields[$aInput['name']] = bx_process_output($oForm->getCleanValue($aInput['name']));
$sCustomFields .= $aInput['caption'] . ': ' . $aCustomFields[$aInput['name']] . '<br />';
}
$aTemplateKeys = array('SenderName' => bx_process_output($oForm->getCleanValue('name')), 'SenderEmail' => bx_process_output($oForm->getCleanValue('email')), 'MessageSubject' => bx_process_output($oForm->getCleanValue('subject')), 'MessageBody' => bx_process_output(nl2br($oForm->getCleanValue('body')), BX_DATA_TEXT_MULTILINE), 'CustomFields' => $sCustomFields);
$aTemplateKeys = array_merge($aTemplateKeys, $aCustomFields);
bx_import('BxDolEmailTemplates');
$aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('bx_contact_contact_form_message', $aTemplateKeys);
$sResult = '';
$sRecipientEmail = $this->_oConfig->getEmail();
if (sendMail($sRecipientEmail, $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM)) {
$this->onContact();
$sResult = '_ADM_PROFILE_SEND_MSG';
} else {
$sResult = '_Email sent failed';
}
$sResult = MsgBox(_t($sResult));
}
}
return array('content' => $sResult . $oForm->getCode());
}
示例15: performActionEdit
public function performActionEdit()
{
$sAction = 'edit';
$sFormObject = $this->oModule->_oConfig->getObject('form_forms_display');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_display_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];
$aDisplay = array();
$iDisplay = $this->oDb->getDisplays(array('type' => 'by_id', 'value' => $iId), $aDisplay);
if ($iDisplay != 1 || empty($aDisplay)) {
$this->_echoResultJson(array());
exit;
}
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
$this->_fillDisplayForm($oForm, $sAction);
$oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_displays_save');
$oForm->initChecker($aDisplay);
if ($oForm->isSubmittedAndValid()) {
if ($oForm->update($iId) !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_bx_dev_frm_err_displays_edit'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-display-edit-popup', _t('_bx_dev_frm_txt_displays_edit_popup', _t($aDisplay['title'])), $this->_oTemplate->parseHtmlByName('form_add_display.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);
}
}