-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLTI_Tool_LearnDash_Binary_Selector_Courses.php
59 lines (51 loc) · 1.82 KB
/
LTI_Tool_LearnDash_Binary_Selector_Courses.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/*
* lti-tool-learndash - WordPress module to integrate LTI support with LearnDash
* Copyright (C) 2024 Stephen P Vickers
*
* Author: [email protected]
*/
if (!defined('ABSPATH')) {
exit;
}
class LTI_Tool_LearnDash_Binary_Selector_Courses extends Learndash_Binary_Selector_Posts
{
/**
* Public constructor for class
*
* @param array $args Array of arguments for class.
*/
public function __construct($args = array())
{
$this->selector_class = get_class($this);
$defaults = array(
'user_id' => 0,
'post_type' => 'sfwd-courses',
'html_title' => '<h3>' . esc_html_x('Registered LearnDash Courses', 'Registered LearnDash courses label',
LTI_TOOL_LEARNDASH_PLUGIN_NAME) . '</h3>',
'html_id' => 'lti_tool_learndash_courses',
'html_class' => 'lti_tool_learndash_courses',
'html_name' => 'lti_tool_learndash_courses',
'suppress_filters' => true,
'search_label_left' => sprintf(
esc_html_x('Search All LearnDash %s', 'Search All LearnDash Courses Label', LTI_TOOL_LEARNDASH_PLUGIN_NAME),
LearnDash_Custom_Label::get_label('courses')
),
'search_label_right' => sprintf(
esc_html_x('Search Registered LearnDash %s', 'Search Registered LearnDash Courses Label',
LTI_TOOL_LEARNDASH_PLUGIN_NAME), LearnDash_Custom_Label::get_label('courses')
),
);
$args = wp_parse_args($args, $defaults);
parent::__construct($args);
}
function getCourses()
{
$courses = array();
$query = new WP_Query($this->args);
if ($query->have_posts()) {
$courses = $query->posts;
}
return $courses;
}
}