本文整理汇总了PHP中BxTemplFormView::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplFormView::getCode方法的具体用法?PHP BxTemplFormView::getCode怎么用?PHP BxTemplFormView::getCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxTemplFormView
的用法示例。
在下文中一共展示了BxTemplFormView::getCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PageCompPageMainCodeWithForm
function PageCompPageMainCodeWithForm()
{
global $oTemplConfig, $site;
$aForm = array('form_attrs' => array('id' => 'post_us_form', 'action' => BX_DOL_URL_ROOT . 'contact.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_Your name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('_Name is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'message_subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_message_subject'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(5, 300), 'error' => _t('_ps_ferr_incorrect_length'))), 'message_text' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_Message text'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 5000), 'error' => _t('_ps_ferr_incorrect_length'))), 'captcha' => array('type' => 'captcha', 'caption' => _t('_Enter what you see'), 'name' => 'securityImageValue', 'required' => true, 'checker' => array('func' => 'captcha', 'error' => _t('_Incorrect Captcha'))), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'))));
$oForm = new BxTemplFormView($aForm);
$sForm = $oForm->getCode();
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$sSenderName = process_pass_data($_POST['name'], BX_TAGS_STRIP);
$sSenderEmail = process_pass_data($_POST['email'], BX_TAGS_STRIP);
$sLetterSubject = process_pass_data($_POST['subject'], BX_TAGS_STRIP);
$sLetterBody = process_pass_data($_POST['body'], BX_TAGS_STRIP);
$sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail;
if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) {
$sActionKey = '_ADM_PROFILE_SEND_MSG';
} else {
$sActionKey = '_Email sent failed';
}
$sActionText = MsgBox(_t($sActionKey));
$sForm = $sActionText . $sForm;
} else {
$sForm = $oForm->getCode();
}
return DesignBoxContent(_t('_CONTACT_H1'), $sForm, $oTemplConfig->PageCompThird_db_num);
}
示例2: getPostForm
function getPostForm($iUnitID = 0)
{
$sAddNewC = _t('_bx_quotes_add_new');
$sAction = 'add';
$sQText = $sQText = '';
if ($iUnitID) {
$aQinfo = $this->_oDb->getQuote($iUnitID);
$sQText = $aQinfo['Text'];
$sQAuthor = $aQinfo['Author'];
$sAction = 'edit';
}
$aForm = array('form_attrs' => array('name' => 'create_quotes_form', 'action' => BX_DOL_URL_ROOT . 'modules/?r=quotes/administration/', 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_quotes_units', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'Text' => array('type' => 'textarea', 'name' => 'Text', 'caption' => _t('_bx_quotes_text'), 'required' => true, 'value' => $sQText, 'checker' => array('func' => 'length', 'params' => array(3, 1024), 'error' => _t('_bx_quotes_text_err', 1024)), 'db' => array('pass' => 'Xss')), 'Author' => array('type' => 'text', 'name' => 'Author', 'caption' => _t('_bx_quotes_author'), 'required' => true, 'value' => $sQAuthor, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_quotes_author_err', 128)), 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => _t('_Submit'))));
if ($iUnitID) {
$aForm['inputs']['hidden_unitid'] = array('type' => 'hidden', 'name' => 'ID', 'value' => $iUnitID);
}
$sCode = '';
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$sCode = MsgBox(_t('_bx_quotes_fail'), 1);
$aValsAdd = array();
$iLastId = -1;
if ($iUnitID > 0) {
$oForm->update($iUnitID, $aValsAdd);
$iLastId = $iUnitID;
$sCode = MsgBox(_t('_bx_quotes_edited_success'), 1);
} else {
$iLastId = $oForm->insert($aValsAdd);
$sCode = MsgBox(_t('_bx_quotes_success'), 1);
}
}
return DesignBoxAdmin($sAddNewC, $sCode . $oForm->getCode(), '', '', 11);
}
示例3: getForm
public function getForm($iDesignBoxTemplate = BX_DB_PADDING_DEF, $sTitle = false)
{
if ($this->_sMetaType) {
return '';
}
if (false === $sTitle) {
$sTitle = _t("_Search");
}
$aValues = $this->getKeyTitlesPairs();
$aValue = isset($_GET['type']) ? bx_process_input($_GET['type']) : array_keys($aValues);
$sIdForm = $this->_sIdForm . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
$sIdResults = $this->_sIdResults . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
$sIdLoadingContainer = $this->_bLiveSearch ? $sIdResults : $sIdForm;
$sJsParams = "5, '#{$sIdForm}', '#{$sIdResults}', '#{$sIdLoadingContainer}', '{$this->_bLiveSearch}'";
$aForm = array('form_attrs' => array('id' => $sIdForm, 'action' => BX_DOL_URL_ROOT . 'searchKeyword.php', 'method' => 'post'), 'csrf' => array('disable' => true), 'inputs' => array('live_search' => array('type' => 'hidden', 'name' => 'live_search', 'value' => $this->_bLiveSearch ? 1 : 0), 'section' => array('type' => 'checkbox_set', 'name' => 'section', 'caption' => _t('_Section'), 'values' => $aValues, 'value' => $aValue), 'keyword' => array('type' => 'text', 'name' => 'keyword', 'caption' => _t('_Keyword'), 'value' => bx_get('keyword') ? bx_process_input(bx_get('keyword')) : ''), 'search' => array('type' => 'submit', 'name' => 'search', 'value' => _t('_Search'))));
if ($this->_bLiveSearch) {
unset($aForm['inputs']['section']);
unset($aForm['inputs']['search']);
unset($aForm['inputs']['keyword']['caption']);
$aForm['inputs']['keyword']['attrs']['placeholder'] = _t('_sys_search_placeholder');
$aForm['inputs']['keyword']['attrs']['onkeypress'] = "return bx_search_on_type(event, {$sJsParams});";
$aForm['inputs']['keyword']['attrs']['onpaste'] = $aForm['inputs']['keyword']['attrs']['onkeypress'];
}
bx_import('BxTemplFormView');
$oForm = new BxTemplFormView($aForm);
$sForm = $oForm->getCode();
if (!$this->_bLiveSearch) {
bx_import('BxTemplPaginate');
$o = new BxTemplPaginate(array());
$o->addCssJs();
}
return DesignBoxContent($sTitle, $sForm, $iDesignBoxTemplate);
}
示例4: getSearchForm
function getSearchForm()
{
$aList = $GLOBALS['MySQL']->fromCache('sys_objects_search', 'getAllWithKey', 'SELECT `ID` as `id`,
`Title` as `title`,
`ClassName` as `class`,
`ClassPath` as `file`,
`ObjectName`
FROM `sys_objects_search`', 'ObjectName');
$aValues = array();
foreach ($aList as $sKey => $aValue) {
$aValues[$sKey] = _t($aValue['title']);
if (!class_exists($aValue['class'])) {
$sPath = BX_DIRECTORY_PATH_ROOT . str_replace('{tmpl}', $GLOBALS['tmpl'], $aValue['file']);
require_once $sPath;
}
$oClass = new $aValue['class']();
$oClass->addCustomParts();
}
if (isset($_GET['type'])) {
$aValue = strip_tags($_GET['type']);
} else {
$aValue = array_keys($aValues);
}
$aForm = array('form_attrs' => array('id' => 'searchForm', 'action' => '', 'method' => 'post', 'onsubmit' => ''), 'inputs' => array('section' => array('type' => 'checkbox_set', 'name' => 'section', 'caption' => _t('_Section'), 'values' => $aValues, 'value' => $aValue), 'keyword' => array('type' => 'text', 'name' => 'keyword', 'caption' => _t('_Keyword')), 'search' => array('type' => 'submit', 'name' => 'search', 'value' => _t('_Search'))));
$oForm = new BxTemplFormView($aForm);
$sFormVal = $oForm->getCode();
return DesignBoxContent(_t("_Search"), $sFormVal, 11);
}
示例5: getFormCode
function getFormCode()
{
$oForm = new BxTemplFormView($this->aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$aValsAdd = array('Date' => time(), 'Uri' => $oForm->generateUri(), 'Status' => 'active', 'Owner' => $this->iOwnerId);
if ($this->iAlbumId > 0 && $this->aInfo['Owner'] == $this->iOwnerId) {
$aValsAdd = array('Date' => time());
if (!$oForm->update($this->iAlbumId, $aValsAdd)) {
return MsgBox(_t('_sys_album_save_error'));
} else {
return MsgBox(_t('_sys_album_save_succ'));
}
} else {
$iAlbumId = $oForm->insert($aValsAdd);
if (!$iAlbumId) {
return MsgBox(_t('_sys_album_save_error'));
} else {
return MsgBox(_t('_sys_album_save_succ'));
}
}
} else {
return $oForm->getCode();
}
}
示例6: _getList
function _getList($mixedResult, $bActive = false)
{
$aForm = array('form_attrs' => array('id' => 'adm-email-templates', 'action' => $GLOBALS['site']['url_admin'] . 'email_templates.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_email_templates', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-emial-templates-save')), 'inputs' => array());
$aLanguages = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Title` AS `title` FROM `sys_localization_languages`");
$aLanguageChooser = array(array('key' => 0, 'value' => 'default'));
foreach ($aLanguages as $aLanguage) {
$aLanguageChooser[] = array('key' => $aLanguage['id'], 'value' => $aLanguage['title']);
}
$sLanguageCpt = _t('_adm_txt_email_language');
$sSubjectCpt = _t('_adm_txt_email_subject');
$sBodyCpt = _t('_adm_txt_email_body');
$aEmails = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Name` AS `name`, `Subject` AS `subject`, `Body` AS `body`, `Desc` AS `description` FROM `sys_email_templates` WHERE `LangID`='0' ORDER BY `ID`");
foreach ($aEmails as $aEmail) {
$aForm['inputs'] = array_merge($aForm['inputs'], array($aEmail['name'] . '_Beg' => array('type' => 'block_header', 'caption' => $aEmail['description'], 'collapsable' => true, 'collapsed' => true), $aEmail['name'] . '_Language' => array('type' => 'select', 'name' => $aEmail['name'] . '_Language', 'caption' => $sLanguageCpt, 'value' => 0, 'values' => $aLanguageChooser, 'db' => array('pass' => 'Int'), 'attrs' => array('onchange' => "javascript:getTranslations(this)")), $aEmail['name'] . '_Subject' => array('type' => 'text', 'name' => $aEmail['name'] . '_Subject', 'caption' => $sSubjectCpt, 'value' => $aEmail['subject'], 'db' => array('pass' => 'Xss')), $aEmail['name'] . '_Body' => array('type' => 'textarea', 'name' => $aEmail['name'] . '_Body', 'caption' => $sBodyCpt, 'value' => $aEmail['body'], 'db' => array('pass' => 'XssHtml')), $aEmail['name'] . '_End' => array('type' => 'block_end')));
}
$aForm['inputs']['adm-emial-templates-save'] = array('type' => 'submit', 'name' => 'adm-emial-templates-save', 'value' => _t('_adm_btn_email_save'));
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
$sResult = "";
if ($oForm->isSubmittedAndValid()) {
$iResult = 0;
foreach ($aEmails as $aEmail) {
$iEmailId = (int) $GLOBALS['MySQL']->getOne("SELECT `ID` FROM `sys_email_templates` WHERE `Name`='" . process_db_input($aEmail['name']) . "' AND `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "' LIMIT 1");
if ($iEmailId != 0) {
$iResult += (int) $GLOBALS['MySQL']->query("UPDATE `sys_email_templates` SET `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "' WHERE `ID`='" . $iEmailId . "'");
} else {
$iResult += (int) $GLOBALS['MySQL']->query("INSERT INTO `sys_email_templates` SET `Name`='" . process_db_input($aEmail['name']) . "', `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "', `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "'");
}
}
$bActive = true;
$sResult .= MsgBox(_t($iResult > 0 ? "_adm_txt_email_success_save" : "_adm_txt_email_nothing_changed"), 3);
}
$sResult .= $oForm->getCode();
return $GLOBALS['oAdmTemplate']->parseHtmlByName('email_templates_list.html', array('display' => $bActive ? 'block' : 'none', 'content' => stripslashes($sResult), 'loading' => LoadingBox('adm-email-loading')));
}
示例7: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode($iID, $sConfCode)
{
global $site;
$ID = (int) $iID;
$ConfCode = clear_xss($sConfCode);
$p_arr = getProfileInfo($ID);
if (!$p_arr) {
$_page['header'] = _t("_Error");
$_page['header_text'] = _t("_Profile Not found");
return MsgBox(_t('_Profile Not found Ex'));
}
$aCode = array('message_status' => '', 'message_info' => '', 'bx_if:form' => array('condition' => false, 'content' => array('form' => '')), 'bx_if:next' => array('condtion' => false, 'content' => array('next_url' => '')));
if ($p_arr['Status'] == 'Unconfirmed') {
$ConfCodeReal = base64_encode(base64_encode(crypt($p_arr[Email], CRYPT_EXT_DES ? "secret_co" : "se")));
if (strcmp($ConfCode, $ConfCodeReal) != 0) {
$aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'profile_activate.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('conf_id' => array('type' => 'hidden', 'name' => 'ConfID', 'value' => $ID), 'conf_code' => array('type' => 'text', 'name' => 'ConfCode', 'value' => '', 'caption' => _t("_Confirmation code")), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Submit"))));
$oForm = new BxTemplFormView($aForm);
$aCode['message_status'] = _t("_Profile activation failed");
$aCode['message_info'] = _t("_EMAIL_CONF_FAILED_EX");
$aCode['bx_if:form']['condition'] = true;
$aCode['bx_if:form']['content']['form'] = $oForm->getCode();
} else {
$aCode['bx_if:next']['condition'] = true;
$aCode['bx_if:next']['content']['next_url'] = BX_DOL_URL_ROOT . 'member.php';
$send_act_mail = false;
if (getParam('autoApproval_ifJoin') == 'on' && !(getParam('sys_dnsbl_enable') && 'approval' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join'))) {
$status = 'Active';
$send_act_mail = true;
$aCode['message_info'] = _t("_PROFILE_CONFIRM");
} else {
$status = 'Approval';
$aCode['message_info'] = _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
}
$update = bx_admin_profile_change_status($ID, $status, $send_act_mail);
// Promotional membership
if (getParam('enable_promotion_membership') == 'on') {
$memership_days = getParam('promotion_membership_days');
setMembership($p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
}
// check couple profile;
if ($p_arr['Couple']) {
$update = bx_admin_profile_change_status($p_arr['Couple'], $status);
//Promotional membership
if (getParam('enable_promotion_membership') == 'on') {
$memership_days = getParam('promotion_membership_days');
setMembership($p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
}
}
if (getParam('newusernotify')) {
$oEmailTemplates = new BxDolEmailTemplates();
$aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed', $p_arr['ID']);
sendMail($site['email_notify'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']);
}
}
} else {
$aCode['message_info'] = _t('_ALREADY_ACTIVATED');
}
return $GLOBALS['oSysTemplate']->parseHtmlByName('profile_activate.html', $aCode);
}
示例8: actionGetInvitation
function actionGetInvitation()
{
$aForm = array('form_attrs' => array('name' => 'invitation_form'), 'params' => array('remove_form' => true), 'inputs' => array(array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'button', 'name' => 'accept', 'value' => _t("_messenger_invitation_accept"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "accept");')), 1 => array('type' => 'button', 'name' => 'decline', 'value' => _t("_messenger_invitation_decline"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "decline");')), 2 => array('type' => 'button', 'name' => 'block', 'value' => _t("_messenger_invitation_block"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "block");')), 3 => array('type' => 'button', 'name' => 'report', 'value' => _t("_messenger_invitation_report"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "spam");')))));
$oForm = new BxTemplFormView($aForm);
$aVariables = array('invitation_buttons' => $oForm->getCode());
$sResult = $this->_oTemplate->parseHtmlByName("invitation.html", $aVariables);
return $sResult;
}
示例9: PageCodeLogo
function PageCodeLogo($mixedResultLogo)
{
$aForm = array('form_attrs' => array('id' => 'adm-settings-form-logo', 'name' => 'adm-settings-form-logo', 'action' => $GLOBALS['site']['url_admin'] . 'basic_settings.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array(), 'inputs' => array('upload_header_beg' => array('type' => 'block_header', 'caption' => _t('_adm_txt_settings_logo_header'), 'collapsable' => false, 'collapsed' => false), 'old_file' => array('type' => 'custom', 'content' => getMainLogo(), 'colspan' => true), 'new_file' => array('type' => 'file', 'name' => 'new_file', 'caption' => _t('_adm_txt_settings_logo_upload'), 'value' => ''), 'resize_header_beg' => array('type' => 'block_header', 'caption' => _t('_adm_txt_settings_resize_header'), 'collapsable' => false, 'collapsed' => false), 'resize' => array('type' => 'checkbox', 'name' => 'resize', 'caption' => _t('_adm_txt_settings_resize_enable'), 'value' => 'yes', 'checked' => true), 'new_width' => array('type' => 'text', 'name' => 'new_width', 'caption' => _t('_adm_txt_settings_resize_width'), 'value' => '64'), 'new_height' => array('type' => 'text', 'name' => 'new_height', 'caption' => _t('_adm_txt_settings_resize_height'), 'value' => '64'), 'resize_header_end' => array('type' => 'block_end'), 'upload' => array('type' => 'submit', 'name' => 'upload', 'value' => _t("_adm_btn_settings_upload"))));
$oForm = new BxTemplFormView($aForm);
$sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
if ($mixedResultLogo !== true && !empty($mixedResultLogo)) {
$sResult = MsgBox(_t($mixedResultLogo), 3) . $sResult;
}
return DesignBoxAdmin(_t('_adm_box_cpt_logo'), $sResult);
}
示例10: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
if ($_POST['DELETE']) {
profile_delete(getLoggedId());
bx_logout();
return MsgBox(_t("_DELETE_SUCCESS"));
}
$aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'unregister.php', 'method' => 'post', 'name' => 'form_unregister'), 'inputs' => array('delete' => array('type' => 'hidden', 'name' => 'DELETE', 'value' => '1'), 'info' => array('type' => 'custom', 'content' => _t("_DELETE_TEXT"), 'colspan' => true), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Delete account"))));
$oForm = new BxTemplFormView($aForm);
return $oForm->getCode();
}
示例11: PageCompMainCode
/**
* page code function
*/
function PageCompMainCode()
{
ob_start();
$aForm = array('form_attrs' => array('id' => 'sample_form', 'action' => BX_DOL_URL_ROOT . 'samples/forms.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('header_contact' => array('type' => 'block_header', 'caption' => 'Contact details'), 'name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_Your name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('_Name is required'))), 'date' => array('type' => 'datepicker', 'name' => 'date', 'caption' => _t('Date'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Date is required'))), 'datetime' => array('type' => 'datetime', 'name' => 'datetime', 'caption' => _t('Datetime'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Datetime is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'header_message' => array('type' => 'block_header', 'caption' => 'Message details', 'collapsable' => true, 'collapsed' => false), 'message_subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_message_subject'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(5, 300), 'error' => _t('_ps_ferr_incorrect_length'))), 'message_text' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_Message text'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 5000), 'error' => _t('_ps_ferr_incorrect_length'))), 'header_advanced' => array('type' => 'block_header', 'caption' => 'Advanced details', 'collapsable' => true, 'collapsed' => true), 'select_something' => array('type' => 'select', 'name' => 'select_something', 'caption' => _t('Select something'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'select_radio' => array('type' => 'radio_set', 'name' => 'select_radio', 'caption' => _t('Select radio something'), 'values' => array(1 => 'One', 'Two', 'Three'), 'required' => true), 'choose_something' => array('type' => 'checkbox_set', 'name' => 'choose_something', 'caption' => _t('Choose something'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'select_multiple' => array('type' => 'select_multiple', 'name' => 'select_multiple', 'caption' => _t('Multiple select'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'doublerange' => array('type' => 'doublerange', 'name' => 'doublerange', 'caption' => _t('Double Range'), 'attrs' => array('min' => 10, 'max' => 200), 'value' => '20-30', 'required' => true), 'header_submit' => array('type' => 'block_header', 'caption' => ''), 'iagree' => array('type' => 'checkbox', 'name' => 'iagree', 'value' => '1', 'caption' => _t('Do you like it?'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Form can not be submitted if you don\'t like it.'))), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('_Reset'), 'attrs' => array('class' => 'bx-def-margin-sec-left')))));
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
echo MsgBox('Data was successfully submitted');
}
echo $oForm->getCode();
$s = ob_get_clean();
return DesignBoxContent("Sample form", $s, BX_DB_PADDING_DEF);
}
示例12: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
$iUserId = getLoggedId();
if ($_POST['DELETE']) {
profile_delete($iUserId);
bx_logout();
return MsgBox(_t("_DELETE_SUCCESS"));
}
$aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'unregister.php', 'method' => 'post', 'name' => 'form_unregister'), 'inputs' => array('delete' => array('type' => 'hidden', 'name' => 'DELETE', 'value' => '1'), 'info' => array('type' => 'custom', 'content' => _t("_DELETE_TEXT"), 'colspan' => true), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Delete account"))));
$oForm = new BxTemplFormView($aForm);
$GLOBALS['oTopMenu']->setCurrentProfileID($iUserId);
return $GLOBALS['oSysTemplate']->parseHtmlByName('default_margin.html', array('content' => $oForm->getCode()));
}
示例13: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
$aForm = array('form_attrs' => array('id' => 'test_email_templates', 'action' => BX_DOL_URL_ROOT . '_ml.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('l_new' => array('type' => 'textarea', 'name' => 'l_new', 'caption' => 'New Language'), 'l_old' => array('type' => 'textarea', 'name' => 'l_old', 'caption' => 'Old Language'), 'module_lang_file' => array('type' => 'checkbox', 'name' => 'module_lang_file', 'caption' => 'Module language file', 'value' => 1, 'checked' => true), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'))));
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$isModuleLangFile = $_POST['module_lang_file'] ? true : false;
$aLang71 = getLangArray(process_pass_data($_POST['l_new']), $isModuleLangFile);
$aLang70 = getLangArray(process_pass_data($_POST['l_old']), $isModuleLangFile);
if (is_array($aLang71) && is_array($aLang70)) {
$s .= prepareTextarea('Added Keys', findAddedKeys($aLang71, $aLang70));
$s .= prepareTextarea('Changed Keys', findChangedKeys($aLang71, $aLang70));
$aDeletedKeys = findDeletedKeys($aLang71, $aLang70);
$s .= prepareTextarea('Deleted Keys', $aDeletedKeys);
$s .= prepareTextareaWithDeltedKeys($aDeletedKeys);
} else {
$s = MsgBox("Invalid arrays") . $oForm->getCode();
}
} else {
$s = $oForm->getCode();
}
return DesignBoxContent($GLOBALS['_page']['header'], $s, 11);
}
示例14: PageCodeEdit
function PageCodeEdit()
{
$aForm = array('form_attrs' => array('id' => 'adm-css-edit', 'name' => 'adm-css-edit', 'action' => $GLOBALS['site']['url_admin'] . 'css_file.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-css-save')), 'inputs' => array('css_file' => array('type' => 'select', 'name' => 'css_file', 'caption' => _t('_adm_txt_css_file'), 'value' => '', 'values' => array(), 'attrs' => array('onchange' => "javascript:document.forms['adm-css-edit'].submit();")), 'content' => array('type' => 'textarea', 'name' => 'content', 'caption' => _t('_adm_txt_css_content', $sFileName), 'value' => '', 'db' => array('pass' => 'XssHtml')), 'adm-css-save' => array('type' => 'submit', 'name' => 'adm-css-save', 'value' => _t('_adm_btn_css_save'))));
//--- Get CSS files ---//
$aItems = array();
$sBasePath = BX_DIRECTORY_PATH_ROOT . "templates/tmpl_" . $GLOBALS['oSysTemplate']->getCode() . "/css/";
$rHandle = opendir($sBasePath);
while (($sFile = readdir($rHandle)) !== false) {
if (is_file($sBasePath . $sFile) && substr($sFile, -3) == 'css') {
$aItems[] = array('key' => $sFile, 'value' => $sFile);
}
}
closedir($rHandle);
$sCurrentFile = isset($_POST['css_file']) && preg_match("/^\\w+\\.css\$/", $_POST['css_file']) ? $_POST['css_file'] : $aItems[0]['key'];
$aForm['inputs']['css_file']['value'] = $sCurrentFile;
$aForm['inputs']['css_file']['values'] = $aItems;
//--- Get CSS file's content ---//
$sContent = '';
$sAbsolutePath = $sBasePath . $sCurrentFile;
if (strlen($sCurrentFile) > 0 && is_file($sAbsolutePath)) {
$rHandle = fopen($sAbsolutePath, 'r');
while (!feof($rHandle)) {
$sContent .= fgets($rHandle, 4096);
}
fclose($rHandle);
}
//$aForm['inputs']['content']['value'] = isset($_POST['content']) ? $_POST['content'] : $sContent;
$aForm['inputs']['content']['value'] = $sContent;
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
if (file_exists($sAbsolutePath) && isRWAccessible($sAbsolutePath)) {
$rHandle = fopen($sAbsolutePath, 'w');
if ($rHandle) {
fwrite($rHandle, clear_xss($_POST['content']));
fclose($rHandle);
$mixedResult = '_adm_txt_css_success_save';
} else {
$mixedResult = '_adm_txt_css_failed_save';
}
} else {
$mixedResult = '_adm_txt_css_cannot_write';
}
}
$sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
if ($mixedResult !== true && !empty($mixedResult)) {
$sResult = MsgBox(_t($mixedResult, $sCurrentFile), 3) . $sResult;
}
return $sResult;
}
示例15: displayManualOrderWindow
function displayManualOrderWindow($aForm)
{
$oForm = new BxTemplFormView($aForm);
$sContent = $this->parseHtmlByName('manual_order_form.html', array('form' => $oForm->getCode(), 'loading' => LoadingBox('pmt-order-manual-loading')));
return PopupBox('pmt-manual-order', _t($this->_sLangsPrefix . 'wcpt_manual_order'), $sContent);
}