class-zvc-admin-recordings.php
3.39 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* Class Recordings
*
* @author Deepen
* @since 3.5.0
*/
class Zoom_Video_Conferencing_Recordings {
private static $instance;
public function __construct() {
}
static function getInstance() {
if ( null === static::$instance ) {
static::$instance = new static();
}
return static::$instance;
}
/**
* Zoom Recordings View
*
* @since 3.5.0
* @changes in CodeBase
* @author Deepen Bajracharya
*/
public static function zoom_recordings() {
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_script( 'video-conferencing-with-zoom-api-select2-js' );
wp_enqueue_script( 'video-conferencing-with-zoom-api-datable-js' );
wp_enqueue_script( 'thickbox' );
wp_enqueue_style( 'thickbox' );
wp_enqueue_script( 'video-conferencing-with-zoom-api-js' );
//Check if any transient by name is available
if ( isset( $_GET['host_id'] ) ) {
if ( isset( $_POST['check-recordings'] ) && isset( $_POST['date'] ) ) {
$search_date = strtotime( $_POST['date'] );
$from = date( 'Y-m-d', $search_date );
$to = date( 'Y-m-t', $search_date );
$postParams['from'] = $from;
$postParams['to'] = $to;
$recordings = json_decode( zoom_conference()->listRecording( $_GET['host_id'], $postParams ) );
} else {
$recordings = json_decode( zoom_conference()->listRecording( $_GET['host_id'] ) );
}
}
if ( ! empty( $recordings ) && ! empty( $recordings->code ) ) {
echo '<p>' . $recordings->message . '</p>';
} else {
//Get Template
require_once ZVC_PLUGIN_VIEWS_PATH . '/live/tpl-list-recordings.php';
}
}
/**
* Get Host selection HTML block
*
* @param $host_id
* @param $datepicker
*/
public function get_hosts( $host_id, $datepicker = false ) {
$users = video_conferencing_zoom_api_get_user_transients();
?>
<div class="select_zvc_user_listings_wrapp">
<?php
if ( $datepicker ) {
?>
<div class="alignleft">
<form action="" class="vczapi-datepicker-admin" method="POST">
<label><?php _e( 'Enter the date to check:', 'video-conferencing-with-zoom-api' ); ?></label>
<input name="date" id="vczapi-check-recording-date"/> <input type="submit" name="check-recordings" value="<?php _e( 'Check', 'video-conferencing-with-zoom-api' ); ?>">
</form>
</div>
<?php
}
?>
<div class="alignright">
<select onchange="location = this.value;" class="zvc-hacking-select">
<option value="?post_type=zoom-meetings&page=zoom-video-conferencing"><?php _e( 'Select a User', 'video-conferencing-with-zoom-api' ); ?></option>
<?php
foreach ( $users as $user ) {
$host_recordings_link = add_query_arg( array(
'post_type' => 'zoom-meetings',
'page' => 'zoom-video-conferencing-recordings',
'host_id' => $user->id
), admin_url( 'edit.php' ) );
?>
<option value="<?php echo esc_url( $host_recordings_link ); ?>" <?php echo $host_id == $user->id ? 'selected' : false; ?>><?php echo $user->first_name . ' ( ' . $user->email . ' )'; ?></option>
<?php } ?>
</select>
</div>
<div class="clear"></div>
</div>
<?php
}
}
function zvc_recordings() {
return Zoom_Video_Conferencing_Recordings::getInstance();
}
zvc_recordings();