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


PHP FormBuilder::getValue方法代码示例

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


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

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

示例2: testGetValue

 public function testGetValue()
 {
     $this->element->value('test');
     $this->assertSame('test', $this->element->getValue());
 }
开发者ID:boyhagemann,项目名称:form,代码行数:5,代码来源:AbstractElementTest.php


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