Plugin Directory

Changeset 2679280


Ignore:
Timestamp:
02/15/2022 04:52:49 PM (4 years ago)
Author:
maurolopes
Message:

Preparing for 2.1.0 release

Location:
easy-dash-for-learndash/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • easy-dash-for-learndash/trunk/admin/tred-admin.php

    r2677389 r2679280  
    55        'type' => 'select',
    66        'kind' => '',
    7         'options' => ['7','10','14','30','60'],
     7        'options' => ['7','10','14','30','60','90','120','180','365','all time'],
    88        'default' => '30',
    99        'description'=> __('Some widgets in the dashboard limit queries to the last x days. Choose here how many days you want to limit.', 'learndash-easy-dash'),
    1010        'obs' => __('All widgets with queries limited by days will be affected.', 'learndash-easy-dash'),
    11         'final' => __('Default: 30 days.', 'learndash-easy-dash'),
    12         'order' => 4,
     11        'final' => __('Default: 30 days. Options above \'90\' days may not work due to memory size and timeout issues', 'learndash-easy-dash'),
     12        'order' => 1,
    1313    ],
    1414    'tred_cache_x_hours' => [
     
    2020        'obs' => __('All queries will be affected next time they are cached.', 'learndash-easy-dash'),
    2121        'final' => __('Default: 6 hours.', 'learndash-easy-dash'),
    22         'order' => 5,
     22        'order' => 2,
    2323    ],
    2424    'tred_select_x_items' => [
     
    3030        'obs' => __('All queries that limit the number of items to be selected will be affected. Please note that your chart may look bad if too many items are queried.', 'learndash-easy-dash'),
    3131        'final' => __('Default: 10 items.', 'learndash-easy-dash'),
    32         'order' => 6,
     32        'order' => 3,
    3333    ]
    3434];
  • easy-dash-for-learndash/trunk/admin/tred-settings.php

    r2677389 r2679280  
    3737                                foreach($vals['options'] as $v => $label) {
    3838                                    $pt = (is_integer($v)) ? $label : $v;
     39                                    if($label == 'all time') {
     40                                        $pt = '-1';
     41                                    }
    3942                                    ?>
    4043                                    <option value="<?php echo esc_attr($pt); ?>" <?php
  • easy-dash-for-learndash/trunk/assets/js/tred-admin.js

    r2677389 r2679280  
    238238        let widgetsParents = divTab.find('.tred-widgets-parents');
    239239        if(!widgetsToShow) {
    240             console.log('!widgetsToShow');
    241240            return false;
    242241        }
    243242        widgetsArr = widgetsToShow.split(',');
    244243        if(!widgetsArr) {
    245             console.log('!widgetsArr');
    246244            return false;
    247245        }
     
    832830        }
    833831        //don't do the rest of the code
    834         console.log('end here');
    835832        return;
    836833    }
    837 
    838 
    839 
    840 
    841    
    842 
    843     console.log('go on...');
    844834
    845835    //load the translated button texts
     
    906896    }
    907897
     898   
     899    $('select[name="tred_last_x_days"]').on('change', function() {
     900        let select = $(this);
     901        let value = select.val();
     902        if(value > 90) {
     903            alert(value + ' ' + tredElementsTranslation['alert']['more_than_x_days']);
     904        }
     905        if(value < 0) {
     906            alert(tredElementsTranslation['alert']['all_time']);
     907        }       
     908    });
    908909//END - PAGE LOADS
    909910
  • easy-dash-for-learndash/trunk/includes/callbacks-actions.php

    r2677389 r2679280  
    277277    $activity = tred_learndash_get_activity();
    278278    if(!is_array($activity)) {
    279         $response['result'] = 'error';
     279        $response['result'] = $activity;
    280280        echo json_encode($response);
    281281        die();
  • easy-dash-for-learndash/trunk/includes/functions.php

    r2677389 r2679280  
    33
    44//UTILITY FUNCTIONS
     5function tred_get_plugin_basic_version($string_version) {
     6  //get first two numbers
     7  $string_version = preg_replace('/[^0-9]/', '', $string_version);
     8  return substr($string_version, 0, 2);
     9}
     10
    511function tred_year_month_numbers_to_string_month_slash_year($year_month) {
    612  if(empty($year_month)) {
     
    422428      return $tred_learndash_get_activity;
    423429  }
     430 
    424431  $transient_expire_time = (int)$hours * HOUR_IN_SECONDS;
     432 
    425433  global $wpdb;
    426     $where_updated = '(activity_updated IS NOT NULL AND activity_updated != "" AND DATEDIFF(NOW(), FROM_UNIXTIME(activity_updated)) < %d)';
    427     $sql_select = 'SELECT * FROM ' . esc_sql( LDLMS_DB::get_table_name( 'user_activity' ) ) . ' WHERE ';
    428     $sql_select .= $where_updated;
    429     $sql_str = $wpdb->prepare( $sql_select, $days );
    430     $activity = $wpdb->get_results( $sql_str );
     434  $sql_select = 'SELECT * FROM ' . esc_sql( LDLMS_DB::get_table_name( 'user_activity' ) ) . ' WHERE activity_updated IS NOT NULL AND activity_updated != ""';
     435  $sql_prepared = $sql_select;
     436  if( !empty($days) && is_numeric($days) && $days > 0 )  {
     437    $sql_select .= ' AND DATEDIFF(NOW(), FROM_UNIXTIME(activity_updated)) < %d';
     438    $sql_prepared = $wpdb->prepare( $sql_select, $days );
     439  }
     440    $activity = $wpdb->get_results( $sql_prepared );
    431441    if ( $activity ) {   
    432442    set_transient( 'tred_learndash_get_activity_' . $days . '_days', $activity, $transient_expire_time );
     
    637647  if(!is_numeric($timestamp) || !is_numeric($days)) {
    638648    return false;
     649  }
     650  if($days <= 0) {
     651    //all time
     652    return true;
    639653  }
    640654  $startDate = new DateTime("-$days days");
  • easy-dash-for-learndash/trunk/includes/translations.php

    r2677389 r2679280  
    1010        'select' => esc_html__('select', 'learndash-easy-dash'),
    1111        'go' => esc_html__('go', 'learndash-easy-dash'),
     12        'alert' => [
     13            'more_than_x_days' => esc_html__('days for a database query might be too much for your website, depending on how many courses and students it has. You can save and try; if it does not work as expected, go back to reduce this value.', 'learndash-easy-dash'),
     14            'all_time' => esc_html__('All time? Really? Depending on how many courses and students your website has, it can be a daunting task. You can save and try; if it does not work as expected, go back to reduce this value.', 'learndash-easy-dash'),
     15        ]
    1216    ];
    1317}
     
    8185            if(strpos($term, '%d days') !== false) {
    8286                $translation_array[$widget_type][$key][$term] = sprintf( esc_html__($term, 'learndash-easy-dash'), TRED_LAST_X_DAYS );
     87                if('-1' == TRED_LAST_X_DAYS) {
     88                    $translation_array[$widget_type][$key][$term] = esc_html__(str_ireplace('last %d days', 'all time',$term), 'learndash-easy-dash');
     89                }
    8390            } else if(strpos($term, 'Top %d') !== false) {
    8491                $translation_array[$widget_type][$key][$term] = sprintf( esc_html__($term, 'learndash-easy-dash'), TRED_SELECT_X_ITEMS );
  • easy-dash-for-learndash/trunk/learndash-easy-dash.php

    r2677389 r2679280  
    66 * Author: Luis Rock
    77 * Author URI: https://wptrat.com/
    8  * Version: 2.0.0
     8 * Version: 2.1.0
    99 * Text Domain: learndash-easy-dash
    1010 * Domain Path: /languages
     
    1919if ( ! defined( 'ABSPATH' ) ) exit;
    2020
    21 define("TRED_VERSION", "2.0.0");
     21define("TRED_VERSION", "2.1.0");
    2222
    2323// Check if LearnDash is active. If not, deactivate...
     
    4949} //end if( !is_plugin_active('sfwd-lms/sfwd_lms.php' ) )
    5050
    51 
    5251add_action( 'init', 'tred_load_textdomain' );
    5352function tred_load_textdomain() {
     
    128127require_once('includes/callbacks-actions.php');
    129128
     129// var_dump(TRED_LAST_X_DAYS);
     130// die();
    130131
    131132function tred_register_all_scripts_and_styles() {
  • easy-dash-for-learndash/trunk/readme.txt

    r2677389 r2679280  
    33Tags: learndash, education, elearning, lms, learning
    44Requires at least: 5.0
    5 Tested up to: 5.8
     5Tested up to: 5.9
    66Requires PHP: 5.6
    7 Stable tag: 2.0.0
     7Stable tag: 2.1.0
    88License: GNU General Public License v3.0
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1010
    11 **Easy Dash for LearnDash: an improved (and easy) dashboard for your LearnDash site.
     11Easy Dash for LearnDash: an improved (and easy) dashboard for your LearnDash site.
    1212
    1313== Description ==
     
    6969
    7070== Changelog ==
     71= 2.1.0 =
     72* New: added more options do "last x days" queries: '120', '180', '365' and 'all time'.
     73* Fixed: tested up to 5.9
     74
    7175= 2.0.0 =
    7276* New: filter course and get its stats
Note: See TracChangeset for help on using the changeset viewer.