'html5,silverlight,flash,html4',
'browse_button' => 'plupload-browse-button',
'container' => 'plupload-upload-ui',
'drop_element' => 'drag-drop-area',
'file_data_name' => 'async-upload',
'multiple_queues' => true,
'max_file_size' => wp_max_upload_size().'b',
'url' => admin_url('admin-ajax.php'),
'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')),
'multipart' => true,
'urlstream_upload' => true,
'multipart_params' => array(
'_ajax_nonce' => wp_create_nonce('document-upload'),
'action' => 'tp_document_upload',
'course_id' => $course_id
),
);
}
/**
* Gets the interface of the document manager
* @param int $course_id The course ID
* @param string $mode course or tinyMCE
* @since 5.0.0
* @access private
*/
private static function get_interface ($course_id, $mode) {
?>
teachPress Document Manager
';
echo '';
echo '';
echo '';
}
/**
* Returns the window content of the document manager for the tinyMCE plugin
* @global type $current_user
* @since 6.0.0
* @access public
*/
public static function get_window () {
if ( is_user_logged_in() && current_user_can('use_teachpress') ) {
self::get_window_header();
// Load scripts and styles
wp_enqueue_script(array('jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-resizable', 'jquery-ui-autocomplete', 'jquery-ui-sortable', 'jquery-ui-dialog', 'plupload'));
wp_enqueue_script('media-upload');
add_thickbox();
wp_enqueue_script('teachpress-standard', plugins_url( 'js/backend.js', dirname( __FILE__ ) ) );
wp_enqueue_style('teachpress.css', plugins_url( 'styles/teachpress.css', dirname( __FILE__ ) ) );
wp_enqueue_style('teachpress-jquery-ui.css', plugins_url( 'styles/jquery.ui.css', dirname( __FILE__ ) ) );
wp_enqueue_style('teachpress-jquery-ui-dialog.css', includes_url() . '/css/jquery-ui-dialog.min.css');
do_action( 'admin_print_scripts' );
do_action( 'admin_print_styles' );
global $current_user;
// Define post_id and course_id
$post_id = ( isset($_GET['post_id']) ) ? intval($_GET['post_id']) : 0;
$course_id = ( isset($_POST['sel_course_id']) ) ? intval($_POST['sel_course_id']) : 0;
// default
if ( $post_id !== 0 && $course_id === 0 ) {
$course_id = intval (TP_Courses::is_used_as_related_content($post_id) );
}
// For user's selection
else if ( $course_id !== 0 ) {
$post_id = TP_Courses::get_course_data($course_id, 'rel_page');
}
echo '';
echo '';
echo '';
echo '
';
wp_footer();
}
echo '';
echo '';
}
}