本文整理汇总了PHP中WooThemes_Sensei_Utils::generate_drop_down方法的典型用法代码示例。如果您正苦于以下问题:PHP WooThemes_Sensei_Utils::generate_drop_down方法的具体用法?PHP WooThemes_Sensei_Utils::generate_drop_down怎么用?PHP WooThemes_Sensei_Utils::generate_drop_down使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WooThemes_Sensei_Utils
的用法示例。
在下文中一共展示了WooThemes_Sensei_Utils::generate_drop_down方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: all_lessons_edit_fields
/**
* Add the admin all lessons screen edit options.
*
* The fields in this function work for both quick and bulk edit. The ID attributes is used
* by bulk edit javascript in the front end to retrieve the new values set byt the user. Then
* name attribute is will be used by the quick edit and submitted via standard POST. This
* will use this classes save_post_meta function to save the new field data.
*
* @hooked quick_edit_custom_box
* @hooked bulk_edit_custom_box
*
* @since 1.8.0
*
* @param string $column_name
* @param string $post_type
* @return void
*/
public function all_lessons_edit_fields($column_name, $post_type)
{
// only show these options ont he lesson post type edit screen
if ('lesson' != $post_type || 'lesson-course' != $column_name) {
return;
}
?>
<fieldset class="sensei-edit-field-set inline-edit-lesson">
<div class="sensei-inline-edit-col column-<?php
echo $column_name;
?>
">
<?php
echo '<h4>' . __('Lesson Information', 'woothemes-sensei') . '</h4>';
// create a nonce field to be used as a security measure when saving the data
wp_nonce_field('bulk-edit-lessons', '_edit_lessons_nonce');
wp_nonce_field('sensei-save-post-meta', 'woo_' . $this->token . '_nonce');
// unchanged option - we need this in because
// the default option in bulk edit should not be empty. If it is
// the user will erase data they didn't want to touch.
$no_change_text = '-- ' . __('No Change', 'woothemes-sensei') . ' --';
//
//course selection
//
$courses = WooThemes_Sensei_Course::get_all_courses();
$course_options = array();
if (count($courses) > 0) {
foreach ($courses as $course) {
$course_options[$course->ID] = get_the_title($course->ID);
}
}
//pre-append the no change option
$course_options['-1'] = $no_change_text;
$course_attributes = array('name' => 'lesson_course', 'id' => 'sensei-edit-lesson-course', 'class' => ' ');
$course_field = WooThemes_Sensei_Utils::generate_drop_down('-1', $course_options, $course_attributes);
echo $this->generate_all_lessons_edit_field(__('Lesson Course', 'woothemes-sensei'), $course_field);
//
// lesson complexity selection
//
$lesson_complexities = $this->lesson_complexities();
//pre-append the no change option
$lesson_complexities['-1'] = $no_change_text;
$complexity_dropdown_attributes = array('name' => 'lesson_complexity', 'id' => 'sensei-edit-lesson-complexity', 'class' => ' ');
$complexity_filed = WooThemes_Sensei_Utils::generate_drop_down('-1', $lesson_complexities, $complexity_dropdown_attributes);
echo $this->generate_all_lessons_edit_field(__('Lesson Complexity', 'woothemes-sensei'), $complexity_filed);
?>
<h4><?php
_e('Quiz Settings', 'woothemes-sensei');
?>
</h4>
<?php
//
// Lesson require pass to complete
//
$pass_required_options = array('-1' => $no_change_text, '0' => __('No', 'woothemes'), '1' => __('Yes', 'woothemes'));
$pass_required_select_attributes = array('name' => 'pass_required', 'id' => 'sensei-edit-lesson-pass-required', 'class' => ' ');
$require_pass_field = WooThemes_Sensei_Utils::generate_drop_down('-1', $pass_required_options, $pass_required_select_attributes, false);
echo $this->generate_all_lessons_edit_field(__('Pass required', 'woothemes-sensei'), $require_pass_field);
//
// Quiz pass percentage
//
$quiz_pass_percentage_field = '<input name="quiz_passmark" id="sensei-edit-quiz-pass-percentage" type="number" />';
echo $this->generate_all_lessons_edit_field(__('Pass Percentage', 'woothemes-sensei'), $quiz_pass_percentage_field);
//
// Enable quiz reset button
//
$quiz_reset_select__options = array('-1' => $no_change_text, '0' => __('No', 'woothemes'), '1' => __('Yes', 'woothemes'));
$quiz_reset_name_id = 'sensei-edit-enable-quiz-reset';
$quiz_reset_select_attributes = array('name' => 'enable_quiz_reset', 'id' => $quiz_reset_name_id, 'class' => ' ');
$quiz_reset_field = WooThemes_Sensei_Utils::generate_drop_down('-1', $quiz_reset_select__options, $quiz_reset_select_attributes, false);
echo $this->generate_all_lessons_edit_field(__('Enable quiz reset button', 'woothemes-sensei'), $quiz_reset_field);
?>
</div>
</fieldset>
<?php
}