function add_vibe_edd_metaboxes() { $prefix = 'vibe_'; $product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400); $wplms_download_metabox = array(array('label' => __('Associated Courses', 'vibe'), 'desc' => __('Associated Courses with this product. Enables access to the course.', 'vibe'), 'id' => $prefix . 'courses', 'type' => 'selectmulticpt', 'post_type' => 'course'), array('label' => __('Subscription ', 'vibe'), 'desc' => __('Enable if Product is Subscription Type (Price per month)', 'vibe'), 'id' => $prefix . 'subscription', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Subscription Duration', 'vibe'), 'desc' => __('Duration for Subscription Products (in ', 'vibe') . calculate_duration_time($product_duration_parameter) . ')', 'id' => $prefix . 'duration', 'type' => 'number')); if (in_array('easy-digital-downloads/easy-digital-downloads.php', apply_filters('active_plugins', get_option('active_plugins')))) { $events_metabox = new custom_add_meta_box('page-settings', __('WPLMS Product Settings', 'vibe'), $wplms_download_metabox, 'download', true); } }
function bp_get_course_user_time_left($args = NULL) { $defaults = array('course' => get_the_ID(), 'user' => get_current_user_id()); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400); $expiry = get_user_meta($user, $course, true); $time_left = $expiry - time(); if ($time_left > 0) { return round($time_left / $course_duration_parameter, 0) . ' ' . calculate_duration_time($course_duration_parameter); } else { return __('EXPIRED', 'vibe'); } }
function wplms_front_end_assignment_controls() { $user_id = get_current_user_id(); global $wp_query; if (!isset($_GET['edit']) && !isset($wp_query->query_vars['edit']) || !current_user_can('edit_posts')) { return; } $assignment_settings = array('vibe_subtitle' => 'Enter a Subtitle', 'vibe_assignment_marks' => 0, 'vibe_assignment_duration' => 0, 'vibe_assignment_evaluation' => 'H', 'vibe_assignment_course' => '', 'vibe_assignment_submission_type' => 'upload', 'vibe_attachment_type' => '', 'vibe_attachment_size' => ''); $assignment_settings = apply_filters('wplms_front_end_assignment_settings', $assignment_settings); ?> <div class="wplms_front_end_wrapper"> <h3 class="heading"><?php _e('ASSIGNMENT SETTINGS', 'wplms-front-end'); ?> </h3> <article class="live-edit" data-model="article" data-id="1" data-url="/articles"> <ul class="assignment_settings"> <li> <label><?php _e('ASSIGNMENT SUB-TITLE', 'wplms-front-end'); ?> </label> <div id="vibe_subtitle" data-editable="true" data-name="content" data-max-length="250" data-text-options="true"> <p><?php echo $assignment_settings['vibe_subtitle']; ?> </p> </div> </li> <li> <label><?php _e('ASSIGNMENT MARKS', 'wplms-front-end'); ?> </label> <h3><?php _e('Assignment Maximum Marks', 'wplms-front-end'); ?> </h3><input type="number" class="small_box" id="vibe_assignment_marks" value="<?php echo $assignment_settings['vibe_assignment_marks']; ?> " /> <?php _e('MARKS', 'wplms-front-end'); ?> </li> <li> <label><?php _e('ASSIGNMENT DURATION', 'wplms-front-end'); ?> </label> <h3><?php _e('Enter Assignment Duration', 'wplms-front-end'); ?> </h3><input type="number" class="small_box" id="vibe_assignment_duration" value="<?php echo $assignment_settings['vibe_assignment_duration']; ?> " /> <?php $assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter', 86400); echo calculate_duration_time($assignment_duration_parameter); ?> </li> <li><label><?php _e('ASSIGNMENT EVALUATION', 'wplms-front-end'); ?> </label> <h3><?php _e('Include in Course Evaluation', 'wplms-front-end'); ?> </h3> <div class="switch"> <input type="radio" class="switch-input vibe_assignment_evaluation" name="vibe_assignment_evaluation" value="S" id="vibe_assignment_evaluate_on" <?php checked($assignment_settings['vibe_assignment_evaluation'], 'S'); ?> > <label for="vibe_assignment_evaluate_on" class="switch-label switch-label-off"><?php _e('YES', 'wplms-front-end'); ?> </label> <input type="radio" class="switch-input vibe_assignment_evaluation" name="vibe_assignment_evaluation" value="H" id="vibe_assignment_evaluate_off" <?php checked($assignment_settings['vibe_assignment_evaluation'], 'H'); ?> > <label for="vibe_assignment_evaluate_off" class="switch-label switch-label-on"><?php _e('NO', 'wplms-front-end'); ?> </label> <span class="switch-selection"></span> </div> </li> <li id="assignment_course" <?php echo $assignment_settings['vibe_assignment_evaluation'] == 'H' ? 'class="hide"' : ''; ?> > <label><?php _e('ASSIGNMENT COURSE', 'wplms-front-end'); ?> </label> <h3><?php _e('Select Assignment Course', 'wplms-front-end'); ?> </h3> <select id="vibe_assignment_course" class="chosen"> <option value=""><?php _e('None', 'wplms-front-end'); ?> </option> <?php $args = array('post_type' => 'course', 'numberposts' => -1); $args = apply_filters('wplms_frontend_cpt_query', $args); $kposts = get_posts($args); if (is_Array($kposts)) { foreach ($kposts as $kpost) { echo '<option value="' . $kpost->ID . '" ' . selected($assignment_settings['vibe_assignment_course'], $kpost->ID) . '>' . $kpost->post_title . '</option>'; } } ?> </select> </li> <li><h3><?php _e('ASSIGNMENT SUBMISISON TYPE', 'wplms-front-end'); ?> </h3> <select id="vibe_assignment_submission_type" class="chosen"> <option value="upload" <?php selected($assignment_settings['vibe_assignment_submission_type'], 'upload'); ?> ><?php _e('UPLOAD', 'wplms-front-end'); ?> </option> <option value="textarea" <?php selected($assignment_settings['vibe_assignment_submission_type'], 'textarea'); ?> ><?php _e('TEXTAREA', 'wplms-front-end'); ?> </option> </select> </li> <li id="attachment_type"><h3><?php _e('ATTACHMENT TYPE', 'wplms-front-end'); ?> </h3> <select id="vibe_attachment_type" class="chosen" multiple> <?php $attachment_types = array(array('value' => 'JPG', 'label' => 'JPG'), array('value' => 'GIF', 'label' => 'GIF'), array('value' => 'PNG', 'label' => 'PNG'), array('value' => 'PDF', 'label' => 'PDF'), array('value' => 'DOC', 'label' => 'DOC'), array('value' => 'DOCX', 'label' => 'DOCX'), array('value' => 'PPT', 'label' => 'PPT'), array('value' => 'PPTX', 'label' => 'PPTX'), array('value' => 'PPS', 'label' => 'PPS'), array('value' => 'PPSX', 'label' => 'PPSX'), array('value' => 'ODT', 'label' => 'ODT'), array('value' => 'XLS', 'label' => 'XLS'), array('value' => 'XLSX', 'label' => 'XLSX'), array('value' => 'MP3', 'label' => 'MP3'), array('value' => 'M4A', 'label' => 'M4A'), array('value' => 'OGG', 'label' => 'OGG'), array('value' => 'WAV', 'label' => 'WAV'), array('value' => 'WMA', 'label' => 'WMA'), array('value' => 'MP4', 'label' => 'MP4'), array('value' => 'M4V', 'label' => 'M4V'), array('value' => 'MOV', 'label' => 'MOV'), array('value' => 'WMV', 'label' => 'WMV'), array('value' => 'AVI', 'label' => 'AVI'), array('value' => 'MPG', 'label' => 'MPG'), array('value' => 'OGV', 'label' => 'OGV'), array('value' => '3GP', 'label' => '3GP'), array('value' => '3G2', 'label' => '3G2'), array('value' => 'FLV', 'label' => 'FLV'), array('value' => 'WEBM', 'label' => 'WEBM'), array('value' => 'APK', 'label' => 'APK '), array('value' => 'RAR', 'label' => 'RAR'), array('value' => 'ZIP', 'label' => 'ZIP')); foreach ($attachment_types as $attachment_type) { echo '<option value="' . $attachment_type['value'] . '" ' . (is_array($assignment_settings['vibe_attachment_type']) && in_array($attachment_type['value'], $assignment_settings['vibe_attachment_type']) ? 'selected' : '') . '>' . $attachment_type['label'] . '</option>'; } ?> </select> </li> <li> <label><?php _e('Attachment Size', 'wplms-front-end'); ?> </label> <h3><?php _e('Maximum attachment size', 'wplms-front-end'); ?> </h3><input type="number" class="small_box" id="vibe_attachment_size" value="<?php echo $assignment_settings['vibe_attachment_size']; ?> " /> <?php _e(' MBs', 'wplms-front-end'); ?> </li> </ul></article> <a id="save_assignment_settings" class="course_button button full"><?php _e('SAVE SETTINGS', 'wplms-front-end'); ?> </a> <input type="hidden" value="<?php echo get_the_ID(); ?> " id="assignment_id" /> <?php wp_nonce_field('save-assignment-settings' . $user_id, 'assignment_security'); ?> </div> <?php }
function bp_course_admin_extend_student_subscription() { $user_id = get_current_user_id(); $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400, get_the_ID()); echo ' <div class="bulk_extend_subscription_students"> <input type="number" id="extend_amount" class="form_field" placeholder="' . sprintf(__('Enter extend amount ( in %s', 'vibe'), calculate_duration_time($course_duration_parameter)) . ')' . '"> <a href="#" id="extend_course_subscription" data-course="' . get_the_ID() . '" class="button full">' . __('Extend Subscription', 'vibe') . '</a> <input type="hidden" id="sender" value="' . $user_id . '" />'; echo '</div>'; }
function vibe_meta_box_arrays($metabox) { // References added to Pick labels for Import/Export $prefix = 'vibe_'; $sidebars = $GLOBALS['wp_registered_sidebars']; $sidebararray = array(); foreach ($sidebars as $sidebar) { if (!in_array($sidebar['id'], array('student_sidebar', 'instructor_sidebar'))) { $sidebararray[] = array('label' => $sidebar['name'], 'value' => $sidebar['id']); } } $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400); $drip_duration_parameter = apply_filters('vibe_drip_duration_parameter', 86400); $unit_duration_parameter = apply_filters('vibe_unit_duration_parameter', 60); $quiz_duration_parameter = apply_filters('vibe_quiz_duration_parameter', 60); $product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400); $assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter', 86400); switch ($metabox) { case 'post': $metabox_settings = array($prefix . 'subtitle' => array('label' => __('Post Sub-Title', 'vibe-customtypes'), 'desc' => __('Post Sub- Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), $prefix . 'template' => array('label' => __('Post Template', 'vibe-customtypes'), 'desc' => __('Select a post template for showing content.', 'vibe-customtypes'), 'id' => $prefix . 'template', 'type' => 'select', 'options' => array(1 => array('label' => __('Content on Left', 'vibe-customtypes'), 'value' => ''), 2 => array('label' => __('Content on Right', 'vibe-customtypes'), 'value' => 'right'), 3 => array('label' => __('Full Width', 'vibe-customtypes'), 'value' => 'full')), 'std' => ''), $prefix . 'sidebar' => array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select a Sidebar | Default : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray), $prefix . 'title' => array('label' => __('Show Page Title', 'vibe-customtypes'), 'desc' => __('Show Page/Post Title.', 'vibe-customtypes'), 'id' => $prefix . 'title', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'author' => array('label' => __('Show Author Information', 'vibe-customtypes'), 'desc' => __('Author information below post content.', 'vibe-customtypes'), 'id' => $prefix . 'author', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'breadcrumbs' => array('label' => __('Show Breadcrumbs', 'vibe-customtypes'), 'desc' => __('Show breadcrumbs.', 'vibe-customtypes'), 'id' => $prefix . 'breadcrumbs', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'prev_next' => array('label' => __('Show Prev/Next Arrows', 'vibe-customtypes'), 'desc' => __('Show previous/next links on top below the Subheader.', 'vibe-customtypes'), 'id' => $prefix . 'prev_next', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H')); break; case 'page': $metabox_settings = array($prefix . 'title' => array('label' => __('Show Page Title', 'vibe-customtypes'), 'desc' => __('Show Page/Post Title.', 'vibe-customtypes'), 'id' => $prefix . 'title', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'subtitle' => array('label' => __('Page Sub-Title', 'vibe-customtypes'), 'desc' => __('Page Sub- Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), $prefix . 'breadcrumbs' => array('label' => __('Show Breadcrumbs', 'vibe-customtypes'), 'desc' => __('Show breadcrumbs.', 'vibe-customtypes'), 'id' => $prefix . 'breadcrumbs', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'sidebar' => array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select Sidebar | Sidebar : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray)); break; case 'course': $metabox_settings = array($prefix . 'sidebar' => array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select a Sidebar | Default : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray, 'std' => 'coursesidebar'), $prefix . 'duration' => array('label' => __('Total Duration of Course', 'vibe-customtypes'), 'desc' => sprintf(__('Duration of Course (in %s)', 'vibe-customtypes'), calculate_duration_time($course_duration_parameter)), 'id' => $prefix . 'duration', 'type' => 'number', 'std' => 10), $prefix . 'students' => array('label' => __('Total number of Students in Course', 'vibe-customtypes'), 'desc' => __('Total number of Students who have taken this Course.', 'vibe-customtypes'), 'id' => $prefix . 'students', 'type' => 'number', 'std' => 0), $prefix . 'course_auto_eval' => array('label' => __('Auto Evaluation', 'vibe-customtypes'), 'desc' => __('Evalute Courses based on Quizes scores available in Course (* Requires atleast 1 Quiz in course)', 'vibe-customtypes'), 'id' => $prefix . 'course_auto_eval', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'start_date' => array('label' => __('Course Start Date', 'vibe-customtypes'), 'desc' => __('Date from which Course Begins', 'vibe-customtypes'), 'id' => $prefix . 'start_date', 'type' => 'date'), $prefix . 'max_students' => array('label' => __('Maximum Students in Course', 'vibe-customtypes'), 'desc' => __('Maximum number of students who can pursue the course at a time.', 'vibe-customtypes'), 'id' => $prefix . 'max_students', 'type' => 'number'), $prefix . 'course_badge' => array('label' => __('Excellence Badge', 'vibe-customtypes'), 'desc' => __('Upload badge image which Students recieve upon course completion', 'vibe-customtypes'), 'id' => $prefix . 'course_badge', 'type' => 'image'), $prefix . 'course_badge_percentage' => array('label' => __('Badge Percentage', 'vibe-customtypes'), 'desc' => __('Badge is given to people passing above percentage (out of 100)', 'vibe-customtypes'), 'id' => $prefix . 'course_badge_percentage', 'type' => 'number'), $prefix . 'course_badge_title' => array('label' => __('Badge Title', 'vibe-customtypes'), 'desc' => __('Title is shown on hovering the badge.', 'vibe-customtypes'), 'id' => $prefix . 'course_badge_title', 'type' => 'text'), $prefix . 'course_certificate' => array('label' => __('Completion Certificate', 'vibe-customtypes'), 'desc' => __('Enable Certificate image which Students recieve upon course completion (out of 100)', 'vibe-customtypes'), 'id' => $prefix . 'course_certificate', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'certificate_template' => array('label' => __('Certificate Template', 'vibe-customtypes'), 'desc' => __('Select a Certificate Template', 'vibe-customtypes'), 'id' => $prefix . 'certificate_template', 'type' => 'selectcpt', 'post_type' => 'certificate'), $prefix . 'course_passing_percentage' => array('label' => __('Passing Percentage', 'vibe-customtypes'), 'desc' => __('Course passing percentage, for completion certificate', 'vibe-customtypes'), 'id' => $prefix . 'course_passing_percentage', 'type' => 'number'), $prefix . 'course_drip' => array('label' => __('Drip Feed', 'vibe-customtypes'), 'desc' => __('Enable Drip Feed course', 'vibe-customtypes'), 'id' => $prefix . 'course_drip', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'course_drip_duration' => array('label' => __('Drip Feed Duration', 'vibe-customtypes'), 'desc' => __('Duration between consecutive Drip feed units (in ', 'vibe-customtypes') . calculate_duration_time($drip_duration_parameter) . ' )', 'id' => $prefix . 'course_drip_duration', 'type' => 'number'), $prefix . 'course_curriculum' => array('label' => __('Course Curriculum', 'vibe-customtypes'), 'desc' => __('Set Course Curriculum, prepare units and quizes before setting up curriculum', 'vibe-customtypes'), 'id' => $prefix . 'course_curriculum', 'post_type1' => 'unit', 'post_type2' => 'quiz', 'type' => 'curriculum'), $prefix . 'pre_course' => array('label' => __('Pre-Required Course', 'vibe-customtypes'), 'desc' => __('Pre Required course for this course', 'vibe-customtypes'), 'id' => $prefix . 'pre_course', 'type' => 'selectmulticpt', 'post_type' => 'course'), $prefix . 'course_retakes' => array('label' => __('Course Retakes', 'vibe-customtypes'), 'desc' => __('Set number of times a student can re-take the course (0 to disable)', 'vibe-customtypes'), 'id' => $prefix . 'course_retakes', 'type' => 'number', 'std' => 0), $prefix . 'forum' => array('label' => __('Course Forum', 'vibe-customtypes'), 'desc' => __('Connect Forum with Course.', 'vibe-customtypes'), 'id' => $prefix . 'forum', 'type' => 'selectcpt', 'post_type' => 'forum'), $prefix . 'group' => array('label' => __('Course Group', 'vibe-customtypes'), 'desc' => __('Connect a Group with Course.', 'vibe-customtypes'), 'id' => $prefix . 'group', 'type' => 'groups'), $prefix . 'course_instructions' => array('label' => __('Course specific instructions', 'vibe-customtypes'), 'desc' => __('Course specific instructions which would be shown in the Start course/Course status page', 'vibe-customtypes'), 'id' => $prefix . 'course_instructions', 'type' => 'editor', 'std' => ''), $prefix . 'course_message' => array('label' => __('Course Completion Message', 'vibe-customtypes'), 'desc' => __('This message is shown to users when they Finish submit the course', 'vibe-customtypes'), 'id' => $prefix . 'course_message', 'type' => 'editor', 'std' => 'Thank you for Finish the Course.')); break; case 'course_product': $metabox_settings = array($prefix . 'course_free' => array('label' => __('Free Course', 'vibe-customtypes'), 'desc' => __('Course is Free for all Members', 'vibe-customtypes'), 'id' => $prefix . 'course_free', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H')); if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && function_exists('pmpro_getAllLevels')) { $levels = pmpro_getAllLevels(); foreach ($levels as $level) { $level_array[] = array('value' => $level->id, 'label' => $level->name); } $metabox_settings[$prefix . 'pmpro_membership'] = array('label' => __('PMPro Membership', 'vibe-customtypes'), 'desc' => __('Required Membership levle for this course', 'vibe-customtypes'), 'id' => $prefix . 'pmpro_membership', 'type' => 'multiselect', 'options' => $level_array); } if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('woocommerce/woocommerce.php')) { $instructor_privacy = vibe_get_option('instructor_content_privacy'); $flag = 1; if (isset($instructor_privacy) && $instructor_privacy && !current_user_can('manage_options')) { $flag = 0; } if ($flag) { $metabox_settings[$prefix . 'product'] = array('label' => __('Associated Product', 'vibe-customtypes'), 'desc' => __('Associated Product with the Course.', 'vibe-customtypes'), 'id' => $prefix . 'product', 'type' => 'selectcpt', 'post_type' => 'product', 'std' => ''); } } break; case 'unit': $unit_types = apply_filters('wplms_unit_types', array(array('label' => __('Video', 'vibe-customtypes'), 'value' => 'play'), array('label' => __('Audio', 'vibe-customtypes'), 'value' => 'music-file-1'), array('label' => __('Podcast', 'vibe-customtypes'), 'value' => 'podcast'), array('label' => __('General', 'vibe-customtypes'), 'value' => 'text-document'))); $metabox_settings = array($prefix . 'subtitle' => array('label' => __('Unit Description', 'vibe-customtypes'), 'desc' => __('Small Description.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), $prefix . 'type' => array('label' => __('Unit Type', 'vibe-customtypes'), 'desc' => __('Select Unit type from Video , Audio , Podcast, General , ', 'vibe-customtypes'), 'id' => $prefix . 'type', 'type' => 'select', 'options' => $unit_types, 'std' => 'text-document'), $prefix . 'free' => array('label' => __('Free Unit', 'vibe-customtypes'), 'desc' => __('Set Free unit, viewable to all', 'vibe-customtypes'), 'id' => $prefix . 'free', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'duration' => array('label' => __('Unit Duration', 'vibe-customtypes'), 'desc' => __('Duration in ', 'vibe-customtypes') . calculate_duration_time($unit_duration_parameter), 'id' => $prefix . 'duration', 'type' => 'number'), $prefix . 'assignment' => array('label' => __('Connect Assignments', 'vibe-customtypes'), 'desc' => __('Select an Assignment which you can connect with this Unit', 'vibe-customtypes'), 'id' => $prefix . 'assignment', 'type' => 'selectmulticpt', 'post_type' => 'wplms-assignment'), $prefix . 'forum' => array('label' => __('Unit Forum', 'vibe-customtypes'), 'desc' => __('Connect Forum with Unit.', 'vibe-customtypes'), 'id' => $prefix . 'forum', 'type' => 'selectcpt', 'post_type' => 'forum')); break; case 'question': $question_types = apply_filters('wplms_question_types', array(array('label' => __('True or False', 'vibe-customtypes'), 'value' => 'truefalse'), array('label' => __('Multiple Choice', 'vibe-customtypes'), 'value' => 'single'), array('label' => __('Multiple Correct', 'vibe-customtypes'), 'value' => 'multiple'), array('label' => __('Sort Answers', 'vibe-customtypes'), 'value' => 'sort'), array('label' => __('Match Answers', 'vibe-customtypes'), 'value' => 'match'), array('label' => __('Fill in the Blank', 'vibe-customtypes'), 'value' => 'fillblank'), array('label' => __('Dropdown Select', 'vibe-customtypes'), 'value' => 'select'), array('label' => __('Small Text', 'vibe-customtypes'), 'value' => 'smalltext'), array('label' => __('Large Text', 'vibe-customtypes'), 'value' => 'largetext'))); $metabox_settings = array($prefix . 'question_type' => array('label' => __('Question Type', 'vibe-customtypes'), 'desc' => __('Select Question type, ', 'vibe-customtypes'), 'id' => $prefix . 'question_type', 'type' => 'select', 'options' => $question_types, 'std' => 'single'), $prefix . 'question_options' => array('label' => __('Question Options (For Single/Multiple/Sort/Match Question types)', 'vibe-customtypes'), 'desc' => __('Single/Mutiple Choice question options', 'vibe-customtypes'), 'id' => $prefix . 'question_options', 'type' => 'repeatable_count'), $prefix . 'question_answer' => array('label' => __('Correct Answer', 'vibe-customtypes'), 'desc' => __('Enter (1 = True, 0 = false ) or Choice Number (1,2..) or comma saperated Choice numbers (1,2..) or Correct Answer for small text (All possible answers comma saperated) | 0 for No Answer or Manual Check', 'vibe-customtypes'), 'id' => $prefix . 'question_answer', 'type' => 'text', 'std' => 0), $prefix . 'question_hint' => array('label' => __('Answer Hint', 'vibe-customtypes'), 'desc' => __('Add a Hint/clue for the answer to show to student', 'vibe-customtypes'), 'id' => $prefix . 'question_hint', 'type' => 'textarea', 'std' => ''), $prefix . 'question_explaination' => array('label' => __('Answer Explanation', 'vibe-customtypes'), 'desc' => __('Add Answer explanation', 'vibe-customtypes'), 'id' => $prefix . 'question_explaination', 'type' => 'editor', 'std' => '')); break; case 'quiz': $metabox_settings = array($prefix . 'subtitle' => array('label' => __('Quiz Subtitle', 'vibe-customtypes'), 'desc' => __('Quiz Subtitle.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'text', 'std' => ''), $prefix . 'quiz_course' => array('label' => __('Connected Course', 'vibe-customtypes'), 'id' => $prefix . 'quiz_course', 'type' => 'selectcpt', 'post_type' => 'course', 'post_status' => array('publish', 'draft'), 'desc' => __('Connecting a quiz with a course would force the quiz to be available to users who have taken the course.', 'vibe-customtypes')), $prefix . 'duration' => array('label' => __('Quiz Duration', 'vibe-customtypes'), 'desc' => __('Quiz duration in ', 'vibe-customtypes') . calculate_duration_time($quiz_duration_parameter) . __(' Enables Timer & auto submits on expire. 9999 to disable.', 'vibe-customtypes'), 'id' => $prefix . 'duration', 'type' => 'number', 'std' => 0), $prefix . 'quiz_auto_evaluate' => array('label' => __('Auto Evaluate Results', 'vibe-customtypes'), 'desc' => __('Evaluate results as soon as quiz is complete. (* No Large text questions ), Diable for manual evaluate', 'vibe-customtypes'), 'id' => $prefix . 'quiz_auto_evaluate', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'quiz_retakes' => array('label' => __('Number of Extra Quiz Retakes', 'vibe-customtypes'), 'desc' => __('Student can reset and start the quiz all over again. Number of Extra retakes a student can take.', 'vibe-customtypes'), 'id' => $prefix . 'quiz_retakes', 'type' => 'number', 'std' => 0), $prefix . 'quiz_message' => array('label' => __('Post Quiz Message', 'vibe-customtypes'), 'desc' => __('This message is shown to users when they submit the quiz', 'vibe-customtypes'), 'id' => $prefix . 'quiz_message', 'type' => 'editor', 'std' => 'Thank you for Submitting the Quiz. Check Results in your Profile.'), $prefix . 'quiz_dynamic' => array('label' => __('Dynamic Quiz', 'vibe-customtypes'), 'desc' => __('Dynamic quiz automatically selects questions.', 'vibe-customtypes'), 'id' => $prefix . 'quiz_dynamic', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'quiz_tags' => array('label' => __('Dynamic Quiz Question tags', 'vibe-customtypes'), 'desc' => __('Select Question tags from where questions will be selected for the quiz.(required if dynamic enabled)', 'vibe-customtypes'), 'id' => $prefix . 'quiz_tags', 'type' => 'dynamic_taxonomy', 'taxonomy' => 'question-tag', 'std' => 0), $prefix . 'quiz_number_questions' => array('label' => __('Number of Questions in Dynamic Quiz', 'vibe-customtypes'), 'desc' => __('Enter the number of Questions in the dynamic quiz. (required if dynamic enabled).', 'vibe-customtypes'), 'id' => $prefix . 'quiz_number_questions', 'type' => 'number', 'std' => 0), $prefix . 'quiz_marks_per_question' => array('label' => __('Marks per Question in Dynamic Quiz', 'vibe-customtypes'), 'desc' => __('Enter the number of marks per Questions in the dynamic quiz. (required if dynamic enabled).', 'vibe-customtypes'), 'id' => $prefix . 'quiz_marks_per_question', 'type' => 'number', 'std' => 0), $prefix . 'quiz_random' => array('label' => __('Randomize Quiz Questions', 'vibe-customtypes'), 'desc' => __('Random Question sequence for every quiz', 'vibe-customtypes'), 'id' => $prefix . 'quiz_random', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'quiz_questions' => array('label' => __('Quiz Questions', 'vibe-customtypes'), 'desc' => __('Quiz questions for Static Quiz only', 'vibe-customtypes'), 'id' => $prefix . 'quiz_questions', 'type' => 'repeatable_selectcpt', 'post_type' => 'question', 'std' => 0)); break; case 'testimonial': $metabox_settings = array(array('label' => __('Author Name', 'vibe-customtypes'), 'desc' => __('Enter the name of the testimonial author.', 'vibe-customtypes'), 'id' => $prefix . 'testimonial_author_name', 'type' => 'text'), array('label' => __('Designation', 'vibe-customtypes'), 'desc' => __('Enter the testimonial author\'s designation.', 'vibe-customtypes'), 'id' => $prefix . 'testimonial_author_designation', 'type' => 'text')); break; case 'product': $metabox_settings = array(array('label' => __('Associated Courses', 'vibe-customtypes'), 'desc' => __('Associated Courses with this product. Enables access to the course.', 'vibe-customtypes'), 'id' => $prefix . 'courses', 'type' => 'selectmulticpt', 'post_type' => 'course'), array('label' => __('Subscription ', 'vibe-customtypes'), 'desc' => __('Enable if Product is Subscription Type (Price per month)', 'vibe-customtypes'), 'id' => $prefix . 'subscription', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Subscription Duration', 'vibe-customtypes'), 'desc' => __('Duration for Subscription Products (in ', 'vibe-customtypes') . calculate_duration_time($product_duration_parameter) . ')', 'id' => $prefix . 'duration', 'type' => 'number')); break; case 'wplms-event': $metabox_settings = array(array('label' => __('Event Sub-Title', 'vibe-customtypes'), 'desc' => __('Event Sub-Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), array('label' => __('Course', 'vibe-customtypes'), 'desc' => __('Select Course for which the event is valid', 'vibe-customtypes'), 'id' => $prefix . 'event_course', 'type' => 'selectcpt', 'post_type' => 'course'), array('label' => __('Connect an Assignment', 'vibe-customtypes'), 'desc' => __('Select an Assignment which you can connect with this Event', 'vibe-customtypes'), 'id' => $prefix . 'assignment', 'type' => 'selectcpt', 'post_type' => 'wplms-assignment'), array('label' => __('Event Icon', 'vibe-customtypes'), 'desc' => __('Click on icon to select an icon for the event', 'vibe-customtypes'), 'id' => $prefix . 'icon', 'type' => 'icon'), array('label' => __('Event Color', 'vibe-customtypes'), 'desc' => __('Select color for Event', 'vibe-customtypes'), 'id' => $prefix . 'color', 'type' => 'color'), array('label' => __('Start Date', 'vibe-customtypes'), 'desc' => __('Date from which Event Begins', 'vibe-customtypes'), 'id' => $prefix . 'start_date', 'type' => 'date'), array('label' => __('End Date', 'vibe-customtypes'), 'desc' => __('Date on which Event ends.', 'vibe-customtypes'), 'id' => $prefix . 'end_date', 'type' => 'date'), array('label' => __('Start Time', 'vibe-customtypes'), 'desc' => __('Date from which Event Begins', 'vibe-customtypes'), 'id' => $prefix . 'start_time', 'type' => 'time'), array('label' => __('End Time', 'vibe-customtypes'), 'desc' => __('Date on which Event ends.', 'vibe-customtypes'), 'id' => $prefix . 'end_time', 'type' => 'time'), array('label' => __('Show Location', 'vibe-customtypes'), 'desc' => __('Show Location and Google map with the event', 'vibe-customtypes'), 'id' => $prefix . 'show_location', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Location', 'vibe-customtypes'), 'desc' => __('Location of event', 'vibe-customtypes'), 'id' => $prefix . 'location', 'type' => 'gmap'), array('label' => __('Additional Information', 'vibe-customtypes'), 'desc' => __('Point wise Additional Information regarding the event', 'vibe-customtypes'), 'id' => $prefix . 'additional_info', 'type' => 'repeatable'), array('label' => __('More Information', 'vibe-customtypes'), 'desc' => __('Supports HTML and shortcodes', 'vibe-customtypes'), 'id' => $prefix . 'more_info', 'type' => 'editor'), array('label' => __('All Day', 'vibe-customtypes'), 'desc' => __('An all Day event', 'vibe-customtypes'), 'id' => $prefix . 'all_day', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Private Event', 'vibe-customtypes'), 'desc' => __('Only Invited participants can see the Event', 'vibe-customtypes'), 'id' => $prefix . 'private_event', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H')); if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('woocommerce/woocommerce.php')) { $metabox_settings[] = array('label' => __('Associated Product for Event Access', 'vibe-customtypes'), 'desc' => __('Purchase of this product grants Event access to the member.', 'vibe-customtypes'), 'id' => $prefix . 'product', 'type' => 'selectcpt', 'post_type' => 'product', 'std' => ''); } break; case 'payments': $metabox_settings = array(array('label' => __('From', 'vibe-customtypes'), 'desc' => __('Date on which Payment was done.', 'vibe-customtypes'), 'id' => $prefix . 'date_from', 'type' => 'text'), array('label' => __('To', 'vibe-customtypes'), 'desc' => __('Date on which Payment was done.', 'vibe-customtypes'), 'id' => $prefix . 'date_to', 'type' => 'text'), array('label' => __('Instructor and Commissions', 'vibe-customtypes'), 'desc' => __('Instructor commissions', 'vibe-customtypes'), 'id' => $prefix . 'instructor_commissions', 'type' => 'payments')); break; case 'certificate': $metabox_settings = array(array('label' => __('Background Image/Pattern', 'vibe-customtypes'), 'desc' => __('Add background image', 'vibe-customtypes'), 'id' => $prefix . 'background_image', 'type' => 'image'), array('label' => __('Enable Print & PDF', 'vibe-customtypes'), 'desc' => __('Displays a Print and Download as PDF Button on top right corner of certificate', 'vibe-customtypes'), 'id' => $prefix . 'print', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Certificate Width', 'vibe-customtypes'), 'desc' => __('Add certificate width', 'vibe-customtypes'), 'id' => $prefix . 'certificate_width', 'type' => 'text'), array('label' => __('Certificate Height', 'vibe-customtypes'), 'desc' => __('Add certificate height', 'vibe-customtypes'), 'id' => $prefix . 'certificate_height', 'type' => 'text'), array('label' => __('Custom Class', 'vibe-customtypes'), 'desc' => __('Add Custom Class over Certificate container.', 'vibe-customtypes'), 'id' => $prefix . 'custom_class', 'type' => 'text'), array('label' => __('Custom CSS', 'vibe-customtypes'), 'desc' => __('Add Custom CSS for Certificate.', 'vibe-customtypes'), 'id' => $prefix . 'custom_css', 'type' => 'textarea'), array('label' => __('NOTE:', 'vibe-customtypes'), 'desc' => __(' USE FOLLOWING SHORTCODES TO DISPLAY RELEVANT DATA : <br />1. <strong>[certificate_student_name]</strong> : Displays Students Name<br />2. <strong>[certificate_course]</strong> : Displays Course Name<br />3. <strong>[certificate_student_marks]</strong> : Displays Students Marks in Course<br />4. <strong>[certificate_student_date]</strong>: Displays date on which Certificate was awarded to the Student<br />5. <strong>[certificate_student_email]</strong>: Displays registered email of the Student<br />6. <strong>[certificate_code]</strong>: Generates unique code for Student which can be validated from Certificate page.<br />7. <strong>[course_completion_date]</strong>: Displays course completion date from course activity.', 'vibe-customtypes'), 'id' => $prefix . 'note', 'type' => 'note')); break; case 'wplms-assignment': $max_upload = (int) ini_get('upload_max_filesize'); $max_post = (int) ini_get('post_max_size'); $memory_limit = (int) ini_get('memory_limit'); $upload_mb = min($max_upload, $max_post, $memory_limit); $metabox_settings = array(array('label' => __('Assignment Sub-Title', 'vibe-customtypes'), 'desc' => __('Assignment Sub-Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select a Sidebar | Default : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray), array('label' => __('Assignment Maximum Marks', 'vibe-customtypes'), 'desc' => __('Set Maximum marks for the assignment', 'vibe-customtypes'), 'id' => $prefix . 'assignment_marks', 'type' => 'number', 'std' => '10'), array('label' => sprintf(__('Assignment Maximum Time limit %s', 'vibe-customtypes'), '( ' . calculate_duration_time($assignment_duration_parameter) . ' )'), 'desc' => __('Set Maximum Time limit for Assignment ( in ', 'vibe-customtypes') . calculate_duration_time($assignment_duration_parameter) . ' )', 'id' => $prefix . 'assignment_duration', 'type' => 'number', 'std' => '10'), array('label' => __('Include in Course Evaluation', 'vibe-customtypes'), 'desc' => __('Include assignment marks in Course Evaluation', 'vibe-customtypes'), 'id' => $prefix . 'assignment_evaluation', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Include in Course', 'vibe-customtypes'), 'desc' => __('Assignments marks will be shown/used in course evaluation', 'vibe-customtypes'), 'id' => $prefix . 'assignment_course', 'type' => 'selectcpt', 'post_type' => 'course'), array('label' => __('Assignment Submissions', 'vibe-customtypes'), 'desc' => __('Select type of assignment submissions', 'vibe-customtypes'), 'id' => $prefix . 'assignment_submission_type', 'type' => 'select', 'options' => array(1 => array('label' => 'Upload file', 'value' => 'upload'), 2 => array('label' => 'Text Area', 'value' => 'textarea')), 'std' => ''), array('label' => __('Attachment Type', 'vibe-customtypes'), 'desc' => __('Select valid attachment types ', 'vibe-customtypes'), 'id' => $prefix . 'attachment_type', 'type' => 'multiselect', 'options' => array(array('value' => 'JPG', 'label' => 'JPG'), array('value' => 'GIF', 'label' => 'GIF'), array('value' => 'PNG', 'label' => 'PNG'), array('value' => 'PDF', 'label' => 'PDF'), array('value' => 'DOC', 'label' => 'DOC'), array('value' => 'DOCX', 'label' => 'DOCX'), array('value' => 'PPT', 'label' => 'PPT'), array('value' => 'PPTX', 'label' => 'PPTX'), array('value' => 'PPS', 'label' => 'PPS'), array('value' => 'PPSX', 'label' => 'PPSX'), array('value' => 'ODT', 'label' => 'ODT'), array('value' => 'XLS', 'label' => 'XLS'), array('value' => 'XLSX', 'label' => 'XLSX'), array('value' => 'MP3', 'label' => 'MP3'), array('value' => 'M4A', 'label' => 'M4A'), array('value' => 'OGG', 'label' => 'OGG'), array('value' => 'WAV', 'label' => 'WAV'), array('value' => 'WMA', 'label' => 'WMA'), array('value' => 'MP4', 'label' => 'MP4'), array('value' => 'M4V', 'label' => 'M4V'), array('value' => 'MOV', 'label' => 'MOV'), array('value' => 'WMV', 'label' => 'WMV'), array('value' => 'AVI', 'label' => 'AVI'), array('value' => 'MPG', 'label' => 'MPG'), array('value' => 'OGV', 'label' => 'OGV'), array('value' => '3GP', 'label' => '3GP'), array('value' => '3G2', 'label' => '3G2'), array('value' => 'FLV', 'label' => 'FLV'), array('value' => 'WEBM', 'label' => 'WEBM'), array('value' => 'APK', 'label' => 'APK '), array('value' => 'RAR', 'label' => 'RAR'), array('value' => 'ZIP', 'label' => 'ZIP')), 'std' => 'single'), array('label' => __('Attachment Size (in MB)', 'vibe-customtypes'), 'desc' => __('Set Maximum Attachment size for upload ( set less than ', 'vibe-customtypes') . $upload_mb . ' MB)', 'id' => $prefix . 'attachment_size', 'type' => 'number', 'std' => '2')); break; case 'popup': $metabox_settings = array(array('label' => __('Width (in px)', 'vibe-customtypes'), 'desc' => __('Set Maximum width of popup', 'vibe-customtypes'), 'id' => $prefix . 'popup_width', 'type' => 'number', 'std' => '480'), array('label' => __('Height (in px)', 'vibe-customtypes'), 'desc' => __('Set Maximum height of popup ', 'vibe-customtypes'), 'id' => $prefix . 'popup_height', 'type' => 'number', 'std' => '600'), array('label' => __('Custom Class', 'vibe-customtypes'), 'desc' => __('Add custom class to popup ', 'vibe-customtypes'), 'id' => $prefix . 'popup_class', 'type' => 'text', 'std' => ''), array('label' => __('Add Custom CSS', 'vibe-customtypes'), 'desc' => __('Custom CSS for Popup', 'vibe-customtypes'), 'id' => $prefix . 'custom_css', 'type' => 'textarea', 'std' => '')); break; } return apply_filters('wplms_' . $metabox . '_metabox', $metabox_settings); }
function wplms_custom_course_parameter($time_html, $time, $id) { if (get_post_type($id) != BP_COURSE_CPT) { return $time_html; } $parameter = vibe_get_option('course_duration_display_parameter'); if ($parameter && intval($time / 86400) < 999) { $time_html = floor($time / $parameter) . ' ' . calculate_duration_time($parameter); } return $time_html; }
function child_create_unit() { $user_id = get_current_user_id(); $course_id = $_POST['course_id']; $unit_title = stripslashes($_POST['unit_title']); wp_enqueue_script('content-min-css', includes_url('/js/tinymce/skins/lightgray/content.min.css')); wp_enqueue_script('content-min-css', includes_url('/css/dashicons.min.css?ver=4.0.1')); wp_enqueue_script('content-min-css', includes_url('/js/tinymce/skins/wordpress/wp-content.css?ver=4.0.1')); if (!isset($unit_title) || count($unit_title) < 2 && $unit_title == '') { _e('Can not have a blank Unit ', 'wplms-front-end'); die; } if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'create_course' . $user_id) || !current_user_can('edit_posts')) { _e('Security check Failed. Contact Administrator.', 'wplms-front-end'); die; } if (!is_numeric($course_id) || get_post_type($course_id) != 'course') { _e('Invalid Course id, please edit a course', 'wplms-front-end'); die; } $the_post = get_post($course_id); if ($the_post->post_author != $user_id && !current_user_can('manage_options')) { _e('Invalid Course Instructor', 'wplms-front-end'); die; } $unit_settings = array('post_title' => $unit_title, 'post_content' => $unit_title, 'post_status' => 'publish', 'post_type' => 'unit'); $unit_settings = apply_filters('wplms_front_end_unit_vars', $unit_settings); $unit_id = wp_insert_post($unit_settings); $unit_settings1 = array('vibe_type' => 'text-document', 'vibe_free' => 'H', 'vibe_duration' => 2, 'vibe_assignment' => array(), 'vibe_forum' => ''); $unit_settings1 = apply_filters('wplms_front_end_unit_settings', $unit_settings1); // <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button> echo ' <div class="set_backgroud_unit" style="position: block; height: 45px"> <h3 class="title" data-id="' . $unit_id . '"><i class="icon-file"></i> ' . $unit_title . '</h3> </div> <div class="btn-group" style="z-index:9;margin-top:-40px"> <span style="font-size:7pt; margin: 5px 35px 0px -30px;" data-tooltip="Thêm nội dung cho bài học" data-id="' . $unit_id . '" class="edit_content btn btn-success">' . __('Thêm nội dung', 'wplms-front-end') . '</span> <span style="font-size:7pt; margin: 5px 35px 0px -30px;" data-tooltip="Cấu hình bài học" data-id="' . $unit_id . '" class="setting_content btn btn-success">' . __('Cấu hình', 'wplms-front-end') . '</span> <a class="menu_delete "><i class="icon-x"></i></a> <div class="header_content_unit"> Chọn nội dung <a class="close-btn icon-close-off-2"></a> </div> </div> <div class="hidden_button_description" style="position: relative; width:100%; height: 100%;margin: 10px;"> <div class="box_shadow_content_unit"> <div class="add_content_unit "> <div class="content_editor"> <div class="text" id="' . $unit_id . '" name="' . $unit_id . '"> </div> <span class="save_unit_post btn btn-success"> Lưu</span> <span class="insert-my-media btn btn-success" data-id="' . $unit_id . '">Thêm hình ảnh</span> </div> <div class="content_settings"> <ul> <li> <span style="float: left; padding: 6px">Miễn phí : </span> <div class="onoffswitch"> <input type="checkbox" name="onoffswitch" value="H" class="onoffswitch-checkbox" id="myonoffswitch" checked> <label class="onoffswitch-label" for="myonoffswitch"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div></br> </li> <li> <span>Loại bài học : </span> <select id="vibe_type"> <option value="play" selected>' . __('Video', 'wplms-front-end') . '</option> <option value="music-file-1">' . __('Audio', 'wplms-front-end') . '</option> <option value="podcast">' . __('Podcast', 'wplms-front-end') . '</option> <option value="text-document">' . __('General', 'wplms-front-end') . '</option> </select></br> </li> <li> <span>' . __('Tổng thời gian bài học : ', 'wplms-front-end') . '</span> <input type="number" class="small_box" id="vibe_duration" value="' . $unit_settings1['vibe_duration'] . '" /> ' . ($unit_duration_parameter = apply_filters('vibe_unit_duration_parameter', 60)); echo calculate_duration_time($unit_duration_parameter) . '</br><p></p> </li> <li> <a style="width: 90%" id="save_unit_settings" class="course_button button full" data-id="' . $unit_id . '" data-course="' . $course_id . '">' . __('LƯU CẤU HÌNH UNIT', 'wplms-front-end') . '</a> </li> </ul> </div> </div> </div> </div> '; //Linkage $linkage = vibe_get_option('linkage'); if (isset($linkage) && $linkage) { $course_linkage = wp_get_post_terms($course_id, 'linkage', array("fields" => "names")); if (isset($course_linkage) && is_array($course_linkage)) { wp_set_post_terms($unit_id, $course_linkage, 'linkage'); } } die; }
_e('Set Product Price', 'vibe'); ?> <span> <input type="text" id="product_price" class="small_box" /> <?php echo get_woocommerce_currency(); ?> </span></h5> <h5 class="product_duration"><?php _e('Set Subscription duration', 'vibe'); ?> <span> <input type="number" id="product_duration" class="small_box" /> <?php $product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400); echo calculate_duration_time($product_duration_parameter); ?> </span></h5> </li> <?php } ?> <?php if (isset($_GET['action']) && is_numeric($_GET['action'])) { $course_id = $_GET['action']; } else { $course_id = 0; } do_action('wplms_front_end_pricing_content', $course_id); ?>
function tabs() { $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400, $this->course_id); $drip_duration_parameter = apply_filters('vibe_drip_duration_parameter', 86400, $this->course_id); return apply_filters('wplms_course_creation_tabs', array('create_course' => array('icon' => 'book-open', 'title' => isset($this->course_id) ? __('EDIT COURSE', 'wplms-front-end') : __('CREATE COURSE', 'wplms-front-end'), 'subtitle' => __('Start building a course', 'wplms-front-end'), 'fields' => array(array('label' => __('Course title', 'wplms-front-end'), 'type' => 'title', 'id' => 'post_title', 'from' => 'post', 'value_type' => 'single', 'style' => 'col-md-12', 'default' => __('ENTER A COURSE TITLE', 'wplms-front-end'), 'help' => __('This is the title of the course which is displayed on top of every course', 'wplms-front-end')), array('label' => __('Course Category', 'wplms-front-end'), 'type' => 'taxonomy', 'taxonomy' => 'course-cat', 'from' => 'taxonomy', 'value_type' => 'single', 'style' => 'col-md-12', 'id' => 'course-cat', 'default' => __('Select a Course Category', 'wplms-front-end')), array('label' => __('Course Image', 'wplms-front-end'), 'type' => 'featured_image', 'level' => 'thumbnail', 'value_type' => 'single', 'upload_title' => __('Upload a Course Image', 'wplms-front-end'), 'upload_button' => __('Set as Course Image', 'wplms-front-end'), 'style' => 'col-md-3', 'from' => 'post', 'id' => 'post_thumbnail', 'default' => VIBE_URL . '/assets/images/add_image.png'), array('label' => __('Course Short Description', 'wplms-front-end'), 'type' => 'textarea', 'style' => 'col-md-9', 'value_type' => 'single', 'id' => 'post_excerpt', 'from' => 'post', 'extras' => '<a class="link toggle_vibe_post_content">' . __('Add full description', 'wplms-front-end') . '</a>', 'default' => __('Enter a short description of the course.', 'wplms-front-end')), array('label' => __('Full Description', 'wplms-front-end'), 'type' => 'editor', 'style' => 'col-md-12', 'value_type' => 'single', 'id' => 'post_content', 'from' => 'post', 'noscript' => true, 'default' => __('Enter full description of the course.', 'wplms-front-end')), array('label' => isset($this->course_id) ? __('SAVE COURSE', 'wplms-front-end') : __('CREATE COURSE', 'wplms-front-end'), 'id' => isset($this->course_id) ? 'save_course_button' : 'create_course_button', 'type' => 'button'))), 'course_settings' => array('icon' => 'settings-1', 'title' => __('SETTINGS', 'wplms-front-end'), 'subtitle' => __('Course settings', 'wplms-front-end'), 'fields' => array(array('label' => __('Course duration', 'wplms-front-end'), 'text' => __('Maximum Course Duration', 'wplms-front-end'), 'type' => 'number', 'style' => '', 'id' => 'vibe_duration', 'from' => 'meta', 'extra' => '<span data-connect="vibe_course_duration_parameter">' . calculate_duration_time($course_duration_parameter) . '</span>', 'default' => 9999, 'desc' => sprintf(__('Enter the maximum duration for the course in %s. This is the maximum duration within which the student should complete the course. Use 9999 for unlimited access to course.', 'wplms-front-end'), calculate_duration_time($course_duration_parameter))), array('label' => __('Course duration parameter', 'wplms-front-end'), 'text' => __('Set Course Duration parameter', 'wplms-front-end'), 'type' => 'duration', 'style' => '', 'id' => 'vibe_course_duration_parameter', 'from' => 'meta', 'default' => $course_duration_parameter, 'desc' => __('Set course duration parameter for this course.', 'wplms-front-end')), array('label' => __('Prerequisite Course', 'wplms-front-end'), 'text' => __('Set a prerequisite Course', 'wplms-front-end'), 'type' => 'selectmulticpt', 'cpt' => 'course', 'style' => '', 'id' => 'vibe_pre_course', 'placeholder' => __('Enter first 4 letters of course for search', 'wplms-front-end'), 'from' => 'meta', 'desc' => __('Pre-required course which the user needs to complete before subscribing to this course.', 'wplms-front-end')), array('label' => __('Course Type', 'wplms-front-end'), 'text' => __('Set Course Type', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('ONLINE', 'wplms-front-end'), 'S' => __('OFFLINE', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_offline', 'from' => 'meta', 'default' => 'H', 'desc' => __('Offline Courses can be filtered in the Course directory.', 'wplms-front-end')), array('label' => __('Unit Content (Offline Courses)', 'wplms-front-end'), 'text' => __('Full units in Curriculum', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('HIDE', 'wplms-front-end'), 'S' => __('SHOW', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_unit_content', 'from' => 'meta', 'default' => 'H', 'desc' => __('Full Unit content is available for users subscribed to the course, directly from Course curriculum. Recommended for Offline Courses.', 'wplms-front-end')), array('label' => __('Course Button (Offline Courses)', 'wplms-front-end'), 'text' => __('Hide Course Button after subscription', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('NO', 'wplms-front-end'), 'S' => __('YES', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_button', 'from' => 'meta', 'default' => 'H', 'desc' => __('Hide the Course button after user is subscribed to the Course.', 'wplms-front-end')), array('label' => __('Course Progress (Offline Courses)', 'wplms-front-end'), 'text' => __('Progress on Course home', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('HIDE', 'wplms-front-end'), 'S' => __('SHOW', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_progress', 'from' => 'meta', 'default' => 'H', 'desc' => __('Display Course progress on Course home page.', 'wplms-front-end')), array('label' => __('Auto Progress (Offline Courses)', 'wplms-front-end'), 'text' => __('Time based Course progress', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('NO', 'wplms-front-end'), 'S' => __('YES', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_auto_progress', 'from' => 'meta', 'default' => 'H', 'desc' => __('Automatically calculate progress based on Time elapsed in Course / Total course duration.', 'wplms-front-end')), array('label' => __('Post Reivews (Offline Courses)', 'wplms-front-end'), 'text' => __('Post Course reviews from Course Home', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('NO', 'wplms-front-end'), 'S' => __('YES', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_review', 'from' => 'meta', 'default' => 'H', 'desc' => __('Enable course subscribed students to post reviews from Course home.', 'wplms-front-end')), array('label' => __('Course Evaluation', 'wplms-front-end'), 'text' => __('Course Evaluation Mode', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('MANUAL', 'wplms-front-end'), 'S' => __('AUTOMATIC', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_auto_eval', 'from' => 'meta', 'default' => 'H', 'desc' => __('User gets the course result instantly upon submission.', 'wplms-front-end')), array('label' => __('Drip Feed', 'wplms-front-end'), 'text' => __('Course Drip Feed', 'wplms-front-end'), 'type' => 'conditionalswitch', 'hide_nodes' => array('vibe_course_section_drip', 'vibe_course_drip_duration', 'vibe_course_drip_duration_type', 'vibe_drip_duration_parameter'), 'options' => array('H' => __('DISABLE', 'wplms-front-end'), 'S' => __('ENABLE', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_drip', 'from' => 'meta', 'default' => 'H', 'desc' => __('Drip Feed courses, units are released one by one after certain duration of time.', 'wplms-front-end')), array('label' => __('Drip Feed Type', 'wplms-front-end'), 'text' => __('Drip Feed Type', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('UNIT', 'wplms-front-end'), 'S' => __('SECTION', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_section_drip', 'from' => 'meta', 'default' => 'H', 'desc' => __('Drip Feed courses, units are released one by one after certain duration to the user.', 'wplms-front-end')), array('label' => __('Drip Feed Duration Type', 'wplms-front-end'), 'text' => __('Drip Feed Duration Type', 'wplms-front-end'), 'type' => 'reverseconditionalswitch', 'hide_nodes' => array('vibe_course_drip_duration', 'vibe_drip_duration_parameter'), 'options' => array('H' => __('STATIC', 'wplms-front-end'), 'S' => __('UNIT DURATION', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_drip_duration_type', 'from' => 'meta', 'default' => 'H', 'desc' => __('Drip Feed courses, units are released one by one after certain duration to the user.', 'wplms-front-end')), array('label' => __('Drip Duration', 'wplms-front-end'), 'text' => __('Set Duration between two successive Course elements', 'wplms-front-end'), 'type' => 'number', 'style' => '', 'id' => 'vibe_course_drip_duration', 'from' => 'meta', 'extra' => '<span data-connect="vibe_drip_duration_parameter">' . calculate_duration_time($drip_duration_parameter) . '</span>', 'default' => 1, 'desc' => sprintf(__('Enter the drip duration for the course in %s. This is the duration after which the next unit/section unlocks for the user after viewing the previous unit/section.', 'wplms-front-end'), calculate_duration_time($drip_duration_parameter))), array('label' => __('Drip Feed duration parameter', 'wplms-front-end'), 'text' => __('Set Drip Duration parameter', 'wplms-front-end'), 'type' => 'duration', 'style' => '', 'id' => 'vibe_drip_duration_parameter', 'from' => 'meta', 'default' => $drip_duration_parameter, 'desc' => __('Set course drip feed duration parameter for this course.', 'wplms-front-end')), array('label' => __('Course Certificate', 'wplms-front-end'), 'text' => __('Course Certificate', 'wplms-front-end'), 'type' => 'conditionalswitch', 'hide_nodes' => array('vibe_course_passing_percentage', 'vibe_certificate_template'), 'options' => array('H' => __('DISABLE', 'wplms-front-end'), 'S' => __('ENABLE', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_certificate', 'from' => 'meta', 'default' => 'H', 'desc' => __('Award Course completion Certificates to student on course completion.', 'wplms-front-end')), array('label' => __('Passing Percentage', 'wplms-front-end'), 'text' => __('Set Certificate Percentage', 'wplms-front-end'), 'type' => 'number', 'style' => '', 'id' => 'vibe_course_passing_percentage', 'from' => 'meta', 'extra' => __(' out of 100', 'wplms-front-end'), 'default' => 40, 'desc' => __('Any user achieving more marks (weighted average of Quizzes/assignments in course) than this gets the Course certificate.', 'wplms-front-end')), array('label' => __('Certificate Template', 'wplms-front-end'), 'text' => __('Select Certificate template', 'wplms-front-end'), 'type' => 'selectcpt', 'cpt' => 'certificate', 'style' => '', 'id' => 'vibe_certificate_template', 'placeholder' => __('Enter first 3 letters to search course template', 'wplms-front-end'), 'from' => 'meta', 'desc' => __('Connect a custom Certificate template for this Course.', 'wplms-front-end')), array('label' => __('Course Badge', 'wplms-front-end'), 'text' => __('Course Badge', 'wplms-front-end'), 'type' => 'conditionalswitch', 'hide_nodes' => array('vibe_course_badge_percentage', 'vibe_course_badge_title', 'vibe_course_badge'), 'options' => array('H' => __('DISABLE', 'wplms-front-end'), 'S' => __('ENABLE', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_badge', 'from' => 'meta', 'default' => 'H', 'desc' => __('Award Excellence badges to student on course completion.', 'wplms-front-end')), array('label' => __('Badge Percentage', 'wplms-front-end'), 'text' => __('Set Excellence Badge Percentage', 'wplms-front-end'), 'type' => 'number', 'style' => '', 'id' => 'vibe_course_badge_percentage', 'from' => 'meta', 'extra' => __(' out of 100', 'wplms-front-end'), 'default' => 75, 'desc' => __('Any user achieving more marks (weighted average of Quizzes/assignments in course) than this gets the Course Badge.', 'wplms-front-end')), array('label' => __('Badge Title', 'wplms-front-end'), 'text' => __('Set Badge title', 'wplms-front-end'), 'type' => 'text', 'style' => '', 'id' => 'vibe_course_badge_title', 'from' => 'meta', 'default' => __('Course Badge Title', 'wplms-front-end'), 'desc' => __('Course Badge Title', 'wplms-front-end')), array('label' => __('Course Badge', 'wplms-front-end'), 'text' => __('Upload Course Badge', 'wplms-front-end'), 'type' => 'media', 'style' => '', 'title' => __('Select or Upload a Course badge.', 'wplms-front-end'), 'button' => __('Add Course badge.', 'wplms-front-end'), 'id' => 'vibe_course_badge', 'default' => VIBE_URL . '/images/add_image.png', 'from' => 'meta', 'desc' => __('Upload a course badge.', 'wplms-front-end')), array('label' => __('Course Retakes', 'wplms-front-end'), 'text' => __('Student Course Retakes', 'wplms-front-end'), 'type' => 'number', 'style' => '', 'id' => 'vibe_course_retakes', 'default' => 0, 'from' => 'meta', 'desc' => __('Set number of times a student can re-take the course (0 to disable)', 'wplms-front-end')), array('label' => __('Maxium Seats in Course', 'wplms-front-end'), 'text' => __('Maximum students that can join the Course', 'wplms-front-end'), 'type' => 'number', 'style' => '', 'id' => 'vibe_max_students', 'default' => 0, 'from' => 'meta', 'desc' => __('Set number of times a student can re-take the course (0 to disable)', 'wplms-front-end')), array('label' => __('Course Start Date', 'wplms-front-end'), 'text' => __('Start date', 'wplms-front-end'), 'type' => 'date', 'style' => '', 'id' => 'vibe_start_date', 'default' => the_date('Y-m-d', '', '', false), 'from' => 'meta', 'desc' => __('Set a Course start date.', 'wplms-front-end')), array('label' => __('Course Instructions', 'wplms-front-end'), 'text' => __('Add Course specific instructions', 'wplms-front-end'), 'type' => 'editor', 'noscript' => true, 'style' => '', 'id' => 'vibe_course_instructions', 'from' => 'meta', 'desc' => __('Course instructions are displayed when the user starts a course.', 'wplms-front-end')), array('label' => __('Course Completion Message', 'wplms-front-end'), 'text' => __('Completion Message', 'wplms-front-end'), 'type' => 'editor', 'noscript' => true, 'style' => '', 'id' => 'vibe_course_message', 'from' => 'meta', 'desc' => __('Completion message is shown to the student when she finishes the course.', 'wplms-front-end')), array('label' => __('SAVE SETTINGS', 'wplms-front-end'), 'id' => 'save_course_settings_button', 'type' => 'button'))), 'course_components' => array('icon' => 'archive', 'title' => __('COMPONENTS', 'wplms-front-end'), 'subtitle' => __('Course settings', 'wplms-front-end'), 'fields' => array(array('label' => __('Course Group', 'wplms-front-end'), 'text' => __('Set a Course Group', 'wplms-front-end'), 'type' => 'group', 'style' => '', 'id' => 'vibe_group', 'from' => 'meta', 'desc' => __('Set a course specific group.', 'wplms-front-end')), array('label' => __('Course Forum', 'wplms-front-end'), 'text' => __('Set a Course Forum', 'wplms-front-end'), 'type' => 'forum', 'style' => '', 'id' => 'vibe_forum', 'from' => 'meta', 'desc' => __('Set a course forum.', 'wplms-front-end')), array('label' => __('SAVE COMPONENTS', 'wplms-front-end'), 'id' => 'save_course_components_button', 'type' => 'button'))), 'course_curriculum' => array('icon' => 'file', 'title' => __('SET CURRICULUM', 'wplms-front-end'), 'subtitle' => __('Add Units and Quizzes', 'wplms-front-end'), 'fields' => array(array('label' => __('Curriculum'), 'id' => 'vibe_course_curriculum', 'buttons' => array('add_course_section' => __('ADD SECTION', 'wplms-front-end'), 'add_course_unit' => __('ADD UNIT', 'wplms-front-end'), 'add_course_quiz' => __('ADD QUIZ', 'wplms-front-end')), 'type' => 'curriculum', 'style' => '', 'default' => 9999, 'desc' => __('Build Course curriculum', 'wplms-front-end')))), 'course_pricing' => array('icon' => 'tag', 'title' => __('PRICING', 'wplms-front-end'), 'subtitle' => __('Set Price for Course', 'wplms-front-end'), 'fields' => array(array('label' => __('Course Pricing', 'wplms-front-end'), 'type' => 'heading'), array('label' => __('Free ', 'wplms-front-end'), 'text' => __('Free Course', 'wplms-front-end'), 'type' => 'switch', 'options' => array('H' => __('No', 'wplms-front-end'), 'S' => __('Yes', 'wplms-front-end')), 'style' => '', 'id' => 'vibe_course_free', 'from' => 'meta', 'default' => 'H', 'desc' => __('By pass any purchase process.', 'wplms-front-end')), array('label' => __('Product ', 'wplms-front-end'), 'text' => __('Set a Course Product', 'wplms-front-end'), 'cpt' => 'product', 'type' => 'selectproduct', 'style' => '', 'id' => 'vibe_product', 'from' => 'meta', 'default' => '', 'desc' => __('Connect a Product with this course.', 'wplms-front-end')), array('label' => __('SAVE PRICING', 'wplms-front-end'), 'id' => 'save_pricing_button', 'type' => 'button'))), 'course_live' => array('icon' => 'glass', 'title' => $this->status == 'publish' ? __('MODIFY COURSE', 'wplms-front-end') : __('PUBLISH COURSE', 'wplms-front-end'), 'subtitle' => $this->status == 'publish' ? __('Change Course status', 'wplms-front-end') : __('Go Live !', 'wplms-front-end'), 'fields' => array(array('label' => __('Take Offline', 'wplms-front-end'), 'id' => 'offline_course', 'type' => 'course_live'))))); }
function get_element() { $course_id = $_POST['course_id']; if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security') || !current_user_can('edit_posts') || !is_numeric($_POST['element_id'])) { _e('Security check Failed. Contact Administrator.', 'wplms-front-end'); die; } $post_type = get_post_type($_POST['element_id']); ?> <div class="element_overlay"> <span class="close-pop dashicons dashicons-no-alt"></span> <div class="list-group list-group-sm open"> <div class="list-group-item accordion_trigger"> <h3><?php _e('CONTENT', 'wplms-front-end'); ?> <span></span></h3> </div> <div class="list-group-item"> <label><?php _e('Title', 'wplms-front-end'); ?> </label> <input type="text" class="post_field megatext" data-type="post_title" id="post_title" placeholder="<?php _e('Enter title', 'wplms-front-end'); ?> " value="<?php echo get_the_title($_POST['element_id']); ?> " class="form-control no-border" required="" tabindex="0" aria-required="true" aria-invalid="true"> </div> <div class="list-group-item"> <?php if ($post_type == 'quiz') { $taxonomy = 'quiz-type'; } else { $taxonomy = 'module-tag'; } $field = array('label' => __('Category', 'vibe'), 'type' => 'taxonomy', 'taxonomy' => $taxonomy, 'from' => 'taxonomy', 'value_type' => 'single', 'style' => '', 'id' => $taxonomy . '_id', 'default' => __('Select Category', 'vibe')); WPLMS_Front_End_Fields::generate_fields($field); ?> </div> <div class="list-group-item"> <label><?php _e('Content', 'wplms-front-end'); ?> </label> <?php $content = get_post_field('post_content', $_POST['element_id']); $settings = array('wpautop' => true, 'media_buttons' => true, 'editor_class' => 'post_field', 'textarea_name' => 'post_content_' . $post_type, 'textarea_rows' => 10, 'tabindex' => '', 'editor_css' => '', 'teeny' => true, 'dfw' => true, 'tinymce' => true, 'quicktags' => true); $id_string = $post_type . '__' . rand(0, 999); wp_editor($content, 'post_content_' . $id_string, $settings); ?> <script> tinyMCE.execCommand('mceAddEditor', false, 'post_content_<?php echo $id_string; ?> '); quicktags({id : 'post_content_<?php echo $id_string; ?> '}); tinyMCE.triggerSave(); </script> </div> </div> <div class="list-group list-group-sm"> <div class="list-group-item accordion_trigger"> <h3><?php _e('SETTINGS', 'wplms-front-end'); ?> <span></span></h3> </div> <?php $settings = vibe_meta_box_arrays($post_type); if ($post_type == 'quiz') { $settings['vibe_quiz_dynamic'] = array('label' => __('Dynamic Quiz', 'vibe-customtypes'), 'desc' => __('Dynamic quiz automatically selects questions.', 'vibe-customtypes'), 'id' => 'vibe_quiz_dynamic', 'type' => 'conditionalswitch', 'hide_nodes' => array('vibe_quiz_tags', 'vibe_quiz_number_questions', 'vibe_quiz_marks_per_question'), 'options' => array('H' => __('DISABLE', 'vibe'), 'S' => __('ENABLE', 'vibe')), 'style' => '', 'from' => 'meta', 'default' => 'H'); unset($settings['vibe_quiz_questions']); } if ($post_type == 'unit') { if (!empty($settings['vibe_assignment'])) { unset($settings['vibe_assignment']); } } if ($post_type == 'wplms-assignment') { $assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter', 86400); $settings[3]['extra'] = calculate_duration_time($assignment_duration_parameter); } foreach ($settings as $setting) { if ($setting['type'] != 'small_button') { echo '<div class="list-group-item vibe_' . $setting['id'] . '">'; WPLMS_Front_End_Fields::generate_fields($setting, $_POST['element_id']); echo '</div>'; } else { WPLMS_Front_End_Fields::generate_fields($setting, $_POST['element_id']); } } ?> </div> <?php if (get_post_type($_POST['element_id']) == 'unit' && class_exists('WPLMS_Assignments')) { ?> <div class="list-group list-group-sm list-group-assignments post_field" data-id="vibe_assignment"> <div class="list-group-item accordion_trigger"> <h3><?php _e('Assignments', 'wplms-front-end'); ?> <span></span></h3> </div> <?php $setting = apply_filters('wplms_front_end_unit_assignments', array('label' => __('Unit assignments', 'vibe-customtypes'), 'desc' => __('Select assignment for Unit', 'vibe-customtypes'), 'id' => 'vibe_assignment', 'type' => 'assignment', 'cpt' => 'assignment', 'from' => 'meta', 'buttons' => array('add_assignment' => __('ADD ASSIGNMENT', 'vibe')))); if (!empty($_POST['element_id'])) { $setting['value'] = get_post_meta($_POST['element_id'], 'vibe_assignment', true); } WPLMS_Front_End_Fields::generate_fields($setting, $_POST['element_id']); ?> </div> <?php } if (get_post_type($_POST['element_id']) == 'quiz') { ?> <div class="list-group list-group-sm list-group-questions post_field" data-id="vibe_quiz_questions"> <div class="list-group-item accordion_trigger"> <h3><?php _e('QUESTIONS', 'wplms-front-end'); ?> <span></span></h3> </div> <?php $setting = apply_filters('wplms_front_end_quiz_questions', array('label' => __('Quiz Questions', 'vibe-customtypes'), 'desc' => __('Static Quiz questions', 'vibe-customtypes'), 'id' => 'vibe_quiz_questions', 'type' => 'quiz_questions', 'cpt' => 'question', 'from' => 'meta', 'buttons' => array('add_quiz_question' => __('ADD QUESTION', 'vibe')))); if (!empty($_POST['element_id'])) { $setting['value'] = get_post_meta($_POST['element_id'], 'vibe_quiz_questions', true); } WPLMS_Front_End_Fields::generate_fields($setting, $_POST['element_id']); ?> </div> <?php } $buttons = array(array('label' => __('SAVE', 'vibe'), 'id' => 'save_element_button', 'data-id' => $_POST['element_id'], 'type' => 'small_button'), array('label' => __('EDIT IN ADMIN', 'vibe'), 'id' => 'edit_element_button', 'href' => get_edit_post_link($_POST['element_id']), 'type' => 'small_button'), array('label' => __('PREVIEW', 'vibe'), 'id' => 'preview_element_button', 'href' => get_permalink($_POST['element_id']), 'type' => 'small_button'), array('label' => __('Close', 'vibe'), 'id' => 'close_element_button', 'type' => 'small_button')); foreach ($buttons as $button) { WPLMS_Front_End_Fields::generate_fields($button, $_POST['element_id']); } ?> </div> </div> <?php die; }
function bp_course_single_item_view($flag) { $course_classes = apply_filters('bp_course_single_item', 'modern_course_single_item', get_the_ID()); ?> <li class="<?php echo $course_classes; ?> "> <div class="row"> <div class="col-md-4"> <div class="item-avatar" data-id="<?php echo get_the_ID(); ?> " itemprop="photo"> <?php bp_course_avatar(); ?> </div> </div> <div class="col-md-6"> <div class="item-title"> <?php bp_course_title(); if (get_post_status() != 'publish') { echo '<i> ( ' . get_post_status() . ' ) </i>'; } ?> </div> <div class="item-desc"><?php echo get_the_term_list(get_the_ID(), 'course-cat', '<ul class="course-category"><li>', '</li><li>', '</li></ul>'); bp_course_desc(); $instructors = apply_filters('wplms_course_instructors', get_post_field('post_author', get_the_ID()), get_the_ID()); if (!is_array($instructors)) { $instructors = array($instructors); } echo '<div class="instructors">'; foreach ($instructors as $instructor) { echo '<a href="' . bp_core_get_user_domain($instructor) . '" title="' . bp_core_get_username($instructor) . '">' . bp_core_fetch_avatar(array('item_id' => $instructor, 'type' => 'thumb')) . '</a>'; } ?> </div></div> </div> <div class="col-md-2"> <div class="course-meta"> <?php $reviews = get_post_meta(get_the_ID(), 'average_rating', true); $students = get_post_meta(get_the_ID(), 'vibe_students', true); $seats = get_post_meta(get_the_ID(), 'vibe_max_students', true); $date = get_post_meta(get_the_ID(), 'vibe_start_date', true); $duration = get_post_meta(get_the_ID(), 'vibe_duration', true); $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400); echo '<ul> <li><span class="dashicons dashicons-groups"></span> ' . $students . (empty($seats) || $seats > 9998 ? '' : ' / ' . $seats) . '</li> <li><span class="dashicons dashicons-clock"></span> ' . ($duration > 9998 ? __('UNLIMITED', 'wplms_modern') : $duration . ' ' . calculate_duration_time($course_duration_parameter)) . '</li>'; if (strtotime($date) > time()) { echo '<li>' . date_i18n(get_option('date_format'), strtotime($date)) . '</li>'; } echo '</ul><div class="modern-star-rating">'; for ($i = 1; $i <= 5; $i++) { if ($reviews >= 1) { echo '<span class="dashicons dashicons-star-filled"></span>'; } elseif ($reviews < 1 && $reviews >= 0.4) { echo '<span class="dashicons dashicons-star-half"></span>'; } else { echo '<span class="dashicons dashicons-star-empty"></span>'; } $reviews--; } echo '</div>'; ?> <div class="item-credits"> <?php bp_course_credits(); ?> </div> </div> </div> <?php do_action('bp_directory_course_item'); ?> </div> </li> <?php return 1; }
function generate_fields($field, $id = null) { if (!empty($id)) { $this->course_id = $id; } $user_id = get_current_user_id(); if (!empty($this->course_id)) { switch ($field['from']) { case 'post': $field['value'] = get_post_field($field['id'], $this->course_id); break; case 'taxonomy': $terms = wp_get_post_terms($this->course_id, $field['taxonomy']); if (!empty($terms)) { $field['value'] = $terms[0]->term_id; } break; default: if ($field['value_type'] == 'array') { $single = false; } else { $single = true; } $field['value'] = get_post_meta($this->course_id, $field['id'], $single); break; } } else { $field['value'] = $field['default']; } switch ($field['type']) { case 'heading': echo '<strong>' . $field['label'] . '</strong>'; break; case 'number': echo '<div class="field_wrapper ' . $field['style'] . '"> <label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>' . (!empty($field['text']) ? '<strong>' . $field['text'] . '</strong>' : ''); echo (!empty($field['text']) ? '<div class="right">' : '') . '<input type="number" id="" class="small_box post_field ' . (empty($field['text']) ? 'form_field' : '') . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" placeholder="' . $field['default'] . '" value="' . $field['value'] . '"/>' . (isset($field['extra']) ? $field['extra'] : '') . '</div>'; echo !empty($field['text']) ? '</div>' : ''; break; case 'text': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; echo !empty($field['text']) ? '<strong>' . $field['text'] . '</strong>' : ''; echo '<input type="text" placeholder="' . $field['default'] . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" class="mid_box post_field ' . (empty($field['text']) ? 'form_field' : '') . '" value="' . $field['value'] . '"/>' . (isset($field['extra']) ? $field['extra'] : ''); echo '</div>'; break; case 'title': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; echo '<input type="text" class="megatext post_field" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" placeholder="' . $field['default'] . '" value="' . ($field['default'] != $field['value'] ? $field['value'] : '') . '" />'; echo '</div>'; echo '<hr />'; break; case 'taxonomy': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; ?> <ul id="<?php echo $field['id']; ?> " class="wplms-taxonomy"> <li> <select id="<?php echo $field['id']; ?> -select" class="chosen post_field" <?php echo 'data-id="' . $field['id'] . '" data-taxonomy="' . $field['taxonomy'] . '" data-type="' . $field['type'] . '"'; ?> > <option><?php echo $field['default']; ?> </option> <?php $new_tax = apply_filters('wplms_front_end_new_tax_cap', true); if ($new_tax) { ?> <option value="new"><?php _e('Add new', 'wplms-front-end'); ?> </option> <?php } $terms = get_terms($field['taxonomy'], apply_filters('wplms_front_end_field_taxonomy_args', array('hide_empty' => false, 'orderby' => 'name', 'order' => 'ASC'), $field)); if (isset($terms) && is_array($terms)) { foreach ($terms as $term) { $parenttermname = ''; if ($term->parent) { $parentterm = get_term_by('id', $term->parent, $field['taxonomy'], 'ARRAY_A'); $parenttermname = $parentterm['name'] . ' › '; } echo '<option value="' . $term->term_id . '" ' . (isset($_GET['action']) ? selected($field['value'], $term->term_id) : '') . '>' . $parenttermname . $term->name . '</option>'; } } ?> </select> </li> <li><input type="text" id="new_<?php echo str_replace('-', '_', $field['id']); ?> " class="ccf_text post_field wplms-new-taxonomy" <?php echo 'data-id="' . $field['taxonomy'] . '" data-type="' . $field['type'] . '_new"'; ?> placeholder="<?php _e('Enter a new', 'wplms-front-end'); ?> " /></li> </ul><br /> <?php echo '</div>'; echo '<hr />'; break; case 'featured_image': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; ?> <div id="<?php echo $field['id']; ?> " class="upload_image_button" data-input-name="<?php echo $field['id']; ?> " data-uploader-title="<?php echo $field['upload_title']; ?> " data-uploader-button-text="<?php echo $field['upload_button']; ?> " data-uploader-allow-multiple="false"> <?php if (isset($this->course_id) && has_post_thumbnail($this->course_id)) { if ($field['level'] == 'thumbnail') { echo get_the_post_thumbnail($this->course_id, 'thumbnail'); echo '<input type="hidden" value="' . get_post_thumbnail_id($this->course_id) . '" class="post_field" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" />'; } } else { ?> <img src="<?php echo $field['default']; ?> " alt="course image" class="default" /> <?php } ?> </div> <?php echo '</div>'; break; case 'media': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; echo (empty($field['text']) ? '' : '<strong>' . $field['text'] . '</strong>') . ' <div class="upload_button">'; if (is_numeric($field['value'])) { $attachment = wp_get_attachment_image_src($field['value']); if (empty($attachment)) { echo '<a id="' . $field['id'] . '" data-input-name="' . $field['id'] . '" data-uploader-title="' . $field['title'] . '" data-uploader-button-text="' . $field['button'] . '"><i class="icon-image-photo-file-1"></i></a>'; } else { $url = $attachment[0]; echo '<a id="' . $field['id'] . '" data-input-name="' . $field['id'] . '" data-uploader-title="' . $field['title'] . '" data-uploader-button-text="' . $field['button'] . '"><img src="' . $url . '" class="submission_thumb thumbnail" /><input type="hidden" value="' . $field['value'] . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" /></a>'; } } else { echo '<a id="' . $field['id'] . '" data-input-name="' . $field['id'] . '" data-uploader-title="' . $field['title'] . '" data-uploader-button-text="' . $field['button'] . '"><i class="icon-image-photo-file-1"></i></a>'; } echo '<script> var media_uploader' . $field['id'] . '; jQuery("#' . $field['id'] . '").on("click", function( event ){ var button = jQuery( this ); if ( media_uploader' . $field['id'] . ' ) { media_uploader' . $field['id'] . '.open(); return; } // Create the media uploader. media_uploader' . $field['id'] . ' = wp.media.frames.media_uploader' . $field['id'] . ' = wp.media({ title: button.attr( "data-uploader-title"), library: { type: "image", query: false }, button: { text: button.attr("data-uploader-button-text"), }, }); // Create a callback when the uploader is called media_uploader' . $field['id'] . '.on( "select", function() { var selection = media_uploader' . $field['id'] . '.state().get("selection"), input_name = button.data( "input-name"); selection.map( function( attachment ) { attachment = attachment.toJSON(); console.log(attachment); button.html("<img src=\'"+attachment.url+"\' class=\'submission_thumb thumbnail\' /><input id=\'"+input_name +"\' class=\'form-control post_field\' name=\'"+input_name+"\' data-id=\'' . $field['id'] . '\' data-type=\'' . $field['type'] . '\' type=\'hidden\' value=\'"+attachment.id+"\' />"); }); }); // Open the uploader media_uploader' . $field['id'] . '.open(); }); </script> </div>'; break; case 'textarea': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; echo '<textarea id="' . $field['id'] . '" class="post_field" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '">' . $field['value'] . '</textarea>' . (empty($field['extras']) ? '' : $field['extras']); echo '</div>'; break; case 'editor': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . '</label>'; wp_editor($field['value'], $field['id'], array('editor_class' => 'post_field')); echo '</div>'; if (!isset($field['noscript'])) { echo '<script>jQuery(document).ready(function($){ tinyMCE.execCommand("mceRemoveEditor", true, "' . $field['id'] . '"); tinyMCE.execCommand("mceAddEditor", false, "' . $field['id'] . '"); quicktags({id : "element_content"}); tinyMCE.triggerSave();}); </script>'; } break; case 'date': case 'calendar': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; echo !empty($field['text']) ? '<strong>' . $field['text'] . '</strong><div class="right">' : ''; echo '<input type="text" placeholder="' . $field['default'] . '" value="' . $field['value'] . '" data-id="' . $field['id'] . '" class="mid_box date_box post_field ' . (empty($field['text']) ? 'form_field' : '') . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '"/>'; echo !empty($field['text']) ? '</div>' : ''; echo '<script>jQuery(document).ready(function(){ jQuery( ".date_box" ).datepicker({ dateFormat: "yy-mm-dd", numberOfMonths: 1, showButtonPanel: true, });});</script><style>.ui-datepicker{z-index:99;}</style></div>'; break; case 'time': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; echo !empty($field['text']) ? '<strong>' . $field['text'] . '</strong><div class="right">' : ''; echo '<input type="text" placeholder="' . $field['default'] . '" value="' . $field['value'] . '" data-id="' . $field['id'] . '" class="mid_box time_box post_field ' . (empty($field['text']) ? 'form_field' : '') . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '"/>'; echo !empty($field['text']) ? '</div>' : ''; echo '<script> jQuery(document).ready(function(){ jQuery( ".time_box" ).each(function(){ jQuery(this).timePicker({ show24Hours: false, separator:":", step: 15 }); });});</script></div>'; break; case 'group': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; ?> <input type="hidden" id="vibe_group" class="post_field" value="<?php echo $field['value']; ?> " <?php echo 'data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" '; ?> /> <?php echo '<span class="dashicons dashicons-dismiss clear_input" data-id="vibe_group"><div class="hide"><span>' . $field['text'] . '</span></div></span>'; echo '<h3>'; if (empty($field['value']) || $field['value'] == $field['default']) { echo '<span>' . $field['text'] . '</span>'; $flag = 0; } else { echo self::get_group_name($field['value']); echo '<span><a id="edit_group" href="' . self::get_group_permalink($field['value']) . '" target="_blank"><i>' . __('edit', 'wplms-front-end') . '</i></a> <i>' . __('change', 'wplms-front-end') . '</i></span>'; $flag = 1; } echo '</h3>'; ?> <div id="change_group" <?php echo $flag ? 'style="display:none;"' : ''; ?> > <div class="col-md-6"> <a class="more"><i class="icon-users"></i> <?php _e('Select Existing Group', 'wplms-front-end'); ?> </a> <div class="select_group_form"> <select class="selectgroup" data-placeholder="<?php _e('Select a Group', 'wplms-front-end'); ?> "> </select> <a class="use_selected button"><?php _e('Set', 'wplms-front-end'); ?> </a> </div> </div> <div class="col-md-6"> <a class="more"><i class="icon-user"></i> <?php _e('Create New Group', 'wplms-front-end'); ?> </a> <div class="new_group_form"> <input type="text" class="form_field" id="vibe_group_name" name="name" placeholder="<?php _e('Group Name', 'wplms-front-end'); ?> "> <select id="vibe_group_privacy" class="chosen form_field"> <option value="public"><?php _e('Public', 'wplms-front-end'); ?> </option> <option value="private"><?php _e('Private', 'wplms-front-end'); ?> </option> <option value="hidden"><?php _e('Hidden', 'wplms-front-end'); ?> </option> </select> <textarea class="description" id="vibe_group_description" placeholder="<?php _e('Group Description', 'wplms-front-end'); ?> "></textarea> <a class="button small" id="create_new_group"><?php _e('Create New Group', 'wplms-front-end'); ?> </a> </div> </div> </div> <?php echo '</div>'; break; case 'forum': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; ?> <input type="hidden" id="vibe_forum" class="post_field" value="<?php echo $field['value']; ?> " <?php echo 'data-id="' . $field['id'] . '" data-type="' . $field['type'] . '"'; ?> /> <?php echo '<span class="dashicons dashicons-dismiss clear_input" data-id="vibe_forum"><div class="hide"><span>' . $field['text'] . '</span></div></span>'; echo '<h3>'; if (empty($field['value']) || $field['value'] == $field['default']) { echo '<span>' . $field['text'] . '</span>'; $flag = 0; } else { echo get_the_title($field['value']); echo '<span><a href="' . get_permalink($field['value']) . '" target="_blank"><i>' . __('edit', 'wplms-front-end') . '</i></a> <i>' . __('change', 'wplms-front-end') . '</i></span>'; $flag = 1; } echo '</h3>'; ?> <div id="change_forum" <?php echo $flag ? 'style="display:none;"' : ''; ?> > <div class="col-md-6"> <a class="more"><i class="icon-users"></i> <?php _e('Select Existing Forum', 'wplms-front-end'); ?> </a> <div class="select_forum_form"> <select class="selectforum" data-placeholder="<?php _e('Select a Forum', 'wplms-front-end'); ?> "> </select> <a class="use_selected button"><?php _e('Set', 'wplms-front-end'); ?> </a> </div> </div> <div class="col-md-6"> <a class="more"><i class="icon-user"></i> <?php _e('Create New Forum', 'wplms-front-end'); ?> </a> <div class="new_forum_form"> <input type="text" class="form_field" id="vibe_forum_name" name="name" placeholder="<?php _e('Forum Name', 'wplms-front-end'); ?> "> <select id="vibe_forum_privacy" class="chosen form_field"> <option value="publish"><?php _e('Public', 'wplms-front-end'); ?> </option> <option value="private"><?php _e('Private', 'wplms-front-end'); ?> </option> <option value="hidden"><?php _e('Hidden', 'wplms-front-end'); ?> </option> </select> <textarea class="description" id="vibe_forum_description" placeholder="<?php _e('Forum Description', 'wplms-front-end'); ?> "></textarea> <a class="button small" id="create_new_forum"><?php _e('Create New Forum', 'wplms-front-end'); ?> </a> </div> </div> </div> <?php break; case 'yesno': case 'showhide': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label><strong>' . $field['text'] . '</strong><div class="switch">'; $i = 0; foreach ($field['options'] as $option) { echo '<input type="radio" class="switch-input post_field ' . $field['id'] . '" name="' . $field['id'] . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" value="' . $option['value'] . '" id="' . $field['id'] . $option['value'] . '" '; checked($field['value'], $option['value']); echo '>'; echo '<label for="' . $field['id'] . $option['value'] . '" class="switch-label switch-label-' . (!($i % 2) ? 'off' : 'on') . '">' . $option['label'] . '</label>'; $i++; } echo '<span class="switch-selection"></span></div></div>'; break; case 'switch': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label><strong>' . $field['text'] . '</strong><div class="switch">'; $i = 0; if (empty($field['value'])) { if (empty($field['default'])) { if (!empty($field['std'])) { $field['value'] = $field['std']; } } else { $field['value'] = $field['default']; } } foreach ($field['options'] as $key => $value) { echo '<input type="radio" class="switch-input post_field ' . $field['id'] . '" name="' . $field['id'] . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" value="' . $key . '" id="' . $field['id'] . $key . '" '; checked($field['value'], $key); echo '>'; echo '<label for="' . $field['id'] . $key . '" class="switch-label switch-label-' . (!($i % 2) ? 'off' : 'on') . '">' . $value . '</label>'; $i++; } echo '<span class="switch-selection"></span></div></div>'; break; case 'conditionalswitch': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label><strong>' . $field['text'] . '</strong><div class="switch">'; $i = 0; if (empty($field['value'])) { if (empty($field['default'])) { if (!empty($field['std'])) { $field['value'] = $field['std']; } } else { $field['value'] = $field['default']; } } foreach ($field['options'] as $key => $value) { echo '<input type="radio" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" class="switch-input post_field conditional-switch ' . $field['id'] . '" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" name="' . $field['id'] . '" value="' . $key . '" id="' . $field['id'] . $key . '" '; checked($field['value'], $key); echo '>'; echo '<label for="' . $field['id'] . $key . '" class="switch-label switch-label-' . (!($i % 2) ? 'off' : 'on') . '">' . $value . '</label>'; $i++; } echo '<span class="switch-selection"></span></div></div>'; if (!empty($field['hide_nodes'])) { echo '<script> jQuery(document).ready(function($){ $(".conditional-switch.' . $field['id'] . '").each(function(){ $(this).on("click",function(){ var val = $(this).parent().find(".conditional-switch.' . $field['id'] . ':checked").val(); if(val == "S" || val === "S"){'; foreach ($field['hide_nodes'] as $node) { echo '$(".vibe_' . $node . '").show(200).addClass("conditional_display");'; } echo '}else{'; foreach ($field['hide_nodes'] as $node) { echo '$(".vibe_' . $node . '").hide(200).removeClass("conditional_display");'; } echo ' } }); var val = $(this).parent().find(".conditional-switch.' . $field['id'] . ':checked").val(); if(typeof val !== "undefined" && (val == "S" || val === "S")){'; foreach ($field['hide_nodes'] as $node) { echo '$(".vibe_' . $node . '").show(200).addClass("conditional_display");'; } echo '}else{'; foreach ($field['hide_nodes'] as $node) { echo '$(".vibe_' . $node . '").hide(200).removeClass("conditional_display");'; } echo ' } }); }); </script>'; } break; case 'select': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>' . (!empty($field['text']) ? '<strong>' . $field['text'] . '</strong>' : ''); echo '<select class="select2 post_field" style="width: 100%;" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" >'; if (!empty($field['options'])) { foreach ($field['options'] as $option) { echo '<option value="' . $option['value'] . '" ' . ($field['value'] == $option['value'] ? 'selected="selected"' : '') . '>' . $option['label'] . '</option>'; } } echo '</select></div>'; break; case 'selectcpt': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>' . (!empty($field['text']) ? '<strong>' . $field['text'] . '</strong>' : ''); if (empty($field['post_status'])) { $field['post_status'] = 'publish'; } else { $field['post_status'] = implode(',', $field['post_status']); } echo (!empty($field['text']) ? '<div class="right">' : '') . '<select class="select2 selectcpt post_field" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" data-status="' . $field['post_status'] . '" style="width: 100%;" data-placeholder="' . $field['placeholder'] . '" data-cpt="' . ($field['cpt'] ? $field['cpt'] : ($field['post_type'] ? $field['post_type'] : '')) . '">'; if (!empty($field['value']) && $field['value'] != $field['default']) { echo '<option value="' . $field['value'] . '">' . get_the_title($field['value']) . '</option>'; } echo '</select></div>'; break; case 'selectproduct': $product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400); $product_fields = apply_filters('wplms_front_end_new_product', array(array('label' => __('Title', 'wplms-front-end'), 'placeholder' => __('Product Title', 'wplms-front-end'), 'type' => 'text', 'style' => '', 'from' => 'post', 'id' => 'post_title', 'desc' => __('Product title is useful to identify courses connected to this product.', 'wplms-front-end')), array('label' => __('Price', 'wplms-front-end'), 'text' => __('Price', 'wplms-front-end'), 'type' => 'text', 'style' => 'col-md-6', 'id' => '_regular_price', 'extra' => get_woocommerce_currency(), 'desc' => __('Set price of the course', 'wplms-front-end')), array('label' => __('Sale', 'wplms-front-end'), 'text' => __('Sale Price', 'wplms-front-end'), 'type' => 'text', 'style' => 'col-md-6', 'id' => '_sale_price', 'extra' => get_woocommerce_currency(), 'desc' => __('Blank if product not in sale', 'wplms-front-end')), array('label' => __('Subscription', 'wplms-front-end'), 'type' => 'conditionalswitch', 'text' => __('Subscription Type', 'wplms-front-end'), 'hide_nodes' => array('vibe_duration'), 'options' => array('H' => __('FULL DURATION', 'wplms-front-end'), 'S' => __('LIMITED', 'wplms-front-end')), 'style' => '', 'default' => 'H', 'id' => 'vibe_subscription', 'desc' => __('Set subscription type of product.', 'wplms-front-end')), array('label' => __('Subscription Duration', 'wplms-front-end'), 'type' => 'text', 'style' => '', 'id' => 'vibe_duration', 'extra' => calculate_duration_time($product_duration_parameter), 'from' => 'meta', 'default' => __('Must not be 0', 'wplms-front-end')))); echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>'; if (!empty($field['value']) && $field['value'] != $field['default']) { $product = wc_get_product($field['value']); echo '<span class="dashicons dashicons-dismiss clear_input" data-id="product_id"><div class="hide">' . $field['text'] . '<span class="change_product">' . __('Set Product', 'wplms-front-end') . '</span><input type="hidden" id="product_id" class="post_field" data-id="vibe_product" /></div></span>'; echo '<h3>' . get_the_title($field['value']) . '<span class="change_product">' . __('Change', 'wplms-front-end') . '</span><span class="edit_product">' . __('Edit', 'wplms-front-end') . '</span><strong class="price">' . $product->get_price_html() . '</strong> <input type="hidden" id="product_id" class="post_field" data-id="vibe_product" value="' . $field['value'] . '" /></h3>'; } else { echo '<h3>' . $field['text'] . '<span class="change_product">' . __('Set Product', 'wplms-front-end') . '</span></h3>'; } ?> <div id="change_product" class="field_wrapper" <?php if (empty($field['value'])) { echo 'style="display:block;"'; } else { echo 'style="display:none;"'; } ?> > <a class="hide_parent"><i class="icon-x"></i></a> <div class="col-md-6"> <a class="more"><i class="icon-users"></i> <?php _e('Select existing product', 'wplms-front-end'); ?> </a> <div class="select_product_form"> <select class="selectcpt select2" data-cpt="product" data-placeholder="<?php _e('Search a product', 'wplms-front-end'); ?> "> </select> <a class="use_selected_product button"><?php _e('Set Product', 'wplms-front-end'); ?> </a> </div> </div> <div class="col-md-6"> <a class="more"><i class="icon-user"></i> <?php _e('Create new product', 'wplms-front-end'); ?> </a> <div class="new_product_form"> <?php foreach ($product_fields as $product_field) { echo '<div class="vibe_' . $product_field['id'] . ' ' . (empty($product_field['style']) ? '' : $product_field['style']) . '">'; unset($product_field['style']); self::generate_fields($product_field); echo '</div>'; } ?> <a class="button small" id="create_new_product"><?php _e('Create Product', 'wplms-front-end'); ?> </a> </div> </div> </div> <?php if (!empty($field['value'])) { ?> <div id="edit_product" class="field_wrapper"> <a class="hide_parent"><i class="icon-x"></i></a> <?php foreach ($product_fields as $product_field) { echo '<div class="vibe_' . $product_field['id'] . ' ' . (empty($product_field['style']) ? '' : $product_field['style']) . '">'; unset($product_field['style']); if ($product_field['id'] == 'vibe_subscription') { $product_field['id'] = 'vibe_subscription1'; } self::generate_fields($product_field, $field['value']); echo '</div>'; } ?> <input type="hidden" class="post_field" data-id="ID" value="<?php echo $field['value']; ?> " /> <a class="button small" id="edit_course_product"><?php _e('Edit Product', 'wplms-front-end'); ?> </a> </div> <?php } break; case 'multiselect': echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label><strong>' . $field['text'] . '</strong>'; echo '<select class="select2 post_field" data-id="' . $field['id'] . '" style="width: 100%;" multiple>'; if (!empty($field['options'])) { foreach ($field['options'] as $option) { echo '<option value="' . $option['value'] . '" ' . (in_array($option['value'], $field['value']) ? 'selected="selected"' : '') . '>' . $option['label'] . '</option>'; } } echo '</select>'; break; case 'selectmulticpt': echo '<div class="field_wrapper ' . $field['style'] . '">'; echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>' . (!empty($field['text']) ? '<strong>' . $field['text'] . '</strong>' : ''); if (empty($field['post_status'])) { $field['post_status'] = 'publish'; } else { $field['post_status'] = implode(',', $field['post_status']); } echo (!empty($field['text']) ? '<div class="right" style="width:240px">' : '') . '<select class="select2 selectcpt post_field" data-id="' . $field['id'] . '" data-type="' . $field['type'] . '" data-status="' . $field['post_status'] . '" style="width: 100%;" data-placeholder="' . $field['placeholder'] . '" data-cpt="' . ($field['cpt'] ? $field['cpt'] : ($field['post_type'] ? $field['post_type'] : '')) . '" multiple>'; if (!empty($field['value']) && $field['value'] != $field['default']) { if (is_array($field['value'])) { foreach ($field['value'] as $value) { echo '<option value="' . $value . '" selected="selected">' . get_the_title($value) . '</option>'; } } } echo '</select></div>'; break; case 'course_live': ?> <?php if (!empty($_GET['action'])) { ?> <strong class="heading"><?php _e('Modify Course', 'wplms-front-end'); ?> <span><a href="<?php echo get_permalink($_GET['action']); ?> "><?php _e('Back to course', 'wplms-front-end'); ?> </a></span></strong> <?php if (get_post_type($_GET['action']) == 'course') { $post_status = get_post_status($_GET['action']); if ($post_status == 'publish') { $new_course_status = vibe_get_option('new_course_status'); if (isset($new_course_status) && $new_course_status == 'publish') { echo '<a id="offline_course" class="button big hero">' . __('TAKE OFFLINE', 'wplms-front-end') . '</a>'; } else { echo '<a id="publish_course" class="button big hero">' . __('SEND FOR APPROVAL', 'wplms-front-end') . '</a>'; } } else { $new_course_status = vibe_get_option('new_course_status'); if (isset($new_course_status) && $new_course_status == 'publish') { echo '<a id="publish_course" class="button big hero">' . __('GO LIVE', 'wplms-front-end') . '</a>'; } else { echo '<a id="publish_course" class="button big hero">' . __('SEND FOR APPROVAL', 'wplms-front-end') . '</a>'; } } $delete_enable = apply_filters('wplms_front_end_course_delete', 0); if ($delete_enable) { echo '<hr /><a id="delete_course" class="button big full primary">' . __('DELETE COURSE', 'wplms-front-end') . '</a>'; echo '<a class="link right showhide_indetails">' . __('SHOW OPTIONS', 'wplms-front-end') . '</a>'; $delete_options = apply_filters('wplms_course_delete_options', array('unit' => array('label' => __('Delete Units', 'wplms-front-end'), 'post_type' => 'unit', 'post_meta' => 'vibe_course_curriculum'), 'quiz' => array('label' => __('Delete Quizzes', 'wplms-front-end'), 'post_type' => 'quiz', 'post_meta' => 'vibe_course_curriculum'), 'assignment' => array('label' => __('Delete Assignments', 'wplms-front-end'), 'post_type' => 'wplms-assignment', 'post_meta' => 'vibe_assignment_course'))); echo '<div class="in_details"><ul class="clear">'; foreach ($delete_options as $option) { echo '<li><label>' . $option['label'] . '</label><input class="delete_field right" type="checkbox" value="1" data-posttype="' . $option['post_type'] . '" data-meta="' . $option['post_meta'] . '" /></li>'; } echo '</ul></div>'; } } else { ?> <?php echo '<p class="message">' . __('Course not set', 'wplms-front-end') . '</p>'; } ?> <?php } else { ?> <strong class="heading"><?php _e('Go Live', 'wplms-front-end'); ?> </strong> <?php $new_course_status = vibe_get_option('new_course_status'); if (isset($new_course_status) && $new_course_status == 'publish') { echo '<a id="publish_course" class="button big hero">' . __('GO LIVE', 'wplms-front-end') . '</a>'; } else { echo '<a id="publish_course" class="button big hero">' . __('SEND FOR APPROVAL', 'wplms-front-end') . '</a>'; } ?> <?php } ?> <?php break; case 'button': echo '<br class="clear" /><hr />'; echo '<a id="' . $field['id'] . '" class="button hero">' . $field['label'] . '</a>'; break; case 'small_button': echo '<a id="' . $field['id'] . '" ' . (empty($field['href']) ? '' : 'href="' . $field['href'] . '"') . ' ' . (empty($field['data-id']) ? '' : 'data-id="' . $field['data-id'] . '"') . ' target="_blank" class="button">' . $field['label'] . '</a>'; break; case 'dynamic_taxonomy': echo '<label>' . $field['label'] . (empty($field['desc']) ? '' : '<a class="tip" title="' . $field['desc'] . '"><i class="icon-question"></i></a>') . '</label>' . (empty($field['text']) ? '' : '<strong>' . $field['text'] . '</strong>'); echo '<select class="select2 post_field" data-id="' . $field['id'] . '" data-type="array" style="width: 100%;" multiple>'; $terms = get_terms($field['taxonomy'], array('fields' => 'id=>name')); if (empty($field['value'])) { $field['value'] = array(); } if (!empty($terms) && is_array($terms)) { foreach ($terms as $key => $term) { echo '<option value="' . $key . '" ' . (in_array($key, $field['value']) ? 'SELECTED' : '') . '>' . $term . '</option>'; } } echo '</select>'; break; case 'repeatable_selectcpt': break; case 'repeatable_count': ?> <a class="button small primary add_repeatable_count_option"><?php _e('ADD OPTION', 'wplms-front-end'); ?> </a> <ul id="<?php echo $field['id']; ?> " data-id="<?php echo $field['id']; ?> " class="repeatable post_field"> <?php if (isset($field['value']) && is_array($field['value'])) { foreach ($field['value'] as $key => $option) { echo '<li><span>' . ($key + 1) . '</span> <input type="text" class="option very_large_box" value="' . $option . '" /> <a class="rem"><i class="icon-x"></i></a> </li>'; } } ?> </ul> <ul class="hidden"> <li><span></span><input type="text" class="option very_large_box" /><a class="rem"><i class="icon-x"></i></a></li> </ul> <?php break; case 'assignment': ?> <?php if (!empty($field['value'])) { foreach ($field['value'] as $k => $assignment_id) { ?> <div class="list-group-item assignment_block"> <span class="dashicons dashicons-sort"></span> <strong class="title" data-id="<?php echo $assignment_id; ?> "><?php echo get_the_title($assignment_id); ?> </strong> <input type="hidden" class="assignment_id" value="<?php echo $assignment_id; ?> " /> <?php echo '<ul class="data_links"> <li><a class="edit_sub" title="' . __('Edit', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li> <li><a class="preview_sub" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li> <li><a class="remove_sub" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li> <li><a class="delete_sub" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li> </ul>'; ?> </div> <?php } } ?> <div class="list-group-item hidden_block hide"> <span class="dashicons dashicons-sort"></span> <strong class="title" data-id=""></strong> <input type="hidden" class="assignment_id" value="" /> <?php echo '<ul class="data_links"> <li><a class="edit_sub" title="' . __('Edit', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li> <li><a class="preview_sub" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li> <li><a class="remove_sub" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li> <li><a class="delete_sub" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li> </ul>'; ?> </div> <div class="list-group-item"> <div class="add_cpt"> <div class="col-md-6"> <a class="more"><i class="icon-users"></i> <?php _e('Select existing assignment', 'wplms-front-end'); ?> </a> <div class="select_existing_cpt"> <select class="selectcpt select2" data-cpt="wplms-assignment" data-placeholder="<?php _e('Search an assignment', 'wplms-front-end'); ?> "> </select> <a class="use_selected_assignment button"><?php _e('Set Assignment', 'wplms-front-end'); ?> </a> </div> </div> <div class="col-md-6"> <a class="more"><i class="icon-user"></i> <?php _e('Create new Assignment', 'wplms-front-end'); ?> </a> <div class="new_cpt"> <input type="text" class="form_field" id="vibe_assignment_title" name="name" placeholder="<?php _e('Reference title', 'wplms-front-end'); ?> "> <a class="button small" id="create_new_assignment"><?php _e('Create Assignment', 'wplms-front-end'); ?> </a> </div> </div> </div> </div> <?php ?> <?php break; case 'quiz_questions': ?> <?php if (!empty($field['value'])) { foreach ($field['value']['ques'] as $k => $question_id) { ?> <div class="list-group-item question_block"> <span class="dashicons dashicons-sort"></span> <strong class="title" data-id="<?php echo $question_id; ?> "><?php echo get_the_title($question_id); ?> </strong> <input type="hidden" class="question_id" value="<?php echo $question_id; ?> " /> <?php echo '<ul class="data_links"> <li><a class="edit_sub" title="' . __('Edit', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li> <li><a class="preview_sub" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li> <li><a class="remove_sub" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li> <li><a class="delete_sub" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li> </ul>'; ?> <div class="right"> <input type="number" class="small_box question_marks" value="<?php echo $field['value']['marks'][$k]; ?> " /> <span><?php _e('Marks', 'wplms-front-end'); ?> </span> </div> </div> <?php } } ?> <div class="list-group-item hidden_block hide"> <span class="dashicons dashicons-sort"></span> <strong class="title" data-id=""></strong> <input type="hidden" class="question_id" value="" /> <?php echo '<ul class="data_links"> <li><a class="edit_sub" title="' . __('Edit', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li> <li><a class="preview_sub" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li> <li><a class="remove_sub" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li> <li><a class="delete_sub" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li> </ul>'; ?> <div class="right"> <input type="number" class="small_box question_marks" value="<?php echo $field['value']['marks'][$k]; ?> " /> <span><?php _e('Marks', 'wplms-front-end'); ?> </span> </div> </div> <div class="list-group-item"> <div class="add_cpt"> <div class="col-md-6"> <a class="more"><i class="icon-users"></i> <?php _e('Select existing question', 'wplms-front-end'); ?> </a> <div class="select_existing_cpt"> <select class="selectcpt select2" data-cpt="question" data-placeholder="<?php _e('Search a question', 'wplms-front-end'); ?> "> </select> <a class="use_selected_question button"><?php _e('Set Question', 'wplms-front-end'); ?> </a> </div> </div> <div class="col-md-6"> <a class="more"><i class="icon-user"></i> <?php _e('Create new Question', 'wplms-front-end'); ?> </a> <div class="new_cpt"> <input type="text" class="form_field" id="vibe_question_title" name="name" placeholder="<?php _e('Reference title', 'wplms-front-end'); ?> "> <?php $field = array('label' => __('Question Tags', 'wplms-front-end'), 'type' => 'taxonomy', 'taxonomy' => 'question-tag', 'from' => 'taxonomy', 'value_type' => 'single', 'style' => '', 'id' => 'question-tag', 'default' => __('Select a Tag', 'wplms-front-end')); self::generate_fields($field); ?> <?php $question_types = apply_filters('wplms_question_types', array(array('label' => __('True or False', 'vibe-customtypes'), 'value' => 'truefalse'), array('label' => __('Multiple Choice', 'vibe-customtypes'), 'value' => 'single'), array('label' => __('Multiple Correct', 'vibe-customtypes'), 'value' => 'multiple'), array('label' => __('Sort Answers', 'vibe-customtypes'), 'value' => 'sort'), array('label' => __('Match Answers', 'vibe-customtypes'), 'value' => 'match'), array('label' => __('Fill in the Blank', 'vibe-customtypes'), 'value' => 'fillblank'), array('label' => __('Dropdown Select', 'vibe-customtypes'), 'value' => 'select'), array('label' => __('Small Text', 'vibe-customtypes'), 'value' => 'smalltext'), array('label' => __('Large Text', 'vibe-customtypes'), 'value' => 'largetext'))); ?> <select class="chosen" id="vibe_question_template"> <?php foreach ($question_types as $type) { echo '<option value="' . $type['value'] . '">' . $type['label'] . '</option>'; } ?> </select> <a class="button small" id="create_new_question"><?php _e('Create question', 'wplms-front-end'); ?> </a> </div> </div> </div> </div> <?php ?> <?php break; case 'curriculum': ?> <ul class="curriculum post_field"> <?php if (isset($_GET['action'])) { $curriculum = vibe_sanitize(get_post_meta($_GET['action'], 'vibe_course_curriculum', false)); if (isset($curriculum) && is_array($curriculum)) { foreach ($curriculum as $kid) { if (is_numeric($kid)) { if (get_post_type($kid) == 'unit') { echo '<li><strong class="title" data-id="' . $kid . '"><i class="icon-file"></i> ' . get_the_title($kid) . '</strong> <ul class="data_links"> <li><a class="edit" title="' . __('Edit Unit', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li> <li><a class="preview" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li> <li><a class="remove" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li> <li><a class="delete" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li> </ul> </li>'; } else { echo '<li><strong class="title" data-id="' . $kid . '"><i class="icon-task"></i> ' . get_the_title($kid) . '</strong> <ul class="data_links"> <li><a class="edit" title="' . __('Edit Quiz', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li> <li><a class="preview" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li> <li><a class="remove" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li> <li><a class="delete" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li> </ul> </li>'; } } else { echo '<li class="new_section"><strong>' . $kid . '</strong> <ul class="data_links"> <li> <a class="remove" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a> </li> </ul> </li>'; } } } } ?> </ul> <ul class="hide"> <li><strong class="title" data-id=""><i class="icon-task"></i> <span></span></strong> <ul class="data_links"> <li><a class="edit" title="<?php _e('Edit Quiz', 'wplms-front-end'); ?> "><span class="dashicons dashicons-edit"></span></a></li> <li><a class="preview" title="<?php _e('Preview', 'wplms-front-end'); ?> " target="_blank"><span class="dashicons dashicons-visibility"></span></a></li> <li><a class="remove" title="<?php _e('Remove', 'wplms-front-end'); ?> "><span class="dashicons dashicons-no-alt"></span></a></li> <li><a class="delete" title="<?php _e('Delete', 'wplms-front-end'); ?> "><span class="dashicons dashicons-trash"></span></a></li> </ul> </li> </ul> <ul id="hidden_base"> <li class="new_section"> <input type="text" class="section " placeholder="<?php _e('Enter Section Title', 'wplms-front-end'); ?> " /> <a class="rem"><i class="icon-x"></i></a> </li> <li class="new_unit"> <div class="add_cpt"> <div class="col-md-6"> <a class="more"><i class="icon-users"></i> <?php _e('Select existing unit', 'wplms-front-end'); ?> </a> <div class="select_existing_cpt"> <select data-cpt="unit" data-placeholder="<?php _e('Search a unit', 'wplms-front-end'); ?> "> </select> <a class="use_selected_curriculum button"><?php _e('Set Unit', 'wplms-front-end'); ?> </a> </div> </div> <div class="col-md-6"> <a class="more"><i class="icon-user"></i> <?php _e('Create new unit', 'wplms-front-end'); ?> </a> <div class="new_cpt"> <input type="text" class="form_field vibe_curriculum_title" name="name" placeholder="<?php _e('Unit title', 'wplms-front-end'); ?> "> <input type="hidden" class="vibe_cpt" value="unit" /> <a class="button small create_new_curriculum"><?php _e('Create Unit', 'wplms-front-end'); ?> </a> </div> </div> </div> <a class="rem"><i class="icon-x"></i></a> </li> <li class="new_quiz"> <div class="add_cpt"> <div class="col-md-6"> <a class="more"><i class="icon-users"></i> <?php _e('Select existing quiz', 'wplms-front-end'); ?> </a> <div class="select_existing_cpt"> <select data-cpt="quiz" data-placeholder="<?php _e('Search a quiz', 'wplms-front-end'); ?> "> </select> <a class="use_selected_curriculum button"><?php _e('Set Quiz', 'wplms-front-end'); ?> </a> </div> </div> <div class="col-md-6"> <a class="more"><i class="icon-user"></i> <?php _e('Create new quiz', 'wplms-front-end'); ?> </a> <div class="new_cpt"> <input type="text" class="form_field vibe_curriculum_title" name="name" placeholder="<?php _e('Quiz title', 'wplms-front-end'); ?> "> <input type="hidden" class="vibe_cpt" value="quiz" /> <a class="button small create_new_curriculum"><?php _e('Create Quiz', 'wplms-front-end'); ?> </a> </div> </div> </div> <a class="rem"><i class="icon-x"></i></a> </li> </ul> <div class="add_element"> <?php foreach ($field['buttons'] as $key => $label) { echo '<a id="' . $key . '" class="button primary">' . $label . '</a>'; } ?> </div> <a id="save_course_curriculum_button" class="button hero"><?php _e('SAVE CURRICULUM', 'wplms-front-end'); ?> </a> <?php break; default: do_action('wplms_front_end_generate_fields_default', $field, $id); break; } }
function wplms_front_end_pricing($course_id) { if (isset($course_id) && $course_id) { $vibe_mycred_points = get_post_meta($course_id, 'vibe_mycred_points', true); $vibe_mycred_subscription = get_post_meta($course_id, 'vibe_mycred_subscription', true); $vibe_mycred_duration = get_post_meta($course_id, 'vibe_mycred_duration', true); } else { $vibe_mycred_points = 0; $vibe_mycred_subscription = 'H'; $vibe_mycred_duration = 0; } echo '<li class="course_product" data-help-tag="19"> <h3>' . __('Set Course Points', 'vibe') . '<span> <input type="text" id="vibe_mycred_points" class="small_box right" value="' . $vibe_mycred_points . '" /></span></h3> </li> <li class="course_product" > <h3>' . __('Subscription Type', 'vibe') . '<span> <div class="switch mycred-subscription"> <input type="radio" class="switch-input vibe_mycred_subscription" name="vibe_mycred_subscription" value="H" id="disable_cred_sub" '; checked($vibe_mycred_subscription, 'H'); echo '> <label for="disable_cred_sub" class="switch-label switch-label-off">' . __('Full Course', 'vibe') . '</label> <input type="radio" class="switch-input vibe_mycred_subscription" name="vibe_mycred_subscription" value="S" id="enable_cred_sub" '; checked($vibe_mycred_subscription, 'S'); echo '> <label for="enable_cred_sub" class="switch-label switch-label-on">' . __('Subscription', 'vibe') . '</label> <span class="switch-selection"></span> </div> </span></h3> </li> <li class="credsubscription course_product" ' . ($vibe_mycred_subscription == 'S' ? 'style="display:block;"' : 'style="display:none;"') . '> <h3>' . __('Set Subscription', 'vibe') . '<span> <input type="text" id="vibe_mycred_duration" class="small_box" value="' . $vibe_mycred_duration . '" /> ' . calculate_duration_time($this->subscription_duration_parameter) . '</span></h3> </li> '; }
function bp_course_enable_access($order_id) { $order = new WC_Order($order_id); $items = $order->get_items(); $user_id = $order->user_id; $order_total = $order->get_total(); $total_discount = $order->get_total_discount(); $commission_array = array(); foreach ($items as $item_id => $item) { $instructors = array(); $product_id = $item['product_id']; $subscribed = get_post_meta($product_id, 'vibe_subscription', true); $courses = vibe_sanitize(get_post_meta($product_id, 'vibe_courses', false)); if ($total_discount) { $multiplier = round($order_total / ($order_total + $total_discount), 4); } if (isset($courses) && is_array($courses)) { if (vibe_validate($subscribed)) { $duration = get_post_meta($product_id, 'vibe_duration', true); $product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400); // Product duration for subscription based foreach ($courses as $course) { $start_date = get_post_meta($course, 'vibe_start_date', true); $time = 0; if (isset($start_date) && $start_date) { $time = strtotime($start_date); } if ($time < time()) { $time = time(); } $t = $time + $duration * $product_duration_parameter; update_post_meta($course, $user_id, 0); update_user_meta($user_id, $course, $t); update_user_meta($user_id, 'course_status' . $course, 1); $group_id = get_post_meta($course, 'vibe_group', true); if (isset($group_id) && $group_id != '' && is_numeric($group_id) && function_exists('groups_join_group')) { groups_join_group($group_id, $user_id); } else { $group_id = ''; } $durationtime = $duration . ' ' . calculate_duration_time($product_duration_parameter); if ($duration == '9999') { $durationtime = __('Unlimited Duration', 'vibe'); } do_action('wplms_course_subscribed', $course, $user_id, $group_id); $instructors[$course] = apply_filters('wplms_course_instructors', get_post_field('post_author', $course), $course); do_action('wplms_course_product_puchased', $course, $user_id, $t, 1); } } else { if (isset($courses) && is_array($courses)) { foreach ($courses as $course) { $duration = get_post_meta($course, 'vibe_duration', true); $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400); // Course duration for subscription based $start_date = get_post_meta($course, 'vibe_start_date', true); $time = 0; if (isset($start_date) && $start_date) { $time = strtotime($start_date); } if ($time < time()) { $time = time(); } $t = $time + $duration * $course_duration_parameter; update_post_meta($course, $user_id, 0); update_user_meta($user_id, $course, $t); update_user_meta($user_id, 'course_status' . $course, 1); $group_id = get_post_meta($course, 'vibe_group', true); if (isset($group_id) && $group_id != '' && is_numeric($group_id) && function_exists('groups_join_group')) { groups_join_group($group_id, $user_id); } else { $group_id = ''; } $durationtime = $duration . ' ' . calculate_duration_time($product_duration_parameter); if ($duration == '9999') { $durationtime = __('Unlimited Duration', 'vibe'); } do_action('wplms_course_subscribed', $course, $user_id, $group_id); $instructors[$course] = apply_filters('wplms_course_instructors', get_post_field('post_author', $course, 'raw'), $course); do_action('wplms_course_product_puchased', $course, $user_id, $t, 0); } } } //End Else if ($total_discount) { // Product discounted $line_total = round($item['line_total'] * $multiplier, 2); } else { $line_total = $item['line_total']; } //Commission Calculation $commission_array[$item_id] = array('instructor' => $instructors, 'course' => $courses, 'total' => $line_total); } //End If courses } // End Item for loop if (function_exists('vibe_get_option')) { $instructor_commission = vibe_get_option('instructor_commission'); } if ($instructor_commission == 0) { return; } if (!isset($instructor_commission) || !$instructor_commission) { $instructor_commission = 70; } $commissions = get_option('instructor_commissions'); foreach ($commission_array as $item_id => $commission_item) { foreach ($commission_item['course'] as $course_id) { if (count($commission_item['instructor'][$course_id]) > 1) { // Multiple instructors $calculated_commission_base = round($commission_item['total'] * ($instructor_commission / 100) / count($commission_item['instructor'][$course_id]), 0); // Default Slit equal propertion foreach ($commission_item['instructor'][$course_id] as $instructor) { if (isset($commissions[$course_id][$instructor])) { $calculated_commission_base = round($commission_item['total'] * $commissions[$course_id][$instructor] / 100, 2); } $calculated_commission_base = apply_filters('wplms_calculated_commission_base', $calculated_commission_base, $instructor); woocommerce_update_order_item_meta($item_id, 'commission' . $instructor, $calculated_commission_base); } } else { if (is_array($commission_item['instructor'][$course_id])) { // Single Instructor $instructor = $commission_item['instructor'][$course_id][0]; } else { $instructor = $commission_item['instructor'][$course_id]; } if (isset($commissions[$course_id][$instructor]) && is_numeric($commissions[$course_id][$instructor])) { $calculated_commission_base = round($commission_item['total'] * $commissions[$course_id][$instructor] / 100, 2); } else { $calculated_commission_base = round($commission_item['total'] * $instructor_commission / 100, 2); } $calculated_commission_base = apply_filters('wplms_calculated_commission_base', $calculated_commission_base, $instructor); woocommerce_update_order_item_meta($item_id, 'commission' . $instructor, $calculated_commission_base); } } } // End Commissions_array }