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


PHP BxTemplFormView::update方法代码示例

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


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

示例1: 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

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

示例3: update

 function update($iContentId, $aValsToAdd = array(), &$aTrackTextFieldsChanges = null)
 {
     $CNF =& $this->_oModule->_oConfig->CNF;
     if (isset($CNF['FIELD_CHANGED'])) {
         $aValsToAdd[$CNF['FIELD_CHANGED']] = time();
     }
     return parent::update($iContentId, $aValsToAdd, $aTrackTextFieldsChanges);
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:8,代码来源:BxBaseModGeneralFormEntry.php

示例4: getManageBannersBlock


//.........这里部分代码省略.........
        $lvshift = $banns_arr['lvshift'];
        $rhshift = $banns_arr['rhshift'];
        $rvshift = $banns_arr['rvshift'];
        list($iYearStart, $iMonthStart, $iDayStart) = explode('-', $banns_arr['campaign_start']);
        //$start_date = "{$iDayStart}/{$iMonthStart}/{$iYearStart}";
        $start_date = "{$iYearStart}-{$iMonthStart}-{$iDayStart} 00:00:00";
        list($iYearEnd, $iMonthEnd, $iDayEnd) = explode('-', $banns_arr['campaign_end']);
        //$end_date = "{$iDayEnd}/{$iMonthEnd}/{$iYearEnd}";
        $end_date = "{$iYearEnd}-{$iMonthEnd}-{$iDayEnd} 00:00:00";
    }
    $sFormTitle = htmlspecialchars($Title);
    $sFormUrl = htmlspecialchars($Url);
    $sFormActiveState = $Active ? 'checked="checked"' : '';
    $sFormActiveStateVal = $Active ? 'yes' : '';
    $sFormActiveStateChk = $Active ? true : false;
    $sFormBannerText = $Text;
    $sFormStartDate = $start_date;
    $sFormStartDateDef = $start_date_default;
    $sFormEndDate = $end_date;
    $sFormEndDateDef = $end_date_default;
    $sTopPosState = substr_count($Position, "1") > 0 ? 'checked="checked"' : '';
    $sLeftPosState = substr_count($Position, "2") > 0 ? 'checked="checked"' : '';
    $sRightPosState = substr_count($Position, "3") > 0 ? 'checked="checked"' : '';
    $sBottomPosState = substr_count($Position, "4") > 0 ? 'checked="checked"' : '';
    $sTopShift = substr_count($Position, "2") > 0 ? $lhshift : '';
    $sLeftShift = substr_count($Position, "2") > 0 ? $lvshift : '';
    $sRightShift = substr_count($Position, "3") > 0 ? $rhshift : '';
    $sBottomShift = substr_count($Position, "3") > 0 ? $rvshift : '';
    $sActionAdd = $action == "modify" ? $sAsNew . '&nbsp;<input type=checkbox name=as_new />' : '';
    $sCustomPositions = <<<EOF
<table border=0 width=100% cellspacing=10 cellpading=20>
\t<tr>
\t\t<td colspan=5 align=center><input type=checkbox name="pos_top" {$sTopPosState} />{$sTopC}</td>
\t</tr>
\t<tr>
\t\t<td colspan=2 align=center><input type=checkbox name="pos_left" {$sLeftPosState} />{$sLeftC}</td>
\t\t<td>&nbsp;</td>
\t\t<td colspan=2 align=center><input type=checkbox name="pos_right" {$sRightPosState} />{$sRightC}</td>
\t</tr>
\t<tr>
\t\t<td>{$sHShiftC}</td>
\t\t<td>{$sVShiftC}</td>
\t\t<td>&nbsp;</td>
\t\t<td>{$sHShiftC}</td>
\t\t<td>{$sVShiftC}</td>
\t</tr>
\t<tr>
\t\t<td><input name="lhshift" type=input size=5 value={$sTopShift} /></td>
\t\t<td><input name="lvshift" type=input size=5 value={$sLeftShift} /></td>
\t\t<td>&nbsp;</td>
\t\t<td><input name="rhshift" type=input size=5 value={$sRightShift} /></td>
\t\t<td><input name="rvshift" type=input size=5 value={$sBottomShift} /></td>
\t</tr>
\t<tr>
\t\t<td colspan=5 align=center><input type=checkbox name="pos_bottom" {$sBottomPosState} />{$sBottomC}</td>
\t</tr>
</table>
{$sActionAdd}
EOF;
    $aForm = array('form_attrs' => array('name' => 'apply_ip_list_form', 'action' => $GLOBALS['site']['url_admin'] . 'banners.php', 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_banners', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('BannerTitle' => array('type' => 'text', 'name' => 'Title', 'value' => $sFormTitle, 'caption' => $sTitleC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(2, 128), 'error' => _t('_chars_to_chars', 2, 128)), 'db' => array('pass' => 'Xss')), 'BannerUrl' => array('type' => 'text', 'name' => 'Url', 'value' => $sFormUrl, 'caption' => $sUrlC, 'required' => false, 'db' => array('pass' => 'Xss')), 'BannerActive' => array('type' => 'checkbox', 'name' => 'Active', 'caption' => $sActiveC, 'value' => 1, 'checked' => $sFormActiveStateChk), 'BannerText' => array('type' => 'textarea', 'name' => 'Text', 'value' => $sFormBannerText, 'caption' => $sTextC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 32000), 'error' => _t('_chars_to_chars', 10, 32000)), 'db' => array('pass' => 'All')), 'StartDate' => array('type' => 'datetime', 'name' => 'start_date', 'value' => $sFormStartDate, 'caption' => $sStartDateC, 'label' => "{$sDefaultC}: {$sFormStartDateDef}", 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'display' => 'filterDate'), 'EndDate' => array('type' => 'datetime', 'name' => 'end_date', 'value' => $sFormEndDate, 'caption' => $sEndDateC, 'label' => "{$sDefaultC}: {$sFormEndDateDef}", 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'display' => 'filterDate'), 'Positions' => array('type' => 'custom', 'name' => 'Position', 'caption' => $sPositionOnPageC, 'content' => $sCustomPositions), 'ID' => array('type' => 'hidden', 'name' => 'banner_id', 'value' => $iBannerID), 'Action' => array('type' => 'hidden', 'name' => 'action', 'value' => $action), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sApplyChangesC)));
    $sResult = '';
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        list($iYearStart, $iMonthStart, $iDayStart) = explode('-', $oForm->getCleanValue('start_date'));
        $sDateStart = "{$iYearStart}-{$iMonthStart}-{$iDayStart}";
        list($iYearEnd, $iMonthEnd, $iDayEnd) = explode('-', $oForm->getCleanValue('end_date'));
        $sDateEnd = "{$iYearEnd}-{$iMonthEnd}-{$iDayEnd}";
        $sCurTime = date("Y-m-d");
        // 2010-12-31
        $iLastId = (int) $oForm->getCleanValue('banner_id');
        $banner_pos = "";
        if ($oForm->getCleanValue('pos_top') == "on") {
            $banner_pos .= '1';
        }
        if ($oForm->getCleanValue('pos_left') == "on") {
            $banner_pos .= '2';
        }
        if ($oForm->getCleanValue('pos_right') == "on") {
            $banner_pos .= '3';
        }
        if ($oForm->getCleanValue('pos_bottom') == "on") {
            $banner_pos .= '4';
        }
        $banner_pos = (int) $banner_pos;
        $banner_lhshift = (int) $oForm->getCleanValue('lhshift');
        $banner_lvshift = (int) $oForm->getCleanValue('lvshift');
        $banner_rhshift = (int) $oForm->getCleanValue('rhshift');
        $banner_rvshift = (int) $oForm->getCleanValue('rvshift');
        $aValsAdd = array('Position' => $banner_pos, 'Active' => '' != $oForm->getCleanValue('Active') ? 1 : 0, 'Created' => $sCurTime, 'campaign_start' => $sDateStart, 'campaign_end' => $sDateEnd, 'lhshift' => $banner_lhshift, 'lvshift' => $banner_lvshift, 'rhshift' => $banner_rhshift, 'rvshift' => $banner_rvshift);
        if ($oForm->getCleanValue('action') == 'modify' && $oForm->getCleanValue('as_new') != "on" && $iLastId > 0) {
            $oForm->update($iLastId, $aValsAdd);
        }
        if ($oForm->getCleanValue('action') == 'new' || $oForm->getCleanValue('as_new') == "on" && $oForm->getCleanValue('action') == 'modify') {
            $iLastId = $oForm->insert($aValsAdd);
        }
        $sResult = $iLastId > 0 ? MsgBox(_t('_Success'), 3) : MsgBox($sErrorC);
    }
    return DesignBoxContent(_t('_adm_bann_title'), $sResult . $oForm->getCode(), 1);
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:101,代码来源:banners.php

示例5: update

 function update($val, $aValsToAdd = array(), &$aTrackTextFieldsChanges = null)
 {
     $sPwd = $this->getCleanValue(self::$FIELD_PASSWORD);
     if ($sPwd) {
         $sSalt = genRndSalt();
         $sPasswordHash = encryptUserPwd($sPwd, $sSalt);
     }
     $aValsToAdd = array_merge($aValsToAdd, array(self::$FIELD_CHANGED => time()), $sPwd ? array(self::$FIELD_PASSWORD => $sPasswordHash, self::$FIELD_SALT => $sSalt) : array());
     return parent::update($val, $aValsToAdd, $aTrackTextFieldsChanges);
 }
开发者ID:Baloo7super,项目名称:dolphin,代码行数:10,代码来源:BxBaseFormAccount.php

示例6: getEmailMessage

function getEmailMessage($sAction)
{
    $sErrorC = _t('_Error Occured');
    $sApplyChangesC = _t('_Save');
    $sSubjectC = _t('_Subject');
    $sBodyC = _t('_adm_mmail_Body');
    $sTextBodyC = _t('_adm_mmail_Text_email_body');
    $sPreviewMessageC = _t('_Preview');
    $sDeleteC = _t('_Delete');
    $sMessageID = (int) $_POST['msgs_id'];
    $sSubject = $sBody = "";
    if ($_POST['body'] && $_POST['action'] != 'delete') {
        $sSubject = process_pass_data($_POST['subject']);
        $sBody = process_pass_data($_POST['body']);
    } elseif ($sMessageID) {
        list($sSubject, $sBody) = $GLOBALS['MySQL']->getRow("SELECT `subject`, `body` FROM `sys_sbs_messages` WHERE `id`='" . $sMessageID . "' LIMIT 1", MYSQL_NUM);
    }
    $sSubject = htmlspecialchars($sSubject);
    $aForm = array('form_attrs' => array('name' => 'sys_sbs_messages', 'action' => $GLOBALS['site']['url_admin'] . 'notifies.php', 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_sbs_messages', 'key' => 'ID', 'submit_name' => 'add_message')), 'inputs' => array('subject' => array('type' => 'text', 'name' => 'subject', 'value' => $sSubject, 'caption' => $sSubjectC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(2, 128), 'error' => $sErrorC), 'db' => array('pass' => 'Xss')), 'body' => array('type' => 'textarea', 'name' => 'body', 'value' => $sBody, 'caption' => $sBodyC, 'required' => true, 'html' => 2, 'attrs' => array('style' => "height:400px;"), 'checker' => array('func' => 'length', 'params' => array(10, 32000), 'error' => $sErrorC), 'db' => array('pass' => 'XssHtml')), 'msgs_id' => array('type' => 'hidden', 'name' => 'msgs_id', 'value' => $sMessageID), 'control' => array('type' => 'input_set', array('type' => 'submit', 'name' => 'add_message', 'caption' => $sApplyChangesC, 'value' => $sApplyChangesC), array('type' => 'submit', 'name' => 'preview_message', 'caption' => $sPreviewMessageC, 'value' => $sPreviewMessageC))));
    if ($sMessageID) {
        $aForm['inputs']['control'][] = array('type' => 'submit', 'name' => 'delete_message', 'caption' => $sDeleteC, 'value' => $sDeleteC);
    }
    $sResult = '';
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        if ($sAction == 'add') {
            if ($sMessageID > 0) {
                $oForm->update($sMessageID);
            } else {
                $sMessageID = $oForm->insert();
            }
        }
        $sResult = $sMessageID > 0 ? MsgBox(_t('_Success'), 3) : MsgBox($sErrorC);
    }
    return DesignBoxContent(_t('_adm_mmail_Email_message'), $sResult . $oForm->getCode(), 11);
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:37,代码来源:notifies.php

示例7: AddNewPostForm


//.........这里部分代码省略.........
            $aForm['inputs']['hidden_postid'] = array('type' => 'hidden', 'name' => 'EditPostID', 'value' => $iPostID);
            if ($aBlogPost['PostPhoto'] != '' && file_exists(BX_BLOGS_IMAGES_PATH . 'small_' . $aBlogPost['PostPhoto'])) {
                $GLOBALS['oTopMenu']->setCustomSubIconUrl(BX_BLOGS_IMAGES_URL . 'small_' . $aBlogPost['PostPhoto']);
            } else {
                $GLOBALS['oTopMenu']->setCustomSubIconUrl('book');
            }
            $GLOBALS['oTopMenu']->setCustomSubHeader($sPostCaption);
        }
        if (empty($aForm['inputs']['allowView']['value']) || !$aForm['inputs']['allowView']['value']) {
            $aForm['inputs']['allowView']['value'] = BX_DOL_PG_ALL;
        }
        if (empty($aForm['inputs']['allowRate']['value']) || !$aForm['inputs']['allowRate']['value']) {
            $aForm['inputs']['allowRate']['value'] = BX_DOL_PG_ALL;
        }
        if (empty($aForm['inputs']['allowComment']['value']) || !$aForm['inputs']['allowComment']['value']) {
            $aForm['inputs']['allowComment']['value'] = BX_DOL_PG_ALL;
        }
        $oForm = new BxTemplFormView($aForm);
        $oForm->initChecker();
        if ($oForm->isSubmittedAndValid()) {
            $this->CheckLogged();
            $iOwnID = $this->_iVisitorID;
            $sCurTime = time();
            $sPostUri = uriGenerate(bx_get('PostCaption'), $this->_oConfig->sSQLPostsTable, 'PostUri');
            $sAutoApprovalVal = getParam('blogAutoApproval') == 'on' ? "approval" : "disapproval";
            $aValsAdd = array('PostDate' => $sCurTime, 'PostStatus' => $sAutoApprovalVal);
            if ($iPostID == 0) {
                $aValsAdd['OwnerID'] = $iOwnID;
                $aValsAdd['PostUri'] = $sPostUri;
            }
            $iBlogPostID = -1;
            if ($iPostID > 0) {
                unset($aValsAdd['PostDate']);
                $oForm->update($iPostID, $aValsAdd);
                $this->isAllowedPostEdit($iOwnerID, true);
                $iBlogPostID = $iPostID;
            } else {
                $iBlogPostID = $oForm->insert($aValsAdd);
                $this->isAllowedPostAdd(true);
            }
            if ($iBlogPostID) {
                $this->iLastPostedPostID = $iBlogPostID;
                if ($_FILES) {
                    for ($i = 0; $i < count($_FILES['BlogPic']['tmp_name']); $i++) {
                        if ($_FILES['BlogPic']['error'][$i]) {
                            continue;
                        }
                        if (0 < $_FILES['BlogPic']['size'][$i] && 0 < strlen($_FILES['BlogPic']['name'][$i]) && 0 < $iBlogPostID) {
                            $sTmpFile = $_FILES['BlogPic']['tmp_name'][$i];
                            if (file_exists($sTmpFile) == false) {
                                break;
                            }
                            $aSize = getimagesize($sTmpFile);
                            if (!$aSize) {
                                @unlink($sTmpFile);
                                break;
                            }
                            switch ($aSize[2]) {
                                case IMAGETYPE_JPEG:
                                case IMAGETYPE_GIF:
                                case IMAGETYPE_PNG:
                                    $sOriginalFilename = $_FILES['BlogPic']['name'][$i];
                                    $sExt = strrchr($sOriginalFilename, '.');
                                    $sFileName = 'blog_' . $iBlogPostID . '_' . $i;
                                    @unlink($sFileName);
                                    move_uploaded_file($sTmpFile, BX_BLOGS_IMAGES_PATH . $sFileName . $sExt);
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:67,代码来源:BxBlogsModule.php

示例8: 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

示例9: 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:noormcs,项目名称:studoro,代码行数:35,代码来源:BxDolAdminIpBlockList.php

示例10: getEditForm

 function getEditForm($aValues, $aAddFields = array())
 {
     $oCategories = new BxDolCategories();
     if (isset($this->_aForm['inputs']['categories'])) {
         //--- convert post form to edit one ---//
         $this->_aForm['inputs']['categories'] = $oCategories->getGroupChooser($this->_oModule->_oConfig->getCategoriesSystemName(), $this->_iOwnerId, true, $aValues['categories']);
     }
     if (!empty($aValues) && is_array($aValues)) {
         foreach ($aValues as $sKey => $sValue) {
             if (array_key_exists($sKey, $this->_aForm['inputs'])) {
                 if ($this->_aForm['inputs'][$sKey]['type'] == 'checkbox') {
                     $this->_aForm['inputs'][$sKey]['checked'] = (int) $sValue == 1 ? true : false;
                 } else {
                     if ($this->_aForm['inputs'][$sKey]['type'] == 'select_box' && $this->_aForm['inputs'][$sKey]['name'] == 'Categories') {
                         $aCategories = preg_split('/[' . $oCategories->sTagsDivider . ']/', $sValue, 0, PREG_SPLIT_NO_EMPTY);
                         $this->_aForm['inputs'][$sKey]['value'] = $aCategories;
                     } else {
                         $this->_aForm['inputs'][$sKey]['value'] = $sValue;
                     }
                 }
             }
         }
         unset($this->_aForm['inputs']['author_id']);
         $this->_aForm['inputs']['id'] = array('type' => 'hidden', 'name' => 'id', 'value' => $aValues['id'], 'db' => array('pass' => 'Int'));
         $this->_aForm['inputs']['post']['value'] = _t("_td_edit");
     }
     $oForm = new BxTemplFormView($this->_aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iDateNow = mktime();
         $iDatePublish = $oForm->getCleanValue('when');
         if ($iDatePublish > $iDateNow) {
             $iStatus = BX_TD_STATUS_PENDING;
         } else {
             if ($iDatePublish <= $iDateNow && $this->_oModule->_oConfig->isAutoapprove()) {
                 $iStatus = BX_TD_STATUS_ACTIVE;
             } else {
                 $iStatus = BX_TD_STATUS_INACTIVE;
             }
         }
         $aDefFields = array('date' => $iDateNow, 'status' => $iStatus);
         $oForm->update($aValues['id'], array_merge($aDefFields, $aAddFields));
         //--- 'System' -> Edit for Alerts Engine ---//
         bx_import('BxDolAlerts');
         $oAlert = new BxDolAlerts($this->_oModule->_oConfig->getAlertsSystemName(), 'edit', $aValues['id'], $this->_iOwnerId);
         $oAlert->alert();
         //--- 'System' -> Edit for Alerts Engine ---//
         //--- Reparse Global Tags ---//
         $oTags = new BxDolTags();
         $oTags->reparseObjTags($this->_oModule->_oConfig->getTagsSystemName(), $aValues['id']);
         //--- Reparse Global Tags ---//
         //--- Reparse Global Categories ---//
         $oCategories->reparseObjTags($this->_oModule->_oConfig->getCategoriesSystemName(), $aValues['id']);
         //--- Reparse Global Categories ---//
         header('Location: ' . $oForm->aFormAttrs['action']);
     } else {
         return $oForm->getCode();
     }
 }
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:59,代码来源:BxDolTextData.php

示例11: _getLevelsCreateForm

function _getLevelsCreateForm($iLevelId, $bActive = false)
{
    $sSubmitUrl = BX_DOL_URL_ADMIN . 'memb_levels.php';
    $aLevel = array();
    if (($bEdit = $iLevelId != 0) === true) {
        $aLevel = $GLOBALS['MySQL']->getRow("SELECT `Name` AS `Name`, `Description` AS `Description`, `Order` AS `Order` FROM `sys_acl_levels` WHERE `ID`='" . $iLevelId . "' LIMIT 1");
    }
    $aForm = array('form_attrs' => array('id' => 'adm-mlevels-create', 'action' => $sSubmitUrl . '?tab=levels_add', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_acl_levels', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'Submit')), 'inputs' => array('Active' => array('type' => 'hidden', 'name' => 'Active', 'value' => 'no', 'db' => array('pass' => 'Xss')), 'Purchasable' => array('type' => 'hidden', 'name' => 'Purchasable', 'value' => 'yes', 'db' => array('pass' => 'Xss')), 'Removable' => array('type' => 'hidden', 'name' => 'Removable', 'value' => 'yes', 'db' => array('pass' => 'Xss')), 'Name' => array('type' => 'text', 'name' => 'Name', 'caption' => _t('_adm_txt_mlevels_name'), 'value' => isset($aLevel['Name']) ? $aLevel['Name'] : '', 'required' => true, 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_adm_txt_mlevels_name_err'))), 'Icon' => array('type' => 'file', 'name' => 'Icon', 'caption' => _t('_adm_txt_mlevels_icon'), 'required' => true, 'checker' => array('func' => '', 'params' => '', 'error' => _t('_adm_txt_mlevels_icon_err'))), 'Description' => array('type' => 'textarea', 'name' => 'Description', 'caption' => _t('_adm_txt_mlevels_description'), 'value' => isset($aLevel['Description']) ? $aLevel['Description'] : '', 'db' => array('pass' => 'XssHtml')), 'Order' => array('type' => 'text', 'name' => 'Order', 'caption' => _t('_adm_txt_mlevels_order'), 'value' => isset($aLevel['Order']) ? $aLevel['Order'] : 0, 'required' => true, 'db' => array('pass' => 'Int'), 'checker' => array('func' => 'preg', 'params' => array('/^[1-9][0-9]*$/'), 'error' => _t('_adm_txt_mlevels_order_err'))), 'Submit' => array('type' => 'submit', 'name' => 'Submit', 'value' => _t('_adm_btn_mlevels_add'))));
    //--- Convert Add to Edit
    if ($bEdit) {
        unset($aForm['inputs']['Active']);
        unset($aForm['inputs']['Purchasable']);
        unset($aForm['inputs']['Removable']);
        unset($aForm['inputs']['Icon']);
        $aForm['form_attrs']['action'] = $sSubmitUrl . '?action=edit&level=' . $iLevelId;
        $aForm['inputs']['Submit']['value'] = _t('_adm_btn_mlevels_save');
        $aForm['inputs']['ID'] = array('type' => 'hidden', 'name' => 'ID', 'value' => $iLevelId, 'db' => array('pass' => 'Int'));
    }
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        //--- Add new level
        if (!$bEdit) {
            $sFilePath = BX_DIRECTORY_PATH_ROOT . 'media/images/membership/';
            $sFileName = time();
            $sFileExt = '';
            if ($GLOBALS['MySQL']->getOne("SELECT `Name` FROM `sys_acl_levels` WHERE `Name`='" . $oForm->getCleanValue('Name') . "' LIMIT 1")) {
                $oForm->aInputs['Name']['error'] = _t('_adm_txt_mlevels_name_err_non_uniq');
            } elseif (isImage($_FILES['Icon']['type'], $sFileExt) && !empty($_FILES['Icon']['tmp_name']) && move_uploaded_file($_FILES['Icon']['tmp_name'], $sFilePath . $sFileName . '.' . $sFileExt)) {
                $sPath = $sFilePath . $sFileName . '.' . $sFileExt;
                imageResize($sPath, $sPath, 110, 110);
                $iId = (int) $oForm->insert(array('Icon' => $sFileName . '.' . $sFileExt));
                if ($iId != 0) {
                    $sName = $oForm->getCleanValue('Name');
                    addStringToLanguage('_adm_txt_mp_' . strtolower($sName), $sName);
                }
                header('Location: ' . $sSubmitUrl);
                exit;
            } else {
                $oForm->aInputs['Icon']['error'] = $oForm->aInputs['Icon']['checker']['error'];
            }
        } else {
            $bResult = $oForm->update($iLevelId);
            if ($bResult !== false) {
                deleteStringFromLanguage('_adm_txt_mp_' . strtolower($aLevel['Name']));
                $sName = $oForm->getCleanValue('Name');
                addStringToLanguage('_adm_txt_mp_' . strtolower($sName), $sName);
            }
            header('Location: ' . $sSubmitUrl);
            exit;
        }
    }
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('mlevels_create.html', array('display' => $bActive ? 'block' : 'none', 'form' => $oForm->getCode()));
}
开发者ID:newton27,项目名称:dolphin.pro,代码行数:54,代码来源:memb_levels.php


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