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


PHP FormBuilder::toString方法代码示例

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


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

示例1: getHTML

 /**
  * Render the form as HTML and return it.
  * @return String The HTML for the form.
  */
 public function getHTML()
 {
     if ($this->formObj) {
         $this->processPost();
         return $this->messages . $this->formObj->toString();
     }
     return false;
 }
开发者ID:NClaus,项目名称:Ambrose,代码行数:12,代码来源:utils_easyform.inc.php

示例2: render

 /**
  * Renders widget
  * @return string
  */
 public function render()
 {
     if ($this->parentShortcode && $this->parentShortcode->getAttributesNormalized()) {
         $this->parentSchemaName = '[parent]';
         $this->appendShortcodeForm($this->parentShortcode, 'parent', $this->parentDefaultValues);
         $this->parentSchemaName = '';
     }
     foreach ($this->shortcodes as $shortcode) {
         //sometimes we may be in trouble
         $this->appendShortcodeForm($shortcode);
     }
     return (string) $this->form->toString();
 }
开发者ID:clevervaughn,项目名称:dottiesbiscuitbarn,代码行数:17,代码来源:ctShortcodeDecorator.class.php

示例3: WPCW_showPage_Settings_load

/**
 * Shows the settings page for the plugin.
 */
function WPCW_showPage_Settings_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Training Courses - Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    // Check for update flag
    if (isset($_POST['update']) && $_POST['update'] == 'tables_force_upgrade') {
        $page->showMessage(__('Upgrading WP Courseware Tables...', 'wp_courseware'));
        flush();
        $installed_ver = get_option(WPCW_DATABASE_KEY) + 0;
        WPCW_database_upgradeTables($installed_ver, true, true);
        $page->showMessage(sprintf(__('%s tables have successfully been upgraded.', 'wp_courseware'), 'WP Courseware'));
    }
    $settingsFields = array('section_access_key' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Licence Key Settings', 'wp_courseware'))), 'licence_key' => array('label' => __('Licence Key', 'wp_courseware'), 'type' => 'text', 'desc' => __('Your licence key for the WP Courseware plugin.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 32, 'minlen' => 32, 'regexp' => '/^[A-Za-z0-9]+$/', 'error' => __('Please enter your 32 character licence key, which contains only letters and numbers.', 'wp_courseware'))), 'license_activation' => array('label' => __('Licence Activation', 'wp_courseware'), 'type' => 'radio', 'required' => 'true', 'data' => array('activate_license' => sprintf('<b>%s</b>', __('Activate', 'wp_courseware')), 'deactivate_license' => sprintf('<b>%s</b>', __('Deactivate', 'wp_courseware'))), 'desc' => __('If you want to receive updates to this plugin, select "Activate". Otherwise, select "Deactivate" to deactivate license. Selecting "Deactivate" will disable any future updates. Deactivating your license allows you to move your plugin to another site.', 'wp_courseware')), 'section_default_css' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Style &amp; Design Settings', 'wp_courseware'))), 'use_default_css' => array('label' => __('Use Default CSS?', 'wp_courseware'), 'type' => 'radio', 'required' => 'true', 'data' => array('show_css' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Use default stylesheet for the frontend of the website.', 'wp_courseware')), 'hide_css' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t use the default stylesheet for the frontend of the website (you\'ll write your own CSS)', 'wp_courseware'))), 'desc' => __('If you want to style your training course material yourself, you can disable the default stylesheet. If in doubt, select <b>Yes</b>.', 'wp_courseware')), 'section_link' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Powered By Link', 'wp_courseware'))), 'show_powered_by' => array('label' => __('Show Powered By Link?', 'wp_courseware'), 'type' => 'radio', 'required' => 'true', 'data' => array('show_link' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Show the <em>\'Powered By WP Courseware\'</em> link.', 'wp_courseware')), 'hide_link' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t show any powered-by links.', 'wp_courseware'))), 'desc' => __("Do you want to show a 'Powered By WP Courseware' link at the bottom of course outlines?", 'wp_courseware')), 'affiliate_id' => array('label' => __('Your Affiliate ID', 'wp_courseware'), 'type' => 'text', 'desc' => __("(Optional) Earn some money by providing your Affiliate ID, which will turn the <b>Powered By WP Courseware</b> into an affiliate link that earns you a percentage of every sale! If you are not an affiliate, login to the member portal to register and get your ID.", 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 15, 'minlen' => 1, 'regexp' => '/^[A-Za-z0-9\\-_]+$/', 'error' => __('Please enter your Affiliate ID, which is only a number..', 'wp_courseware'))));
    // Remove licence key for child multi-sites
    if (!WPCW_plugin_hasAdminRights()) {
        unset($settingsFields['section_access_key']);
        unset($settingsFields['licence_key']);
    }
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_general');
    $settings->setSaveButtonLabel(__('Save ALL Settings', 'wp_courseware'));
    // Update messages for translation
    $settings->msg_settingsSaved = __('Settings successfully saved.', 'wp_courseware');
    $settings->msg_settingsProblem = __('There was a problem saving the settings.', 'wp_courseware');
    $settings->customFormErrorMsg = __('Sorry, but unfortunately there were some errors saving the course details. Please fix the errors and try again.', 'wp_courseware');
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    // Form event handlers - processes the saved settings in some way
    $settings->afterSaveFunction = 'WPCW_showPage_Settings_afterSave';
    $settings->afterSaveFunction = 'edd_activate_license_WPCW';
    $settings->show();
    // Create little form to force upgrading tables if something went wrong during update.
    echo WPCW_forms_createBreakHTML(__("Upgrade Tables", 'wp_courseware'), false, true, 'wpcw_upgrade_tables');
    ?>
	
	<p><?php 
    _e("If you're getting any errors with WP Courseware relating to database tables when you've updated, you can force an upgrade of the database tables using the button below.", 'wp_courseware');
    ?>
</p>
	<?php 
    $form = new FormBuilder('tables_force_upgrade');
    $form->setSubmitLabel(__('Force Table Upgrade', 'wp_courseware'));
    echo $form->toString();
    // RHS Support Information
    $page->showPageMiddle('23%');
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
开发者ID:Juni4567,项目名称:meritscholarship,代码行数:51,代码来源:page_settings.inc.php

示例4: WPCW_showPage_ImportExport_importUsers

/**
 * Show the import course page.
 */
function WPCW_showPage_ImportExport_importUsers()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Import Users from CSV File', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    // Show selection menu for import/export to save pages
    WPCW_showPage_ImportExport_menu('import_users');
    // Show form to import some XML
    $form = new FormBuilder('wpcw_import_users');
    $form->setSubmitLabel(__('Import Users', 'wp_courseware'));
    // Course upload for XML file
    $formElem = new FormElement('import_course_csv', __('User Import CSV File', 'wp_courseware'), true);
    $formElem->setTypeAsUploadFile();
    $form->addFormElement($formElem);
    if ($form->formSubmitted()) {
        // Do the full export
        if ($form->formValid()) {
            // Handle the importing/uploading
            WPCW_users_importUsersFromFile($page);
        } else {
            $page->showListOfErrors($form->getListOfErrors(), __('Unfortunately, there were some errors trying to import the XML file.', 'wp_courseware'));
        }
    }
    // Workout maximum upload size
    $max_upload = (int) ini_get('upload_max_filesize');
    $max_post = (int) ini_get('post_max_size');
    $memory_limit = (int) ini_get('memory_limit');
    $upload_mb = min($max_upload, $max_post, $memory_limit);
    printf('<p class="wpcw_doc_quick">');
    printf(__('You can import a CSV file of users using the form below.', 'wp_courseware') . ' ' . __('The <b>maximum upload file size</b> for your server is <b>%d MB</b>.', 'wp_courseware'), $upload_mb);
    printf('</p>');
    echo $form->toString();
    printf('<br/><br/><div class="wpcw_docs_wrapper">');
    printf('<b>%s</b>', __('Some tips for importing users via a CSV file:', 'wp_courseware'));
    printf('<ul>');
    printf('<li>' . __('If a user email address already exists, then just the courses are updated for that user.', 'wp_courseware'));
    printf('<li>' . __('User names are generated from the first and last name information. If a user name already exists, then a unique username is generated.', 'wp_courseware'));
    printf('<li>' . __('To add a user to many courses, just separate those course IDs with a comma in the <code>courses_to_add_to</code> column.', 'wp_courseware'));
    printf('<li>' . __('If a user is created, any courses set to be automatically assigned will be done first, and then the courses added in the <code>courses_to_add_to</code> column.', 'wp_courseware'));
    printf('<li>' . __('You can download an <a href="%s">example CSV file here</a>.', 'wp_courseware') . '</li>', admin_url('?wpcw_export=csv_import_user_sample'));
    printf('<li>' . __('The IDs for the training courses can be found on the <a href="%s">course summary page</a>.', 'wp_courseware') . '</li>', admin_url('admin.php?page=WPCW_wp_courseware'));
    printf('</ul>');
    printf('</div>');
    $page->showPageFooter();
}
开发者ID:umairriaz90,项目名称:Daschug1,代码行数:47,代码来源:page_import_export.inc.php

示例5: WPPortfolio_modify_group


//.........这里部分代码省略.........
    if ($editmode && $groupid == 0) {
        WPPortfolio_showMessage(sprintf(__('Sorry, but no group with that ID could be found. Please click <a href="%s">here</a> to return to the list of groups.', 'wp-portfolio'), WPP_GROUP_SUMMARY), true);
        return;
    }
    $groupdetails = false;
    // ### EDIT ### Check if we're adding or editing a group
    if ($editmode && $groupid > 0) {
        // Get details from the database
        $groupdetails = WPPortfolio_getGroupDetails($groupid);
        // False alarm, couldn't find it.
        if (count($groupdetails) == 0) {
            $editmode = false;
        }
    }
    // end of editing check
    // Check if group is being updated/added.
    if (isset($_POST) && isset($_POST['update'])) {
        // Grab specified details
        $data = array();
        $data['groupid'] = $groupid;
        $data['groupname'] = strip_tags($_POST['group_groupname']);
        $data['groupdescription'] = $_POST['group_groupdescription'];
        $data['grouporder'] = $_POST['group_grouporder'] + 0;
        // Add zero to convert to number
        // Keep track of errors for validation
        $errors = array();
        // Ensure all fields have been completed
        if (!($data['groupname'] && $data['groupdescription'])) {
            array_push($errors, __("Please check that you have completed the group name and description fields.", 'wp-portfolio'));
        }
        // Continue if there are no errors
        if (count($errors) == 0) {
            global $wpdb;
            $table_name = $wpdb->prefix . TABLE_WEBSITE_GROUPS;
            // Change query based on add or edit
            if ($editmode) {
                $query = arrayToSQLUpdate($table_name, $data, 'groupid');
            } else {
                unset($data['groupid']);
                // Don't need id for an insert
                $query = arrayToSQLInsert($table_name, $data);
            }
            // Try to put the data into the database
            $wpdb->show_errors();
            $wpdb->query($query);
            // When editing, show what we've just been editing.
            if ($editmode) {
                WPPortfolio_showMessage(__("Group details successfully updated.", 'wp-portfolio'));
                // Retrieve the details from the database again
                $groupdetails = WPPortfolio_getGroupDetails($groupid);
            } else {
                WPPortfolio_showMessage(__("Group details successfully added.", 'wp-portfolio'));
                $groupdetails['groupid'] = false;
                $groupdetails['groupname'] = false;
                $groupdetails['groupdescription'] = false;
                $groupdetails['grouporder'] = false;
            }
        } else {
            $message = __("Sorry, but unfortunately there were some errors. Please fix the errors and try again.", 'wp-portfolio') . '<br><br>';
            $message .= "<ul style=\"margin-left: 20px; list-style-type: square;\">";
            // Loop through all errors in the $error list
            foreach ($errors as $errormsg) {
                $message .= "<li>{$errormsg}</li>";
            }
            $message .= "</ul>";
            WPPortfolio_showMessage($message, true);
            $groupdetails = $data;
        }
    }
    $form = new FormBuilder();
    $formElem = new FormElement("group_groupname", __("Group Name", 'wp-portfolio'));
    $formElem->value = WPPortfolio_getArrayValue($groupdetails, 'groupname');
    $formElem->description = __("The name for this group of websites.", 'wp-portfolio');
    $form->addFormElement($formElem);
    $formElem = new FormElement("group_groupdescription", __("Group Description", 'wp-portfolio'));
    $formElem->value = WPPortfolio_getArrayValue($groupdetails, 'groupdescription');
    $formElem->description = __("The description of your group. HTML is permitted.", 'wp-portfolio');
    $formElem->setTypeAsTextArea(4, 70);
    $form->addFormElement($formElem);
    $formElem = new FormElement("group_grouporder", __("Group Order", 'wp-portfolio'));
    $formElem->value = WPPortfolio_getArrayValue($groupdetails, 'grouporder');
    $formElem->description = '&bull; ' . __("The number to use for ordering the groups. Groups are rendered in ascending order, first by this order value (lowest value first), then by group name.", 'wp-portfolio') . '<br/>' . '&bull; ' . __('e.g. Groups (A, B, C, D) with ordering (50, 100, 0, 50) will be rendered as (C, A, D, B).', 'wp-portfolio') . '<br/>' . '&bull; ' . __("If all groups have 0 for ordering, then the groups are rendered in alphabetical order.", 'wp-portfolio');
    $form->addFormElement($formElem);
    // Hidden Elements
    $formElem = new FormElement("group_groupid", false);
    $formElem->value = WPPortfolio_getArrayValue($groupdetails, 'groupid');
    $formElem->setTypeAsHidden();
    $form->addFormElement($formElem);
    $formElem = new FormElement("editmode", false);
    $formElem->value = $editmode ? "edit" : "add";
    $formElem->setTypeAsHidden();
    $form->addFormElement($formElem);
    $form->setSubmitLabel(($editmode ? __("Update", 'wp-portfolio') : __("Add", 'wp-portfolio')) . " " . __("Group Details", 'wp-portfolio'));
    echo $form->toString();
    ?>
		
	<br><br>
	</div><!-- wrap -->
	<?php 
}
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:wp-portfolio.php

示例6: showMembershipMappingLevels_specificLevel

 /**
  * Show the form for editing the specific courses a user can access based on what level that they have access to.
  * @param PageBuilder $page The page rendering object.
  * @param Array $levelDetails The list of level details
  */
 private function showMembershipMappingLevels_specificLevel($page, $levelDetails)
 {
     // Show a nice summary of what level is being edited.
     printf('<div id="wpcw_member_level_name_title">%s</div>', sprintf(__('Editing permissions for <b>%s</b> level with <b>%s</b>:', 'wp_courseware'), $levelDetails['name'], $this->extensionName));
     // Get a list of course IDs that exist
     $courses = WPCW_courses_getCourseList(false);
     // Get list of courses already associated with level.
     $courseListInDB = $this->getCourseAccessListForLevel($levelDetails['id']);
     // Create the summary URL to return
     $summaryURL = admin_url('admin.php?page=' . $this->extensionID);
     // Update form...
     $form = new FormBuilder('wpcw_member_levels_edit');
     $form->setSubmitLabel(__('Save Changes', 'wp_courseware'));
     // Create list of courses using checkboxes (max of 2 columns)
     $elem = new FormElement('level_courses', __('Courses user can access at this level', 'wp_courseware'), false);
     $elem->setTypeAsCheckboxList($courses);
     $elem->checkboxListCols = 2;
     $form->addFormElement($elem);
     // Normally would check for errors too, but there's not a lot to check here.
     if ($form->formSubmitted()) {
         if ($form->formValid()) {
             $mapplingList = $form->getValue('level_courses');
             global $wpdb, $wpcwdb;
             $wpdb->show_errors();
             // Remove all previous level mappings (as some will have been removed)
             $wpdb->query($wpdb->prepare("\n\t\t\t\t\t\tDELETE \n\t\t\t\t\t\tFROM {$wpcwdb->map_member_levels} \n\t\t\t\t\t\tWHERE member_level_id = %s\n\t\t\t\t\t", $levelDetails['id']));
             // Add all of the new mappings the user has chosen.
             if ($mapplingList && count($mapplingList) > 0) {
                 foreach ($mapplingList as $courseID => $itemState) {
                     $wpdb->query($wpdb->prepare("\n\t\t\t\t\t\t\t\tINSERT INTO {$wpcwdb->map_member_levels} \n\t\t\t\t\t\t\t\t(course_id, member_level_id)  \n\t\t\t\t\t\t\t\tVALUES (%d, %s)\n\t\t\t\t\t\t\t", $courseID, $levelDetails['id']));
                 }
             }
             // Show a success message.
             $page->showMessage(__('Level and course permissions successfully updated.', 'wp_courseware') . '<br/><br/>' . sprintf(__('Want to return to the <a href="%s">Course Access Settings summary</a>?', 'wp_courseware'), $summaryURL));
         }
         // if ($form->formValid())
     } else {
         $form->setDefaultValues(array('level_courses' => $courseListInDB));
     }
     // Show the form
     echo $form->toString();
     printf('<a href="%s" class="button-secondary">%s</a>', $summaryURL, __('&laquo; Return to Course Access Settings summary', 'wp_courseware'));
 }
开发者ID:JalpMi,项目名称:v2contact,代码行数:48,代码来源:class_members.inc.php

示例7: STWWT_showPage_ThumbnailCache

/**
 * Shows information about the thumbnail cache.
 */
function STWWT_showPage_ThumbnailCache()
{
    $page = new PageBuilder(false);
    $page->showPageHeader(__('Shrink The Web - Website Thumbnails - Cache', 'stwwt'), '70%');
    ?>
	<h3>Clear Thumbnail Cache</h3>
	<p>Generally speaking, you do not need to clear the thumbnail cache. The plugin automatically manages the thumbnail cache, updating thumbnails automatically. However, if you do need to clear the cache for any reason, you can use the button below to flush the cache.</p>
	<?php 
    $form = new FormBuilder('stwwt_cache_clear');
    $form->setSubmitLabel('Clear Thumbnail Cache');
    if ($form->formSubmitted() && $form->formValid()) {
        STWWT_cache_emptyCache(false);
        $page->showMessage("Cache successfully emptied.");
    }
    echo $form->toString();
    // #### Cache Path Information
    $cachePathDir = STWWT_plugin_getCacheDirectory();
    $cachePathURL = STWWT_plugin_getCacheURL();
    $pathIsWriteable = file_exists($cachePathDir) && is_dir($cachePathDir) && is_writable($cachePathDir);
    ?>
	<br/>
	<h3>Cache Path Information</h3>
	<p>Your server cache path is <b><?php 
    echo $cachePathDir;
    ?>
</b>, which translates to a URL of <b><?php 
    echo $cachePathURL;
    ?>
</b>.</p>
	<p>Your cache path is currently <?php 
    echo $pathIsWriteable ? '<span class="stwwt_cache_status stwwt_cache_ok">Writeable</span>. This is fine, so you do not need to do anything more.' : '<span class="stwwt_cache_status stwwt_cache_error">Not Writeable</span>. This needs fixing for the thumbnail cache to work.';
    ?>
</p>
	<?php 
    $page->showPageFooter();
}
开发者ID:nerdhaus,项目名称:avse,代码行数:39,代码来源:admin_only.inc.php


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