function dt_get_statistics_teachers_list($post_per_page, $curr_page) { $offset = ($curr_page - 1) * $post_per_page; $teachers = get_users(array('offset' => $offset, 'number' => $post_per_page, 'role' => 'teacher')); echo '<table border="0" cellpadding="0" cellspacing="10" style="width:100%;"> <tr> <th scope="col">' . __('#', 'dt_themes') . '</th> <th scope="col">' . __('Teacher', 'dt_themes') . '</th> <th scope="col">' . __('Registered Date', 'dt_themes') . '</th> <th scope="col">' . __('Courses Submitted', 'dt_themes') . '</th> <th scope="col">' . __('Assignments Submitted', 'dt_themes') . '</th> </tr>'; $i = $total_courses_submitted = $total_assignments_submitted = 0; if (isset($teachers) && !empty($teachers)) { foreach ($teachers as $teacher) { $total_courses = $total_assignments = 0; $teacher_id = $teacher->data->ID; $courses_args = array('post_type' => 'dt_courses', 'post_status' => 'publish', 'author' => $teacher_id); $courses = get_posts($courses_args); $total_courses = count($courses); $assignments_args = array('post_type' => 'dt_assignments', 'post_status' => 'publish', 'author' => $teacher_id); $assignments = get_posts($assignments_args); $total_assignments = count($assignments); echo '<tr> <td>' . ($i + 1) . '</td> <td><a href="' . admin_url('admin.php?page=dt-statistics-options&tab=dt_statistics_teachers&teacher_id=' . $teacher_id) . '">' . $teacher->data->display_name . '</a></td> <td>' . $teacher->data->user_registered . '</td> <td>' . $total_courses . '</td> <td>' . $total_assignments . '</td> </tr>'; $i++; } } if ($i == 0) { echo '<tr><td colspan="5">' . __('No Records Found!', 'dt_themes') . '</td></tr>'; } echo '</table>'; $teachers = get_users(array('role' => 'teacher')); echo dtthemes_ajax_pagination($post_per_page, $curr_page, count($teachers), 0); }
function dt_get_teacher_assignments($post_per_page, $curr_page) { $user_id = get_current_user_id(); $offset = ($curr_page - 1) * $post_per_page; echo '<table border="0" cellpadding="0" cellspacing="10" style="width:100%;"> <thead> <tr> <th scope="col">' . __('#', 'dt_themes') . '</th> <th scope="col">' . __('Assignment', 'dt_themes') . '</th> <th scope="col">' . __('Related Course', 'dt_themes') . '</th> <th scope="col">' . __('File Types', 'dt_themes') . '</th> <th scope="col">' . __('File Size (MB)', 'dt_themes') . '</th> </tr> </thead> <tbody>'; $dtassignments = array('posts_per_page' => -1, 'post_type' => 'dt_assignments', 'author' => $user_id); $dtassignments_post = get_posts($dtassignments); $assignments_cnt = count($dtassignments_post); $dt_assignments = array('post_type' => 'dt_assignments', 'offset' => $offset, 'paged' => $curr_page, 'posts_per_page' => $post_per_page, 'author' => $user_id); $dt_assignments_post = get_posts($dt_assignments); if (isset($dt_assignments_post)) { $i = 1; foreach ($dt_assignments_post as $assignment_post) { $assignment_course_evaluation = get_post_meta($assignment_post->ID, "assignment-course-evaluation", true); $dt_assignment_course = get_post_meta($assignment_post->ID, "dt-assignment-course", true); $rel_course = ''; if (isset($assignment_course_evaluation) && $assignment_course_evaluation != '') { $course_args = array('post_type' => 'dt_courses', 'p' => $dt_assignment_course); $course = get_posts($course_args); $rel_course = $course[0]->post_title; } $assignment_attachment_type = get_post_meta($assignment_post->ID, "assignment-attachment-type", true); if (isset($assignment_attachment_type) && !empty($assignment_attachment_type)) { $attacment_types = implode(', ', $assignment_attachment_type); } else { $attacment_types = ''; } $assignment_attachment_size = get_post_meta($assignment_post->ID, "assignment-attachment-size", true); if (isset($assignment_attachment_size) && !empty($assignment_attachment_size)) { $attachment_size = $assignment_attachment_size; } else { $attachment_size = ''; } echo '<tr> <td>' . $i . '</td> <td><a href="' . get_permalink($assignment_post->ID) . '">' . $assignment_post->post_title . '</a></td> <td>' . $rel_course . '</td> <td>' . $attacment_types . '</td> <td>' . $attachment_size . '</td> </tr>'; $i++; } } if ($i == 1) { echo '<tr><td colspan="5">' . __('No assignemnts found!', 'dt_themes') . '</td></tr>'; } echo '</tbody></table>'; echo dtthemes_ajax_pagination($post_per_page, $curr_page, $assignments_cnt, 0); }
if ($starting_price != '') { if (dttheme_option('dt_course', 'currency-position') == 'after-price') { $cost = $starting_price . dttheme_wp_kses(dttheme_option('dt_course', 'currency')); } else { $cost = dttheme_wp_kses(dttheme_option('dt_course', 'currency')) . $starting_price; } } else { $cost = __('Free', 'dt_themes'); } echo '<tr> <td class="courses-table-title"><a href="' . $permalink . '">' . $title . '</a></td> <td class="courses-table-type">' . $course_terms . '</td> <td class="courses-table-lessons">' . $count . '</td> <td class="courses-table-cost">' . $cost . '</td> <td class="courses-table-length">' . $duration . '</td> </tr>'; } echo '</tbody>'; echo '</table>'; $total_posts = $wp_query->found_posts; echo dtthemes_ajax_pagination($post_per_page, $curr_page, $total_posts, ''); echo '<script type="text/javascript"> jQuery(document).ready(function($){ if ($(".courses-table-list").length > 0) { $(".courses-table-list").tablesorter(); } }); </script>'; } else { echo '<div class="dt-sc-info-box">' . __('No Courses Found!', 'dt_themes') . '</div>'; }