本文整理汇总了PHP中Course::get_course方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::get_course方法的具体用法?PHP Course::get_course怎么用?PHP Course::get_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::get_course方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<div class="alignleft actions">
<select name="course_id" id="dynamic_courses" class="chosen-select">
<?php
$args = array('post_type' => 'course', 'post_status' => 'any', 'posts_per_page' => -1);
$courses = get_posts($args);
$courses_with_students = 0;
$course_num = 0;
$first_course_id = 0;
foreach ($courses as $course) {
if ($course_num == 0) {
$first_course_id = $course->ID;
}
$course_obj = new Course($course->ID);
$course_object = $course_obj->get_course();
if ($course_obj->get_number_of_students() >= 1) {
$courses_with_students++;
?>
<option value="<?php
echo $course->ID;
?>
" <?php
echo isset($_GET['course_id']) && $_GET['course_id'] == $course->ID ? 'selected="selected"' : '';
?>
><?php
echo $course->post_title;
?>
</option>
<?php
}
示例2: Course
function check_for_valid_post_type_permalinks($permalink, $post, $leavename)
{
if (get_post_type($post->ID) == 'discussions') {
$course_id = get_post_meta($post->ID, 'course_id', true);
if (!empty($course_id)) {
$course_obj = new Course($course_id);
$course = $course_obj->get_course();
return str_replace('%course%', $course->post_name, $permalink);
} else {
return $permalink;
}
} else {
if (get_post_type($post->ID) == 'notifications') {
$course_id = get_post_meta($post->ID, 'course_id', true);
if (!empty($course_id)) {
$course_obj = new Course($course_id);
$course = $course_obj->get_course();
return str_replace('%course%', $course->post_name, $permalink);
} else {
return $permalink;
}
} else {
if (get_post_type($post->ID) == 'unit') {
return Unit::get_permalink($post->ID);
} else {
return $permalink;
}
}
}
}
示例3: Student
function course_details($atts)
{
global $wp_query, $signup_url, $coursepress;
$student = new Student(get_current_user_id());
extract(shortcode_atts(array('course_id' => isset($wp_query->post->ID) ? $wp_query->post->ID : 0, 'field' => 'course_start_date'), $atts));
$course_id = (int) $course_id;
$field = sanitize_html_class($field);
$course_obj = new Course($course_id);
if ($course_obj->is_open_ended()) {
$open_ended = true;
} else {
$open_ended = false;
}
$course = $course_obj->get_course();
if ($field == 'action_links') {
$withdraw_link_visible = false;
if ($student->user_enrolled_in_course($course_id)) {
if (strtotime($course->course_start_date) <= current_time('timestamp', 0) && strtotime($course->course_end_date) >= current_time('timestamp', 0) || strtotime($course->course_end_date) >= current_time('timestamp', 0) || $course->open_ended_course == 'on') {
//course is currently active or is not yet active ( will be active in the future )
$withdraw_link_visible = true;
}
}
$course->action_links = '<div class="apply-links">';
if ($withdraw_link_visible === true) {
$course->action_links .= '<a href="?withdraw=' . $course->ID . '" onClick="return withdraw();">' . __('Withdraw', 'cp') . '</a> | ';
}
$course->action_links .= '<a href="' . get_permalink($course->ID) . '">' . __('Course Details', 'cp') . '</a></div>';
}
if ($field == 'class_size') {
if ($course->class_size == '0' || $course->class_size == '') {
$course->class_size = __('Infinite', 'cp');
} else {
$count_left = $course->class_size - $course_obj->get_number_of_students();
$course->class_size = $course->class_size . ' ' . sprintf(__('( %d left )', 'cp'), $count_left);
}
}
$passcode_box_visible = false;
if (!isset($course->enroll_type)) {
$course->enroll_type = 'anyone';
} else {
if ($course->enroll_type == 'passcode') {
$course->enroll_type = __('Anyone with a Passcode', 'cp');
$passcode_box_visible = true;
}
if ($course->enroll_type == 'prerequisite') {
$course->init_enroll_type = 'prerequisite';
$course->enroll_type = sprintf(__('Anyone who attanded to the %1s', 'cp'), '<a href="' . get_permalink($course->prerequisite) . '">' . __('prerequisite course', 'cp') . '</a>');
//__( 'Anyone who attended to the ', 'cp' );
}
}
if ($field == 'enroll_type') {
if ($course->enroll_type == 'anyone') {
$course->enroll_type = __('Anyone', 'cp');
}
if ($course->enroll_type == 'manually') {
$course->enroll_type = __('Public enrollments are disabled', 'cp');
}
}
if ($field == 'course_start_date' or $field == 'course_end_date' or $field == 'enrollment_start_date' or $field == 'enrollment_end_date') {
$date_format = get_option('date_format');
if ($course->open_ended_course == 'on') {
$course->{$field} = __('Open-ended', 'cp');
} else {
if ($course->{$field} == '') {
$course->{$field} = __('N/A', 'cp');
} else {
$course->{$field} = cp_sp2nbsp(date_i18n($date_format, strtotime($course->{$field})));
}
}
}
if ($field == 'price') {
global $coursepress;
$is_paid = get_post_meta($course_id, 'paid_course', true) == 'on' ? true : false;
if ($is_paid && isset($course->marketpress_product) && $course->marketpress_product != '' && $coursepress->marketpress_active) {
echo do_shortcode('[mp_product_price product_id="' . $course->marketpress_product . '" label=""]');
} else {
$course->price = __('FREE', 'cp');
}
}
if ($field == 'button') {
$course->button = '<form name="enrollment-process" method="post" action="' . do_shortcode("[courses_urls url='enrollment-process']") . '">';
if (is_user_logged_in()) {
if (!$student->user_enrolled_in_course($course_id)) {
if (!$course_obj->is_populated()) {
if ($course->enroll_type != 'manually') {
if (strtotime($course->course_end_date) <= current_time('timestamp', 0) && $course->open_ended_course == 'off') {
//Course is no longer active
$course->button .= '<span class="apply-button-finished">' . __('Finished', 'cp') . '</span>';
} else {
if ($course->enrollment_start_date !== '' && $course->enrollment_end_date !== '' && strtotime($course->enrollment_start_date) <= current_time('timestamp', 0) && strtotime($course->enrollment_end_date) >= current_time('timestamp', 0) || $course->open_ended_course == 'on') {
if ($course->init_enroll_type == 'prerequisite' && $student->user_enrolled_in_course($course->prerequisite) || $course->init_enroll_type !== 'prerequisite') {
$course->button .= '<input type="submit" class="apply-button" value="' . __('Enroll Now', 'cp') . '" />';
$course->button .= '<div class="passcode-box">' . do_shortcode('[course_details field="passcode_input"]') . '</div>';
} else {
$course->button .= '<span class="apply-button-finished">' . __('Prerequisite Required', 'cp') . '</span>';
}
} else {
if (strtotime($course->enrollment_end_date) <= current_time('timestamp', 0)) {
$course->button .= '<span class="apply-button-finished">' . __('Not available', 'cp') . '</span>';
} else {
//.........这里部分代码省略.........
示例4: array
<?php
// CP_Helper_Tooltip::tooltip( __( 'Students will need to fulfil prerequisite in order to enroll.', 'cp' ) );
?>
</label>
<p><?php
_e('Students will need to complete the following prerequisite course in order to enroll.', 'cp');
?>
</p>
<select name="meta_prerequisite" class="chosen-select">
<?php
$args = array('post_type' => 'course', 'post_status' => 'any', 'posts_per_page' => -1, 'exclude' => $course_id);
$pre_courses = get_posts($args);
foreach ($pre_courses as $pre_course) {
$pre_course_obj = new Course($pre_course->ID);
$pre_course_object = $pre_course_obj->get_course();
?>
<option value="<?php
echo $pre_course->ID;
?>
" <?php
selected($prerequisite, $pre_course->ID, true);
?>
><?php
echo $pre_course->post_title;
?>
</option>
<?php
}
?>
</select>