function gdlr_lms_certificate_form($course_id, $settings)
{
    global $gdlr_lms_cer_settings, $post;
    $certificate_val = gdlr_lms_decode_preventslashes(get_post_meta($settings['template'], 'gdlr-lms-certificate-settings', true));
    $certificate_options = empty($certificate_val) ? array() : json_decode($certificate_val, true);
    $gdlr_lms_cer_settings = $settings;
    $gdlr_lms_cer_settings['course_id'] = $course_id;
    ?>
<div class="gdlr-lms-lightbox-container certificate-form">
	<?php 
    if (!empty($certificate_options['custom-css'])) {
        echo '<style type="text/css">' . $certificate_options['custom-css'] . '</style>';
    }
    ?>
	<?php 
    if (empty($certificate_options['enable-printer']) || $certificate_options['enable-printer'] == 'enable') {
        ?>
	<div class="gdlr-lms-lightbox-printer"><i class="fa fa-print icon-print"></i></div>
	<?php 
    }
    ?>
	<div class="gdlr-lms-lightbox-close"><i class="fa fa-remove icon-remove"></i></div>

	<div class="certificate-form-printable gdlr-printable">
	<?php 
    $post = get_post($settings['template']);
    setup_postdata($post);
    the_content();
    wp_reset_postdata();
    ?>
	</div>	
</div>
<?php 
}
 function widget($args, $instance)
 {
     global $theme_option;
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $thumbnail_size = $instance['thumbnail_size'];
     // Opening of widget
     echo $args['before_widget'];
     // Open of title tag
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Widget Content
     $player = get_posts(array('suppress_filters' => 0, 'name' => $category, 'post_type' => 'player', 'post_status' => 'publish', 'numberposts' => 1));
     $player_val = gdlr_lms_decode_preventslashes(get_post_meta($player[0]->ID, 'gdlr-soccer-player-settings', true));
     $player_options = empty($player_val) ? array() : json_decode($player_val, true);
     echo '<div class="feature-player-widget-wrapper">';
     echo '<div class="feature-player-widget-thumbnail">';
     echo gdlr_get_image(get_post_thumbnail_id($player[0]->ID), $thumbnail_size, true);
     echo '</div>';
     echo '<div class="feature-player-widget-title-wrapper">';
     echo '<h4 class="feature-player-widget-title">' . $player[0]->post_title . '</h4>';
     echo '<div class="feature-player-widget-position">';
     echo '<span class="gdlr-soccer-player-squad" >' . $player_options['player-info']['squad'] . '</span>';
     echo $player_options['player-info']['position'];
     echo '</div>';
     echo '</div>';
     // feature-player-widget-title
     echo '<div class="feature-player-widget-info-wrapper">';
     if (!empty($player_options['player-info']['games-played']) || $player_options['player-info']['games-played'] === "0") {
         echo '<div class="feature-player-widget-info">';
         echo '<span class="gdlr-head">' . $player_options['player-info']['games-played'] . '</span>';
         echo '<span class="gdlr-tail">' . __('Games Played', 'gdlr_translate') . '</span>';
         echo '</div>';
     }
     if (!empty($player_options['player-stats']['goals']) || $player_options['player-stats']['goals'] === "0") {
         echo '<div class="feature-player-widget-info">';
         echo '<span class="gdlr-head">' . $player_options['player-stats']['goals'] . '</span>';
         echo '<span class="gdlr-tail">' . __('Goals', 'gdlr_translate') . '</span>';
         echo '</div>';
     }
     if (!empty($player_options['player-stats']['assists']) || $player_options['player-stats']['assists'] === "0") {
         echo '<div class="feature-player-widget-info">';
         echo '<span class="gdlr-head">' . $player_options['player-stats']['assists'] . '</span>';
         echo '<span class="gdlr-tail">' . __('Assists', 'gdlr_translate') . '</span>';
         echo '</div>';
     }
     echo '</div>';
     // feature-player-widget-info
     echo '<a class="feature-player-widget-link gdlr-button with-border" href="' . get_permalink($player[0]->ID) . '" >' . __('View Profile & Stats', 'gdlr_translate') . '</a>';
     echo '</div>';
     // feature-player-widget-wrapper
     // Closing of widget
     echo $args['after_widget'];
 }
Esempio n. 3
0
function gdlr_lms_create_quiz_meta_box()
{
    global $post;
    // Add an nonce field so we can check for it later.
    wp_nonce_field('quiz_meta_box', 'quiz_meta_box_nonce');
    ////////////////////////////////
    //// quiz setting section ////
    ////////////////////////////////
    $quiz_settings = array('retake-quiz' => array('title' => __('Allow to retake this quiz', 'gdlr-lms'), 'type' => 'checkbox', 'default' => 'enable'), 'retake-times' => array('title' => __('Number of quiz retakes', 'gdlr-lms'), 'type' => 'text', 'class' => 'small', 'description' => __('times', 'gdlr-lms')));
    $quiz_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-lms-quiz-settings', true));
    $quiz_settings_val = empty($quiz_val) ? array() : json_decode($quiz_val, true);
    echo '<div class="gdlr-lms-meta-wrapper">';
    echo '<h3>' . __('Quiz Settings', 'gdlr-lms') . '</h3>';
    foreach ($quiz_settings as $slug => $quiz_setting) {
        $quiz_setting['slug'] = $slug;
        $quiz_setting['value'] = empty($quiz_settings_val[$slug]) ? '' : $quiz_settings_val[$slug];
        gdlr_lms_print_meta_box($quiz_setting);
    }
    echo '<textarea name="gdlr-lms-quiz-settings">' . esc_textarea($quiz_val) . '</textarea>';
    echo '</div>';
    /////////////////////
    //// tab section ////
    /////////////////////
    $course_content_options = array('section-name' => array('title' => __('Section Name', 'gdlr-lms'), 'type' => 'text'), 'question-type' => array('title' => __('Question Type', 'gdlr-lms'), 'type' => 'combobox', 'options' => array('single' => __('Single Choice', 'gdlr-lms'), 'multiple' => __('Multiple Choice', 'gdlr-lms'), 'small' => __('Small Fill', 'gdlr-lms'), 'large' => __('Large Fill', 'gdlr-lms')), 'description' => __('( Manual marking the score for small and large fill )', 'gdlr-lms')), 'section-timer' => array('title' => __('Section Timer', 'gdlr-lms'), 'type' => 'checkbox'), 'time-period' => array('title' => __('Time Period', 'gdlr-lms'), 'type' => 'text', 'class' => 'small', 'description' => __('Minutes', 'gdlr-lms')), 'question' => array('type' => 'question'));
    $course_content_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-lms-content-settings', true));
    $course_content_options_val = empty($course_content_val) ? array() : json_decode($course_content_val, true);
    echo '<div class="gdlr-lms-meta-wrapper gdlr-tabs">';
    echo '<h3>' . __('Course Content', 'gdlr-lms') . '</h3>';
    echo '<div class="course-tab-add-new">';
    echo '<span class="head">+</span>';
    echo '<span class="tail">' . __('Add Section', 'gdlr-lms') . '</span>';
    echo '</div>';
    // course-tab-add-new
    echo '<div class="course-tab-title">';
    echo '<span class="active">1</span>';
    for ($i = 2; $i <= sizeof($course_content_options_val); $i++) {
        echo '<span>' . $i . '</span>';
    }
    echo '</div>';
    // course-tab-title
    echo '<div class="course-tab-content">';
    echo '<div class="course-tab-remove">' . __('Delete', 'gdlr-lms') . '</div>';
    foreach ($course_content_options as $slug => $course_content_option) {
        $course_content_option['slug'] = $slug;
        $course_content_option['value'] = empty($course_content_options_val[0][$slug]) ? '' : $course_content_options_val[0][$slug];
        gdlr_lms_print_meta_box($course_content_option);
    }
    echo '</div>';
    // course-tab-content
    echo '<textarea name="gdlr-lms-content-settings">' . esc_textarea($course_content_val) . '</textarea>';
    echo '</div>';
}
function gdlr_soccer_create_player_meta_box()
{
    global $post;
    // Add an nonce field so we can check for it later.
    wp_nonce_field('player_meta_box', 'player_meta_box_nonce');
    /////////////////
    //// setting ////
    /////////////////
    $player_settings = array('player-info' => array('title' => __('Player Info', 'gdlr-soccer'), 'options' => array('general-info' => array('title' => __('General Info', 'gdlr-soccer'), 'type' => 'title'), 'first-name' => array('title' => __('First Name', 'gdlr-soccer'), 'type' => 'text'), 'last-name' => array('title' => __('Last Name', 'gdlr-soccer'), 'type' => 'text'), 'squad' => array('title' => __('Squad', 'gdlr-soccer'), 'type' => 'text'), 'position' => array('title' => __('Position', 'gdlr-soccer'), 'type' => 'text'), 'position-ab' => array('title' => __('Position (abbreviation)', 'gdlr-soccer'), 'type' => 'text'), 'nationality' => array('title' => __('Nationality', 'gdlr-soccer'), 'type' => 'text'), 'date-of-birth' => array('title' => __('Date Of Birth', 'gdlr-soccer'), 'type' => 'text'), 'height' => array('title' => __('Hieght', 'gdlr-soccer'), 'type' => 'text'), 'weight' => array('title' => __('Weight', 'gdlr-soccer'), 'type' => 'text'), 'games-played' => array('title' => __('Games Played', 'gdlr-soccer'), 'type' => 'text'), 'minutes-played' => array('title' => __('Minutes Played', 'gdlr-soccer'), 'type' => 'text'), 'starts' => array('title' => __('Starts', 'gdlr-soccer'), 'type' => 'text'), 'substitution-on' => array('title' => __('Substitution On', 'gdlr-soccer'), 'type' => 'text'), 'substitution-off' => array('title' => __('Substitution Off', 'gdlr-soccer'), 'type' => 'text'), 'social-media' => array('title' => __('Social Media', 'gdlr-soccer'), 'type' => 'title', 'class' => 'with-space'), 'facebook' => array('title' => __('Facebook', 'gdlr-soccer'), 'type' => 'text'), 'twitter' => array('title' => __('Twitter', 'gdlr-soccer'), 'type' => 'text'), 'youtube' => array('title' => __('Youtube', 'gdlr-soccer'), 'type' => 'text'), 'instagram' => array('title' => __('Instagram', 'gdlr-soccer'), 'type' => 'text'))), 'player-stats' => array('title' => __('Player Stats', 'gdlr-soccer'), 'options' => array('general' => array('title' => __('General', 'gdlr-soccer'), 'type' => 'title'), 'passes' => array('title' => __('Passes', 'gdlr-soccer'), 'type' => 'text'), 'passing-accuracy' => array('title' => __('Passing Accuracy', 'gdlr-soccer'), 'type' => 'text'), 'passing-accuracy-opp' => array('title' => __('Passing Accuracy opp. Half', 'gdlr-soccer'), 'type' => 'text'), 'duels-won' => array('title' => __('Duels Won', 'gdlr-soccer'), 'type' => 'text'), 'duels-lost' => array('title' => __('Duels Lost', 'gdlr-soccer'), 'type' => 'text'), 'duels-won-percent' => array('title' => __('Duels Won (%)', 'gdlr-soccer'), 'type' => 'text'), 'aerial-duels-won' => array('title' => __('Aerial Duels Won', 'gdlr-soccer'), 'type' => 'text'), 'aerial-duels-lost' => array('title' => __('Aerial Duels Lost', 'gdlr-soccer'), 'type' => 'text'), 'aerial-duels-won-percent' => array('title' => __('Aerial Duels Won (%)', 'gdlr-soccer'), 'type' => 'text'), 'recoveries' => array('title' => __('Recoveries', 'gdlr-soccer'), 'type' => 'text'), 'defence-descipline' => array('title' => __('Defence & Descipline', 'gdlr-soccer'), 'type' => 'title', 'class' => 'with-space'), 'tackles-won' => array('title' => __('Tackles Won', 'gdlr-soccer'), 'type' => 'text'), 'tackles-lost' => array('title' => __('Tackles Lost', 'gdlr-soccer'), 'type' => 'text'), 'tackles-won-percent' => array('title' => __('Tackles Won (%)', 'gdlr-soccer'), 'type' => 'text'), 'clearances' => array('title' => __('Clearances', 'gdlr-soccer'), 'type' => 'text'), 'blocks' => array('title' => __('Blocks', 'gdlr-soccer'), 'type' => 'text'), 'interceptions' => array('title' => __('Interceptions', 'gdlr-soccer'), 'type' => 'text'), 'penalties-conceded' => array('title' => __('Penalties Conceded', 'gdlr-soccer'), 'type' => 'text'), 'fouls-won' => array('title' => __('Fouls Won', 'gdlr-soccer'), 'type' => 'text'), 'fouls-conceded' => array('title' => __('Fouls Conceded', 'gdlr-soccer'), 'type' => 'text'), 'yellow-cards' => array('title' => __('Yellow Cards', 'gdlr-soccer'), 'type' => 'text'), 'red-cards' => array('title' => __('Red Cards', 'gdlr-soccer'), 'type' => 'text'), 'attack' => array('title' => __('Attack', 'gdlr-soccer'), 'type' => 'title', 'class' => 'with-space'), 'goals' => array('title' => __('Goals', 'gdlr-soccer'), 'type' => 'text'), 'penalty-goals' => array('title' => __('Penalty Goals', 'gdlr-soccer'), 'type' => 'text'), 'minutes-per-goal' => array('title' => __('Minutes Per Goal', 'gdlr-soccer'), 'type' => 'text'), 'total-shots-on-target' => array('title' => __('Total Shots On Target', 'gdlr-soccer'), 'type' => 'text'), 'total-shots-off-target' => array('title' => __('Total Shots Off Target', 'gdlr-soccer'), 'type' => 'text'), 'shooting-accuracy' => array('title' => __('Shooting Accuracy', 'gdlr-soccer'), 'type' => 'text'), 'successful-crosses' => array('title' => __('Successful Crosses', 'gdlr-soccer'), 'type' => 'text'), 'unsuccessful-crosses' => array('title' => __('Unsuccessful Crosses', 'gdlr-soccer'), 'type' => 'text'), 'successful-crosses-percent' => array('title' => __('Successful Crosses (%)', 'gdlr-soccer'), 'type' => 'text'), 'assists' => array('title' => __('Assists', 'gdlr-soccer'), 'type' => 'text'), 'chances-created' => array('title' => __('Chances Created', 'gdlr-soccer'), 'type' => 'text'), 'penalties-won' => array('title' => __('Penalties Won', 'gdlr-soccer'), 'type' => 'text'), 'offsides' => array('title' => __('Offsides', 'gdlr-soccer'), 'type' => 'text'))), 'biography' => array('title' => __('Biography', 'gdlr-soccer'), 'options' => array('biography' => array('type' => 'wysiwyg'))), 'gallery' => array('title' => __('Gallery', 'gdlr-soccer'), 'options' => array('player-gallery' => array('type' => 'wysiwyg'))));
    $player_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-soccer-player-settings', true));
    $player_settings_val = empty($player_val) ? array() : json_decode($player_val, true);
    echo '<div class="gdlr-lms-meta-wrapper gdlr-tabs">';
    // tab title
    $count = 0;
    echo '<div class="soccer-tab-title">';
    foreach ($player_settings as $section_slug => $player_setting) {
        echo '<span data-tab="' . $section_slug . '" ';
        echo $count == 0 ? 'class="active" ' : '';
        echo '>' . $player_setting['title'] . '</span>';
        $count++;
    }
    echo '</div>';
    // soccer-tab-title
    // tab content
    $count = 0;
    echo '<div class="soccer-tab-content-wrapper">';
    foreach ($player_settings as $section_slug => $player_setting) {
        echo '<div class="soccer-tab-content ';
        echo $count == 0 ? 'active' : '';
        echo '" data-tab="' . $section_slug . '" >';
        foreach ($player_setting['options'] as $option_slug => $option_val) {
            $option_val['slug'] = $option_slug;
            if (!empty($player_settings_val[$section_slug][$option_slug])) {
                $option_val['value'] = $player_settings_val[$section_slug][$option_slug];
            } else {
                $option_val['value'] = '';
            }
            gdlr_lms_print_meta_box($option_val);
        }
        echo '</div>';
        $count++;
    }
    echo '</div>';
    // soccer-tab-content-wrapper
    echo '<textarea name="gdlr-soccer-player-settings">' . esc_textarea($player_val) . '</textarea>';
    echo '</div>';
}
function gdlr_print_league_table_item($settings)
{
    $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
    global $gdlr_spaces;
    $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
    $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
    // query league table
    $args = array('post_type' => 'league_table', 'suppress_filters' => false);
    $args['posts_per_page'] = 999;
    $args['paged'] = 1;
    $args['orderby'] = 'title';
    $args['order'] = 'asc';
    if (!empty($settings['category'])) {
        $args['tax_query'] = array();
        if (!empty($settings['category'])) {
            array_push($args['tax_query'], array('terms' => explode(',', $settings['category']), 'taxonomy' => 'league_category', 'field' => 'slug'));
        }
    }
    $query = new WP_Query($args);
    // getting table array
    $league_table = array();
    while ($query->have_posts()) {
        $query->the_post();
        $league_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-soccer-league-table-settings', true));
        $league_options = empty($league_val) ? array() : json_decode($league_val, true);
        $lists = array('win', 'draw', 'lose');
        $league_table[get_the_title()] = $league_options;
        foreach ($lists as $list) {
            $league_table[get_the_title()]['overall-' . $list] = $league_table[get_the_title()]['home-' . $list] + $league_table[get_the_title()]['away-' . $list];
        }
        $league_table[get_the_title()]['p'] = $league_table[get_the_title()]['overall-win'] + $league_table[get_the_title()]['overall-draw'] + $league_table[get_the_title()]['overall-lose'];
        $league_table[get_the_title()]['gd'] = $league_table[get_the_title()]['home-goal-score'] + $league_table[get_the_title()]['away-goal-score'] - ($league_table[get_the_title()]['home-goal-concede'] + $league_table[get_the_title()]['away-goal-concede']);
        $league_table[get_the_title()]['pts'] = $league_table[get_the_title()]['overall-win'] * 3 + $league_table[get_the_title()]['overall-draw'];
    }
    $league_table = gdlr_sort_league_table($league_table);
    echo gdlr_get_item_title($settings);
    echo '<div class="gdlr-item gdlr-league-table-item" ' . $item_id . $margin_style . ' >';
    if (empty($settings['style']) || $settings['style'] == 'full') {
        gdlr_print_league_table_table($league_table);
    } else {
        gdlr_print_league_small_table($league_table, $settings['num-display']);
        if (!empty($settings['button-link'])) {
            echo '<a class="gdlr-full-table-link gdlr-button with-border" href="' . $settings['button-link'] . '">' . $settings['button-text'] . '</a>';
        }
    }
    echo '</div>';
}
function gdlr_soccer_create_league_table_meta_box()
{
    global $post;
    ?>
<style type="text/css"> #edit-slug-box{display: none !important;} </style>
<?php 
    // Add an nonce field so we can check for it later.
    wp_nonce_field('league_table_meta_box', 'league_table_meta_box_nonce');
    /////////////////
    //// setting ////
    /////////////////
    $league_table_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-soccer-league-table-settings', true));
    $league_table_settings_val = empty($league_table_val) ? array() : json_decode($league_table_val, true);
    // flag
    echo '<div class="gdlr-lms-meta-wrapper">';
    $flag = array('title' => __('Team Flag', 'gdlr-soccer'), 'type' => 'upload', 'slug' => 'flag', 'wrapper-class' => 'team-flag-wrapper', 'value' => empty($league_table_settings_val['flag']) ? '' : $league_table_settings_val['flag']);
    gdlr_lms_print_meta_box($flag);
    $league_table_settings = array('win' => array('title' => __('Wins', 'gdlr-soccer'), 'type' => 'text', 'class' => 'medium'), 'draw' => array('title' => __('Draws', 'gdlr-soccer'), 'type' => 'text', 'class' => 'medium'), 'lose' => array('title' => __('Loses', 'gdlr-soccer'), 'type' => 'text', 'class' => 'medium'), 'goal-score' => array('title' => __('Goals Scored', 'gdlr-soccer'), 'type' => 'text', 'class' => 'medium'), 'goal-concede' => array('title' => __('Goals Conceded', 'gdlr-soccer'), 'type' => 'text', 'class' => 'medium'));
    echo '<div class="gdlr-lms-meta-inner gdlr-left">';
    echo '<h3>' . __('Home', 'gdlr-soccer') . '</h3>';
    foreach ($league_table_settings as $slug => $league_table_setting) {
        $league_table_setting['slug'] = 'home-' . $slug;
        $league_table_setting['value'] = isset($league_table_settings_val['home-' . $slug]) ? $league_table_settings_val['home-' . $slug] : '';
        gdlr_lms_print_meta_box($league_table_setting);
    }
    $league_table_settings_val['sticky'] = empty($league_table_settings_val['sticky']) ? '' : $league_table_settings_val['sticky'];
    gdlr_lms_print_meta_box(array('title' => __('Always show in League Table (summary)', 'gdlr-soccer'), 'type' => 'checkbox', 'default' => 'disable', 'slug' => 'sticky', 'value' => $league_table_settings_val['sticky']));
    echo '</div>';
    echo '<div class="gdlr-lms-meta-inner gdlr-right">';
    echo '<h3>' . __('Away', 'gdlr-soccer') . '</h3>';
    foreach ($league_table_settings as $slug => $league_table_setting) {
        $league_table_setting['slug'] = 'away-' . $slug;
        $league_table_setting['value'] = isset($league_table_settings_val['away-' . $slug]) ? $league_table_settings_val['away-' . $slug] : '';
        gdlr_lms_print_meta_box($league_table_setting);
    }
    echo '</div>';
    echo '<div class="clear"></div>';
    echo '<textarea name="gdlr-soccer-league-table-settings">' . esc_textarea($league_table_val) . '</textarea>';
    echo '</div>';
    // gdlr-lms-meta-wrapper
}
function gdlr_lms_create_certificate_meta_box()
{
    global $post;
    // Add an nonce field so we can check for it later.
    wp_nonce_field('certificate_meta_box', 'certificate_meta_box_nonce');
    /////////////////////////////////////
    //// certificate setting section ////
    /////////////////////////////////////
    $certificate_settings = array('enable-printer' => array('title' => __('Online Course', 'gdlr-lms'), 'type' => 'checkbox', 'default' => 'enable'), 'custom-css' => array('title' => __('Custom Certificate Css', 'gdlr-lms'), 'type' => 'textarea'), 'fill-default' => array('title' => __('Fill Default Shortcode Text', 'gdlr-lms'), 'type' => 'button', 'default' => __('Fill Shortcode', 'gdlr-lms')), 'shortcode-description' => array('title' => __('Shortcode Description', 'gdlr-lms'), 'type' => 'description', 'default' => '<br><span class="head">Wrapper - </span>[gdlr_cer_wrapper border="yes" background="XXX" class="XXX" student_code="true" ][/gdlr_cer_wrapper]' . '<br><span class="head">Caption - </span>[gdlr_cer_caption font_size="19px" class="XXX"]This is to certify that[/gdlr_cer_caption]' . '<br><span class="head">Student name - </span>[gdlr_cer_student_name font_size="34px" class="XXX"]' . '<br><span class="head">Course name - </span>[gdlr_cer_course_name font_size="25px" class="XXX"]' . '<br><span class="head">Marks - </span>[gdlr_cer_mark font_size="19px" class="XXX"]With Marks[/gdlr_cer_mark]' . '<br><span class="head">Date - </span>[gdlr_cer_date font_size="15px" margin_top="20px" class="XXX" format="j/n/Y"]Date[/gdlr_cer_date]' . '<br><span class="head">Signature - </span>[gdlr_cer_signature image="XXX" font_size="15px" margin_top="0px" class="XXX"]Sam White, Course Instructor[/gdlr_cer_signature]'));
    $certificate_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-lms-certificate-settings', true));
    $certificate_settings_val = empty($certificate_val) ? array() : json_decode($certificate_val, true);
    echo '<div class="gdlr-lms-meta-wrapper">';
    echo '<h3>' . __('Certificate Settings', 'gdlr-lms') . '</h3>';
    foreach ($certificate_settings as $slug => $certificate_setting) {
        $certificate_setting['slug'] = $slug;
        $certificate_setting['value'] = empty($certificate_settings_val[$slug]) ? '' : $certificate_settings_val[$slug];
        gdlr_lms_print_meta_box($certificate_setting);
    }
    echo '<textarea name="gdlr-lms-certificate-settings">' . esc_textarea($certificate_val) . '</textarea>';
    echo '</div>';
}
function gdlr_soccer_create_fixture_result_meta_box()
{
    global $post;
    // Add an nonce field so we can check for it later.
    wp_nonce_field('fixture_result_meta_box', 'fixture_result_meta_box_nonce');
    /////////////////
    //// setting ////
    /////////////////
    $fixture_result_settings = array('home-flag' => array('title' => __('Home Team Flag', 'gdlr-soccer'), 'type' => 'upload', 'slug' => 'flag'), 'away-flag' => array('title' => __('Away Team Flag', 'gdlr-soccer'), 'type' => 'upload', 'slug' => 'flag', 'wrapper-class' => 'team-flag-wrapper'), 'home' => array('title' => __('Home Team', 'gdlr-soccer'), 'type' => 'text', 'wrapper-class' => 'gdlr-lms-left'), 'home-goal' => array('title' => __('Goal', 'gdlr-soccer'), 'type' => 'text', 'class' => 'small', 'wrapper-class' => 'gdlr-lms-right', 'description' => __('* Leave this field blank if the match hasn\'t start yet.', 'gdlr-soccer')), 'away' => array('title' => __('Away Team', 'gdlr-soccer'), 'type' => 'text', 'wrapper-class' => 'gdlr-lms-left'), 'away-goal' => array('title' => __('Goal', 'gdlr-soccer'), 'type' => 'text', 'class' => 'small', 'wrapper-class' => 'gdlr-lms-right', 'description' => __('* Leave this field blank if the match hasn\'t start yet.', 'gdlr-soccer')), 'date-of-match' => array('title' => __('Date Of Match', 'gdlr-soccer'), 'type' => 'datepicker'), 'match-time' => array('title' => __('Match Time', 'gdlr-soccer'), 'type' => 'text', 'description' => __('* have to be in HH:MM format', 'gdlr-soccer')), 'location' => array('title' => __('Location', 'gdlr-soccer'), 'type' => 'textarea'), 'show-match-detail' => array('title' => __('Show Match Detail Before Date Of Match', 'gdlr-soccer'), 'type' => 'checkbox', 'default' => 'disable'));
    $fixture_result_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-soccer-fixture-result-settings', true));
    $fixture_result_settings_val = empty($fixture_result_val) ? array() : json_decode($fixture_result_val, true);
    echo '<div class="gdlr-lms-meta-wrapper">';
    echo '<h3>' . __('Fixtures & Result', 'gdlr-soccer') . '</h3>';
    foreach ($fixture_result_settings as $slug => $fixture_result_setting) {
        $fixture_result_setting['slug'] = $slug;
        $fixture_result_setting['value'] = !isset($fixture_result_settings_val[$slug]) ? '' : $fixture_result_settings_val[$slug];
        gdlr_lms_print_meta_box($fixture_result_setting);
    }
    echo '<div class="clear" style="height: 40px;"></div>';
    echo '<h3>' . __('Match Report', 'gdlr-soccer') . '</h3>';
    gdlr_lms_print_meta_box(array('slug' => 'match-report', 'value' => empty($fixture_result_settings_val['match-report']) ? '' : $fixture_result_settings_val['match-report'], 'type' => 'wysiwyg'));
    echo '<textarea name="gdlr-soccer-fixture-result-settings">' . esc_textarea($fixture_result_val) . '</textarea>';
    echo '</div>';
}
<?php

global $wpdb, $current_user, $post;
$lms_page = empty($_GET['course_page']) ? 1 : intval($_GET['course_page']);
// for single quiz post_type
if ($post->post_type == 'quiz') {
    $quiz_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-lms-content-settings', true));
    $quiz_options = empty($quiz_val) ? array() : json_decode($quiz_val, true);
} else {
    // initialte the value
    $course_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-lms-course-settings', true));
    $course_options = empty($course_val) ? array() : json_decode($course_val, true);
    $quiz_val = gdlr_lms_decode_preventslashes(get_post_meta($course_options['quiz'], 'gdlr-lms-content-settings', true));
    $quiz_options = empty($quiz_val) ? array() : json_decode($quiz_val, true);
    if (!empty($_GET['retake']) && $_GET['retake'] == 1 && $_GET['course_page'] != 'finish') {
        // get old value
        $sql = 'SELECT * FROM ' . $wpdb->prefix . 'gdlrquiz ';
        $sql .= 'WHERE quiz_id=' . $course_options['quiz'] . ' AND student_id=' . $current_user->ID . ' AND course_id=' . get_the_ID() . ' ';
        $sql .= 'AND (quiz_status=\'complete\' OR quiz_status=\'submitted\')';
        $old_quiz = $wpdb->get_row($sql);
        // remove old value
        if (!empty($old_quiz)) {
            $wpdb->update($wpdb->prefix . 'gdlrquiz', array('quiz_answer' => '', 'quiz_score' => '', 'quiz_status' => 'pending', 'retake_times' => $old_quiz->retake_times + 1), array('id' => $old_quiz->id), array('%s', '%s', '%s', '%d'), array('%d'));
        }
    } else {
        if ($current_user->ID != $post->post_author) {
            // get the old value
            $sql = 'SELECT * FROM ' . $wpdb->prefix . 'gdlrquiz ';
            $sql .= 'WHERE quiz_id=' . $course_options['quiz'] . ' AND student_id=' . $current_user->ID . ' AND course_id=' . get_the_ID();
            $current_row = $wpdb->get_row($sql);
            $quiz_answer = empty($current_row) ? array() : unserialize($current_row->quiz_answer);
Esempio n. 10
0
function gdlr_lms_transaction_option()
{
    ?>
<div class="wrap">
<h2><?php 
    _e('Transaction List', 'gdlr-lms');
    ?>
</h2>
<form class="gdlr-lms-transaction-form" method="GET" action="">
	<div class="gdlr-lms-transaction-form-row">
		<span class="gdlr-lms-head"><?php 
    _e('Search transaction by :', 'gdlr-lms');
    ?>
</span>
		<div class="gdlr-combobox-wrapper">
		<select name="selector" >
			<option value="name" <?php 
    echo !empty($_GET['selector']) && $_GET['selector'] == 'name' ? 'selected' : '';
    ?>
 ><?php 
    _e('Name', 'gdlr-lms');
    ?>
</option>
			<option value="code" <?php 
    echo !empty($_GET['selector']) && $_GET['selector'] == 'code' ? 'selected' : '';
    ?>
 ><?php 
    _e('Code', 'gdlr-lms');
    ?>
</option>
		</select>
		</div>
		<div class="clear"></div>
	</div>
	<div class="gdlr-lms-transaction-form-row">
		<span class="gdlr-lms-head"><?php 
    _e('Keywords :', 'gdlr-lms');
    ?>
</span>
		<input type="text" name="keywords" value="<?php 
    echo !empty($_GET['keywords']) ? $_GET['keywords'] : '';
    ?>
" />
		<input type="hidden" name="page" value="lms-transaction" />
		<input type="submit" value="<?php 
    _e('Search!', 'gdlr-lms');
    ?>
" />
		<div class="clear"></div>
	</div>
</form>
<table class="gdlr-lms-table">
<tr>
	<th><?php 
    _e('ID', 'gdlr-lms');
    ?>
</th>
	<th><?php 
    _e('Name', 'gdlr-lms');
    ?>
</th>
	<th><?php 
    _e('Course', 'gdlr-lms');
    ?>
</th>
	<th><?php 
    _e('Type', 'gdlr-lms');
    ?>
</th>
	<th><?php 
    _e('Price', 'gdlr-lms');
    ?>
</th>
	<th><?php 
    _e('Status', 'gdlr-lms');
    ?>
</th>
	<th><?php 
    _e('Code', 'gdlr-lms');
    ?>
</th>
	<th><?php 
    _e('Booked/Paid Date', 'gdlr-lms');
    ?>
</th>
</tr>
<?php 
    global $wpdb;
    $temp_sql = "SELECT id, course_id, student_id, payment_info, payment_status, payment_date, price ";
    $temp_sql .= "FROM " . $wpdb->prefix . "gdlrpayment ";
    $temp_sql .= "WHERE  price != 0 ";
    if (!empty($_GET['selector']) && !empty($_GET['keywords'])) {
        if ($_GET['selector'] == 'name') {
            $user_array = array(0);
            $users = new WP_User_Query(array('meta_query' => array('relation' => 'OR', array('key' => 'first_name', 'value' => $_GET['keywords'], 'compare' => 'LIKE'), array('key' => 'last_name', 'value' => $_GET['keywords'], 'compare' => 'LIKE'))));
            $users_found = $users->get_results();
            foreach ($users_found as $user) {
                if (!in_array($user->ID, $user_array)) {
                    $user_array[] = $user->ID;
                }
            }
            $users = new WP_User_Query(array('search' => '*' . esc_attr($_GET['keywords']) . '*', 'search_columns' => array('user_login', 'user_nicename')));
            $users_found = $users->get_results();
            foreach ($users_found as $user) {
                if (!in_array($user->ID, $user_array)) {
                    $user_array[] = $user->ID;
                }
            }
            $temp_sql .= 'AND student_id IN (' . implode(",", $user_array) . ') ';
        } else {
            if ($_GET['selector'] == 'code') {
                $temp_sql .= 'AND payment_info LIKE \'%' . $_GET['keywords'] . '%\' ';
            }
        }
    }
    $temp_sql .= "ORDER BY id desc";
    $results = $wpdb->get_results($temp_sql);
    // handle pagination
    global $gdlr_lms_option;
    $record_num = count($results);
    $current_page = empty($_GET['paged']) ? 1 : intval($_GET['paged']);
    $record_per_page = empty($gdlr_lms_option['transaction-record']) ? 30 : intval($gdlr_lms_option['transaction-record']);
    $max_num_page = ceil($record_num / $record_per_page);
    for ($i = $record_per_page * ($current_page - 1); $i < $record_num && $i < $record_per_page * $current_page; $i++) {
        $result = $results[$i];
        $course_val = gdlr_lms_decode_preventslashes(get_post_meta($result->course_id, 'gdlr-lms-course-settings', true));
        $course_options = empty($course_val) ? array() : json_decode($course_val, true);
        $payment_info = unserialize($result->payment_info);
        $payment_info['code'] = empty($payment_info['code']) ? '' : $payment_info['code'];
        $student_info = get_userdata($result->student_id);
        echo '<tr>';
        echo '<td>' . $result->id . '</td>';
        echo '<td class="evidence-of-payment-name">';
        echo $student_info->first_name . ' ' . $student_info->last_name;
        echo '<div class="evidence-of-payment-name-hover" >';
        foreach ($payment_info as $key => $value) {
            echo '<div class="evidence-of-payment-info">';
            echo '<span class="head">' . $key . ' :</span>';
            if ($key == 'price') {
                echo '<span class="tail">' . gdlr_lms_money_format($value) . '</span>';
            } else {
                echo '<span class="tail">' . $value . '</span>';
            }
            echo '</div>';
        }
        echo '</div>';
        // evd-of-payment-name-hover
        echo '</td>';
        // evd-of-payment-name
        echo '<td>' . $course_options['course-code'] . $result->course_id . '</td>';
        echo '<td>';
        echo $course_options['online-course'] == 'enable' ? __('Online', 'gdlr-lms') : __('Onsite', 'gdlr-lms');
        echo '</td>';
        echo '<td>' . gdlr_lms_money_format(number_format_i18n($result->price, 2)) . '</td>';
        echo '<td>' . $result->payment_status . '</td>';
        echo '<td>' . $payment_info['code'] . '</td>';
        echo '<td>' . gdlr_lms_date_format($result->payment_date) . '</td>';
        echo '</tr>';
    }
    ?>
</table>
<?php 
    // print pagination
    if ($max_num_page > 1) {
        $page_var = $_GET;
        echo '<div class="gdlr-lms-pagination">';
        if ($current_page > 1) {
            $page_var['paged'] = intval($current_page) - 1;
            echo '<a class="prev page-numbers" href="' . esc_url(add_query_arg($page_var)) . '" >';
            echo __('&lsaquo; Previous', 'gdlr-lms') . '</a>';
        }
        for ($i = 1; $i <= $max_num_page; $i++) {
            $page_var['paged'] = $i;
            if ($i == $current_page) {
                echo '<span class="page-numbers current" href="' . esc_url(add_query_arg($page_var)) . '" >' . $i . '</span>';
            } else {
                echo '<a class="page-numbers" href="' . esc_url(add_query_arg($page_var)) . '" >' . $i . '</a>';
            }
        }
        if ($current_page < $max_num_page) {
            $page_var['paged'] = intval($current_page) + 1;
            echo '<a class="next page-numbers" href="' . esc_url(add_query_arg($page_var)) . '" >';
            echo __('Next &rsaquo;', 'gdlr-lms') . '</a>';
        }
        echo '</div>';
    }
    ?>
</div>
<?php 
}
Esempio n. 11
0
?>
</th>
	<th align="center" ><?php 
_e('Score', 'gdlr-lms');
?>
</th>
</tr>
<?php 
$temp_sql = "SELECT course_id, quiz_id, quiz_score FROM " . $wpdb->prefix . "gdlrquiz ";
$temp_sql .= "WHERE student_id = " . $current_user->ID;
$results = $wpdb->get_results($temp_sql);
foreach ($results as $result) {
    $course_val = gdlr_lms_decode_preventslashes(get_post_meta($result->course_id, 'gdlr-lms-course-settings', true));
    $course_options = empty($course_val) ? array() : json_decode($course_val, true);
    $course_options['author_id'] = get_post_field('post_author', $result->course_id);
    $quiz_val = gdlr_lms_decode_preventslashes(get_post_meta($result->quiz_id, 'gdlr-lms-content-settings', true));
    $quiz_options = empty($quiz_val) ? array() : json_decode($quiz_val, true);
    $quiz_score = unserialize($result->quiz_score);
    $quiz_score = empty($quiz_score) ? array() : $quiz_score;
    $score_summary = gdlr_lms_score_part_summary($quiz_score);
    echo '<tr class="with-divider">';
    echo '<td><a href="' . get_permalink($result->course_id) . '" >' . get_the_title($result->course_id) . '</a>';
    gdlr_lms_print_course_info($course_options, array('instructor'));
    echo '<a data-title="' . esc_attr(__('After viewing an answer, you\'ll not be able to retake the quiz anymore.', 'gdlr-lms')) . '" ';
    echo 'data-sub-title="' . esc_attr(__('* only for retakeable quiz.', 'gdlr-lms')) . '" ';
    echo 'data-yes="' . esc_attr(__('Confirm', 'gdlr-lms')) . '" data-no="' . esc_attr(__('Cancel', 'gdlr-lms')) . '" ';
    echo 'href="' . esc_url(add_query_arg(array('type' => 'view-answer', 'quiz_id' => $result->quiz_id, 'course_id' => $result->course_id))) . '" ';
    echo 'class="gdlr-lms-view-correct-answer" >' . __('View Correct Answers', 'gdlr-lms') . '</a>';
    echo '<br>';
    echo '<a class="gdlr-leader-board-link" href="' . esc_url(add_query_arg(array('course_id' => $result->course_id, 'type' => 'leader-board'))) . '" >' . __('View Leader Board', 'gdlr-lms') . '</a>';
    echo '</td>';
Esempio n. 12
0
function gdlr_print_modern_carousel_player($query, $size, $thumbnail_size)
{
    echo '<div class="gdlr-item gdlr-modern-player-carousel-wrapper">';
    echo '<div class="flexslider" data-type="carousel" data-nav-container="player-item-holder" data-columns="' . $size . '" >';
    echo '<ul class="slides" >';
    while ($query->have_posts()) {
        $query->the_post();
        $player_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-soccer-player-settings', true));
        $player_options = empty($player_val) ? array() : json_decode($player_val, true);
        echo '<li class="gdlr-item gdlr-modern-player">';
        echo gdlr_soccer_get_player_avatar($thumbnail_size);
        echo '<div class="gdlr-modern-player-item-content">';
        echo '<a href="' . get_permalink() . '" >';
        echo '<span class="gdlr-modern-player-item-overlay"></span>';
        echo '<span class="gdlr-modern-player-item-content-inner">';
        echo '<span class="gdlr-soccer-player-squad gdlr-title-font" >' . $player_options['player-info']['squad'] . '</span>';
        echo '<span class="gdlr-soccer-player-title gdlr-title-font">' . get_the_title() . '</span>';
        echo '<span class="gdlr-soccer-player-position">' . $player_options['player-info']['position'] . '</span>';
        echo '</span>';
        // modern-player-item-content-inner
        echo '</a>';
        echo '</div>';
        // modern-player-item-content
        echo '</li>';
        // gdlr-item
    }
    echo '</ul>';
    echo '</div>';
    // flexslider
    echo '</div>';
    // gdlr-item
    wp_reset_postdata();
}
Esempio n. 13
0
_e('Booked Seat', 'gdlr-lms');
?>
</th>
	<th align="center" ><?php 
_e('Course Code', 'gdlr-lms');
?>
</th>
</tr>
<?php 
$args = array('post_type' => 'course', 'suppress_filters' => false);
$args['author'] = $current_user->ID;
$args['posts_per_page'] = 9999;
$args['orderby'] = 'post_date';
$args['order'] = 'desc';
$query = new WP_Query($args);
while ($query->have_posts()) {
    $query->the_post();
    $course_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-lms-course-settings', true));
    $course_options = empty($course_val) ? array() : json_decode($course_val, true);
    echo '<tr class="with-divider">';
    echo '<td><a href="' . esc_url(add_query_arg(array('type' => 'my-course-student', 'course_id' => get_the_ID()))) . '" >' . get_the_title() . '</a>';
    gdlr_lms_print_course_info($course_options, array('date', 'type', 'price'));
    echo '</td>';
    $seat = empty($course_options['booked-seat']) ? 0 : $course_options['booked-seat'];
    $seat .= empty($course_options['max-seat']) ? '' : '/' . $course_options['max-seat'];
    echo '<td>' . $seat . '</td>';
    echo '<td>' . $course_options['course-code'] . get_the_ID() . '</td>';
    echo '</tr>';
}
?>
</table>
Esempio n. 14
0
function gdlr_lms_print_course_button($course_options, $options = array('buy', 'book', 'learn'))
{
    global $gdlr_lms_option, $current_user;
    echo '<div class="gdlr-course-button" >';
    // for non member course
    if (!empty($course_options['allow-non-member']) && $course_options['allow-non-member'] == 'enable' && (empty($course_options['online-course']) || $course_options['online-course'] == 'enable') && (in_array('buy', $options) || in_array('book', $options))) {
        $options = array('start');
        // if not logging in
    } else {
        if (!is_user_logged_in() && !in_array('finish-quiz', $options)) {
            $lightbox_open = 'login-form';
            gdlr_lms_sign_in_lightbox_form();
        } else {
            // when purchase button is available
            if (in_array('buy', $options) || in_array('book', $options)) {
                // prerequisite course
                $prerequisite = false;
                if (!empty($course_options['prerequisite-course']) && $course_options['prerequisite-course'] != 'none') {
                    $prerequisite = true;
                    $find_row = gdlr_lms_get_payment_row($course_options['prerequisite-course'], $current_user->ID);
                    $payment_status = empty($find_row) ? false : $find_row->payment_status;
                    $p_course_options = gdlr_lms_get_course_options($course_options['prerequisite-course']);
                    // if prerequisite is offline course
                    if (!empty($p_course_options['online-course']) && $p_course_options['online-course'] == 'disable') {
                        if ($payment_status == 'paid' || $payment_status == 'reserved') {
                            $prerequisite = false;
                        }
                        // for online course
                    } else {
                        if ($payment_status == 'paid' || $payment_status == 'reserved') {
                            // if prerequisite course has quiz
                            if (!empty($p_course_options['quiz']) && $p_course_options['quiz'] != 'none') {
                                $quiz_row = gdlr_lms_get_quiz_row($p_course_options['quiz'], $course_options['prerequisite-course'], $current_user->ID, 'quiz_status');
                                $quiz_status = empty($quiz_row) ? false : $quiz_row->quiz_status;
                                if ($quiz_status == 'complete' || $quiz_status == 'submitted') {
                                    $prerequisite = false;
                                }
                            } else {
                                $p_section = empty($find_row) ? -1 : intval($find_row->attendance_section);
                                $p_course_settings = gdlr_lms_get_course_content_settings($course_options['prerequisite-course']);
                                if ($p_section == sizeof($p_course_settings)) {
                                    $prerequisite = false;
                                }
                            }
                        }
                    }
                }
                // course author
                global $post;
                $is_course_author = $post->post_author == $current_user->ID;
                // print button
                if ($prerequisite) {
                    $options = array('prerequisite');
                } else {
                    $find_row = gdlr_lms_get_payment_row(get_the_ID(), $current_user->ID, 'payment_status');
                    $payment_status = empty($find_row) ? false : $find_row->payment_status;
                    // for paid and free courses
                    if ($is_course_author || empty($course_options['price']) && empty($course_options['discount-price']) || $payment_status == 'paid') {
                        if (empty($course_options['online-course']) || $course_options['online-course'] == 'enable') {
                            $options = array('start');
                        } else {
                            if ($payment_status == 'reserved') {
                                $options = array('booking-status');
                            } else {
                                if ($payment_status != 'paid' && !$is_course_author) {
                                    $options = array('book');
                                } else {
                                    $options = array();
                                }
                            }
                        }
                        // booked course
                    } else {
                        if ($payment_status == 'pending' || $payment_status == 'submitted') {
                            $options = array('proceed-payment');
                        }
                    }
                }
            }
        }
    }
    // receipt only
    if (in_array('buy', $options) && !empty($gdlr_lms_option['payment-method']) && $gdlr_lms_option['payment-method'] == 'receipt') {
        unset($options[array_search('buy', $options)]);
    }
    foreach ($options as $value) {
        switch ($value) {
            case 'buy':
                if (empty($course_options['expired-date']) || time() < strtotime($course_options['expired-date'])) {
                    echo '<a data-rel="gdlr-lms-lightbox" data-lb-open="';
                    echo empty($lightbox_open) ? 'buy-form' : $lightbox_open;
                    echo '" class="gdlr-lms-button cyan" >' . __('Buy Now', 'gdlr-lms') . '</a>';
                    if (empty($lightbox_open)) {
                        gdlr_lms_purchase_lightbox_form($course_options, 'buy');
                    }
                }
                break;
            case 'book':
                if (empty($course_options['expired-date']) || time() < strtotime($course_options['expired-date'])) {
                    echo '<a data-rel="gdlr-lms-lightbox" data-lb-open="';
                    echo empty($lightbox_open) ? 'book-form' : $lightbox_open;
                    echo '" class="gdlr-lms-button blue" >' . __('Book Now', 'gdlr-lms') . '</a>';
                    if (empty($lightbox_open)) {
                        gdlr_lms_purchase_lightbox_form($course_options, 'book');
                    }
                }
                break;
            case 'learn':
                echo '<a class="gdlr-lms-button black" href="' . get_permalink() . '" >' . __('Learn More', 'gdlr-lms') . '</a>';
                break;
            case 'start':
                echo '<a class="gdlr-lms-button cyan" href="' . esc_url(add_query_arg(array('course_type' => 'content', 'course_page' => 1), get_permalink())) . '" >';
                _e('Start the course', 'gdlr-lms');
                echo '</a>';
                break;
            case 'proceed-payment':
                global $current_user;
                echo '<a class="gdlr-lms-button cyan" href="' . esc_url(add_query_arg('type', 'book-courses', get_author_posts_url($current_user->ID))) . '" >';
                _e('Proceed to Payment', 'gdlr-lms');
                echo '</a>';
                break;
            case 'booking-status':
                global $current_user;
                echo '<a class="gdlr-lms-button cyan" href="' . esc_url(add_query_arg('type', 'free-onsite', get_author_posts_url($current_user->ID))) . '" >';
                _e('Booking Status', 'gdlr-lms');
                echo '</a>';
                break;
            case 'prerequisite':
                echo __('You have to complete ', 'gdlr-lms') . '<a href="' . get_permalink($course_options['prerequisite-course']) . '" >';
                echo get_the_title($course_options['prerequisite-course']);
                echo '</a> ' . __('before you can access to this course.', 'gdlr-lms');
                break;
            case 'quiz':
                if (!empty($course_options['quiz']) && $course_options['quiz'] != 'none') {
                    global $wpdb, $current_user;
                    $sql = 'SELECT * FROM ' . $wpdb->prefix . 'gdlrquiz ';
                    $sql .= 'WHERE quiz_id=' . $course_options['quiz'] . ' AND student_id=' . $current_user->ID . ' AND course_id=' . get_the_ID() . ' ';
                    $sql .= 'AND (quiz_status=\'complete\' OR quiz_status=\'submitted\')';
                    $old_quiz = $wpdb->get_row($sql);
                    if (!empty($old_quiz)) {
                        $quiz_val = gdlr_lms_decode_preventslashes(get_post_meta($course_options['quiz'], 'gdlr-lms-quiz-settings', true));
                        $quiz_options = empty($quiz_val) ? array() : json_decode($quiz_val, true);
                        if (!empty($quiz_options['retake-quiz']) && $quiz_options['retake-quiz'] == 'enable' && $old_quiz->retake_times < 9999 && (empty($quiz_options['retake-times']) || $old_quiz->retake_times < intval($quiz_options['retake-times']))) {
                            echo '<a class="gdlr-lms-button cyan" href="' . esc_url(add_query_arg(array('course_type' => 'quiz', 'course_page' => 1, 'retake' => 1), get_permalink())) . '" >';
                            _e('Retake a quiz', 'gdlr-lms');
                            echo '</a>';
                        }
                    } else {
                        if (is_user_logged_in()) {
                            echo '<a class="gdlr-lms-button cyan" href="' . esc_url(add_query_arg(array('course_type' => 'quiz', 'course_page' => 1), get_permalink())) . '" >';
                            _e('Take a quiz', 'gdlr-lms');
                            echo '</a>';
                        } else {
                            echo '<div class="gdlr-login-for-quiz" style="padding: 0px 20px 30px">';
                            _e('You have to register and login to the site before you can take the quiz.', 'gdlr-lms');
                            echo '</div>';
                        }
                    }
                }
                break;
            case 'finish-quiz':
                echo '<a href="' . esc_url(add_query_arg(array('course_type' => 'quiz', 'course_page' => 'finish'))) . '" ';
                echo 'data-loading="' . __('Submitting the answer', 'gdlr-lms') . '" ';
                echo 'class="gdlr-lms-button cyan finish-quiz-form-button" >';
                _e('Finish the quiz', 'gdlr-lms');
                echo '</a>';
                gdlr_lms_finish_quiz_form();
                break;
        }
    }
    echo '</div>';
}
    $gdlr_lms_rating[$_POST['course_id']][$current_user->ID] = $_POST['rating'];
    update_option('gdlr_lms_rating', $gdlr_lms_rating);
} else {
    if (empty($gdlr_lms_rating)) {
        $gdlr_lms_rating = get_option('gdlr_lms_rating', array('course_id' => 'score'));
    }
}
// query data
$temp_sql = "SELECT id, course_id, payment_status, payment_info FROM " . $wpdb->prefix . "gdlrpayment ";
$temp_sql .= "WHERE student_id = " . $current_user->data->ID . " ";
$temp_sql .= "AND payment_status = 'paid' AND ";
$temp_sql .= "attendance <= cast('" . date('Y-m-d H:i:s') . "' as DATETIME) AND ";
$temp_sql .= "attendance != cast('0000-00-00' as DATETIME)";
$results = $wpdb->get_results($temp_sql);
foreach ($results as $result) {
    $course_val = gdlr_lms_decode_preventslashes(get_post_meta($result->course_id, 'gdlr-lms-course-settings', true));
    $course_options = empty($course_val) ? array() : json_decode($course_val, true);
    $payment_info = unserialize($result->payment_info);
    echo '<tr class="with-divider">';
    echo '<td>';
    echo '<a href="' . get_permalink($result->course_id) . '" >' . get_the_title($result->course_id) . '</a>';
    $additional_html = '';
    if ($payment_info['amount'] > 1) {
        $additional_html .= '<div class="gdlr-lms-info">';
        $additional_html .= '<span class="head">' . __('Amount', 'gdlr-lms') . '</span>';
        $additional_html .= '<span class="tail">' . $payment_info['amount'] . ' ' . __('Seats', 'gdlr-lms') . '</span>';
        $additional_html .= '</div>';
    }
    if (!empty($gdlr_lms_rating[$result->course_id][$current_user->ID])) {
        $additional_html .= '<div class="gdlr-lms-info">';
        $additional_html .= '<span class="head">' . __('Rating', 'gdlr-lms') . '</span>';
Esempio n. 16
0
function gdlr_lms_create_course_meta_box()
{
    global $post;
    // Add an nonce field so we can check for it later.
    wp_nonce_field('course_meta_box', 'course_meta_box_nonce');
    ////////////////////////////////
    //// course setting section ////
    ////////////////////////////////
    $course_settings = array('prerequisite-course' => array('title' => __('Prerequisite Course', 'gdlr-lms'), 'type' => 'combobox', 'options' => gdlr_lms_get_post_list('course')), 'online-course' => array('title' => __('Online Course', 'gdlr-lms'), 'type' => 'checkbox', 'default' => 'enable', 'description' => __('Course content section will be ignored when this option is disabled.', 'gdlr-lms')), 'allow-non-member' => array('title' => __('Allow non member to read course', 'gdlr-lms'), 'type' => 'checkbox', 'default' => 'disable', 'wrapper-class' => 'online-course-enable', 'description' => __('The price, quiz, seat and wait time field will be omitted.', 'gdlr-lms')), 'course-code' => array('title' => __('Course Code', 'gdlr-lms'), 'type' => 'text', 'description' => __('Use to generate code after submit payment evidence.', 'gdlr-lms')), 'quiz' => array('title' => __('Course Quiz', 'gdlr-lms'), 'type' => 'combobox', 'options' => gdlr_lms_get_post_list('quiz'), 'wrapper-class' => 'online-course-enable'), 'location' => array('title' => __('Location', 'gdlr-lms'), 'type' => 'text', 'class' => 'long', 'wrapper-class' => 'online-course-disable'), 'start-date' => array('title' => __('Start Date', 'gdlr-lms'), 'type' => 'datepicker'), 'end-date' => array('title' => __('End Date', 'gdlr-lms'), 'type' => 'datepicker'), 'course-time' => array('title' => __('Course Time', 'gdlr-lms'), 'type' => 'text', 'wrapper-class' => 'online-course-disable'), 'expired-date' => array('title' => __('Expired Date', 'gdlr-lms'), 'type' => 'datepicker', 'description' => __('(If any)', 'gdlr-lms')), 'max-seat' => array('title' => __('Max Seat', 'gdlr-lms'), 'type' => 'text', 'wrapper-class' => 'online-course-disable'), 'booked-seat' => array('title' => __('Booked Seat', 'gdlr-lms'), 'type' => 'text', 'wrapper-class' => 'online-course-disable'), 'price' => array('title' => __('Price', 'gdlr-lms'), 'type' => 'text', 'class' => 'small', 'description' => __('Leaving this field blankfor free course (Only number is allowed here)', 'gdlr-lms')), 'discount-price' => array('title' => __('Discount Price', 'gdlr-lms'), 'type' => 'text', 'class' => 'small', 'description' => __('(Only number is allowed here)', 'gdlr-lms')), 'enable-badge' => array('title' => __('Enable Badge', 'gdlr-lms'), 'type' => 'checkbox', 'default' => 'disable', 'wrapper-class' => 'online-course-enable'), 'badge-percent' => array('title' => __('% Of Score To Get Badge', 'gdlr-lms'), 'type' => 'text', 'wrapper-class' => 'online-course-enable'), 'badge-title' => array('title' => __('Badge Title', 'gdlr-lms'), 'type' => 'text', 'wrapper-class' => 'online-course-enable'), 'badge-file' => array('title' => __('Badge File', 'gdlr-lms'), 'type' => 'upload', 'wrapper-class' => 'online-course-enable'), 'enable-certificate' => array('title' => __('Enable Certificate', 'gdlr-lms'), 'type' => 'checkbox', 'default' => 'disable', 'wrapper-class' => 'online-course-enable'), 'certificate-percent' => array('title' => __('% Of Score To Get Certificate', 'gdlr-lms'), 'type' => 'text', 'wrapper-class' => 'online-course-enable'), 'certificate-template' => array('title' => __('Certificate Template', 'gdlr-lms'), 'type' => 'combobox', 'options' => gdlr_lms_get_post_list('certificate'), 'wrapper-class' => 'online-course-enable'));
    $course_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-lms-course-settings', true));
    $course_settings_val = empty($course_val) ? array() : json_decode($course_val, true);
    echo '<div class="gdlr-lms-meta-wrapper">';
    echo '<h3>' . __('Course Settings', 'gdlr-lms') . '</h3>';
    foreach ($course_settings as $slug => $course_setting) {
        $course_setting['slug'] = $slug;
        $course_setting['value'] = empty($course_settings_val[$slug]) ? '' : $course_settings_val[$slug];
        gdlr_lms_print_meta_box($course_setting);
    }
    echo '<textarea name="gdlr-lms-course-settings">' . esc_textarea($course_val) . '</textarea>';
    echo '</div>';
    /////////////////////
    //// tab section ////
    /////////////////////
    $course_content_options = array('section-name' => array('title' => __('Section Name', 'gdlr-lms'), 'type' => 'text'), 'pdf-download-link' => array('title' => __('PDF Download Link', 'gdlr-lms'), 'type' => 'upload'), 'wait-time' => array('title' => __('Student have to wait', 'gdlr-lms'), 'type' => 'text', 'class' => 'small', 'description' => __('days before continuing to next section.', 'gdlr-lms')), 'wait-date' => array('title' => __('Next section will be available at', 'gdlr-lms'), 'type' => 'datepicker', 'description' => __('( Wait time has to be blank for this field to take effects )', 'gdlr-lms')), 'course-content' => array('type' => 'wysiwyg'));
    $course_content_val = gdlr_lms_decode_preventslashes(get_post_meta($post->ID, 'gdlr-lms-content-settings', true));
    $course_content_options_val = empty($course_content_val) ? array() : json_decode($course_content_val, true);
    echo '<div class="gdlr-lms-meta-wrapper gdlr-tabs">';
    echo '<h3>' . __('Course Content', 'gdlr-lms') . '</h3>';
    echo '<div class="course-tab-add-new">';
    echo '<span class="head">+</span>';
    echo '<span class="tail">' . __('Add Section', 'gdlr-lms') . '</span>';
    echo '</div>';
    // course-tab-add-new
    echo '<div class="course-tab-title">';
    echo '<span class="active">1</span>';
    for ($i = 2; $i <= sizeof($course_content_options_val); $i++) {
        echo '<span>' . $i . '</span>';
    }
    echo '</div>';
    // course-tab-title
    echo '<div class="course-tab-content">';
    echo '<div class="course-tab-remove">Delete</div>';
    foreach ($course_content_options as $slug => $course_content_option) {
        $course_content_option['slug'] = $slug;
        $course_content_option['value'] = empty($course_content_options_val[0][$slug]) ? '' : $course_content_options_val[0][$slug];
        gdlr_lms_print_meta_box($course_content_option);
    }
    echo '</div>';
    // course-tab-content
    echo '<textarea name="gdlr-lms-content-settings">' . esc_textarea($course_content_val) . '</textarea>';
    echo '</div>';
}
<?php

get_header();
?>
<div class="gdlr-content">

	<?php 
global $gdlr_sidebar, $theme_option;
if (empty($gdlr_post_option['sidebar']) || $gdlr_post_option['sidebar'] == 'default-sidebar') {
    $gdlr_sidebar = array('type' => $theme_option['result-sidebar-template'], 'left-sidebar' => $theme_option['result-sidebar-left'], 'right-sidebar' => $theme_option['result-sidebar-right']);
} else {
    $gdlr_sidebar = array('type' => $gdlr_post_option['sidebar'], 'left-sidebar' => $gdlr_post_option['left-sidebar'], 'right-sidebar' => $gdlr_post_option['right-sidebar']);
}
$gdlr_sidebar = gdlr_get_sidebar_class($gdlr_sidebar);
$match_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-soccer-fixture-result-settings', true));
$match_options = empty($match_val) ? array() : json_decode($match_val, true);
?>
	
	<!-- player info -->
	<div class="gdlr-soccer-match-results-wrapper">
		<div class="gdlr-soccer-match-results-overlay"></div>
		<div class="gdlr-soccer-match-results-container container">
			<div class="gdlr-soccer-match-results gdlr-item">
				<div class="gdlr-soccer-match-results-title gdlr-title-font">
					<?php 
if (!empty($match_options['home-flag'])) {
    ?>
						<span class="gdlr-team-flag"><?php 
    echo gdlr_get_image($match_options['home-flag']);
    ?>
</span>
<?php

$course_val = gdlr_lms_decode_preventslashes(get_post_meta($_GET['course_id'], 'gdlr-lms-course-settings', true));
$course_options = empty($course_val) ? array() : json_decode($course_val, true);
?>
<h3 class="gdlr-lms-admin-head" ><?php 
echo get_the_title($_GET['course_id']);
?>
</h3>
<table class="gdlr-lms-table">
<tr>
	<th><?php 
_e('Student', 'gdlr-lms');
?>
</th>
	<?php 
if ($course_options['online-course'] == 'disable') {
    ?>
	<th align="center" ><?php 
    _e('Seat', 'gdlr-lms');
    ?>
</th>
	<?php 
}
?>
	<th align="center" ><?php 
_e('Status', 'gdlr-lms');
?>
</th>
	<th align="center" ><?php 
_e('Code', 'gdlr-lms');
Esempio n. 19
0
<?php

get_header();
?>
<div class="gdlr-content">

	<?php 
global $gdlr_sidebar, $theme_option;
if (empty($gdlr_post_option['sidebar']) || $gdlr_post_option['sidebar'] == 'default-sidebar') {
    $gdlr_sidebar = array('type' => $theme_option['player-sidebar-template'], 'left-sidebar' => $theme_option['player-sidebar-left'], 'right-sidebar' => $theme_option['player-sidebar-right']);
} else {
    $gdlr_sidebar = array('type' => $gdlr_post_option['sidebar'], 'left-sidebar' => $gdlr_post_option['left-sidebar'], 'right-sidebar' => $gdlr_post_option['right-sidebar']);
}
$gdlr_sidebar = gdlr_get_sidebar_class($gdlr_sidebar);
$social_type = 'dark';
$player_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-soccer-player-settings', true));
$player_options = empty($player_val) ? array() : json_decode($player_val, true);
?>
	
	<!-- player info -->
	<div class="gdlr-soccer-player-general-info-wrapper">
		<div class="gdlr-soccer-player-general-info-container container">
			<div class="gdlr-soccer-player-general-info-inner gdlr-item">
				<div class="gdlr-soccer-player-general-info-left">
					<div class="gdlr-soccer-player-general-info-left-overlay"></div>
					<?php 
echo gdlr_soccer_get_player_avatar();
?>
					<h1 class="gdlr-soccer-player-title"><?php 
the_title();
?>
_e('Scoring status', 'gdlr-lms');
?>
</h3>
<table class="gdlr-lms-table">
<tr>
	<th><?php 
_e('Summary', 'gdlr-lms');
?>
</th>
	<th align="center" ><?php 
_e('Scores', 'gdlr-lms');
?>
</th>
</tr>
<?php 
$quiz_val = gdlr_lms_decode_preventslashes(get_post_meta($_GET['quiz_id'], 'gdlr-lms-content-settings', true));
$quiz_options = empty($quiz_val) ? array() : json_decode($quiz_val, true);
$sql = 'SELECT quiz_answer, quiz_score FROM ' . $wpdb->prefix . 'gdlrquiz ';
$sql .= 'WHERE quiz_id=' . $_GET['quiz_id'] . ' AND student_id=' . $_GET['student_id'] . ' AND course_id=' . $_GET['course_id'];
$current_row = $wpdb->get_row($sql);
$quiz_answer = unserialize($current_row->quiz_answer);
$quiz_score = unserialize($current_row->quiz_score);
$quiz_score = empty($quiz_score) ? array() : $quiz_score;
$score_summary = gdlr_lms_score_part_summary($quiz_score);
$pnum = 0;
foreach ($quiz_options as $quiz_option) {
    echo '<tr>';
    echo '<td>' . $quiz_option['section-name'] . '</td>';
    echo '<td>';
    echo empty($score_summary[$pnum]) ? __('Pending', 'gdlr-lms') : $score_summary[$pnum]['score'] . '/' . $score_summary[$pnum]['from'];
    echo '</td>';
function gdlr_print_upcoming_match_item($settings)
{
    $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
    global $gdlr_spaces;
    $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
    if (!empty($settings['image-id'])) {
        $image_url = is_numeric($settings['image-id']) ? wp_get_attachment_url($settings['image-id']) : $settings['image-id'];
        $margin .= ' background-image: url(\'' . $image_url . '\'); ';
    }
    $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
    $current_date = date_i18n('Y-m-d H:i', current_time('timestamp'));
    // query posts section
    $args = array('post_type' => 'fixture_and_result', 'suppress_filters' => false);
    $args['posts_per_page'] = 1;
    $args['meta_key'] = 'gdlr-start-date';
    $args['orderby'] = 'meta_value';
    $args['order'] = 'asc';
    $args['paged'] = 1;
    $args['meta_query'] = array(array('key' => 'gdlr-start-date', 'value' => $current_date, 'compare' => '>'));
    if (!empty($settings['category'])) {
        $args['tax_query'] = array();
        if (!empty($settings['category'])) {
            array_push($args['tax_query'], array('terms' => explode(',', $settings['category']), 'taxonomy' => 'result_category', 'field' => 'slug'));
        }
    }
    $query = new WP_Query($args);
    while ($query->have_posts()) {
        $query->the_post();
        $match_val = gdlr_lms_decode_preventslashes(get_post_meta(get_the_ID(), 'gdlr-soccer-fixture-result-settings', true));
        $match_options = empty($match_val) ? array() : json_decode($match_val, true);
        echo '<div class="upcoming-match-item-wrapper gdlr-item" ' . $item_id . $margin_style . ' >';
        echo '<div class="upcoming-match-overlay"></div>';
        echo '<div class="gdlr-upcoming-match-team-wrapper">';
        echo '<span class="gdlr-upcoming-match-team gdlr-left">';
        echo empty($match_options['home-flag']) ? '' : '<span class="gdlr-team-flag">' . gdlr_get_image($match_options['home-flag']) . '</span>';
        echo $match_options['home'] . '</span>';
        echo '<span class="gdlr-upcoming-match-versus">' . __('VS', 'gdlr-soccer') . '</span>';
        echo '<span class="gdlr-upcoming-match-team gdlr-right">' . $match_options['away'];
        echo empty($match_options['away-flag']) ? '' : '<span class="gdlr-team-flag">' . gdlr_get_image($match_options['away-flag']) . '</span>';
        echo '</span>';
        echo '</div>';
        // upcoming-match-team
        echo gdlr_soccer_get_match_info($match_options, '<span class="upcoming-match-info-overlay"></span>');
        echo '</div>';
    }
    wp_reset_postdata();
}