当前位置: 首页>>代码示例>>PHP>>正文


PHP BxTemplFormView::initChecker方法代码示例

本文整理汇总了PHP中BxTemplFormView::initChecker方法的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplFormView::initChecker方法的具体用法?PHP BxTemplFormView::initChecker怎么用?PHP BxTemplFormView::initChecker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BxTemplFormView的用法示例。


在下文中一共展示了BxTemplFormView::initChecker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:toxalot,项目名称:dolphin.pro,代码行数:33,代码来源:BxQuotesModule.php

示例2: 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();
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:25,代码来源:BxBaseAlbumForm.php

示例3: 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);
}
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:25,代码来源:contact.php

示例4: _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')));
}
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:35,代码来源:email_templates.php

示例5: getManagingForm

 function getManagingForm()
 {
     $sApplyChangesC = _t('_sys_admin_apply');
     $sFromC = _t('_From');
     $sToC = _t('_To');
     $sSampleC = _t('_adm_ipbl_sample');
     $sTypeC = _t('_adm_ipbl_IP_Role');
     $sDescriptionC = _t('_Description');
     $sDatatimeC = _t('_adm_ipbl_Date_of_finish');
     $sErrorC = _t('_Error Occured');
     $aForm = array('form_attrs' => array('name' => 'apply_ip_list_form', 'action' => $this->_sActionUrl, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_ip_list', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('FromIP' => array('type' => 'text', 'name' => 'from', 'caption' => $sFromC, 'info' => $sSampleC . ': 10.0.0.0', 'required' => true, 'checker' => array('func' => 'length', 'params' => array(7, 15), 'error' => $sErrorC)), 'ToIP' => array('type' => 'text', 'name' => 'to', 'caption' => $sToC, 'info' => $sSampleC . ': 10.0.0.100', 'required' => true, 'checker' => array('func' => 'length', 'params' => array(7, 15), 'error' => $sErrorC)), 'IPRole' => array('type' => 'select', 'name' => 'type', 'caption' => $sTypeC, 'values' => array('allow', 'deny'), 'required' => true), 'DateTime' => array('type' => 'datetime', 'name' => 'LastDT', 'caption' => $sDatatimeC, 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'db' => array('pass' => 'DateTime')), 'Desc' => array('type' => 'text', 'name' => 'desc', 'caption' => $sDescriptionC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(2, 128), 'error' => $sErrorC), 'db' => array('pass' => 'Xss')), 'ID' => array('type' => 'hidden', 'value' => '0', 'name' => 'id'), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sApplyChangesC)));
     $sResult = '';
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         /*list($iDay, $iMonth, $iYear) = explode( '/', $_REQUEST['datatime']);
           $iDay = (int)$iDay;
           $iMonth = (int)$iMonth;
           $iYear = (int)$iYear;
           //$sCurTime = date("Y:m:d H:i:s");// 2012-06-20 15:46:21
           $sCurTime = "{$iYear}:{$iMonth}:{$iDay} 12:00:00";*/
         $sFrom = sprintf("%u", ip2long($_REQUEST['from']));
         $sTo = sprintf("%u", ip2long($_REQUEST['to']));
         $sType = (int) $_REQUEST['type'] == 1 ? 'deny' : 'allow';
         $aValsAdd = array('From' => $sFrom, 'To' => $sTo, 'Type' => $sType);
         $iLastId = (int) $_REQUEST['id'] > 0 ? (int) $_REQUEST['id'] : -1;
         if ($iLastId > 0) {
             $oForm->update($iLastId, $aValsAdd);
         } else {
             $iLastId = $oForm->insert($aValsAdd);
         }
         $sResult = $iLastId > 0 ? MsgBox(_t('_Success'), 3) : MsgBox($sErrorC);
     }
     return $sResult . $oForm->getCode();
 }
开发者ID:toxalot,项目名称:dolphin.pro,代码行数:35,代码来源:BxDolAdminIpBlockList.php

示例6: _getDefaults

function _getDefaults($mixedResult, $bActive = false)
{
    $sNamePrefix = 'adm-pvc-action-';
    $aForm = array('form_attrs' => array('id' => 'adm-pvc-defaults', 'action' => $GLOBALS['site']['url_admin'] . 'privacy.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_privacy_actions', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-pvc-defaults-save')), 'inputs' => array());
    $aValues = array();
    $aGroupIds = $GLOBALS['MySQL']->getColumn("SELECT `id` FROM `sys_privacy_groups` WHERE `owner_id`='0' AND `id` NOT IN('" . implode("','", array(BX_DOL_PG_DEFAULT, BX_DOL_PG_HIDDEN)) . "')");
    foreach ($aGroupIds as $iGroupId) {
        if (getParam('sys_ps_enabled_group_' . $iGroupId) == 'on') {
            $aValues[$iGroupId] = _t('_ps_group_' . $iGroupId . '_title');
        }
    }
    $sModule = '';
    $aActions = $GLOBALS['MySQL']->getAll("SELECT `id` AS `id`, `module_uri` AS `module`, `title` AS `title`, `default_group` AS `default_group` FROM `sys_privacy_actions` WHERE 1 ORDER BY `module_uri` ASC");
    foreach ($aActions as $aAction) {
        $sName = $sNamePrefix . $aAction['id'];
        $sValue = $aAction['default_group'];
        if ($aAction['module'] != $sModule) {
            if (!empty($sModule)) {
                $aForm['inputs'][$sModule . '_end'] = array('type' => 'block_end');
            }
            $sModule = $aAction['module'];
            $aForm['inputs'][$sModule . '_beg'] = array('type' => 'block_header', 'caption' => _t('_sys_module_' . $sModule), 'collapsable' => true, 'collapsed' => true);
        }
        if (!in_array($sValue, $aGroupIds)) {
            continue;
        }
        $aForm['inputs'][$sName] = array('type' => 'select', 'name' => $sName, 'caption' => _t($aAction['title']), 'value' => (int) $sValue, 'values' => $aValues, 'db' => array('pass' => 'Int'));
    }
    $aForm['inputs'][$sModule . '_end'] = array('type' => 'block_end');
    $aForm['inputs']['adm-pvc-defaults-save'] = array('type' => 'submit', 'name' => 'adm-pvc-defaults-save', 'value' => _t('_adm_btn_pvc_save'));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    $sResult = "";
    if ($oForm->isSubmittedAndValid()) {
        $iResult = 0;
        foreach ($aActions as $aAction) {
            $sName = $sNamePrefix . $aAction['id'];
            $sValueOld = $aAction['default_group'];
            if (!in_array($sValueOld, $aGroupIds)) {
                continue;
            }
            $sValueNew = bx_get($sName);
            if ($sValueNew === false || (int) $sValueNew == (int) $sValueOld) {
                continue;
            }
            $iResult += (int) $GLOBALS['MySQL']->query("UPDATE `sys_privacy_actions` SET `default_group`='" . (int) $sValueNew . "' WHERE `id`='" . $aAction['id'] . "'");
        }
        $bActive = true;
        $sResult .= MsgBox(_t($iResult > 0 ? "_adm_txt_pvc_success_save" : "_adm_txt_pvc_nothing_changed"), 3);
    }
    $sResult .= $oForm->getCode();
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('privacy_defaults.html', array('display' => $bActive ? 'block' : 'none', 'form' => stripslashes($sResult)));
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:53,代码来源:privacy.php

示例7: 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);
}
开发者ID:blas-dmx,项目名称:trident,代码行数:16,代码来源:forms.php

示例8: 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;
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:50,代码来源:css_file.php

示例9: 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);
}
开发者ID:blas-dmx,项目名称:trident,代码行数:26,代码来源:merge_langs.php

示例10: getAddSubcatForm

 function getAddSubcatForm($iSubCategoryID = 0, $bOnlyForm = false)
 {
     //admin side only
     $sSubmitC = _t('_bx_ads_add_subcategory');
     $sAction = 'add_sub_category';
     $aParentCategories = array();
     $vParentValues = $this->_oDb->getAllCatsInfo();
     while ($aCategInfo = mysql_fetch_assoc($vParentValues)) {
         $iID = $aCategInfo['ID'];
         $sName = $aCategInfo['Name'];
         $aParentCategories[$iID] = $sName;
     }
     $sTitle = $sDescription = '';
     $iParentID = 0;
     if ($iSubCategoryID) {
         $aSubcatInfos = $this->_oDb->getSubcatInfo($iSubCategoryID);
         $sTitle = $aSubcatInfos[0]['NameSub'];
         $sDescription = $aSubcatInfos[0]['Description'];
         $iParentID = (int) $aSubcatInfos[0]['IDClassified'];
     }
     //adding form
     $aForm = array('form_attrs' => array('name' => 'create_sub_cats_form', 'action' => 'javascript: void(0)', 'method' => 'post'), 'params' => array('db' => array('table' => $this->_oConfig->sSQLSubcatTable, 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'IDClassified' => array('type' => 'select', 'name' => 'IDClassified', 'caption' => _t('_bx_ads_parent_category'), 'values' => $aParentCategories, 'value' => $iParentID, 'db' => array('pass' => 'Int')), 'NameSub' => array('type' => 'text', 'name' => 'NameSub', 'caption' => _t('_Title'), 'required' => true, 'value' => $sTitle, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_ads_title_error_desc', 128)), 'db' => array('pass' => 'Xss')), 'Description' => array('type' => 'text', 'name' => 'Description', 'caption' => _t('_Description'), 'value' => $sDescription, 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sSubmitC, 'attrs' => array('onClick' => "AdmCreateSubcategory('{$this->sHomeUrl}{$this->sCurrBrowsedFile}'); return false;"))));
     if ($iSubCategoryID) {
         $aForm['inputs']['hidden_postid'] = array('type' => 'hidden', 'name' => 'id', 'value' => $iSubCategoryID);
     }
     $sCode = '';
     $sJS = $this->_oTemplate->addJs('main.js', true);
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aValsAdd = array();
         if ($iSubCategoryID == 0) {
             $sCategUri = uriGenerate(bx_get('NameSub'), $this->_oConfig->sSQLSubcatTable, 'SEntryUri');
             $aValsAdd['SEntryUri'] = $sCategUri;
         }
         $iLastId = -1;
         if ($iSubCategoryID > 0) {
             $oForm->update($iSubCategoryID, $aValsAdd);
             $iLastId = $iSubCategoryID;
         } else {
             $iLastId = $oForm->insert($aValsAdd);
         }
         if ($iLastId > 0) {
             $sCode = MsgBox(_t('_bx_ads_Sub_category_successfully_added'), 3);
         } else {
             $sCode = MsgBox(_t('_bx_ads_Sub_category_failed_add'), 3);
         }
     }
     if ($bOnlyForm) {
         return $sCode . $oForm->getCode();
     }
     $sResult = $sJS . $sCode . $oForm->getCode();
     if (bx_get('mode') == 'json') {
         require_once BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php';
         $oJson = new Services_JSON();
         return $oJson->encode($sResult);
         exit;
     }
     $sResult = $this->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sResult));
     return $GLOBALS['oFunctions']->popupBox('ads_add_sub_category', _t('_bx_ads_add_subcategory'), $sResult);
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:61,代码来源:BxAdsModule.php

示例11: array

 function getBlockCode_CreateGroup()
 {
     $sContent = "";
     $aValues = array_merge(array('0' => _t('_ps_cpt_none')), $this->_getSelectItems(array('type' => 'extendable', 'owner_id' => $this->_iOwnerId)));
     $aForm = array('form_attrs' => array('id' => 'ps-create-group-form', 'name' => 'ps-create-group-form', 'action' => BX_DOL_URL_ROOT . 'member_privacy.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_privacy_groups', 'key' => 'id', 'submit_name' => 'create')), 'inputs' => array('owner_id' => array('type' => 'hidden', 'name' => 'owner_id', 'value' => $this->_iOwnerId, 'db' => array('pass' => 'Int')), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t("_ps_fcpt_title"), 'value' => '', 'checker' => array('func' => 'length', 'params' => array(3, 64), 'error' => _t('_ps_ferr_incorrect_length')), 'db' => array('pass' => 'Xss')), 'parent_id' => array('type' => 'select', 'name' => 'parent_id', 'caption' => _t("_ps_fcpt_extends"), 'value' => '', 'values' => $aValues, 'checker' => array('func' => 'length', 'params' => array(1, 4), 'error' => _t('_ps_ferr_incorrect_select')), 'db' => array('pass' => 'Int')), 'create' => array('type' => 'submit', 'name' => 'create', 'value' => _t("_ps_btncpt_create"))));
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iId = $oForm->insert();
         header('Location: ' . $oForm->aFormAttrs['action']);
         exit;
     } else {
         $sContent = $oForm->getCode();
     }
     $sContent = $this->parseHtmlByName('ps_create_group.html', array('form' => !empty($sContent) ? $sContent : MsgBox(_t('_Empty'))));
     return DesignBoxContent(_t("_ps_bcpt_create_group"), $sContent, 1);
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:17,代码来源:BxBasePrivacyView.php

示例12: BxDolPrivacy

 function getBlockCode_Privacy()
 {
     $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id');
     $this->aFormPrivacy['inputs']['allow_view_to'] = $oPrivacy->getGroupChooser(getLoggedId(), 'profile', 'view');
     $this->aFormPrivacy['inputs']['allow_view_to']['value'] = (string) $this->aProfiles[0]['allow_view_to'];
     $oForm = new BxTemplFormView($this->aFormPrivacy);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iProfileId = (int) $_POST['profile_id'];
         $iAllowViewTo = (int) $_POST['allow_view_to'];
         if ((int) db_res("UPDATE `Profiles` SET `allow_view_to`='" . $iAllowViewTo . "' WHERE `ID`='" . $iProfileId . "' LIMIT 1") > 0) {
             $sStatusText = '_Save profile successful';
         }
     }
     if ($sStatusText) {
         $sStatusText = MsgBox(_t($sStatusText), 3);
     }
     return $sStatusText . $oForm->getCode();
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:19,代码来源:pedit.php

示例13: performActionAdd

 /**
  * 'add' action handler
  */
 public function performActionAdd()
 {
     $sAction = 'add';
     $aForm = array('form_attrs' => array('id' => 'sample-add-form', 'action' => 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => 'post'), 'params' => array('db' => array('table' => 'sample_grid_data', 'key' => 'ID', 'submit_name' => 'do_submit')), 'inputs' => array('NickName' => array('type' => 'text', 'name' => 'NickName', 'caption' => _t('Username'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('Username is required')), 'db' => array('pass' => 'Xss')), 'Email' => array('type' => 'text', 'name' => 'Email', 'caption' => _t('Email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email')), 'db' => array('pass' => 'Xss')), 'City' => array('type' => 'text', 'name' => 'City', 'caption' => _t('City'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('City is required')), 'db' => array('pass' => 'Xss')), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('Close'), 'attrs' => array('onclick' => "\$('.dolPopup:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $iNewId = $oForm->insert(array(), true);
         // insert record to database
         if ($iNewId) {
             $aRes = array('grid' => $this->getCode(true), 'blink' => $iNewId);
         } else {
             $aRes = array('msg' => "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');
         // we need to use 'transBox' function to properly display 'popup'
         $s = BxTemplFunctions::getInstance()->transBox('', '
             <div class="bx-def-padding-top bx-def-padding-left bx-def-padding-right bx-def-color-bg-block" style="width:300px;">' . $oForm->getCode() . '</div>
             <script>
                 $(document).ready(function () {
                     $("#sample-add-form").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $aForm['form_attrs']['id'] . '"), true);
                         },
                         success: function (data) {
                             $(".dolPopup:visible").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "' . $sAction . '");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
开发者ID:Baloo7super,项目名称:dolphin,代码行数:44,代码来源:BxGridMy.php

示例14: getCreationForm

 /**
  * Function will generate the poll's creation form ;
  *
  * @return : (text) - Html presentation data ;
  */
 function getCreationForm()
 {
     // check membership;
     if (!$this->isPollCreateAlowed($this->aPollSettings['member_id'], false)) {
         return MsgBox(_t('_bx_poll_access_denied'));
     }
     $iDefaultAnswerCount = 2;
     $aLanguageKeys = array('create' => _t('_bx_poll_create'), 'tags' => _t('_bx_poll_tags'), 'tags_sep' => _t('_sys_tags_note'), 'generate' => _t('_bx_poll_generate'), 'question' => _t('_bx_poll_question'), 'answer' => _t('_bx_poll_answer'), 'add_answer' => _t('_bx_poll_add'), 'max_pool' => _t('_bx_poll_max_reached'), 'question_length_req' => _t('_bx_poll_question_length_required', $this->aPollSettings['question_min_length'], $this->aPollSettings['question_max_length']), 'answer_length_req' => _t('_bx_poll_answer_length_required', $this->aPollSettings['answer_min_length'], $this->aPollSettings['answer_max_length']));
     $aForm = array('form_attrs' => array('action' => $this->sPathToModule . '&mode=' . $this->aPollSettings['mode'], 'method' => 'post', 'name' => 'poll_creation_form'), 'params' => array('checker_helper' => 'BxCheckerPoll', 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('question' => array('type' => 'text', 'name' => 'question', 'caption' => $aLanguageKeys['question'], 'required' => true, 'checker' => array('func' => 'length', 'params' => array($this->aPollSettings['question_min_length'], $this->aPollSettings['question_max_length']), 'error' => $aLanguageKeys['question_length_req'])), 'answers' => array('type' => 'text', 'name' => 'answers[]', 'caption' => $aLanguageKeys['answer'], 'required' => true, 'value' => array('', ''), 'attrs' => array('multiplyable' => 'true'), 'checker' => array('func' => 'answers', 'params' => array($this->aPollSettings['answer_min_length'], $this->aPollSettings['answer_max_length']), 'error' => $aLanguageKeys['answer_length_req']), 'db' => array('pass' => 'Anwers')), 'category' => array(), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => $aLanguageKeys['tags'], 'required' => false, 'info' => $aLanguageKeys['tags_sep']), 'allow_view_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'view', array(), _t('_bx_poll_allow_view')), 'allow_comments_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'comment', array(), _t('_bx_poll_allow_comment')), 'allow_vote_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'vote', array(), _t('_bx_poll_allow_vote'))));
     // generate categories;
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $aForm['inputs']['category'] = $oCategories->getGroupChooser('bx_poll', $this->aPollSettings['member_id'], true);
     // add submit button;
     $aForm['inputs'][] = array('type' => 'submit', 'name' => 'do_submit', 'value' => $aLanguageKeys['generate']);
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     // create new poll
     if ($oForm->isSubmittedAndValid()) {
         $this->proccesData();
         $sOutputCode .= $this->sActionAnswer;
     } else {
         $sOutputCode .= $oForm->getCode();
     }
     return $this->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sOutputCode));
 }
开发者ID:Arvindvi,项目名称:dolphin,代码行数:31,代码来源:BxPollModule.php

示例15: PageListMemberMenuSettings

/**
 * Change member's menu position ;
 *
 * @param $iProfileId integer
 * @param $sMenuPosition string
 * @param $sAction string
 * @return text - html presentation data
 */
function PageListMemberMenuSettings($iProfileId, $sAction)
{
    $iProfileId = (int) $iProfileId;
    // define default menu position;
    if (isset($_COOKIE['menu_position'])) {
        $sDefaultValue = clear_xss($_COOKIE['menu_position']);
    } else {
        $sDefaultValue = getParam('ext_nav_menu_top_position');
    }
    //get form
    $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'list_pop.php?action=' . clear_xss($sAction), 'method' => 'post', 'name' => 'menu_position_form'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array(array('type' => 'radio_set', 'name' => 'menu_settings', 'caption' => 'Position', 'dv' => '<br />', 'values' => array('top' => _t('_Top'), 'bottom' => _t('_Bottom'), 'static' => _t('_Static')), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 6), 'error' => _t('_Error occured')), 'value' => $sDefaultValue, 'db' => array('pass' => 'Xss')), array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Save Changes'))));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        $sCode = MsgBox(_t('_Saved'));
        $sCode .= '
            <script type="text/javascript">
                opener.location.reload();
                window.close();
            </script>
        ';
        //change menu position
        setcookie("menu_position", $oForm->getCleanValue('menu_settings'), time() + 60 * 60 * 24 * 180);
        //clear member menu cache
        bx_import('BxDolMemberMenu');
        $oMemberMenu = new BxDolMemberMenu();
        $oMemberMenu->deleteMemberMenuKeyFile($iProfileId);
    } else {
        $sCode = $oForm->getCode();
    }
    return $sCode;
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:40,代码来源:list_pop.php


注:本文中的BxTemplFormView::initChecker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。