From 536be08b790a4bb9f044c16da170e0b690192f8a Mon Sep 17 00:00:00 2001 From: Corentin Date: Fri, 4 Jan 2019 16:17:43 +0100 Subject: [PATCH 01/35] -> Dev de la page Indicator -> Planning utilisateur --- core/assets/js/backend.min.js | 164 ++++----- core/external/eo-framework | 2 +- core/view/main.view.php | 2 +- .../activity/action/class-activity-action.php | 27 +- module/activity/class/activity.class.php | 68 +++- module/follower/action/follower.action.php | 130 +++++++- module/follower/asset/js/follower.backend.js | 12 +- module/follower/class/follower.class.php | 313 +++++++++++++++++- module/follower/model/follower.model.php | 7 +- .../backend/user-profile-planning.view.php | 274 +++++++++++++++ .../indicator/asset/js/indicator.backend.js | 18 +- .../indicator-metabox-main.view.php | 2 +- .../navigation/action/navigation.action.php | 2 +- module/task/class/task.class.php | 2 +- .../task/shortcode/class-task-shortcode.php | 3 + package-lock.json | 12 +- task-manager.config.json | 3 +- task-manager.php | 4 +- 18 files changed, 919 insertions(+), 126 deletions(-) create mode 100644 module/follower/view/backend/user-profile-planning.view.php diff --git a/core/assets/js/backend.min.js b/core/assets/js/backend.min.js index bd8f937d..d8879f1b 100644 --- a/core/assets/js/backend.min.js +++ b/core/assets/js/backend.min.js @@ -830,6 +830,75 @@ window.eoxiaJS.taskManager.comment.afterTriggerChangeDate = function( $input ) { $input.closest( '.group-date' ).find( 'span' ).css( 'background', '#389af6' ); }; +/** + * Initialise l'objet "task" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. + * + * @since 1.5.1 + * @version 1.6.0 + */ +window.eoxiaJS.taskManager.taskExport = {}; + +window.eoxiaJS.taskManager.taskExport.init = function() { + window.eoxiaJS.taskManager.taskExport.event(); +}; + +window.eoxiaJS.taskManager.taskExport.event = function() { + jQuery( document ).on( 'change', 'input[name=export_type]', window.eoxiaJS.taskManager.taskExport.displayDateForExport ); +}; + +/** + * Le callback en cas de réussite à la requête Ajax "load_export_popup". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.6.0 + * @version 1.6.0 + */ +window.eoxiaJS.taskManager.taskExport.loadedExportPopup = function( triggeredElement, response ) { + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .content' ).html( response.data.view ); + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .container' ).removeClass( 'loading' ); +}; + +/** + * [description] + * @method + * @param {[type]} $input [description] + * @return {[type]} [description] + */ +window.eoxiaJS.taskManager.taskExport.afterTriggerChangeDate = function( $input ) { + $input.closest( '.group-date' ).find( '.date-display' ).html( $input.val() ); +}; + +/** + * [description] + * @method + * @param {[type]} triggeredElement [description] + * @return {[type]} [description] + */ +window.eoxiaJS.taskManager.taskExport.displayDateForExport = function( triggeredElement ) { + if ( 'by_date' == jQuery( this ).val() ) { + jQuery( '.tm_export_date_container' ).show(); + } else { + jQuery( '.tm_export_date_container' ).hide(); + } +}; + +/** + * Le callback en cas de réussite à la requête Ajax "export_task". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.3.6 + * @version 1.6.0 + */ +window.eoxiaJS.taskManager.taskExport.exportedTask = function( triggeredElement, response ) { + jQuery( '.tm_export_result_container' ).find( 'textarea' ).html( response.data.content ); +}; + /** * Initialise l'objet "point" ainsi que la méthode "follower" obligatoire pour la bibliothèque EoxiaJS. * @@ -842,7 +911,9 @@ window.eoxiaJS.taskManager.follower.init = function() { window.eoxiaJS.taskManager.follower.event(); }; -window.eoxiaJS.taskManager.follower.event = function() { }; +window.eoxiaJS.taskManager.follower.event = function() { + jQuery( document ).on( 'click', '.showfullplanning', window.eoxiaJS.taskManager.follower.showfullplanning ); + }; /** * Le callback en cas de réussite à la requête Ajax "load_followers". @@ -937,75 +1008,14 @@ window.eoxiaJS.taskManager.follower.unaffectedFollowerSuccess = function( elemen element.attr( 'data-before-method', 'beforeAffectFollower' ); element.attr( 'data-nonce', response.data.nonce ); }; - -/** - * Initialise l'objet "task" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. - * - * @since 1.5.1 - * @version 1.6.0 - */ -window.eoxiaJS.taskManager.taskExport = {}; - -window.eoxiaJS.taskManager.taskExport.init = function() { - window.eoxiaJS.taskManager.taskExport.event(); -}; - -window.eoxiaJS.taskManager.taskExport.event = function() { - jQuery( document ).on( 'change', 'input[name=export_type]', window.eoxiaJS.taskManager.taskExport.displayDateForExport ); -}; -/** - * Le callback en cas de réussite à la requête Ajax "load_export_popup". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.6.0 - * @version 1.6.0 - */ -window.eoxiaJS.taskManager.taskExport.loadedExportPopup = function( triggeredElement, response ) { - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .content' ).html( response.data.view ); - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .container' ).removeClass( 'loading' ); -}; - -/** - * [description] - * @method - * @param {[type]} $input [description] - * @return {[type]} [description] - */ -window.eoxiaJS.taskManager.taskExport.afterTriggerChangeDate = function( $input ) { - $input.closest( '.group-date' ).find( '.date-display' ).html( $input.val() ); -}; - -/** - * [description] - * @method - * @param {[type]} triggeredElement [description] - * @return {[type]} [description] - */ -window.eoxiaJS.taskManager.taskExport.displayDateForExport = function( triggeredElement ) { - if ( 'by_date' == jQuery( this ).val() ) { - jQuery( '.tm_export_date_container' ).show(); - } else { - jQuery( '.tm_export_date_container' ).hide(); - } -}; +window.eoxiaJS.taskManager.follower.showfullplanning = function( event ){ + $( '.showfullplanning' ).css( 'display', 'none' ); +} -/** - * Le callback en cas de réussite à la requête Ajax "export_task". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.3.6 - * @version 1.6.0 - */ -window.eoxiaJS.taskManager.taskExport.exportedTask = function( triggeredElement, response ) { - jQuery( '.tm_export_result_container' ).find( 'textarea' ).html( response.data.content ); -}; +window.eoxiaJS.taskManager.follower.reloadPlanningUser = function( element, response ){ + $( '.planninguser' ).replaceWith( response.data.view ); +} /** * Initialise l'objet "historyTime" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. @@ -1165,12 +1175,10 @@ window.eoxiaJS.taskManager.indicator.toggleMetabox = function( event ) { /** * Le callback en cas de réussite à la requête Ajax "load_customer_activity". * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} + * Affiche les canvas * - * @since 1.5.0 - * @version 1.5.0 + * @author Corentin Eoxia + * @since 1.8.0 */ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggeredElement, response ) { jQuery( '#tm-indicator-activity .inside' ).html( response.data.view ); @@ -1263,10 +1271,16 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere $( '#information_canvas' ).css('display', 'none'); }else{ - if( response.data.error == 'date_error' ){ + if( response.data.error == 'date_error' ){ // Date invalid + $( '#information_canvas' ).html( window.indicatorString.date_error ); - }else if( response.data.error == 'person_error' ){ + + }else if( response.data.error == 'person_error' ){ // User don't choose person + $( '#information_canvas' ).html( window.indicatorString.person_error ); + + }else{ // No data found + } $( '#information_canvas' ).css('display', 'block'); diff --git a/core/external/eo-framework b/core/external/eo-framework index e1cd5158..28587caf 160000 --- a/core/external/eo-framework +++ b/core/external/eo-framework @@ -1 +1 @@ -Subproject commit e1cd515839a4af44e2c97ebd46ac3f568b07719c +Subproject commit 28587caf13defddab6c1596aa0e70a967161f7ea diff --git a/core/view/main.view.php b/core/view/main.view.php index 02f7cb99..b08dc281 100644 --- a/core/view/main.view.php +++ b/core/view/main.view.php @@ -57,7 +57,7 @@ class="action-attribute add-new-h2 wpeo-button button-size-small button-radius-2 foreach ( $search_args as $shortcode_params_key => $shortcode_params_value ) { $shortcode_final_args .= $shortcode_params_key . '="' . $shortcode_params_value . '" '; } - do_shortcode( '[task ' . $shortcode_final_args . ']' ); + echo do_shortcode( '[task ' . $shortcode_final_args . ']' ); endif; ?> diff --git a/module/activity/action/class-activity-action.php b/module/activity/action/class-activity-action.php index 7748f67d..ea087356 100644 --- a/module/activity/action/class-activity-action.php +++ b/module/activity/action/class-activity-action.php @@ -32,6 +32,8 @@ public function __construct() { add_action( 'wp_ajax_open_popup_user_chart', array( $this, 'callback_open_popup_user_chart' ) ); add_action( 'wp_ajax_export_activity', array( $this, 'callback_export_activity' ) ); add_action( 'wp_ajax_validate_indicator', array( $this, 'callback_validate_indicator' ) ); + + //add_action( 'admin_init', array( $this, 'callback_update_db_planning' ) ); } /** @@ -148,8 +150,8 @@ public function load_customer_activity() { public function callback_export_activity() { $user_id = ! empty( $_POST['user_id_selected'] ) ? (int) $_POST['user_id_selected'] : 0; $customer_id = ! empty( $_POST['user']['customer_id'] ) ? (int) $_POST['user']['customer_id'] : 0; - $date_end = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_start'] ) ? $_POST['tm_abu_date_start'] : current_time( 'Y-m-d' ); - $date_start = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_end'] ) ? $_POST['tm_abu_date_end'] : current_time( 'Y-m-d' ); + $date_end = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_start'] ) ? $_POST['tm_abu_date_start'] : current_time( 'Y-m-d' ); + $date_start = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_end'] ) ? $_POST['tm_abu_date_end'] : current_time( 'Y-m-d' ); $datas = Activity_Class::g()->display_user_activity_by_date( $user_id, $date_end, $date_start, $customer_id ); @@ -176,11 +178,11 @@ public function callback_export_activity() { if ( ! empty( $datas ) ) { foreach ( $datas as $data ) { - $date = \eoxia\Date_Util::g()->fill_date( $data->COM_DATE ); + $date = \eoxia\Date_Util::g()->fill_date( $data->COM_DATE ); $com_details = ( ! empty( $data->COM_DETAILS ) ? json_decode( $data->COM_DETAILS ) : '' ); $user_data = get_userdata( $data->COM_author_id ); - $search = array( '
', ' ', '>', '"', '&', ''' ); + $search = array( '
', ' ', '>', '"', '&', ''' ); $replace = array( PHP_EOL, ' ', '>', '"', 'é', '\'' ); $data_to_export = array( @@ -208,6 +210,11 @@ public function callback_export_activity() { ) ); } +/** + * [Récupere les données utilisateurs | Affiche les canvas] + * @since 1.8.0 + * @author Corentin Eoxia + **/ public function callback_validate_indicator(){ check_ajax_referer( 'validate_indicator' ); @@ -223,6 +230,8 @@ public function callback_validate_indicator(){ $joursaffichagedonut = 0; $error = ''; + + ob_start(); if( $arraylistfollower[0] ){ @@ -241,13 +250,14 @@ public function callback_validate_indicator(){ } $datas = Activity_Class::g()->display_user_activity_by_date( $arraylistfollower[0], $date_end, $date_start ); - $data_charset = Activity_Class::g()->get_data_chart( $datas, $date_end, $date_start, $time ); + + $data_charset = Activity_Class::g()->get_data_chart( $datas, $date_end, $date_start, $time, $arraylistfollower[0] ); + $datatime = $data_charset['datatime']; $date_gap = $data_charset['date_gap']; - $date_start = $data_return['date_start']; - $date_end = $date_return['date_end']; - + $date_start = $data_charset['date_start']; + $date_end = $data_charset['date_end']; if( $date_gap == 0 ){ $error = 'date_error'; @@ -268,7 +278,6 @@ public function callback_validate_indicator(){ 'jourdonut' => $joursaffichagedonut, 'error' => $error ) ); - } } diff --git a/module/activity/class/activity.class.php b/module/activity/class/activity.class.php index 73648b09..2925ad50 100644 --- a/module/activity/class/activity.class.php +++ b/module/activity/class/activity.class.php @@ -89,6 +89,7 @@ public function get_activity( $tasks_id, $offset, $date_end = '', $date_start = * @return array */ public function display_user_activity_by_date( $user_id, $date_end = '', $date_start = '', $customer_id = 0 ) { + if ( empty( $date_end ) ) { $date_end = current_time( 'Y-m-d' ); } @@ -133,7 +134,7 @@ public function display_user_activity_by_date( $user_id, $date_end = '', $date_s return $datas; } - public function get_data_chart( $datas, $date_end = '', $date_start = '', $time = '') { + public function get_data_chart( $datas, $date_end = '', $date_start = '', $time = '', $user_id ) { $datatime = []; $datatime_estimated = []; @@ -151,23 +152,70 @@ public function get_data_chart( $datas, $date_end = '', $date_start = '', $time //86 400 = Une journée en seconde $date_gap = ( $date_end_strtotime - $date_start_strtotime ) / 86400; // Recupere le nombre jour d'ecart - $datatime = []; - $time = date( "D", $date_start_strtotime ); + $data_full_planning = get_user_meta( $user_id, '_tm_planning_users', true ); + + $dates = array(); + $current = strtotime( $date_start ); + $last = strtotime( $date_end ); + + $temp_year = ''; + $temp_month = ''; + + $data_monthyear_db = array(); + + while( $current <= $last ) { + if( date( 'm', $current ) != $temp_month ){ + + $temp_month = date( 'm', $current ); + + $data_monthyear_db[ count( $data_monthyear_db ) ] = array( + 'month' => date( 'm', $current ), + 'year' => date( 'Y', $current ) + ); + } + + $dates[] = date( 'd/m/Y', $current ); + $current = strtotime( '+1 day', $current ); + } + + foreach ( $data_monthyear_db as $nbr => $month ) { // Recupere dans la db, le planning de la période ciblée + + $data_planningeachmonth_user[ count( $data_planningeachmonth_user ) ] = get_user_meta( $user_id, '_tm_planning_' . $month['year'] . '_' . $month['month'], true ); + } for( $p = 0; $p < $date_gap; $p++ ){ // BOUCLE FOR | Pour chaque jours (intervalle choisi) $strtotime_int = $p * 86400; $time_timestamp = $date_start_strtotime + $strtotime_int; - $time = date("D", $date_start_strtotime + $strtotime_int); + $time = date("l", $date_start_strtotime + $strtotime_int); + + $worktoday = false; + $default_value = 0; + + foreach( $data_planningeachmonth_user as $keyyear => $valueyear ){ + $day_found = false; + foreach ( $valueyear as $key => $value) { + if( $time_timestamp == strtotime( $value['date'] ) ){ + if( $value['default'] > 0 ){ // On verifie que la personne travaille ce jour la + $worktoday = true; + $default_value = $value['default']; + } + $day_found = true; + break; + } + } - if( $time == 'Sat' || $time == 'Sun' ){ + if( $day_found ){ + break; + } + } + + if( ! $worktoday ){ continue; }else{ - $datatime_length = count( $datatime ); - //$datatime[ $datatime_length ][ 'jour' ] = strftime( '%A %d/%m', $date_start_strtotime + $strtotime_int ); - // ----- + $datatime_length = count( $datatime ); $temp_day = strftime( '%d-%m-%Y', $date_start_strtotime + $strtotime_int ); @@ -185,7 +233,7 @@ public function get_data_chart( $datas, $date_end = '', $date_start = '', $time $datatime[ $datatime_length ][ 'jour' ] = $data['date']; $datatime[ $datatime_length ][ 'strtotime' ] = $date_start_strtotime + $strtotime_int; - $datatime[ $datatime_length ][ 'duree_journée' ] = 7 * 60;// Nombre de journée de travail * la durée d'une journée de travail + $datatime[ $datatime_length ][ 'duree_journée' ] = $default_value;// Nombre de journée de travail * la durée d'une journée de travail $datatime[ $datatime_length ][ 'duree_travail' ] = 0; foreach ($datas as $i => $data_user) { // BOUCLE FOR EACH | Pour chaque tache effectué par l'utilisateur @@ -225,7 +273,7 @@ public function get_data_chart( $datas, $date_end = '', $date_start = '', $time $date_return['datatime'] = $datatime; $date_return['date_gap'] = $date_gap; - $data_return['date_start'] = $date_start; + $date_return['date_start'] = $date_start; $date_return['date_end'] = $date_end; return $date_return; diff --git a/module/follower/action/follower.action.php b/module/follower/action/follower.action.php index d47da064..604b3536 100644 --- a/module/follower/action/follower.action.php +++ b/module/follower/action/follower.action.php @@ -34,6 +34,9 @@ public function __construct() { add_action( 'personal_options_update', array( $this, 'callback_user_profile_edit' ) ); add_action( 'edit_user_profile_update', array( $this, 'callback_user_profile_edit' ) ); + + add_action( 'wp_ajax_deleteplan', array( $this, 'callback_deleteplan' ) ); + } /** @@ -214,13 +217,48 @@ public function ajax_follower_unaffectation() { * * @param WP_User $user L'objet contenant la définition complète de l'utilisateur. */ - public function callback_edit_user_profile( $user ) { + public function callback_edit_user_profile( $user_id ) { $user = Follower_Class::g()->get( array( - 'id' => $user->ID, + 'id' => $user_id, ), true ); + $data_planning = array(); + $datebefore = ''; + + $data_planning_array = get_user_meta( $user->data[ 'id' ], '_tm_planning_users', true ); + if( ! empty( $data_planning_array ) ){ + + $data_planning = $data_planning_array[ 0 ]; + + foreach ($data_planning_array as $key => $value) { + if( $datebefore != '' ){ + $data_planning_array[ $key ][ 'lastdate' ] = $datebefore; + } + $datebefore = $value[ 'date_en' ]; + } + + //$data_planning_array[0] = array_reverse( $data_planning_array[0] ); // pour afficher du plus récent au plus ancien + } + \eoxia\View_Util::exec( 'task-manager', 'follower', 'backend/user-profile', array( - 'user' => $user, + 'user' => $user + ) ); + + + + $archive_user_array = Follower_Class::g()->get_User_Archive( $user['data']['id'] ); + + $current_time = current_time( 'd/m/Y' ); + $current_time_en = current_time( 'Y-m-d' ); + + \eoxia\View_Util::exec( 'task-manager', 'follower', 'backend/user-profile-planning', array( + 'data' => $data_planning['minutary_duration'], + 'last_update' => $data_planning['date'], + 'data_planning' => $data_planning_array, + 'time' => $current_time, + 'time_en' => $current_time_en, + 'id' => $user['data']['id'], + 'list_archive' => $archive_user_array ) ); } @@ -230,6 +268,11 @@ public function callback_edit_user_profile( $user ) { * @param integer $user_id L'identifiant de l'utilisateur pour qui il faut sauvegarder les informations. */ public function callback_user_profile_edit( $user_id ) { + + $user = Follower_Class::g()->get( array( + 'id' => $user_id, + ), true ); + check_admin_referer( 'update-user_' . $user_id ); if ( ! current_user_can( 'edit_user', $user_id ) ) { return false; @@ -241,9 +284,90 @@ public function callback_user_profile_edit( $user_id ) { $user['_tm_quick_point'] = isset( $_POST['_tm_quick_point'] ) && boolval( $_POST['_tm_quick_point'] ) ? true : false; $user['_tm_display_indicator'] = isset( $_POST['_tm_display_indicator'] ) && boolval( $_POST['_tm_display_indicator'] ) ? true : false; + $planning = array(); + $planning[ 'mon' ] = ! empty( $_POST['_tm_planning_monday'] ) ? (int) $_POST['_tm_planning_monday'] : 0; + $planning[ 'tue' ] = ! empty( $_POST['_tm_planning_tuesday'] ) ? (int) $_POST['_tm_planning_tuesday'] : 0; + $planning[ 'wed' ] = ! empty( $_POST['_tm_planning_wednesday'] ) ? (int) $_POST['_tm_planning_wednesday'] : 0; + $planning[ 'thu' ] = ! empty( $_POST['_tm_planning_thursday'] ) ? (int) $_POST['_tm_planning_thursday'] : 0; + $planning[ 'fri' ] = ! empty( $_POST['_tm_planning_friday'] ) ? (int) $_POST['_tm_planning_friday'] : 0; + $planning[ 'sat' ] = ! empty( $_POST['_tm_planning_saturday'] ) ? (int) $_POST['_tm_planning_saturday'] : 0; + $planning[ 'sun' ] = ! empty( $_POST['_tm_planning_sunday'] ) ? (int) $_POST['_tm_planning_sunday'] : 0; + + $date = ! empty( $_POST['_tm_planning_date'] ) ? $_POST['_tm_planning_date'] : current_time( 'Y-m-d' ); + + if( strtotime( $date ) > strtotime( "now" ) ){ + $date = current_time( 'Y-m-d' ); + } + + $planning_update = Follower_Class::g()->update_planning( $user, $planning, $date ); $user_update = Follower_Class::g()->update( $user ); } + public function callback_deleteplan(){ + check_ajax_referer( 'deleteplan' ); + + $posarray = ! empty( $_POST['posarray'] ) ? (int) $_POST['posarray'] : -1; + $id = ! empty( $_POST['id'] ) ? (int) $_POST['id'] : -1; + + if( $posarray == -1 || $id == -1 ){ + wp_send_json_error(); + return; + }else{ + $posarray -= 1; + } + + $data_planning_old = get_user_meta( $id, '_tm_planning_users', true ); + $data_planning = $data_planning_old; + + $planning_lignedelete = $data_planning[ $posarray ]; + + array_splice( $data_planning, $posarray, 1 ); + + $planning_lignedelete[ 'day_delete_en' ] = current_time( 'Y-m-d' ); + $planning_lignedelete[ 'day_delete' ] = current_time( 'd/m/Y' ); + + + update_user_meta( $id, '_tm_planning_users', $data_planning ); + + $planning_archive = []; + + if( get_user_meta( $id, '_tm_planning_archives' ) != null && get_user_meta( $id, '_tm_planning_archives' ) != '' ){ + $planning_archive = get_user_meta( $id, '_tm_planning_archives', true ); + } + + array_push( $planning_archive, $planning_lignedelete); + + update_user_meta( $id, '_tm_planning_archives', $planning_archive ); + + Follower_Class::g()->deleteAlldbPlanning( $id, $data_planning_old ); + Follower_Class::g()->createAlldbPlanning( $id, $data_planning ); + + $archive_user_array = Follower_Class::g()->get_User_Archive( $id ); + + ob_start(); + + $current_time = current_time( 'd/m/Y' ); + $current_time_en = current_time( 'Y-m-d' ); + + \eoxia\View_Util::exec( 'task-manager', 'follower', 'backend/user-profile-planning', array( + 'data' => $data_planning[0]['minutary_duration'], + 'last_update' => $data_planning[0]['date'], + 'data_planning' => $data_planning, + 'time' => $current_time, + 'time_en' => $current_time_en, + 'id' => $id, + 'list_archive' => $archive_user_array + ) ); + + $ob_get_clean = ob_get_clean(); + + wp_send_json_success( array( + 'namespace' => 'taskManager', + 'module' => 'follower', + 'callback_success' => 'reloadPlanningUser', + 'view' => $ob_get_clean + ) ); + } } new Follower_Action(); diff --git a/module/follower/asset/js/follower.backend.js b/module/follower/asset/js/follower.backend.js index 61719f42..8b0e5895 100644 --- a/module/follower/asset/js/follower.backend.js +++ b/module/follower/asset/js/follower.backend.js @@ -10,7 +10,9 @@ window.eoxiaJS.taskManager.follower.init = function() { window.eoxiaJS.taskManager.follower.event(); }; -window.eoxiaJS.taskManager.follower.event = function() { }; +window.eoxiaJS.taskManager.follower.event = function() { + jQuery( document ).on( 'click', '.showfullplanning', window.eoxiaJS.taskManager.follower.showfullplanning ); + }; /** * Le callback en cas de réussite à la requête Ajax "load_followers". @@ -105,3 +107,11 @@ window.eoxiaJS.taskManager.follower.unaffectedFollowerSuccess = function( elemen element.attr( 'data-before-method', 'beforeAffectFollower' ); element.attr( 'data-nonce', response.data.nonce ); }; + +window.eoxiaJS.taskManager.follower.showfullplanning = function( event ){ + $( '.showfullplanning' ).css( 'display', 'none' ); +} + +window.eoxiaJS.taskManager.follower.reloadPlanningUser = function( element, response ){ + $( '.planninguser' ).replaceWith( response.data.view ); +} diff --git a/module/follower/class/follower.class.php b/module/follower/class/follower.class.php index 0a3a33dd..0d742924 100644 --- a/module/follower/class/follower.class.php +++ b/module/follower/class/follower.class.php @@ -32,16 +32,16 @@ class Follower_Class extends \eoxia\User_Class { * @var string */ protected $base = 'follower'; - + public function init_default_data() { $users = get_users( array( 'roles' => 'administrator', ) ); - + if ( ! empty( $users ) ) { foreach ( $users as $user ) { $shortcuts = get_user_meta( $user->ID, '_tm_shortcuts', true ); - + if ( empty( $shortcuts ) ) { $shortcuts = array( 'wpeomtm-dashboard' => array( @@ -52,12 +52,317 @@ public function init_default_data() { ), ), ); - + update_user_meta( $user->ID, '_tm_shortcuts', $shortcuts ); } } } } + +/** + * [update_planning description] + * @param [type] $user [description] + * @param [type] $planning [description] + * @return [type] [description] + */ + public function update_planning( $user, $planning, $date_en ){ + + $date = date( 'd/m/Y', strtotime( $date_en ) ); + + foreach ($planning as $key => $value) { // On verifie que les journées soient OK + if( $planning[$key] < 0 || $planning[$key] > 1440){ // Journée => 0-1440 minutes + $planning[ $key ] = 0; + } + } + + $minuraty_duration = array( + 'Monday' => $planning[ 'mon' ], + 'Tuesday' => $planning[ 'tue' ] , + 'Wednesday' => $planning[ 'wed' ], + 'Thursday' => $planning[ 'thu' ], + 'Friday' => $planning[ 'fri' ], + 'Saturday' => $planning[ 'sat' ], + 'Sunday' => $planning[ 'sun' ] + ); + + $data_plan = get_user_meta( $user['id'], '_tm_planning_users', true ); + + if( empty( $data_plan[0] ) ){ + $this->callback_update_db_planning( $user['id'], 0, strtotime( $date_en ), 0, $minuraty_duration); + + $data_plan = array( + array( + 'date' => $date, + 'date_en' => $date_en, + 'minutary_duration' => $minuraty_duration + ) + ); + + $data_withnewdate = $data_plan; + + }else{ + $temp = count( $data_plan ); + if( $data_plan[ $temp - 1 ]['minutary_duration'] === $minuraty_duration ){ // on verifie si le changement actuel est différent du dernier + return; + } + + $data_plan = $this->array_sort( $data_plan, 'date_en', SORT_DESC ); // Objet trié par 'date' + + $date_update = 0; + $data_withnewdate = []; + $date_pluspetite = false; + + $date_debut_str = 0; // Date de début -> Choisis par l'utilisateur + $date_duree_str = 0; // Date durée -> Date butoir - date de début = le nombre de jour à ajouté dans la db + + $lastdate = ''; + + foreach ($data_plan as $key => $value) { + + if( strtotime( $value['date_en'] ) < strtotime( $date_en ) ){ + + if( $lastdate == '' ){ // Creation sur 5 ans + $date_duree_str = 0; + }else{ // date butoir trouvé + $date_duree_str = strtotime( $lastdate ) - strtotime( $date_en ); + } + + $date_pluspetite = true; + $date_update = $key; + + break; + } + + + $date_duree_str = strtotime( $value[ 'date_en' ] ) - strtotime( $date_en ); + $lastdate = $value[ 'date_en' ]; + } + + $date_debut_str = strtotime( $date_en ); + + if( ! $date_pluspetite ){ + + foreach ($data_plan as $key => $value) { + array_push( $data_withnewdate, $value ); + } + + $temp_length = count( $data_withnewdate ); + $data_withnewdate[ $temp_length ][ 'date' ] = $date; + $data_withnewdate[ $temp_length ][ 'date_en' ] = $date_en; + $data_withnewdate[ $temp_length ][ 'minutary_duration' ] = $minuraty_duration; + + }else{ + + foreach ($data_plan as $key => $value) { + if( $key == $date_update ){ + $temp_length = count( $data_withnewdate ); + $data_withnewdate[ $temp_length ][ 'date' ] = $date; + $data_withnewdate[ $temp_length ][ 'date_en' ] = $date_en; + $data_withnewdate[ $temp_length ][ 'minutary_duration' ] = $minuraty_duration; + } + array_push( $data_withnewdate, $value ); + } + } + + + + $this->callback_update_db_planning( $user['id'], $data_withnewdate[ $date_update ][ 'minutary_duration' ], $date_debut_str, $date_duree_str, $minuraty_duration ); + } + + + update_user_meta( $user['id'], '_tm_planning_users', $data_withnewdate ); + } + + +/** + * Order by des tableaux de deux dimensions + * @param [type] $array [L'objet] + * @param [type] $on [L'element qui doit etre trié] + * @param [type] $order [SORT_ASC ou SORT_DESC] + * @return [type] [Tableau trié] + */ + function array_sort( $array, $on, $order=SORT_ASC ) + { + $new_array = array(); + $sortable_array = array(); + + if (count($array) > 0) { + foreach ($array as $k => $v) { + if (is_array($v)) { + foreach ($v as $k2 => $v2) { + if ($k2 == $on) { + $sortable_array[$k] = $v2; + } + } + } else { + $sortable_array[$k] = $v; + } + } + + switch ($order) { + case SORT_ASC: + asort($sortable_array); + break; + case SORT_DESC: + arsort($sortable_array); + break; + } + + + $i = 0; + foreach ($sortable_array as $k => $v) { + $new_array[$i] = $array[$k]; + $i ++; + } + } + + return $new_array; +} + + function getDatesFromRange($start, $end, $format='Y-m-d') { + return array_map(function($timestamp) use($format) { + return date($format, $timestamp); + }, + range(strtotime($start) + ($start < $end ? 4000 : 8000), strtotime($end) + ($start < $end ? 8000 : 4000), 86400)); +} + + function getAllDayBetweenTwoDates( $debut, $duree, $planning = '' ){ + + $every_day_between_les_deux_dates = $this->getDatesFromRange( date( 'Y-m-d', $debut ), date( 'Y-m-d', $debut + $duree ) ); + + $full_data = []; + + foreach( $every_day_between_les_deux_dates as $key => $value ){ + + $length = 0; + if( $full_data[ date( 'Y', strtotime( $value ) ) ][ date( 'm', strtotime( $value ) ) ] != null ){ + $length = count( $full_data[ date( 'Y', strtotime( $value ) ) ][ date( 'm', strtotime( $value ) ) ] ); + } + + $full_data[ date( 'Y', strtotime( $value ) ) ][ date( 'm', strtotime( $value ) ) ][ $length + 1 ] = array( + 'date' => $value, + 'jour' => date( 'D', strtotime( $value ) ), + 'default' => $planning[ date( 'l', strtotime( $value ) ) ], // Valeur définis historique -> Jour / défaut + 'absent' => 0, // 0 || définis par l'utilisateur -> Absence + 'holiday' => 0, // 0 || définis par l'utilisateur -> Vacance (Congés) + 'seek' => 0, // 0 || définis par l'utilisateur -> Malade + 'free' => 0, // 0 || définis par l'admin -> Fériés + 'ticket' => 0,// 0 || définis par l'utilisateur -> Tickets + ); + } + + return $full_data; + } + + + public function callback_update_db_planning( $id, $data, $debut, $duree, $planning ){ // Id utilisateur | date nouveau planning + + + if( $duree == 0){ // Si la personne créait un nouvel emploi du temps => 5 ans + $duree = 31556925 * 5; // Année tropique * 5 Y + } + + $all_day_object = $this->getAllDayBetweenTwoDates( $debut, $duree, $planning ); + + $premier_mois = false; + + foreach( $all_day_object as $keyyear => $year ){ + $dernier_mois['annee'] = $keyyear; + foreach ($year as $keymonth => $months ) { + $dernier_mois['mois'] = $keymonth; + } + } + + + foreach( $all_day_object as $keyy => $years ){ + foreach ($years as $keym => $month ) { + $db_planning_name_column = "_tm_planning_" . $keyy . "_" . $keym; + + if( !$premier_mois && get_user_meta( $id, $db_planning_name_column, true ) != null){ // Si le premier mois est existant, on ne l'écrase pas entièrement, on récupere le début de mois + + $premier_mois = true; // Seulement pour le premier mois + $content_month_user_meta = get_user_meta( $id, $db_planning_name_column, true ); + $plan_month = $content_month_user_meta; + + foreach( $month as $key => $value ){ // On parcours le nouveau planning + foreach( $content_month_user_meta as $keydb => $valuedb ) { // On parcours l'ancien planning + if( $value['date'] == $valuedb['date'] ){ // Si on retrouve une date commune -> le nouvel emploi du temps l'ecrase + $plan_month[ $keydb ] = $value; + break; + } + } + } + update_user_meta( $id, $db_planning_name_column, $plan_month ); + }else if( $keyy == $dernier_mois['annee'] && $keym == $dernier_mois['mois'] && get_user_meta( $id, $db_planning_name_column, true ) != null ){ // Dernier mois + $content_month_user_meta = get_user_meta( $id, $db_planning_name_column, true ); + $plan_month = $content_month_user_meta; + + foreach( $month as $key => $value ){ // On parcours le nouveau planning + foreach( $content_month_user_meta as $keydb => $valuedb ) { // On parcours l'ancien planning + if( $value['date'] == $valuedb['date'] ){ // Si on retrouve une date commune -> le nouvel emploi du temps l'ecrase + $plan_month[ $keydb ] = $value; + break; + } + } + } + + update_user_meta( $id, $db_planning_name_column, $plan_month ); + }else{ + update_user_meta( $id, $db_planning_name_column, $month ); + } + } + } + } + + public function deleteAlldbPlanning( $id, $planning ){ + + $date_fin_str = strtotime( $planning[ 0 ][ 'date_en' ] ); + $date_debut_str = strtotime( $planning[ count( $planning ) - 1 ][ 'date_en' ] ); + $duree_str = $date_fin_str - $date_debut_str + 31556925 * 5; + + $all_day_object = $this->getAllDayBetweenTwoDates( $date_debut_str, $duree_str ); + + foreach( $all_day_object as $keyy => $years ){ + foreach ($years as $keym => $month ) { + $db_planning_name_column = "_tm_planning_" . $keyy . "_" . $keym; + if( get_user_meta( $id, $db_planning_name_column, true ) != null ){ + delete_usermeta( $id, $db_planning_name_column ); + } + } + } + } + + public function createAlldbPlanning( $id, $planning ){ + + if( empty( $planning ) ){ // si il reste une seule ligne sur le planning -> planning vide -> rien à créer + return; + } + + foreach( $planning as $key => $ligne ){ + $date_debut_str = strtotime( $ligne['date_en'] ); + $minutary_duration = $ligne[ 'minutary_duration' ]; + + if( $key == 0 ){ + $duree_str = 31556925 * 5; + + }else{ + $duree_str = $last_date_str - $date_debut_str; + } + + + $last_date_str = $date_debut_str; + + $this->callback_update_db_planning( $id, 0, $date_debut_str, $duree_str, $minutary_duration ); + } + } + + public function get_User_Archive( $id ){ + if( get_user_meta( $id, '_tm_planning_archives' ) != null && get_user_meta( $id, '_tm_planning_archives' ) != ''){ + return get_user_meta( $id, '_tm_planning_archives', true ); + }else{ + return ''; + } + } } Follower_Class::g(); diff --git a/module/follower/model/follower.model.php b/module/follower/model/follower.model.php index 7b25df62..a5f8e32c 100644 --- a/module/follower/model/follower.model.php +++ b/module/follower/model/follower.model.php @@ -36,27 +36,28 @@ public function __construct( $object, $req_method = null ) { 'field' => '_tm_auto_elapsed_time', 'default' => false, ); - + $this->schema['_tm_advanced_display'] = array( 'type' => 'boolean', 'meta_type' => 'single', 'field' => '_tm_advanced_display', 'default' => false, ); - + $this->schema['_tm_quick_point'] = array( 'type' => 'boolean', 'meta_type' => 'single', 'field' => '_tm_quick_point', 'default' => false, ); - + $this->schema['_tm_display_indicator'] = array( 'type' => 'boolean', 'meta_type' => 'single', 'field' => '_tm_display_indicator', 'default' => false, ); + parent::__construct( $object, $req_method ); } diff --git a/module/follower/view/backend/user-profile-planning.view.php b/module/follower/view/backend/user-profile-planning.view.php new file mode 100644 index 00000000..a1ea43c9 --- /dev/null +++ b/module/follower/view/backend/user-profile-planning.view.php @@ -0,0 +1,274 @@ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $value) :?> + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + +
+ + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+
+
diff --git a/module/indicator/asset/js/indicator.backend.js b/module/indicator/asset/js/indicator.backend.js index 68e215ae..e1c2810e 100644 --- a/module/indicator/asset/js/indicator.backend.js +++ b/module/indicator/asset/js/indicator.backend.js @@ -30,12 +30,10 @@ window.eoxiaJS.taskManager.indicator.toggleMetabox = function( event ) { /** * Le callback en cas de réussite à la requête Ajax "load_customer_activity". * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} + * Affiche les canvas * - * @since 1.5.0 - * @version 1.5.0 + * @author Corentin Eoxia + * @since 1.8.0 */ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggeredElement, response ) { jQuery( '#tm-indicator-activity .inside' ).html( response.data.view ); @@ -128,10 +126,16 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere $( '#information_canvas' ).css('display', 'none'); }else{ - if( response.data.error == 'date_error' ){ + if( response.data.error == 'date_error' ){ // Date invalid + $( '#information_canvas' ).html( window.indicatorString.date_error ); - }else if( response.data.error == 'person_error' ){ + + }else if( response.data.error == 'person_error' ){ // User don't choose person + $( '#information_canvas' ).html( window.indicatorString.person_error ); + + }else{ // No data found + } $( '#information_canvas' ).css('display', 'block'); diff --git a/module/indicator/view/backend-indicator/indicator-metabox-main.view.php b/module/indicator/view/backend-indicator/indicator-metabox-main.view.php index e66e4082..881b1e77 100644 --- a/module/indicator/view/backend-indicator/indicator-metabox-main.view.php +++ b/module/indicator/view/backend-indicator/indicator-metabox-main.view.php @@ -91,4 +91,4 @@ - + diff --git a/module/navigation/action/navigation.action.php b/module/navigation/action/navigation.action.php index cb75beac..5cdeead0 100644 --- a/module/navigation/action/navigation.action.php +++ b/module/navigation/action/navigation.action.php @@ -65,7 +65,7 @@ public function callback_search() { $search_result_view = ob_get_clean(); ob_start(); - do_shortcode( '[task id="' . $task_id . '" post_parent="' . $post_parent . '" point_id="' . $point_id . '" users_id="' . $user_id . '" categories_id="' . $categories_id . '" term="' . $term . '" posts_per_page="' . \eoxia\Config_Util::$init['task-manager']->task->posts_per_page . '" with_wrapper="0"]' ); + echo do_shortcode( '[task id="' . $task_id . '" post_parent="' . $post_parent . '" point_id="' . $point_id . '" users_id="' . $user_id . '" categories_id="' . $categories_id . '" term="' . $term . '" posts_per_page="' . \eoxia\Config_Util::$init['task-manager']->task->posts_per_page . '" with_wrapper="0"]' ); $tasks_view = ob_get_clean(); wp_send_json_success( array( diff --git a/module/task/class/task.class.php b/module/task/class/task.class.php index aa88bf01..f7dfacc4 100644 --- a/module/task/class/task.class.php +++ b/module/task/class/task.class.php @@ -168,7 +168,7 @@ public function get_tasks( $param ) { AND TASK.post_status IN (" . $param['status'] . ") "; - if ( isset( $param['post_parent'] ) && ! is_null( $param['post_parent'] ) ) { + if ( ! is_null( $param['post_parent'] ) ) { $query .= 'AND TASK.post_parent IN (' . implode( $param['post_parent'], ',' ) . ')'; } diff --git a/module/task/shortcode/class-task-shortcode.php b/module/task/shortcode/class-task-shortcode.php index 0faf6109..6fa726c1 100644 --- a/module/task/shortcode/class-task-shortcode.php +++ b/module/task/shortcode/class-task-shortcode.php @@ -78,6 +78,7 @@ public function callback_task( $param ) { $tasks = Task_Class::g()->get_tasks( $param ); + ob_start(); if ( ! is_admin() ) { \eoxia\View_Util::exec( 'task-manager', 'task', 'frontend/main', array( 'tasks' => $tasks, @@ -89,6 +90,8 @@ public function callback_task( $param ) { 'with_wrapper' => $with_wrapper, ) ); } + + return ob_get_clean(); } } diff --git a/package-lock.json b/package-lock.json index 5f79b9bd..8f47baa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -476,7 +476,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -3220,7 +3220,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -3233,7 +3233,7 @@ }, "supports-color": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "resolved": "http://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true } @@ -4278,9 +4278,9 @@ } }, "sshpk": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz", - "integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.0.tgz", + "integrity": "sha512-Zhev35/y7hRMcID/upReIvRse+I9SVhyVre/KTJSJQWMz3C3+G+HpO7m1wK/yckEtujKZ7dS4hkVxAnmHaIGVQ==", "dev": true, "requires": { "asn1": "~0.2.3", diff --git a/task-manager.config.json b/task-manager.config.json index 06554883..1c4d83bc 100644 --- a/task-manager.config.json +++ b/task-manager.config.json @@ -12,7 +12,8 @@ "task-manager-update", "wpshop_customers", "wpshop_shop_orders", - "tache_page_indicator-page" + "tache_page_indicator-page", + "profile" ], "externals": [], "modules": [ diff --git a/task-manager.php b/task-manager.php index 0141f6d6..f87cb82c 100644 --- a/task-manager.php +++ b/task-manager.php @@ -2,7 +2,7 @@ /** * Plugin Name: Task Manager * Description: Quick and easy to use, manage all your tasks and your time with the Task Manager plugin. - * Version: 1.8.0-beta + * Version: 1.9.0-beta * Author: Eoxia * Author URI: http://www.eoxia.com/ * License: GPL2 or later @@ -24,4 +24,4 @@ require_once 'core/external/eo-framework/eo-framework.php'; -\eoxia\Init_Util::g()->exec( PLUGIN_TASK_MANAGER_PATH, basename( __FILE__, '.php' ) ); +\eoxia\Init_Util::g()->exec( PLUGIN_TASK_MANAGER_PATH, basename( __FILE__, '.php' ) ); From 6c457039f38c9d3b686260f8f812d85848033229 Mon Sep 17 00:00:00 2001 From: Corentin Date: Fri, 4 Jan 2019 16:40:09 +0100 Subject: [PATCH 02/35] Incrementes version --- module/indicator/action/indicator.action.php | 2 +- readme.txt | 10 +++++++++- task-manager.config.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/module/indicator/action/indicator.action.php b/module/indicator/action/indicator.action.php index 120bc5cf..11801dba 100644 --- a/module/indicator/action/indicator.action.php +++ b/module/indicator/action/indicator.action.php @@ -53,7 +53,7 @@ public function __construct() { */ public function callback_admin_menu() { - add_submenu_page( 'wpeomtm-dashboard', __( 'Categories', 'task-manager' ), __( 'Indicator', 'task-manager' ), 'manage_task_manager', 'indicator-page', array( Indicator_Class::g(), 'callable_indicator_page' ) ); + add_submenu_page( 'wpeomtm-dashboard', __( 'Indicator', 'task-manager' ), __( 'Indicator', 'task-manager' ), 'manage_task_manager', 'indicator-page', array( Indicator_Class::g(), 'callable_indicator_page' ) ); add_meta_box( 'tm-indicator-activity', __( 'Daily activity', 'task-manager' ), array( Indicator_Class::g(), 'callback_my_daily_activity' ), 'wpeomtm-dashboard', 'normal' ); add_meta_box( 'indicator-page-id', __( 'Indicator', 'task-manager' ), array( Indicator_Class::g(), 'callback_load_indicator_page' ), 'indicator-page', 'normal' ); diff --git a/readme.txt b/readme.txt index 803f3e38..ad9be440 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: Tags: task, tasks, management, manager, collaboration, dashboard, organizer, project management, project manager, projects, task lists, task management, task manager, Time Tracking, to do, to do list, todo, todo list Requires at least: 4.4.0 Tested up to: 4.9.6 -Stable tag: 1.7.0 +Stable tag: 1.8.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -63,6 +63,14 @@ No questions asked yet. == Changelog == += 1.8.0 = + += Improvment = + +* 23284 - Update search functionnality +* 23825 - Add options to user (on profile page) to show/hide some widgets on dashboard: Activity, Sticky Note and customer activity with WPShop. +* 23555 - Task Manager interface get new design. + = 1.7.0 = = Fix = diff --git a/task-manager.config.json b/task-manager.config.json index 1c4d83bc..dd3f25fe 100644 --- a/task-manager.config.json +++ b/task-manager.config.json @@ -1,7 +1,7 @@ { "name": "Task Manager", "slug": "task-manager", - "version": "1.8.0-test-eoxia-4a", + "version": "1.9.0", "description": "L'application Task Manager", "insert_scripts_pages": [ "wpeomtm-dashboard", From ae75b69f510edef1a0e4d0bcf6604fa48a82f7e7 Mon Sep 17 00:00:00 2001 From: Corentin Date: Wed, 9 Jan 2019 15:55:31 +0100 Subject: [PATCH 03/35] Remplaces $ par jQuery --- core/assets/js/backend.min.js | 240 +++++++++--------- module/follower/asset/js/follower.backend.js | 4 +- .../indicator/asset/js/indicator.backend.js | 28 +- package-lock.json | 8 +- task-manager.config.json | 2 +- 5 files changed, 139 insertions(+), 143 deletions(-) diff --git a/core/assets/js/backend.min.js b/core/assets/js/backend.min.js index d8879f1b..5816b2ca 100644 --- a/core/assets/js/backend.min.js +++ b/core/assets/js/backend.min.js @@ -1010,11 +1010,11 @@ window.eoxiaJS.taskManager.follower.unaffectedFollowerSuccess = function( elemen }; window.eoxiaJS.taskManager.follower.showfullplanning = function( event ){ - $( '.showfullplanning' ).css( 'display', 'none' ); + jQuery( '.showfullplanning' ).css( 'display', 'none' ); } window.eoxiaJS.taskManager.follower.reloadPlanningUser = function( element, response ){ - $( '.planninguser' ).replaceWith( response.data.view ); + jQuery( '.planninguser' ).replaceWith( response.data.view ); } /** @@ -1182,16 +1182,16 @@ window.eoxiaJS.taskManager.indicator.toggleMetabox = function( event ) { */ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggeredElement, response ) { jQuery( '#tm-indicator-activity .inside' ).html( response.data.view ); - $( '#displaycanvas' ).html( '' ); + jQuery( '#displaycanvas' ).html( '' ); var data = response.data.object; if( data.length != 0 ){ - $("#horizontalChart").css('display','block'); - $("#doghnutChart").css('display','block'); + jQuery("#horizontalChart").css('display','block'); + jQuery("#doghnutChart").css('display','block'); for ( var i = 0; i < data.length ; i++ ){ - $( "#displaycanvas" ).append( '
' ); + jQuery( "#displaycanvas" ).append( '
' ); var canvasHorizontal = document.getElementById( "canvasHorizontalBar" + i ).getContext('2d'); new Chart(canvasHorizontal, { @@ -1268,22 +1268,22 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere } } - $( '#information_canvas' ).css('display', 'none'); + jQuery( '#information_canvas' ).css('display', 'none'); }else{ if( response.data.error == 'date_error' ){ // Date invalid - $( '#information_canvas' ).html( window.indicatorString.date_error ); + jQuery( '#information_canvas' ).html( window.indicatorString.date_error ); }else if( response.data.error == 'person_error' ){ // User don't choose person - $( '#information_canvas' ).html( window.indicatorString.person_error ); + jQuery( '#information_canvas' ).html( window.indicatorString.person_error ); }else{ // No data found } - $( '#information_canvas' ).css('display', 'block'); + jQuery( '#information_canvas' ).css('display', 'block'); } }; @@ -1292,7 +1292,7 @@ window.eoxiaJS.taskManager.indicator.event = function( event ) { }; window.eoxiaJS.taskManager.indicator.addFollower = function( event) { - var addFollower = $( this ).attr( "data-user-id" ); + var addFollower = jQuery( this ).attr( "data-user-id" ); var value_input = document.getElementById( "tm_indicator_list_followers" ).value; var list_follower = value_input.toString() ? value_input.toString() : ''; @@ -1303,18 +1303,18 @@ window.eoxiaJS.taskManager.indicator.addFollower = function( event) { var arrayFollowers = list_follower.split( ',' ); } - if( $( this ).attr( "data-user-choose" ) === 'false' ){ // On ajoute une personne - $( this ).attr( "data-user-choose", "true" ); + if( jQuery( this ).attr( "data-user-choose" ) === 'false' ){ // On ajoute une personne + jQuery( this ).attr( "data-user-choose", "true" ); arrayFollowers.push( addFollower ); - $( this ).animate({ + jQuery( this ).animate({ top: "+=10", }, 0, "linear", function() { }); }else{ // on retire la personne - $( this ).attr( "data-user-choose", "false" ); + jQuery( this ).attr( "data-user-choose", "false" ); for( var i = 0; i < arrayFollowers.length ; i++ ){ if( addFollower == arrayFollowers[i] ){ @@ -1322,7 +1322,7 @@ window.eoxiaJS.taskManager.indicator.addFollower = function( event) { } } - $( this ).animate({ + jQuery( this ).animate({ top: "-=10", }, 0, "linear", function() { @@ -1475,110 +1475,6 @@ window.eoxiaJS.taskManager.navigation.deletedShortcutSuccess = function( trigger triggeredElement.closest( 'tr' ).fadeOut(); jQuery( '.tm-dashboard-shortcuts li[data-key="' + response.data.key + '"]' ).fadeOut(); }; -/** - * Initialise l'objet "notify" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. - * - * @since 1.5.0 - * @version 1.6.1 - */ -window.eoxiaJS.taskManager.notify = {}; - -/** - * Méthode 'init' obligatoire. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManager.notify.init = function() { - window.eoxiaJS.taskManager.notify.event(); -}; - -/** - * Méthode 'event'. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManager.notify.event = function() { - jQuery( document ).on( 'click', '.popup-notification ul li', window.eoxiaJS.taskManager.notify.selectUser ); -}; - -/** - * Méthode qui permet d'ajouter/supprimer l'utilisateur ID dans champs caché users_id. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManager.notify.selectUser = function() { - var index = 0; - var container = jQuery( this ).closest( 'ul' ); - var input = container.find( 'input' ); - var currentVal = input.val(); - - if ( currentVal ) { - currentVal = currentVal.split( ',' ); - } else { - currentVal = []; - } - - for ( var i = 0; i < currentVal.length; i++ ) { - currentVal[i] = parseInt( currentVal[i] ); - } - - jQuery( this ).toggleClass( 'active' ); - - if ( jQuery( this ).hasClass( 'active' ) ) { - currentVal.push( parseInt( jQuery( this ).data( 'id' ) ) ); - } else { - index = currentVal.indexOf( jQuery( this ).data( 'id' ) ); - - if ( -1 != index ) { - currentVal.splice( index, 1 ); - } - } - - jQuery( this ).closest( 'div' ).find( '.selected-number' ).text( currentVal.length ); - - input.val( currentVal.join( ',' ) ); -}; - -/** - * Le callback en cas de réussite à la requête Ajax "load_notify_popup". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.5.0 - * @version 1.5.0 - */ -window.eoxiaJS.taskManager.notify.loadedNotifyPopup = function( triggeredElement, response ) { - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .content' ).html( response.data.view ); - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .container' ).removeClass( 'loading' ); -}; - -/** - * Le callback en cas de réussite à la requête Ajax "send_notification". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.5.0 - * @version 1.6.1 - */ -window.eoxiaJS.taskManager.notify.sendedNotification = function( triggeredElement, response ) { - triggeredElement.closest( '.wpeo-modal' ).find( '.modal-close' ).click(); - - -}; - /** * Initialise l'objet "user" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. * @@ -2047,6 +1943,110 @@ window.eoxiaJS.taskManager.point.undisplayPoint = function( event ) { // jQuery( this ).closest( '.wpeo-project-task-container' ).find( '.points .point.edit[data-point-state="' + pointState + '"]' ).remove(); }; +/** + * Initialise l'objet "notify" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. + * + * @since 1.5.0 + * @version 1.6.1 + */ +window.eoxiaJS.taskManager.notify = {}; + +/** + * Méthode 'init' obligatoire. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManager.notify.init = function() { + window.eoxiaJS.taskManager.notify.event(); +}; + +/** + * Méthode 'event'. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManager.notify.event = function() { + jQuery( document ).on( 'click', '.popup-notification ul li', window.eoxiaJS.taskManager.notify.selectUser ); +}; + +/** + * Méthode qui permet d'ajouter/supprimer l'utilisateur ID dans champs caché users_id. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManager.notify.selectUser = function() { + var index = 0; + var container = jQuery( this ).closest( 'ul' ); + var input = container.find( 'input' ); + var currentVal = input.val(); + + if ( currentVal ) { + currentVal = currentVal.split( ',' ); + } else { + currentVal = []; + } + + for ( var i = 0; i < currentVal.length; i++ ) { + currentVal[i] = parseInt( currentVal[i] ); + } + + jQuery( this ).toggleClass( 'active' ); + + if ( jQuery( this ).hasClass( 'active' ) ) { + currentVal.push( parseInt( jQuery( this ).data( 'id' ) ) ); + } else { + index = currentVal.indexOf( jQuery( this ).data( 'id' ) ); + + if ( -1 != index ) { + currentVal.splice( index, 1 ); + } + } + + jQuery( this ).closest( 'div' ).find( '.selected-number' ).text( currentVal.length ); + + input.val( currentVal.join( ',' ) ); +}; + +/** + * Le callback en cas de réussite à la requête Ajax "load_notify_popup". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.5.0 + * @version 1.5.0 + */ +window.eoxiaJS.taskManager.notify.loadedNotifyPopup = function( triggeredElement, response ) { + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .content' ).html( response.data.view ); + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .container' ).removeClass( 'loading' ); +}; + +/** + * Le callback en cas de réussite à la requête Ajax "send_notification". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.5.0 + * @version 1.6.1 + */ +window.eoxiaJS.taskManager.notify.sendedNotification = function( triggeredElement, response ) { + triggeredElement.closest( '.wpeo-modal' ).find( '.modal-close' ).click(); + + +}; + /** * Initialise l'objet "quickPoint" (point rapide) ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. * diff --git a/module/follower/asset/js/follower.backend.js b/module/follower/asset/js/follower.backend.js index 8b0e5895..127b8d13 100644 --- a/module/follower/asset/js/follower.backend.js +++ b/module/follower/asset/js/follower.backend.js @@ -109,9 +109,9 @@ window.eoxiaJS.taskManager.follower.unaffectedFollowerSuccess = function( elemen }; window.eoxiaJS.taskManager.follower.showfullplanning = function( event ){ - $( '.showfullplanning' ).css( 'display', 'none' ); + jQuery( '.showfullplanning' ).css( 'display', 'none' ); } window.eoxiaJS.taskManager.follower.reloadPlanningUser = function( element, response ){ - $( '.planninguser' ).replaceWith( response.data.view ); + jQuery( '.planninguser' ).replaceWith( response.data.view ); } diff --git a/module/indicator/asset/js/indicator.backend.js b/module/indicator/asset/js/indicator.backend.js index e1c2810e..5e973710 100644 --- a/module/indicator/asset/js/indicator.backend.js +++ b/module/indicator/asset/js/indicator.backend.js @@ -37,16 +37,16 @@ window.eoxiaJS.taskManager.indicator.toggleMetabox = function( event ) { */ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggeredElement, response ) { jQuery( '#tm-indicator-activity .inside' ).html( response.data.view ); - $( '#displaycanvas' ).html( '' ); + jQuery( '#displaycanvas' ).html( '' ); var data = response.data.object; if( data.length != 0 ){ - $("#horizontalChart").css('display','block'); - $("#doghnutChart").css('display','block'); + jQuery("#horizontalChart").css('display','block'); + jQuery("#doghnutChart").css('display','block'); for ( var i = 0; i < data.length ; i++ ){ - $( "#displaycanvas" ).append( '
' ); + jQuery( "#displaycanvas" ).append( '
' ); var canvasHorizontal = document.getElementById( "canvasHorizontalBar" + i ).getContext('2d'); new Chart(canvasHorizontal, { @@ -123,22 +123,22 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere } } - $( '#information_canvas' ).css('display', 'none'); + jQuery( '#information_canvas' ).css('display', 'none'); }else{ if( response.data.error == 'date_error' ){ // Date invalid - $( '#information_canvas' ).html( window.indicatorString.date_error ); + jQuery( '#information_canvas' ).html( window.indicatorString.date_error ); }else if( response.data.error == 'person_error' ){ // User don't choose person - $( '#information_canvas' ).html( window.indicatorString.person_error ); + jQuery( '#information_canvas' ).html( window.indicatorString.person_error ); }else{ // No data found } - $( '#information_canvas' ).css('display', 'block'); + jQuery( '#information_canvas' ).css('display', 'block'); } }; @@ -147,7 +147,7 @@ window.eoxiaJS.taskManager.indicator.event = function( event ) { }; window.eoxiaJS.taskManager.indicator.addFollower = function( event) { - var addFollower = $( this ).attr( "data-user-id" ); + var addFollower = jQuery( this ).attr( "data-user-id" ); var value_input = document.getElementById( "tm_indicator_list_followers" ).value; var list_follower = value_input.toString() ? value_input.toString() : ''; @@ -158,18 +158,18 @@ window.eoxiaJS.taskManager.indicator.addFollower = function( event) { var arrayFollowers = list_follower.split( ',' ); } - if( $( this ).attr( "data-user-choose" ) === 'false' ){ // On ajoute une personne - $( this ).attr( "data-user-choose", "true" ); + if( jQuery( this ).attr( "data-user-choose" ) === 'false' ){ // On ajoute une personne + jQuery( this ).attr( "data-user-choose", "true" ); arrayFollowers.push( addFollower ); - $( this ).animate({ + jQuery( this ).animate({ top: "+=10", }, 0, "linear", function() { }); }else{ // on retire la personne - $( this ).attr( "data-user-choose", "false" ); + jQuery( this ).attr( "data-user-choose", "false" ); for( var i = 0; i < arrayFollowers.length ; i++ ){ if( addFollower == arrayFollowers[i] ){ @@ -177,7 +177,7 @@ window.eoxiaJS.taskManager.indicator.addFollower = function( event) { } } - $( this ).animate({ + jQuery( this ).animate({ top: "-=10", }, 0, "linear", function() { diff --git a/package-lock.json b/package-lock.json index 8f47baa3..452b98e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1418,14 +1418,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1445,8 +1443,7 @@ "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", @@ -1594,7 +1591,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } diff --git a/task-manager.config.json b/task-manager.config.json index dd3f25fe..614cde62 100644 --- a/task-manager.config.json +++ b/task-manager.config.json @@ -1,7 +1,7 @@ { "name": "Task Manager", "slug": "task-manager", - "version": "1.9.0", + "version": "1.9.0-2", "description": "L'application Task Manager", "insert_scripts_pages": [ "wpeomtm-dashboard", From b2c831c8a50ebf895828b2405de9b148546d43c1 Mon Sep 17 00:00:00 2001 From: Jimmy L Date: Wed, 9 Jan 2019 15:58:12 +0100 Subject: [PATCH 04/35] Add PHPCS --- .travis.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..9068add4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,38 @@ +sudo: false +dist: trusty + +language: php + +notifications: + email: + on_success: never + on_failure: change + +cache: + directories: + - $HOME/.composer/cache + +matrix: + include: + - php: 5.6 + env: WP_TRAVISCI=phpcs + +before_script: + - export PATH="$HOME/.composer/vendor/bin:$PATH" + - | + if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then + phpenv config-rm xdebug.ini + else + echo "xdebug.ini does not exist" + fi + - | + if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then + composer global require wp-coding-standards/wpcs + phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs + fi + +script: + - | + if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then + phpcs + fi From ee7775d4a2b4818a6653908d3457102b083d54bf Mon Sep 17 00:00:00 2001 From: Corentin Date: Thu, 10 Jan 2019 15:12:27 +0100 Subject: [PATCH 05/35] Commit Indicator --- core/action/task_manager.action.php | 3 ++- module/activity/class/activity.class.php | 11 ++++++++++ module/follower/action/follower.action.php | 22 ++++++++++++++++--- module/follower/class/follower.class.php | 17 ++++++++++++-- .../backend/user-profile-planning.view.php | 4 ++-- .../indicator/asset/js/indicator.backend.js | 2 +- .../indicator-metabox-main.view.php | 2 +- task-manager.config.json | 2 +- 8 files changed, 52 insertions(+), 11 deletions(-) diff --git a/core/action/task_manager.action.php b/core/action/task_manager.action.php index 1b523b5a..2586c668 100644 --- a/core/action/task_manager.action.php +++ b/core/action/task_manager.action.php @@ -104,7 +104,8 @@ public function callback_admin_enqueue_scripts() { 'minute' => __( 'minute(s)', 'task-manager' ), 'planning' => __( 'Planning', 'task-manager' ), 'date_error' => __( 'Invalid date' , 'task-manager' ), - 'person_error' => __( 'Choose a user' , 'task-manager' ) + 'person_error' => __( 'Choose a user' , 'task-manager' ), + 'nodata' => __( 'I don\'t found data', 'task-manager' ) )); break; } diff --git a/module/activity/class/activity.class.php b/module/activity/class/activity.class.php index 2925ad50..d895d94e 100644 --- a/module/activity/class/activity.class.php +++ b/module/activity/class/activity.class.php @@ -136,6 +136,7 @@ public function display_user_activity_by_date( $user_id, $date_end = '', $date_s public function get_data_chart( $datas, $date_end = '', $date_start = '', $time = '', $user_id ) { + $datatime = []; $datatime_estimated = []; $datatime_reel = []; @@ -187,12 +188,14 @@ public function get_data_chart( $datas, $date_end = '', $date_start = '', $time for( $p = 0; $p < $date_gap; $p++ ){ // BOUCLE FOR | Pour chaque jours (intervalle choisi) $strtotime_int = $p * 86400; + $time_timestamp = $date_start_strtotime + $strtotime_int; $time = date("l", $date_start_strtotime + $strtotime_int); $worktoday = false; $default_value = 0; + foreach( $data_planningeachmonth_user as $keyyear => $valueyear ){ $day_found = false; foreach ( $valueyear as $key => $value) { @@ -236,9 +239,12 @@ public function get_data_chart( $datas, $date_end = '', $date_start = '', $time $datatime[ $datatime_length ][ 'duree_journée' ] = $default_value;// Nombre de journée de travail * la durée d'une journée de travail $datatime[ $datatime_length ][ 'duree_travail' ] = 0; + $work_ = false; + foreach ($datas as $i => $data_user) { // BOUCLE FOR EACH | Pour chaque tache effectué par l'utilisateur if( strtotime( strftime( '%Y-%m-%d', strtotime( $data_user->COM_DATE ) ) ) == $time_timestamp ){ + $work_ = true; $data_comdetails = json_decode( $data_user->COM_DETAILS ); $datatime[ $datatime_length ][ 'duree_travail' ] += $data_comdetails->time_info->elapsed; @@ -268,6 +274,11 @@ public function get_data_chart( $datas, $date_end = '', $date_start = '', $time } } } + + if( $work_ == false ){ + $datatime[ $datatime_length ][ 'duree_travail' ] = 0; + $datatime[ $datatime_length ][ 'date' ] = ''; + } } } diff --git a/module/follower/action/follower.action.php b/module/follower/action/follower.action.php index 604b3536..aed59138 100644 --- a/module/follower/action/follower.action.php +++ b/module/follower/action/follower.action.php @@ -217,9 +217,9 @@ public function ajax_follower_unaffectation() { * * @param WP_User $user L'objet contenant la définition complète de l'utilisateur. */ - public function callback_edit_user_profile( $user_id ) { + public function callback_edit_user_profile( $user ) { $user = Follower_Class::g()->get( array( - 'id' => $user_id, + 'id' => $user->ID, ), true ); $data_planning = array(); @@ -229,7 +229,7 @@ public function callback_edit_user_profile( $user_id ) { if( ! empty( $data_planning_array ) ){ $data_planning = $data_planning_array[ 0 ]; - + foreach ($data_planning_array as $key => $value) { if( $datebefore != '' ){ $data_planning_array[ $key ][ 'lastdate' ] = $datebefore; @@ -251,6 +251,22 @@ public function callback_edit_user_profile( $user_id ) { $current_time = current_time( 'd/m/Y' ); $current_time_en = current_time( 'Y-m-d' ); + + + if( empty( $data_planning ) ){ + $data_planning['minutary_duration'] = array( + 'Monday' => '0', + 'Tuesday' => '0', + 'Wednesday' => '0', + 'Thursday' => '0', + 'Friday' => '0', + 'Saturday' => '0', + 'Sunday' => '0' + ); + + $data_planning['date'] = ''; + } + \eoxia\View_Util::exec( 'task-manager', 'follower', 'backend/user-profile-planning', array( 'data' => $data_planning['minutary_duration'], 'last_update' => $data_planning['date'], diff --git a/module/follower/class/follower.class.php b/module/follower/class/follower.class.php index 0d742924..1143a867 100644 --- a/module/follower/class/follower.class.php +++ b/module/follower/class/follower.class.php @@ -88,6 +88,17 @@ public function update_planning( $user, $planning, $date_en ){ $data_plan = get_user_meta( $user['id'], '_tm_planning_users', true ); if( empty( $data_plan[0] ) ){ + $minuteupdate = false; + foreach( $minuraty_duration as $key => $value ){ + if( $value != 0 ){ + $minuteupdate = true; + } + } + + if( $minuteupdate == false ){ + return; + } + $this->callback_update_db_planning( $user['id'], 0, strtotime( $date_en ), 0, $minuraty_duration); $data_plan = array( @@ -102,10 +113,12 @@ public function update_planning( $user, $planning, $date_en ){ }else{ $temp = count( $data_plan ); - if( $data_plan[ $temp - 1 ]['minutary_duration'] === $minuraty_duration ){ // on verifie si le changement actuel est différent du dernier + if( $data_plan[ 0 ]['minutary_duration'] === $minuraty_duration ){ // on verifie si le changement actuel est différent du dernier return; } + + $data_plan = $this->array_sort( $data_plan, 'date_en', SORT_DESC ); // Objet trié par 'date' $date_update = 0; @@ -235,7 +248,7 @@ function getAllDayBetweenTwoDates( $debut, $duree, $planning = '' ){ foreach( $every_day_between_les_deux_dates as $key => $value ){ $length = 0; - if( $full_data[ date( 'Y', strtotime( $value ) ) ][ date( 'm', strtotime( $value ) ) ] != null ){ + if( ! empty( $full_data[ date( 'Y', strtotime( $value ) ) ][ date( 'm', strtotime( $value ) ) ] ) ){ $length = count( $full_data[ date( 'Y', strtotime( $value ) ) ][ date( 'm', strtotime( $value ) ) ] ); } diff --git a/module/follower/view/backend/user-profile-planning.view.php b/module/follower/view/backend/user-profile-planning.view.php index a1ea43c9..91d022a0 100644 --- a/module/follower/view/backend/user-profile-planning.view.php +++ b/module/follower/view/backend/user-profile-planning.view.php @@ -123,7 +123,7 @@ $value) :?> - +
@@ -185,7 +185,7 @@ diff --git a/module/indicator/asset/js/indicator.backend.js b/module/indicator/asset/js/indicator.backend.js index 5e973710..6bbd71fd 100644 --- a/module/indicator/asset/js/indicator.backend.js +++ b/module/indicator/asset/js/indicator.backend.js @@ -135,7 +135,7 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere jQuery( '#information_canvas' ).html( window.indicatorString.person_error ); }else{ // No data found - + jQuery( '#information_canvas' ).html( window.indicatorString.nodata ); } jQuery( '#information_canvas' ).css('display', 'block'); diff --git a/module/indicator/view/backend-indicator/indicator-metabox-main.view.php b/module/indicator/view/backend-indicator/indicator-metabox-main.view.php index 881b1e77..756721a0 100644 --- a/module/indicator/view/backend-indicator/indicator-metabox-main.view.php +++ b/module/indicator/view/backend-indicator/indicator-metabox-main.view.php @@ -91,4 +91,4 @@ - + diff --git a/task-manager.config.json b/task-manager.config.json index 614cde62..85c0fb14 100644 --- a/task-manager.config.json +++ b/task-manager.config.json @@ -11,7 +11,7 @@ "task-manager-setting", "task-manager-update", "wpshop_customers", - "wpshop_shop_orders", + "wpshop_shop_order", "tache_page_indicator-page", "profile" ], From c3ed4caa72234ea3eec8d0239e9dd4e651eb1015 Mon Sep 17 00:00:00 2001 From: Corentin Date: Fri, 11 Jan 2019 11:30:24 +0100 Subject: [PATCH 06/35] Indicator --- core/action/task_manager.action.php | 2 +- core/assets/js/backend.min.js | 302 ++++++++++-------- core/assets/language/task-manager-fr_FR.mo | Bin 17182 -> 18485 bytes core/assets/language/task-manager-fr_FR.po | 158 +++++---- .../activity/action/class-activity-action.php | 33 +- module/activity/class/activity.class.php | 2 +- .../indicator/asset/js/indicator.backend.js | 92 ++++-- .../indicator-follower-admin.view.php | 6 +- .../indicator-metabox-main.view.php | 23 +- 9 files changed, 363 insertions(+), 255 deletions(-) diff --git a/core/action/task_manager.action.php b/core/action/task_manager.action.php index 2586c668..857cc30d 100644 --- a/core/action/task_manager.action.php +++ b/core/action/task_manager.action.php @@ -105,7 +105,7 @@ public function callback_admin_enqueue_scripts() { 'planning' => __( 'Planning', 'task-manager' ), 'date_error' => __( 'Invalid date' , 'task-manager' ), 'person_error' => __( 'Choose a user' , 'task-manager' ), - 'nodata' => __( 'I don\'t found data', 'task-manager' ) + 'nodata' => __( 'No data, please configure your planning settings !', 'task-manager' ) )); break; } diff --git a/core/assets/js/backend.min.js b/core/assets/js/backend.min.js index 5816b2ca..d7cb15fb 100644 --- a/core/assets/js/backend.min.js +++ b/core/assets/js/backend.min.js @@ -1183,11 +1183,20 @@ window.eoxiaJS.taskManager.indicator.toggleMetabox = function( event ) { window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggeredElement, response ) { jQuery( '#tm-indicator-activity .inside' ).html( response.data.view ); jQuery( '#displaycanvas' ).html( '' ); + var data = response.data.object; + jQuery( '#tm_redirect_settings_user' ).css('display', 'none'); + jQuery( '#tm_indicator_chart_display' ).css( 'display', 'none' ); + if( data.length != 0 ){ - jQuery("#horizontalChart").css('display','block'); - jQuery("#doghnutChart").css('display','block'); + + if( response.data.display_specific_week == true ){ + window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek( response ); + }else{ + jQuery("#horizontalChart").css('display','block'); + jQuery("#doghnutChart").css('display','block'); + } for ( var i = 0; i < data.length ; i++ ){ @@ -1253,7 +1262,7 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere datasets: [ { label: window.indicatorString.planning, - backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"], + backgroundColor: ["#800000", "#9A6324","#808000","#469990","#000075", "#e6194B", "#f58231", "#ffe119", "#bfef45", "#3cb44b", "#42d4f4", "#4363d8", "#911eb4", "#f032e6", "#a9a9a9", "#fabebe", "#ffd8b1", "#fffac8", "#aaffc3", "#e6beff"], data: donutduree, } ] @@ -1280,7 +1289,8 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere jQuery( '#information_canvas' ).html( window.indicatorString.person_error ); }else{ // No data found - + jQuery( '#information_canvas' ).html( window.indicatorString.nodata ); + jQuery( '#tm_redirect_settings_user' ).css('display', 'block'); } jQuery( '#information_canvas' ).css('display', 'block'); @@ -1289,6 +1299,7 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere window.eoxiaJS.taskManager.indicator.event = function( event ) { jQuery( document ).on( 'click', '.clickonfollower', window.eoxiaJS.taskManager.indicator.addFollower ); + jQuery( document ).on( 'click', '.clickontypechart', window.eoxiaJS.taskManager.indicator.modifyTypeChart ); }; window.eoxiaJS.taskManager.indicator.addFollower = function( event) { @@ -1298,51 +1309,66 @@ window.eoxiaJS.taskManager.indicator.addFollower = function( event) { var list_follower = value_input.toString() ? value_input.toString() : ''; if( list_follower == '' ){ - var arrayFollowers = []; + var arrayFollowers = addFollower; + if( document.getElementById( 'tm_user_indicator_' + addFollower ) ){ + jQuery( '#tm_user_indicator_' + addFollower ).addClass( 'active' ); + } + // active addFollower }else{ - var arrayFollowers = list_follower.split( ',' ); - } - - if( jQuery( this ).attr( "data-user-choose" ) === 'false' ){ // On ajoute une personne - jQuery( this ).attr( "data-user-choose", "true" ); - arrayFollowers.push( addFollower ); - - - jQuery( this ).animate({ - top: "+=10", - }, 0, "linear", function() { + if( list_follower == addFollower ){ // Desactive list + var arrayFollowers = ''; + if( document.getElementById( 'tm_user_indicator_' + list_follower ) ){ // Desactive list + jQuery( '#tm_user_indicator_' + list_follower ).removeClass( 'active' ); + } + }else{ - }); - }else{ // on retire la personne - jQuery( this ).attr( "data-user-choose", "false" ); + var arrayFollowers = addFollower; + if( document.getElementById( 'tm_user_indicator_' + addFollower ) ){ // active add + jQuery( '#tm_user_indicator_' + addFollower ).addClass( 'active' ); + } - for( var i = 0; i < arrayFollowers.length ; i++ ){ - if( addFollower == arrayFollowers[i] ){ - arrayFollowers.splice( i, 1 ); + if( document.getElementById( 'tm_user_indicator_' + list_follower ) ){ // Desactive list + jQuery( '#tm_user_indicator_' + list_follower ).removeClass( 'active' ); } } - - jQuery( this ).animate({ - top: "-=10", - }, 0, "linear", function() { - - }); } - - - - - document.getElementById( "tm_indicator_list_followers" ).value = arrayFollowers.join(); + document.getElementById( "tm_indicator_list_followers" ).value = arrayFollowers; }; + window.eoxiaJS.taskManager.indicator.createCanvas = function( triggeredElement, response ) { - console.log( 'Create Canvas' ); + }; window.eoxiaJS.taskManager.indicator.markedAsReadSuccess = function ( triggeredElement, response ) { triggeredElement.closest( '.activity' ).hide(); }; + +window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek = function( response ){ + jQuery( '#tm_indicator_chart_display' ).css( 'display', 'block' ); + console.log( response.data ); +} + + +window.eoxiaJS.taskManager.indicator.modifyTypeChart = function( triggeredElement, response ) { + + var chart_selected = jQuery( this ).attr( "data-chart-type" ); + var data_chart_display = jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display" ); + + if( chart_selected != data_chart_display ){ // on change d'affichage + if( chart_selected == 'bar' ){ + jQuery( '#tm_indicator_chart_bar' ).addClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_horizontalBar' ).removeClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display", "bar" ); + }else{ + jQuery( '#tm_indicator_chart_horizontalBar' ).addClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_bar' ).removeClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display", "horizontalBar" ); + } + } + +}; /** * Initialise l'objet "point" ainsi que la méthode "navigation" obligatoire pour la bibliothèque EoxiaJS. @@ -1475,6 +1501,110 @@ window.eoxiaJS.taskManager.navigation.deletedShortcutSuccess = function( trigger triggeredElement.closest( 'tr' ).fadeOut(); jQuery( '.tm-dashboard-shortcuts li[data-key="' + response.data.key + '"]' ).fadeOut(); }; +/** + * Initialise l'objet "notify" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. + * + * @since 1.5.0 + * @version 1.6.1 + */ +window.eoxiaJS.taskManager.notify = {}; + +/** + * Méthode 'init' obligatoire. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManager.notify.init = function() { + window.eoxiaJS.taskManager.notify.event(); +}; + +/** + * Méthode 'event'. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManager.notify.event = function() { + jQuery( document ).on( 'click', '.popup-notification ul li', window.eoxiaJS.taskManager.notify.selectUser ); +}; + +/** + * Méthode qui permet d'ajouter/supprimer l'utilisateur ID dans champs caché users_id. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManager.notify.selectUser = function() { + var index = 0; + var container = jQuery( this ).closest( 'ul' ); + var input = container.find( 'input' ); + var currentVal = input.val(); + + if ( currentVal ) { + currentVal = currentVal.split( ',' ); + } else { + currentVal = []; + } + + for ( var i = 0; i < currentVal.length; i++ ) { + currentVal[i] = parseInt( currentVal[i] ); + } + + jQuery( this ).toggleClass( 'active' ); + + if ( jQuery( this ).hasClass( 'active' ) ) { + currentVal.push( parseInt( jQuery( this ).data( 'id' ) ) ); + } else { + index = currentVal.indexOf( jQuery( this ).data( 'id' ) ); + + if ( -1 != index ) { + currentVal.splice( index, 1 ); + } + } + + jQuery( this ).closest( 'div' ).find( '.selected-number' ).text( currentVal.length ); + + input.val( currentVal.join( ',' ) ); +}; + +/** + * Le callback en cas de réussite à la requête Ajax "load_notify_popup". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.5.0 + * @version 1.5.0 + */ +window.eoxiaJS.taskManager.notify.loadedNotifyPopup = function( triggeredElement, response ) { + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .content' ).html( response.data.view ); + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .container' ).removeClass( 'loading' ); +}; + +/** + * Le callback en cas de réussite à la requête Ajax "send_notification". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.5.0 + * @version 1.6.1 + */ +window.eoxiaJS.taskManager.notify.sendedNotification = function( triggeredElement, response ) { + triggeredElement.closest( '.wpeo-modal' ).find( '.modal-close' ).click(); + + +}; + /** * Initialise l'objet "user" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. * @@ -1943,110 +2073,6 @@ window.eoxiaJS.taskManager.point.undisplayPoint = function( event ) { // jQuery( this ).closest( '.wpeo-project-task-container' ).find( '.points .point.edit[data-point-state="' + pointState + '"]' ).remove(); }; -/** - * Initialise l'objet "notify" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. - * - * @since 1.5.0 - * @version 1.6.1 - */ -window.eoxiaJS.taskManager.notify = {}; - -/** - * Méthode 'init' obligatoire. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManager.notify.init = function() { - window.eoxiaJS.taskManager.notify.event(); -}; - -/** - * Méthode 'event'. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManager.notify.event = function() { - jQuery( document ).on( 'click', '.popup-notification ul li', window.eoxiaJS.taskManager.notify.selectUser ); -}; - -/** - * Méthode qui permet d'ajouter/supprimer l'utilisateur ID dans champs caché users_id. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManager.notify.selectUser = function() { - var index = 0; - var container = jQuery( this ).closest( 'ul' ); - var input = container.find( 'input' ); - var currentVal = input.val(); - - if ( currentVal ) { - currentVal = currentVal.split( ',' ); - } else { - currentVal = []; - } - - for ( var i = 0; i < currentVal.length; i++ ) { - currentVal[i] = parseInt( currentVal[i] ); - } - - jQuery( this ).toggleClass( 'active' ); - - if ( jQuery( this ).hasClass( 'active' ) ) { - currentVal.push( parseInt( jQuery( this ).data( 'id' ) ) ); - } else { - index = currentVal.indexOf( jQuery( this ).data( 'id' ) ); - - if ( -1 != index ) { - currentVal.splice( index, 1 ); - } - } - - jQuery( this ).closest( 'div' ).find( '.selected-number' ).text( currentVal.length ); - - input.val( currentVal.join( ',' ) ); -}; - -/** - * Le callback en cas de réussite à la requête Ajax "load_notify_popup". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.5.0 - * @version 1.5.0 - */ -window.eoxiaJS.taskManager.notify.loadedNotifyPopup = function( triggeredElement, response ) { - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .content' ).html( response.data.view ); - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup .container' ).removeClass( 'loading' ); -}; - -/** - * Le callback en cas de réussite à la requête Ajax "send_notification". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.5.0 - * @version 1.6.1 - */ -window.eoxiaJS.taskManager.notify.sendedNotification = function( triggeredElement, response ) { - triggeredElement.closest( '.wpeo-modal' ).find( '.modal-close' ).click(); - - -}; - /** * Initialise l'objet "quickPoint" (point rapide) ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. * diff --git a/core/assets/language/task-manager-fr_FR.mo b/core/assets/language/task-manager-fr_FR.mo index 81135a2a5030cb1120bf01643b94395e608b5b53..d51ce0b703ee54495a3dc6ac805dbb69e749c4a9 100644 GIT binary patch delta 6469 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 delta 5298 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 Lzn>G\n" "Language-Team: Eoxia\n" "Language: fr_FR\n" @@ -60,18 +60,24 @@ msgstr "Date invalide" msgid "Choose a user" msgstr "Choisissez un utilisateur" -#: core/action/task_manager.action.php:136 +#: core/action/task_manager.action.php:108 +msgid "No data, please configure your planning settings !" +msgstr "" +"Aucune données, configurer votre emplois du temps dans vos réglages " +"utilisateur" + +#: core/action/task_manager.action.php:137 #: module/comment/view/backend/comment.view.php:52 msgid "Delete this comment ?" msgstr "Voulez vous supprimer ce commentaire ?" -#: core/action/task_manager.action.php:180 +#: core/action/task_manager.action.php:181 #: module/import/view/backend/import-textarea.view.php:20 #: module/task/action/task.action.php:455 msgid "Task" msgstr "Tâche" -#: core/action/task_manager.action.php:181 +#: core/action/task_manager.action.php:182 msgid "Customer" msgstr "Client" @@ -111,39 +117,30 @@ msgid "Cancel" msgstr "Annuler" #: module/activity/view/backend/list.view.php:64 -#: module/notify/asset/js/activity/view/backend/list.view.php:64 msgid "End of history" msgstr "Fin de l'historique" #: module/activity/view/backend/mail/action-completed-point.view.php:16 -#: module/notify/asset/js/activity/view/backend/mail/action-completed-point.view.php:16 msgid "completed a point" msgstr "a complété le point" #: module/activity/view/backend/mail/action-created-comment.view.php:16 -#: module/notify/asset/js/activity/view/backend/mail/action-created-comment.view.php:16 msgid "added a new comment on the point" msgstr "a ajouté un nouveau commentaire sur le point" #: module/activity/view/backend/mail/action-created-point.view.php:16 -#: module/notify/asset/js/activity/view/backend/mail/action-created-point.view.php:16 msgid "added a new point" msgstr "a ajouté un nouveau point" #: module/activity/view/backend/mail/list.view.php:19 -#: module/notify/asset/js/activity/view/backend/mail/list.view.php:19 msgid "Access my full support" msgstr "Accéder à mon support complet" #: module/activity/view/backend/mail/list.view.php:23 -#: module/notify/asset/js/activity/view/backend/mail/list.view.php:23 msgid "Last activities on your support" msgstr "Dernières activités sur votre support" #: module/activity/view/backend/mail/list.view.php:46 -#: module/notify/asset/js/activity/view/backend/mail/list.view.php:46 -#, fuzzy -#| msgid "No activity found for now" msgid "No activity for now" msgstr "Pas d'activité trouvé pour le moment." @@ -152,9 +149,6 @@ msgstr "Pas d'activité trouvé pour le moment." #: module/activity/view/backend/post-last-activity.view.php:27 #: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:25 #: module/indicator/view/backend/daily-activity.view.php:37 -#: module/notify/asset/js/activity/view/backend/main.view.php:25 -#: module/notify/asset/js/activity/view/backend/main.view.php:27 -#: module/notify/asset/js/activity/view/backend/post-last-activity.view.php:27 #: module/time-exceeded/view/backend/main.view.php:24 msgid "Start date" msgstr "Date de début" @@ -164,54 +158,43 @@ msgstr "Date de début" #: module/activity/view/backend/post-last-activity.view.php:34 #: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:32 #: module/indicator/view/backend/daily-activity.view.php:44 -#: module/notify/asset/js/activity/view/backend/main.view.php:32 -#: module/notify/asset/js/activity/view/backend/main.view.php:34 -#: module/notify/asset/js/activity/view/backend/post-last-activity.view.php:34 #: module/time-exceeded/view/backend/main.view.php:30 msgid "End date" msgstr "Date de fin" #: module/activity/view/backend/post-last-activity.view.php:43 #: module/indicator/view/backend/daily-activity.view.php:53 -#: module/notify/asset/js/activity/view/backend/post-last-activity.view.php:43 msgid "View activity" msgstr "Voir l'activité" #: module/activity/view/backend/post-last-activity.view.php:110 #: module/indicator/view/backend/daily-activity.view.php:120 -#: module/notify/asset/js/activity/view/backend/post-last-activity.view.php:110 msgid "No activity found for now" msgstr "Pas d'activité trouvé pour le moment." #: module/activity/view/backend/task-header-button.view.php:18 -#: module/notify/asset/js/activity/view/backend/task-header-button.view.php:18 #: module/task/view/frontend/task.view.php:61 msgid "Edit display" msgstr "Affichage édition" #: module/activity/view/backend/task-header-button.view.php:25 -#: module/notify/asset/js/activity/view/backend/task-header-button.view.php:25 #: module/task/view/frontend/task.view.php:69 msgid "Activity display" msgstr "Affichage activité" #: module/activity/view/backend/title.view.php:19 -#: module/notify/asset/js/activity/view/backend/title.view.php:19 msgid "Results" msgstr "Résultats" #: module/activity/view/backend/title.view.php:23 -#: module/notify/asset/js/activity/view/backend/title.view.php:23 msgid " with the term " msgstr " avec le terme " #: module/activity/view/backend/title.view.php:30 -#: module/notify/asset/js/activity/view/backend/title.view.php:30 msgid " in the categories: " msgstr "dans les catégories:" #: module/activity/view/backend/title.view.php:37 -#: module/notify/asset/js/activity/view/backend/title.view.php:37 msgid " for the followers: " msgstr "pour les abonnés:" @@ -284,6 +267,78 @@ msgstr "Votre export" msgid "My tasks" msgstr "Mes tâches" +#: module/follower/view/backend/user-profile-planning.view.php:22 +msgid "Planning TIME (minute)" +msgstr "Emplois du temps (minute)" + +#: module/follower/view/backend/user-profile-planning.view.php:27 +msgid "Update" +msgstr "Enregistrer les modifications" + +#: module/follower/view/backend/user-profile-planning.view.php:28 +#: module/follower/view/backend/user-profile-planning.view.php:201 +msgid "Monday" +msgstr "Lundi" + +#: module/follower/view/backend/user-profile-planning.view.php:29 +#: module/follower/view/backend/user-profile-planning.view.php:202 +msgid "Tuesday" +msgstr "Mardi" + +#: module/follower/view/backend/user-profile-planning.view.php:30 +#: module/follower/view/backend/user-profile-planning.view.php:203 +msgid "Wednesday" +msgstr "Mercredi" + +#: module/follower/view/backend/user-profile-planning.view.php:31 +#: module/follower/view/backend/user-profile-planning.view.php:204 +msgid "Thursday" +msgstr "Jeudi" + +#: module/follower/view/backend/user-profile-planning.view.php:32 +#: module/follower/view/backend/user-profile-planning.view.php:205 +msgid "Friday" +msgstr "Vendredi" + +#: module/follower/view/backend/user-profile-planning.view.php:33 +#: module/follower/view/backend/user-profile-planning.view.php:206 +msgid "Saturday" +msgstr "Samedi" + +#: module/follower/view/backend/user-profile-planning.view.php:34 +#: module/follower/view/backend/user-profile-planning.view.php:207 +msgid "Sunday" +msgstr "Dimanche" + +#: module/follower/view/backend/user-profile-planning.view.php:127 +msgid "To" +msgstr "jusqu'à" + +#: module/follower/view/backend/user-profile-planning.view.php:128 +#: module/follower/view/backend/user-profile-planning.view.php:131 +msgid "From" +msgstr "A partir de" + +#: module/follower/view/backend/user-profile-planning.view.php:130 +msgid "To now" +msgstr "jusqu'à aujourd'hui" + +#: module/follower/view/backend/user-profile-planning.view.php:180 +msgid "Open archive" +msgstr "Ouvrir les archives" + +#: module/follower/view/backend/user-profile-planning.view.php:188 +msgid "List of archives" +msgstr "Liste des archives" + +#: module/follower/view/backend/user-profile-planning.view.php:199 +msgid "Day delete" +msgstr "Jour de suppression" + +#: module/follower/view/backend/user-profile-planning.view.php:200 +msgid "Date" +msgstr "Date" + #: module/follower/view/backend/user-profile.view.php:17 #: module/setting/view/main.view.php:19 msgid "Task Manager settings" @@ -384,12 +439,6 @@ msgstr "Import de points depuis un fichier texte dans la tâche : %s" msgid "Point" msgstr "Point" -#: module/indicator/action/indicator.action.php:56 -#: module/navigation/view/backend/tags.view.php:20 -#: module/tag/action/tag.action.php:51 -msgid "Categories" -msgstr "Catégories" - #: module/indicator/action/indicator.action.php:56 #: module/indicator/action/indicator.action.php:58 #: module/indicator/view/backend/main.view.php:19 @@ -452,9 +501,9 @@ msgstr "Semaine" msgid "Month" msgstr "Mois" -#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:94 -msgid "Invalid !" -msgstr "Invalide" +#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:97 +msgid "Change your settings here" +msgstr "Modifié vos paramètres ici" #: module/indicator/view/backend/filter-daily-activity.view.php:21 msgid "Which user" @@ -545,6 +594,11 @@ msgstr "" msgid "Shortcut" msgstr "Raccourci" +#: module/navigation/view/backend/tags.view.php:20 +#: module/tag/action/tag.action.php:51 +msgid "Categories" +msgstr "Catégories" + #: module/navigation/view/backend/tags.view.php:30 msgid "Create categories" msgstr "Créer des catégories" @@ -588,16 +642,12 @@ msgid "You have been notified by" msgstr "" #: module/notify/view/backend/support/body-admin.view.php:24 -#, fuzzy -#| msgid "to the task" msgid "for the task" -msgstr "pour la tâche" +msgstr "Pour la tache" #: module/notify/view/backend/support/body-admin.view.php:26 -#, fuzzy -#| msgid "Which customer" msgid "for the customer" -msgstr "Quel client" +msgstr "Pour l'utilisateur" #: module/notify/view/backend/support/body-admin.view.php:30 msgid "This message above is only visible by you" @@ -608,16 +658,12 @@ msgid "Contacts" msgstr "" #: module/notify/view/backend/support/main.view.php:41 -#, fuzzy -#| msgid "Send notification" msgid "Preview of notification" -msgstr "Envoyer la notification" +msgstr "Accéder à la notification" #: module/notify/view/backend/support/main.view.php:47 -#, fuzzy -#| msgid "No post found" msgid "No support post defined" -msgstr "Aucun post trouvé" +msgstr "Aucun post définit" #: module/point/action/point.action.php:303 #: module/point/action/point.action.php:304 @@ -851,8 +897,6 @@ msgid "Ask" msgstr "Demande" #: module/support/filter/support.filter.php:171 -#, fuzzy -#| msgid "No post found" msgid "No support post found" msgstr "Aucun post trouvé" @@ -1244,6 +1288,9 @@ msgstr "Une erreur est survenu lors de la modification de la tâche %d" msgid "%1$d tasks have been marked as archived on %2$d" msgstr "%1$d tâches ont été marquées comme archivées sur %2$d" +#~ msgid "Invalid !" +#~ msgstr "Invalide" + #~ msgid "Estimate" #~ msgstr "Estimé" @@ -1436,9 +1483,6 @@ msgstr "%1$d tâches ont été marquées comme archivées sur %2$d" #~ msgid "Errors" #~ msgstr "Erreurs" -#~ msgid "Date" -#~ msgstr "Date" - #~ msgid "View" #~ msgstr "Voir" @@ -1750,9 +1794,6 @@ msgstr "%1$d tâches ont été marquées comme archivées sur %2$d" #~ msgid "Send the task to element #" #~ msgstr "Envoyer la tâche vers l'élément #" -#~ msgid "Update" -#~ msgstr "Enregistrer les modifications" - #~ msgid "Created " #~ msgstr "Créé le " @@ -1935,9 +1976,6 @@ msgstr "%1$d tâches ont été marquées comme archivées sur %2$d" #~ msgid "Settings" #~ msgstr "Réglages" -#~ msgid "Move to archive" -#~ msgstr "Déplacer vers Archive" - #~ msgid "An error occured while dissociating file" #~ msgstr "Une erreur est survenue lors de la dissociation du fichier" diff --git a/module/activity/action/class-activity-action.php b/module/activity/action/class-activity-action.php index ea087356..8bfb91bd 100644 --- a/module/activity/action/class-activity-action.php +++ b/module/activity/action/class-activity-action.php @@ -224,17 +224,15 @@ public function callback_validate_indicator(){ $time = ! empty( $_POST['time'] ) ? $_POST['time'] : ''; $customer_id = 0; - $arraylistfollower = explode(',', $list_follower); $datatime = ''; $date_gap = ''; $joursaffichagedonut = 0; $error = ''; - - + $display_specific_week = false; ob_start(); - if( $arraylistfollower[0] ){ + if( $list_follower ){ if( $time == 'day' ){ // Jour actuel $date_start = current_time( 'Y-m-d' ); @@ -242,6 +240,7 @@ public function callback_validate_indicator(){ }else if( $time == 'week' ){ // Semaine actuelle $date_start = date( 'Y-m-d', strtotime( 'monday this week' ) ); $date_end = current_time( 'Y-m-d' ); + $display_specific_week = true; }else if( $time == 'month' ){ // Mois actuelle $date_start = date('Y-m-01'); $date_end = current_time( 'Y-m-d' ); @@ -249,10 +248,9 @@ public function callback_validate_indicator(){ } - $datas = Activity_Class::g()->display_user_activity_by_date( $arraylistfollower[0], $date_end, $date_start ); - - $data_charset = Activity_Class::g()->get_data_chart( $datas, $date_end, $date_start, $time, $arraylistfollower[0] ); + $datas = Activity_Class::g()->display_user_activity_by_date( $list_follower, $date_end, $date_start ); + $data_charset = Activity_Class::g()->get_data_chart( $datas, $date_end, $date_start, $time, $list_follower, $display_specific_week ); $datatime = $data_charset['datatime']; $date_gap = $data_charset['date_gap']; @@ -267,16 +265,17 @@ public function callback_validate_indicator(){ } wp_send_json_success( array( - 'namespace' => 'taskManager', - 'module' => 'indicator', - 'callback_success' => 'loadedCustomerActivity', - 'view' => ob_get_clean(), - 'object' => $datatime, - 'date_gap' => $date_gap, - 'date_start' => $date_start, - 'date_end' => $date_end, - 'jourdonut' => $joursaffichagedonut, - 'error' => $error + 'namespace' => 'taskManager', + 'module' => 'indicator', + 'callback_success' => 'loadedCustomerActivity', + 'view' => ob_get_clean(), + 'object' => $datatime, + 'date_gap' => $date_gap, + 'date_start' => $date_start, + 'date_end' => $date_end, + 'jourdonut' => $joursaffichagedonut, + 'error' => $error, + 'display_specific_week' => $display_specific_week ) ); } } diff --git a/module/activity/class/activity.class.php b/module/activity/class/activity.class.php index d895d94e..19d14405 100644 --- a/module/activity/class/activity.class.php +++ b/module/activity/class/activity.class.php @@ -134,7 +134,7 @@ public function display_user_activity_by_date( $user_id, $date_end = '', $date_s return $datas; } - public function get_data_chart( $datas, $date_end = '', $date_start = '', $time = '', $user_id ) { + public function get_data_chart( $datas, $date_end = '', $date_start = '', $time = '', $user_id, $display_specific_week ) { $datatime = []; diff --git a/module/indicator/asset/js/indicator.backend.js b/module/indicator/asset/js/indicator.backend.js index 6bbd71fd..01b9941f 100644 --- a/module/indicator/asset/js/indicator.backend.js +++ b/module/indicator/asset/js/indicator.backend.js @@ -38,11 +38,20 @@ window.eoxiaJS.taskManager.indicator.toggleMetabox = function( event ) { window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggeredElement, response ) { jQuery( '#tm-indicator-activity .inside' ).html( response.data.view ); jQuery( '#displaycanvas' ).html( '' ); + var data = response.data.object; + jQuery( '#tm_redirect_settings_user' ).css('display', 'none'); + jQuery( '#tm_indicator_chart_display' ).css( 'display', 'none' ); + if( data.length != 0 ){ - jQuery("#horizontalChart").css('display','block'); - jQuery("#doghnutChart").css('display','block'); + + if( response.data.display_specific_week == true ){ + window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek( response ); + }else{ + jQuery("#horizontalChart").css('display','block'); + jQuery("#doghnutChart").css('display','block'); + } for ( var i = 0; i < data.length ; i++ ){ @@ -108,7 +117,7 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere datasets: [ { label: window.indicatorString.planning, - backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"], + backgroundColor: ["#800000", "#9A6324","#808000","#469990","#000075", "#e6194B", "#f58231", "#ffe119", "#bfef45", "#3cb44b", "#42d4f4", "#4363d8", "#911eb4", "#f032e6", "#a9a9a9", "#fabebe", "#ffd8b1", "#fffac8", "#aaffc3", "#e6beff"], data: donutduree, } ] @@ -136,6 +145,7 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere }else{ // No data found jQuery( '#information_canvas' ).html( window.indicatorString.nodata ); + jQuery( '#tm_redirect_settings_user' ).css('display', 'block'); } jQuery( '#information_canvas' ).css('display', 'block'); @@ -144,6 +154,7 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere window.eoxiaJS.taskManager.indicator.event = function( event ) { jQuery( document ).on( 'click', '.clickonfollower', window.eoxiaJS.taskManager.indicator.addFollower ); + jQuery( document ).on( 'click', '.clickontypechart', window.eoxiaJS.taskManager.indicator.modifyTypeChart ); }; window.eoxiaJS.taskManager.indicator.addFollower = function( event) { @@ -153,48 +164,63 @@ window.eoxiaJS.taskManager.indicator.addFollower = function( event) { var list_follower = value_input.toString() ? value_input.toString() : ''; if( list_follower == '' ){ - var arrayFollowers = []; + var arrayFollowers = addFollower; + if( document.getElementById( 'tm_user_indicator_' + addFollower ) ){ + jQuery( '#tm_user_indicator_' + addFollower ).addClass( 'active' ); + } + // active addFollower }else{ - var arrayFollowers = list_follower.split( ',' ); - } - - if( jQuery( this ).attr( "data-user-choose" ) === 'false' ){ // On ajoute une personne - jQuery( this ).attr( "data-user-choose", "true" ); - arrayFollowers.push( addFollower ); - - - jQuery( this ).animate({ - top: "+=10", - }, 0, "linear", function() { + if( list_follower == addFollower ){ // Desactive list + var arrayFollowers = ''; + if( document.getElementById( 'tm_user_indicator_' + list_follower ) ){ // Desactive list + jQuery( '#tm_user_indicator_' + list_follower ).removeClass( 'active' ); + } + }else{ - }); - }else{ // on retire la personne - jQuery( this ).attr( "data-user-choose", "false" ); + var arrayFollowers = addFollower; + if( document.getElementById( 'tm_user_indicator_' + addFollower ) ){ // active add + jQuery( '#tm_user_indicator_' + addFollower ).addClass( 'active' ); + } - for( var i = 0; i < arrayFollowers.length ; i++ ){ - if( addFollower == arrayFollowers[i] ){ - arrayFollowers.splice( i, 1 ); + if( document.getElementById( 'tm_user_indicator_' + list_follower ) ){ // Desactive list + jQuery( '#tm_user_indicator_' + list_follower ).removeClass( 'active' ); } } - - jQuery( this ).animate({ - top: "-=10", - }, 0, "linear", function() { - - }); } - - - - - document.getElementById( "tm_indicator_list_followers" ).value = arrayFollowers.join(); + document.getElementById( "tm_indicator_list_followers" ).value = arrayFollowers; }; + window.eoxiaJS.taskManager.indicator.createCanvas = function( triggeredElement, response ) { - console.log( 'Create Canvas' ); + }; window.eoxiaJS.taskManager.indicator.markedAsReadSuccess = function ( triggeredElement, response ) { triggeredElement.closest( '.activity' ).hide(); }; + +window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek = function( response ){ + jQuery( '#tm_indicator_chart_display' ).css( 'display', 'block' ); + console.log( response.data ); +} + + +window.eoxiaJS.taskManager.indicator.modifyTypeChart = function( triggeredElement, response ) { + + var chart_selected = jQuery( this ).attr( "data-chart-type" ); + var data_chart_display = jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display" ); + + if( chart_selected != data_chart_display ){ // on change d'affichage + if( chart_selected == 'bar' ){ + jQuery( '#tm_indicator_chart_bar' ).addClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_horizontalBar' ).removeClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display", "bar" ); + }else{ + jQuery( '#tm_indicator_chart_horizontalBar' ).addClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_bar' ).removeClass( 'button-disabled' ); + jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display", "horizontalBar" ); + } + } + +}; diff --git a/module/indicator/view/backend-indicator/indicator-follower-admin.view.php b/module/indicator/view/backend-indicator/indicator-follower-admin.view.php index c029850e..fbb22de8 100644 --- a/module/indicator/view/backend-indicator/indicator-follower-admin.view.php +++ b/module/indicator/view/backend-indicator/indicator-follower-admin.view.php @@ -22,9 +22,9 @@ foreach ( $followers as $follower ): ?>
  • - + id="tm_user_indicator_data['id'] ?>" + data-user-id="data['id'] ?>"> + data['id'] . '" size="40"]' ); ?>
  • diff --git a/module/indicator/view/backend-indicator/indicator-metabox-main.view.php b/module/indicator/view/backend-indicator/indicator-metabox-main.view.php index 756721a0..2537da60 100644 --- a/module/indicator/view/backend-indicator/indicator-metabox-main.view.php +++ b/module/indicator/view/backend-indicator/indicator-metabox-main.view.php @@ -80,15 +80,34 @@ - " /> */?> + + + +
    +
    +
    + +
    - + + From 2184e6cf4683f6d56e9cefcc348c498463ae002f Mon Sep 17 00:00:00 2001 From: Jimmy L Date: Fri, 18 Jan 2019 10:33:09 +0100 Subject: [PATCH 07/35] Export Activity Client --- module/activity/action/class-activity-action.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/activity/action/class-activity-action.php b/module/activity/action/class-activity-action.php index 8bfb91bd..3f13d6f7 100644 --- a/module/activity/action/class-activity-action.php +++ b/module/activity/action/class-activity-action.php @@ -150,8 +150,8 @@ public function load_customer_activity() { public function callback_export_activity() { $user_id = ! empty( $_POST['user_id_selected'] ) ? (int) $_POST['user_id_selected'] : 0; $customer_id = ! empty( $_POST['user']['customer_id'] ) ? (int) $_POST['user']['customer_id'] : 0; - $date_end = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_start'] ) ? $_POST['tm_abu_date_start'] : current_time( 'Y-m-d' ); - $date_start = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_end'] ) ? $_POST['tm_abu_date_end'] : current_time( 'Y-m-d' ); + $date_end = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_end'] ) ? $_POST['tm_abu_date_end'] : current_time( 'Y-m-d' ); + $date_start = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_start'] ) ? $_POST['tm_abu_date_start'] : current_time( 'Y-m-d' ); $datas = Activity_Class::g()->display_user_activity_by_date( $user_id, $date_end, $date_start, $customer_id ); From 9fee3d2171dcbbd8d03eb826cedb117d99ab7a29 Mon Sep 17 00:00:00 2001 From: Corentin Date: Fri, 25 Jan 2019 16:44:40 +0100 Subject: [PATCH 08/35] - Update des indicators - Ajout de norme --- core/action/task_manager.action.php | 5 +- core/assets/js/backend.min.js | 613 +++++++++---- core/assets/js/frontend.min.js | 333 +++---- core/assets/language/task-manager-fr_FR.mo | Bin 18485 -> 18611 bytes core/assets/language/task-manager-fr_FR.po | 80 +- .../activity/action/class-activity-action.php | 306 ++++--- module/activity/class/activity.class.php | 641 ++++++++------ .../activity/filter/class-activity-filter.php | 11 +- module/activity/filter/index.php | 2 + .../view/backend/created-comment.view.php | 44 +- .../view/backend/created-point.view.php | 36 +- module/activity/view/backend/list.view.php | 140 +-- .../mail/action-completed-point.view.php | 32 +- .../mail/action-created-comment.view.php | 32 +- .../mail/action-created-point.view.php | 32 +- .../backend/mail/completed-point.view.php | 32 +- .../backend/mail/created-comment.view.php | 32 +- .../view/backend/mail/created-point.view.php | 32 +- .../activity/view/backend/mail/list.view.php | 98 +- .../view/backend/post-last-activity.view.php | 56 +- module/admin-bar/action/admin-bar.action.php | 32 +- module/admin-bar/action/index.php | 2 + module/admin-bar/asset/index.php | 2 + module/admin-bar/asset/js/index.php | 2 + module/admin-bar/class/admin-bar.class.php | 218 ++--- module/admin-bar/class/index.php | 2 + module/admin-bar/index.php | 2 + .../view/backend/button-quick-time.view.php | 42 +- module/admin-bar/view/backend/index.php | 2 + module/admin-bar/view/backend/main.view.php | 38 +- module/admin-bar/view/index.php | 2 + module/avatar/class/avatar.class.php | 129 +-- module/avatar/class/index.php | 2 + module/avatar/index.php | 2 + .../shortcode/class-avatar-shortcode.php | 25 +- module/avatar/shortcode/index.php | 2 + module/avatar/view/index.php | 2 + module/comment/action/comment.action.php | 749 +++++++++------- module/comment/action/index.php | 2 + module/comment/asset/index.php | 2 + module/comment/class/comment.class.php | 316 +++---- module/comment/class/index.php | 2 + .../comment/filter/class-comment-filter.php | 107 ++- module/comment/filter/index.php | 2 + module/comment/index.php | 2 + module/comment/model/comment.model.php | 102 +-- module/comment/model/index.php | 2 + .../comment/shortcode/comment.shortcode.php | 14 + module/comment/shortcode/index.php | 2 + .../view/backend/comment-advanced.view.php | 54 +- module/comment/view/backend/comment.view.php | 126 +-- .../view/backend/edit-advanced.view.php | 68 +- module/comment/view/backend/edit.view.php | 96 +- module/comment/view/backend/index.php | 2 + .../view/backend/list-comment.view.php | 55 +- module/comment/view/backend/main.view.php | 64 +- module/comment/view/frontend/edit.view.php | 96 +- module/comment/view/frontend/index.php | 2 + .../view/frontend/list-comment.view.php | 53 +- module/comment/view/frontend/main.view.php | 64 +- module/comment/view/index.php | 2 + module/export/action/export.action.php | 346 ++++---- module/export/action/index.php | 2 + module/export/assets/index.php | 2 + module/export/assets/js/index.php | 2 + module/export/class/export.class.php | 18 +- module/export/class/index.php | 2 + module/export/index.php | 2 + module/export/view/index.php | 2 + module/follower/action/follower.action.php | 336 ++++--- module/follower/action/index.php | 2 + module/follower/asset/index.php | 2 + module/follower/asset/js/index.php | 2 + module/follower/class/follower.class.php | 834 ++++++++++-------- module/follower/class/index.php | 2 + module/follower/index.php | 2 + module/follower/model/follower.model.php | 135 ++- module/follower/model/index.php | 2 + module/follower/shortcode/index.php | 2 + .../view/backend/follower-edit.view.php | 54 +- .../follower/view/backend/follower.view.php | 38 +- module/follower/view/backend/index.php | 2 + .../view/backend/list-follower-edit.view.php | 55 +- .../follower/view/backend/main-edit.view.php | 104 ++- module/follower/view/backend/main.view.php | 11 +- .../backend/user-profile-planning.view.php | 98 +- module/follower/view/index.php | 2 + .../action/history-time.action.php | 114 ++- .../history-time/class/history-time.class.php | 38 +- .../helper/history-time.helper.php | 5 +- .../history-time/model/history-time.model.php | 8 +- .../view/backend/history-time.view.php | 5 +- .../history-time/view/backend/main.view.php | 24 +- module/import/action/class-import-action.php | 67 +- module/import/action/index.php | 2 + module/import/asset/index.php | 2 + module/import/asset/js/index.php | 2 + module/import/class/import.class.php | 21 +- module/import/class/index.php | 2 + module/import/filter/class-import-filter.php | 24 +- module/import/filter/index.php | 2 + module/import/view/backend/index.php | 2 + module/import/view/index.php | 2 + module/indicator/action/index.php | 2 + module/indicator/action/indicator.action.php | 102 ++- module/indicator/asset/index.php | 2 + module/indicator/asset/js/index.php | 2 + .../indicator/asset/js/indicator.backend.js | 467 ++++++++-- module/indicator/class/index.php | 2 + module/indicator/class/indicator.class.php | 450 ++++++---- module/indicator/filter/index.php | 2 + module/indicator/index.php | 2 + .../view/backend-indicator/index.php | 2 + .../indicator-follower-admin.view.php | 26 +- .../backend-indicator/indicator-main.view.php | 6 +- .../indicator-metabox-main.view.php | 87 +- .../indicator-pagination-day.view.php | 13 + .../view/backend/daily-activity.view.php | 387 ++++---- .../backend/filter-daily-activity.view.php | 100 +-- module/indicator/view/backend/index.php | 2 + module/indicator/view/backend/item.view.php | 163 ++-- module/indicator/view/backend/main.view.php | 1 - .../indicator/view/backend/request.view.php | 103 ++- module/indicator/view/index.php | 2 + module/navigation/action/index.php | 2 + .../navigation/action/navigation.action.php | 218 +++-- module/navigation/asset/index.php | 2 + module/navigation/class/index.php | 2 + module/navigation/class/navigation.class.php | 303 ++++--- .../filter/class-navigation-filter.php | 25 +- module/navigation/filter/index.php | 2 + module/navigation/index.php | 2 + .../shortcode/class-search-bar-shortcode.php | 104 ++- module/navigation/shortcode/index.php | 2 + module/navigation/view/backend/index.php | 2 + module/navigation/view/backend/main.view.php | 13 +- ...al-create-shortcut-button-success.view.php | 38 +- .../modal-create-shortcut-buttons.view.php | 56 +- ...l-create-shortcut-content-success.view.php | 38 +- .../modal-create-shortcut-content.view.php | 72 +- .../backend/modal-handle-shortcut.view.php | 146 +-- .../view/backend/navigation-shortcut.view.php | 17 +- .../view/backend/search-orders.view.php | 74 +- .../view/backend/search-results.view.php | 2 +- .../navigation/view/backend/shortcut.view.php | 56 +- module/navigation/view/backend/tag.view.php | 34 +- module/navigation/view/backend/tags.view.php | 11 +- module/navigation/view/index.php | 2 + module/notify/action/notify.action.php | 382 ++++---- module/notify/class/notify.class.php | 66 +- module/notify/view/backend/button.view.php | 2 +- module/notify/view/backend/main.view.php | 159 ++-- .../view/backend/support/body-admin.view.php | 62 +- .../notify/view/backend/support/main.view.php | 100 +-- module/owner/action/index.php | 2 + module/owner/action/owner.action.php | 58 +- module/owner/class/index.php | 2 + module/owner/class/owner.class.php | 77 +- module/owner/model/index.php | 2 + module/owner/model/owner.model.php | 45 +- .../owner/shortcode/class-owner-shortcode.php | 13 +- module/owner/shortcode/index.php | 2 + .../owner/view/backend/dropdown-main.view.php | 13 +- module/owner/view/backend/list.view.php | 58 +- module/owner/view/backend/main.view.php | 54 +- module/point/action/index.php | 2 + module/point/action/point.action.php | 233 +++-- module/point/asset/js/point.backend.js | 8 +- module/point/class/point.class.php | 95 +- module/point/filter/class-point-filter.php | 65 +- module/point/filter/index.php | 2 + module/point/view/backend/main.view.php | 34 +- .../point/view/backend/point-summary.view.php | 54 +- module/point/view/backend/point.view.php | 1 - module/point/view/backend/points.view.php | 59 +- .../view/backend/toggle-content.view.php | 12 + module/point/view/frontend/main.view.php | 15 +- module/point/view/frontend/point.view.php | 86 +- module/point/view/frontend/points.view.php | 59 +- .../action/class-quick-point-action.php | 100 ++- module/quick-point/action/index.php | 2 + module/quick-point/asset/index.php | 2 + module/quick-point/asset/js/index.php | 2 + .../filter/class-quick-point-filter.php | 56 +- module/quick-point/filter/index.php | 2 + module/quick-point/index.php | 2 + module/quick-point/view/button.view.php | 61 +- module/quick-point/view/index.php | 2 + .../quick-point/view/modal-content.view.php | 19 +- .../quick-point/view/modal-success.view.php | 7 +- .../quick_time/action/quick-time.action.php | 137 +-- module/quick_time/class/quick-time.class.php | 210 ++--- module/quick_time/helper/index.php | 2 + .../quick_time/helper/quick-time.helper.php | 104 ++- .../view/backend/button-setting.view.php | 46 +- module/quick_time/view/backend/item.view.php | 76 +- module/quick_time/view/backend/list.view.php | 179 ++-- module/quick_time/view/backend/main.view.php | 36 +- .../view/backend/setting/buttons.view.php | 42 +- .../view/backend/setting/item.view.php | 68 +- .../view/backend/setting/main.view.php | 67 +- .../view/backend/setting/points.view.php | 62 +- module/setting/action/setting.action.php | 54 +- module/setting/class/setting.class.php | 34 +- .../setting/view/capability/has-cap.view.php | 44 +- .../view/capability/list-item.view.php | 52 +- module/setting/view/capability/list.view.php | 125 +-- module/setting/view/capability/main.view.php | 66 +- module/sticky-note/action/index.php | 2 + .../sticky-note/action/sticky-note.action.php | 309 ++++--- module/sticky-note/asset/index.php | 2 + module/sticky-note/asset/js/index.php | 2 + module/sticky-note/class/index.php | 2 + .../sticky-note/class/sticky-note.class.php | 153 ++-- module/sticky-note/index.php | 2 + module/sticky-note/model/index.php | 2 + module/sticky-note/view/backend/add.view.php | 46 +- module/sticky-note/view/backend/index.php | 2 + module/sticky-note/view/backend/main.view.php | 66 +- .../view/backend/sticky-note.view.php | 76 +- module/sticky-note/view/index.php | 2 + .../support/action/class-support.action.php | 323 +++---- module/support/class/support.class.php | 116 +-- module/support/filter/support.filter.php | 698 ++++++++------- .../frontend/created-ticket-success.view.php | 42 +- .../view/frontend/form-create-ticket.view.php | 88 +- module/support/view/frontend/main.view.php | 169 ++-- module/support/view/frontend/menu.view.php | 45 +- module/support/view/frontend/popup.view.php | 60 +- module/tag/action/tag.action.php | 180 ++-- module/tag/filter/tag.filter.php | 32 +- module/tag/shortcode/class-tag-shortcode.php | 30 +- module/tag/shortcode/index.php | 2 + module/tag/view/backend/main-edit.view.php | 93 +- module/tag/view/backend/main.view.php | 11 +- module/tag/view/backend/tag-edit.view.php | 1 + module/task/action/index.php | 2 + module/task/action/task.action.php | 205 +++-- module/task/asset/index.php | 2 + module/task/asset/js/index.php | 2 + module/task/class/task.class.php | 164 ++-- module/task/filter/index.php | 2 + module/task/helper/index.php | 2 + module/task/shortcode/index.php | 2 + package-lock.json | 70 +- package.json | 3 + phpcs.xml.dist | 18 + task-manager.config.json | 2 +- 248 files changed, 9701 insertions(+), 7382 deletions(-) create mode 100644 module/activity/filter/index.php create mode 100644 module/admin-bar/action/index.php create mode 100644 module/admin-bar/asset/index.php create mode 100644 module/admin-bar/asset/js/index.php create mode 100644 module/admin-bar/class/index.php create mode 100644 module/admin-bar/index.php create mode 100644 module/admin-bar/view/backend/index.php create mode 100644 module/admin-bar/view/index.php create mode 100644 module/avatar/class/index.php create mode 100644 module/avatar/index.php create mode 100644 module/avatar/shortcode/index.php create mode 100644 module/avatar/view/index.php create mode 100644 module/comment/action/index.php create mode 100644 module/comment/asset/index.php create mode 100644 module/comment/class/index.php create mode 100644 module/comment/filter/index.php create mode 100644 module/comment/index.php create mode 100644 module/comment/model/index.php create mode 100644 module/comment/shortcode/index.php create mode 100644 module/comment/view/backend/index.php create mode 100644 module/comment/view/frontend/index.php create mode 100644 module/comment/view/index.php create mode 100644 module/export/action/index.php create mode 100644 module/export/assets/index.php create mode 100644 module/export/assets/js/index.php create mode 100644 module/export/class/index.php create mode 100644 module/export/index.php create mode 100644 module/export/view/index.php create mode 100644 module/follower/action/index.php create mode 100644 module/follower/asset/index.php create mode 100644 module/follower/asset/js/index.php create mode 100644 module/follower/class/index.php create mode 100644 module/follower/index.php create mode 100644 module/follower/model/index.php create mode 100644 module/follower/shortcode/index.php create mode 100644 module/follower/view/backend/index.php create mode 100644 module/follower/view/index.php create mode 100644 module/import/action/index.php create mode 100644 module/import/asset/index.php create mode 100644 module/import/asset/js/index.php create mode 100644 module/import/class/index.php create mode 100644 module/import/filter/index.php create mode 100644 module/import/view/backend/index.php create mode 100644 module/import/view/index.php create mode 100644 module/indicator/action/index.php create mode 100644 module/indicator/asset/index.php create mode 100644 module/indicator/asset/js/index.php create mode 100644 module/indicator/class/index.php create mode 100644 module/indicator/filter/index.php create mode 100644 module/indicator/index.php create mode 100644 module/indicator/view/backend-indicator/index.php create mode 100644 module/indicator/view/backend/index.php create mode 100644 module/indicator/view/index.php create mode 100644 module/navigation/action/index.php create mode 100644 module/navigation/asset/index.php create mode 100644 module/navigation/class/index.php create mode 100644 module/navigation/filter/index.php create mode 100644 module/navigation/index.php create mode 100644 module/navigation/shortcode/index.php create mode 100644 module/navigation/view/backend/index.php create mode 100644 module/navigation/view/index.php create mode 100644 module/owner/action/index.php create mode 100644 module/owner/class/index.php create mode 100644 module/owner/model/index.php create mode 100644 module/owner/shortcode/index.php create mode 100644 module/point/action/index.php create mode 100644 module/point/filter/index.php create mode 100644 module/quick_time/helper/index.php create mode 100644 module/sticky-note/action/index.php create mode 100644 module/sticky-note/asset/index.php create mode 100644 module/sticky-note/asset/js/index.php create mode 100644 module/sticky-note/class/index.php create mode 100644 module/sticky-note/index.php create mode 100644 module/sticky-note/model/index.php create mode 100644 module/sticky-note/view/backend/index.php create mode 100644 module/sticky-note/view/index.php create mode 100644 module/tag/shortcode/index.php create mode 100644 module/task/action/index.php create mode 100644 module/task/asset/index.php create mode 100644 module/task/asset/js/index.php create mode 100644 module/task/filter/index.php create mode 100644 module/task/helper/index.php create mode 100644 module/task/shortcode/index.php create mode 100644 phpcs.xml.dist diff --git a/core/action/task_manager.action.php b/core/action/task_manager.action.php index 857cc30d..542f0b32 100644 --- a/core/action/task_manager.action.php +++ b/core/action/task_manager.action.php @@ -105,7 +105,10 @@ public function callback_admin_enqueue_scripts() { 'planning' => __( 'Planning', 'task-manager' ), 'date_error' => __( 'Invalid date' , 'task-manager' ), 'person_error' => __( 'Choose a user' , 'task-manager' ), - 'nodata' => __( 'No data, please configure your planning settings !', 'task-manager' ) + 'nodata' => __( 'No data, please configure your planning settings !', 'task-manager' ), + 'from' => __( 'From', 'task-manager' ), + 'to' => __( 'to', 'task-manager' ), + 'plan_week' => __( 'Stats of the week', 'task-manager' ), )); break; } diff --git a/core/assets/js/backend.min.js b/core/assets/js/backend.min.js index d7cb15fb..2b564ee2 100644 --- a/core/assets/js/backend.min.js +++ b/core/assets/js/backend.min.js @@ -624,6 +624,75 @@ window.eoxiaJS.taskManager.activity.exportedActivity = function( triggeredElemen window.eoxiaJS.global.downloadFile( response.data.url_to_file, response.data.filename ); }; +/** + * Initialise l'objet "task" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. + * + * @since 1.5.1 + * @version 1.6.0 + */ +window.eoxiaJS.taskManager.taskExport = {}; + +window.eoxiaJS.taskManager.taskExport.init = function() { + window.eoxiaJS.taskManager.taskExport.event(); +}; + +window.eoxiaJS.taskManager.taskExport.event = function() { + jQuery( document ).on( 'change', 'input[name=export_type]', window.eoxiaJS.taskManager.taskExport.displayDateForExport ); +}; + +/** + * Le callback en cas de réussite à la requête Ajax "load_export_popup". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.6.0 + * @version 1.6.0 + */ +window.eoxiaJS.taskManager.taskExport.loadedExportPopup = function( triggeredElement, response ) { + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .content' ).html( response.data.view ); + jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .container' ).removeClass( 'loading' ); +}; + +/** + * [description] + * @method + * @param {[type]} $input [description] + * @return {[type]} [description] + */ +window.eoxiaJS.taskManager.taskExport.afterTriggerChangeDate = function( $input ) { + $input.closest( '.group-date' ).find( '.date-display' ).html( $input.val() ); +}; + +/** + * [description] + * @method + * @param {[type]} triggeredElement [description] + * @return {[type]} [description] + */ +window.eoxiaJS.taskManager.taskExport.displayDateForExport = function( triggeredElement ) { + if ( 'by_date' == jQuery( this ).val() ) { + jQuery( '.tm_export_date_container' ).show(); + } else { + jQuery( '.tm_export_date_container' ).hide(); + } +}; + +/** + * Le callback en cas de réussite à la requête Ajax "export_task". + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.3.6 + * @version 1.6.0 + */ +window.eoxiaJS.taskManager.taskExport.exportedTask = function( triggeredElement, response ) { + jQuery( '.tm_export_result_container' ).find( 'textarea' ).html( response.data.content ); +}; + /** * Initialise l'objet "comment" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. * @@ -830,75 +899,6 @@ window.eoxiaJS.taskManager.comment.afterTriggerChangeDate = function( $input ) { $input.closest( '.group-date' ).find( 'span' ).css( 'background', '#389af6' ); }; -/** - * Initialise l'objet "task" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. - * - * @since 1.5.1 - * @version 1.6.0 - */ -window.eoxiaJS.taskManager.taskExport = {}; - -window.eoxiaJS.taskManager.taskExport.init = function() { - window.eoxiaJS.taskManager.taskExport.event(); -}; - -window.eoxiaJS.taskManager.taskExport.event = function() { - jQuery( document ).on( 'change', 'input[name=export_type]', window.eoxiaJS.taskManager.taskExport.displayDateForExport ); -}; - -/** - * Le callback en cas de réussite à la requête Ajax "load_export_popup". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.6.0 - * @version 1.6.0 - */ -window.eoxiaJS.taskManager.taskExport.loadedExportPopup = function( triggeredElement, response ) { - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .content' ).html( response.data.view ); - jQuery( triggeredElement ).closest( '.wpeo-project-task' ).find( '.popup.popup-export .container' ).removeClass( 'loading' ); -}; - -/** - * [description] - * @method - * @param {[type]} $input [description] - * @return {[type]} [description] - */ -window.eoxiaJS.taskManager.taskExport.afterTriggerChangeDate = function( $input ) { - $input.closest( '.group-date' ).find( '.date-display' ).html( $input.val() ); -}; - -/** - * [description] - * @method - * @param {[type]} triggeredElement [description] - * @return {[type]} [description] - */ -window.eoxiaJS.taskManager.taskExport.displayDateForExport = function( triggeredElement ) { - if ( 'by_date' == jQuery( this ).val() ) { - jQuery( '.tm_export_date_container' ).show(); - } else { - jQuery( '.tm_export_date_container' ).hide(); - } -}; - -/** - * Le callback en cas de réussite à la requête Ajax "export_task". - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.3.6 - * @version 1.6.0 - */ -window.eoxiaJS.taskManager.taskExport.exportedTask = function( triggeredElement, response ) { - jQuery( '.tm_export_result_container' ).find( 'textarea' ).html( response.data.content ); -}; - /** * Initialise l'objet "point" ainsi que la méthode "follower" obligatoire pour la bibliothèque EoxiaJS. * @@ -1173,107 +1173,132 @@ window.eoxiaJS.taskManager.indicator.toggleMetabox = function( event ) { } /** - * Le callback en cas de réussite à la requête Ajax "load_customer_activity". + * Fonction principal qui génére les canvas de type Bar et Doghnut + * Elle est lancé par une fonction php '/activity/action' * - * Affiche les canvas + * @param {[type]} triggeredElement [ ] + @param {[type]} response [ donnés reçues par la requete ajax ] * * @author Corentin Eoxia - * @since 1.8.0 + * @since 1.9.0 - BETA */ + window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggeredElement, response ) { + window.eoxiaJS.taskManager.indicator.isSelectOneUser( response.data.user_select, response.data.user_id ); jQuery( '#tm-indicator-activity .inside' ).html( response.data.view ); - jQuery( '#displaycanvas' ).html( '' ); + jQuery( '#displaycanvas' ).html( '' ); // reset les affichages de Canvas + jQuery( '#displaycanvas_specific_week' ).html( '' ); // reset le second affichage de la semaine + jQuery( '#displaymodal' ).html( '' ); var data = response.data.object; jQuery( '#tm_redirect_settings_user' ).css('display', 'none'); jQuery( '#tm_indicator_chart_display' ).css( 'display', 'none' ); - if( data.length != 0 ){ + jQuery( '#display_modal' ).html( '' ); + if( data.length != 0 ){ if( response.data.display_specific_week == true ){ - window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek( response ); - }else{ - jQuery("#horizontalChart").css('display','block'); - jQuery("#doghnutChart").css('display','block'); + window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek( data ); } + jQuery("#horizontalChart").css('display','block'); + jQuery("#doghnutChart").css('display','block'); + jQuery("#displaycanvas").css('display','block'); + for ( var i = 0; i < data.length ; i++ ){ - jQuery( "#displaycanvas" ).append( '
    ' ); + jQuery( "#displaycanvas" ).append( '
    ' ); var canvasHorizontal = document.getElementById( "canvasHorizontalBar" + i ).getContext('2d'); - new Chart(canvasHorizontal, { - type: 'horizontalBar', // bar = Vertical | horizontalBar = Horizontal - data: { - labels: [ window.indicatorString.minute ], - datasets: [ - { - label: window.indicatorString.time_work,//window.indicator.time_work, - backgroundColor: "#3e95cd", - data: [ data[i]['duree_travail'] ], - borderWidth: 1 - }, { - label: window.indicatorString.time_day,//window.indicator.time_day, - backgroundColor: "#8e5ea2", - data: [ data[i]['duree_journée'], 0 ], - borderWidth: 1 - }] + var data_canvas_horizontalBar = { + labels: [ window.indicatorString.minute ], + datasets: [ + { + label: window.indicatorString.time_work,//window.indicator.time_work, + backgroundColor: "#3e95cd", + data: [ data[i]['duree_travail'] ], + borderWidth: 1 + }, { + label: window.indicatorString.time_day,//window.indicator.time_day, + backgroundColor: "#8e5ea2", + data: [ data[i]['duree_journée'], 0 ], + borderWidth: 1 + }] + }; + + var option_canvas_horizontalbar = { + plugins: { + labels: { + render: 'label' + } }, - options: { - plugins: { - labels: { - render: 'label' - } - }, - legend: { display: true }, - title: { - display: true, - text: data[i]['jour'] - }, - scales: { - yAxes: [{ - ticks: { - beginAtZero: true - } - }] - } - } - }); + legend: { display: true }, + title: { + display: true, + text: data[i]['jour'] + }, + scales: { + yAxes: [{ + ticks: { + beginAtZero: true + } + }] + } + }; + + window.eoxiaJS.taskManager.indicator.generateCanvasDynamic( canvasHorizontal, 'horizontalBar', data_canvas_horizontalBar, option_canvas_horizontalbar ); // Génération du canvas de type horizontalBar + + // - - - - - var canvasDonut = document.getElementById( "canvasDoghnutChart" + i).getContext('2d'); if( data[ i ][ 'tache_effectue' ] != undefined && data[ i ][ 'tache_effectue' ].length > 0 ){ + $( '#canvasDoghnutChart' + i ).css( 'cursor', 'pointer' ); + $( '#canvasDoghnutChart' + i ).addClass( 'display_all_point' ); + jQuery( '#canvasDoghnutChart' + i ).attr( "data-canvas-focus", i ); + + window.eoxiaJS.taskManager.indicator.generateModalContent( i, data[ i ] ); var donutduree = []; var donutpoint = []; - var dayfocus = ''; + var dayfocus = ''; for (var v = 0; v < data[ i ][ 'tache_effectue' ].length; v++) { donutduree[ v ] = data[ i ][ 'tache_effectue' ][ v ][ 'duree' ]; donutpoint[ v ] = data[ i ][ 'tache_effectue' ][ v ][ 'point_id' ]; - dayfocus = data[ i ][ 'jour' ]; + dayfocus = data[ i ][ 'jour' ]; } - new Chart(canvasDonut, { - type: 'doughnut', - data: { - labels: donutpoint, - datasets: [ + var data_canvas_doghnut = { + labels : donutpoint, + datasets: [ { label: window.indicatorString.planning, backgroundColor: ["#800000", "#9A6324","#808000","#469990","#000075", "#e6194B", "#f58231", "#ffe119", "#bfef45", "#3cb44b", "#42d4f4", "#4363d8", "#911eb4", "#f032e6", "#a9a9a9", "#fabebe", "#ffd8b1", "#fffac8", "#aaffc3", "#e6beff"], data: donutduree, } ] - }, - options: { - title: { - display: true, - text: data[ i ][ 'jour' ] - } - } - }); + }; + + var option_canvas_doghnut = { + onClick: function( event, info ) { + var numline = -1; + if( info.length != 0 ){ + numline = info[0]['_index']; + } + window.eoxiaJS.taskManager.indicator.displayAllPoint( numline, this['canvas'] ); + }, + title: { + display: true, + text: data[ i ][ 'jour' ] + }, + legend: { + onClick: (e) => e.stopPropagation() // Block click + } + }; + + window.eoxiaJS.taskManager.indicator.generateCanvasDynamic( canvasDonut, 'doughnut', data_canvas_doghnut, option_canvas_doghnut ); // Génération du canvas de type doghnut } } @@ -1297,13 +1322,44 @@ window.eoxiaJS.taskManager.indicator.loadedCustomerActivity = function( triggere } }; +/** + * Fonction qui génère (TOUS) les canvas + * @param {String} [elementbyid=''] [Recupère l'élement créé, qui contiendra le canvas] + * @param {String} [typelabel='bar'] [type de canvas à afficher] => 3 types : 'bar', 'horizontalBar','doughnut' + * @param {Object} [data={}] [liste des données] + * @param {Object} [option={}] [liste des options / fonctions à éxecuter] + * @since 1.9.0 - BETA + */ +window.eoxiaJS.taskManager.indicator.generateCanvasDynamic = function( elementbyid = '', typelabel = 'bar', data = {}, option = {} ){ + new Chart(elementbyid, { + type: typelabel, + data: data, + options: option + }); +} + window.eoxiaJS.taskManager.indicator.event = function( event ) { jQuery( document ).on( 'click', '.clickonfollower', window.eoxiaJS.taskManager.indicator.addFollower ); jQuery( document ).on( 'click', '.clickontypechart', window.eoxiaJS.taskManager.indicator.modifyTypeChart ); + jQuery( document ).on( 'click', '.display_this_point', window.eoxiaJS.taskManager.indicator.displayThisPoint ); }; -window.eoxiaJS.taskManager.indicator.addFollower = function( event) { - var addFollower = jQuery( this ).attr( "data-user-id" ); +/** + * Modifie le css d'un utilisateur suite à une action utilisateur + * La fonction peut etre lancé par un clic sur un cadre utilisateur, ou lors de l'affichage de l'emploi du temps + * @param {[type]} event [action utilisateur] + * @param {Number} [user_id=0] [utilisateur actuel] + * @return {[type]} [description] + * + * @since 1.9.0 - BETA + */ +window.eoxiaJS.taskManager.indicator.addFollower = function( event, user_id = 0 ) { + if( user_id == 0 ){ + + var addFollower = jQuery( this ).attr( "data-user-id" ); + }else{ + var addFollower = user_id; + } var value_input = document.getElementById( "tm_indicator_list_followers" ).value; var list_follower = value_input.toString() ? value_input.toString() : ''; @@ -1336,21 +1392,127 @@ window.eoxiaJS.taskManager.indicator.addFollower = function( event) { document.getElementById( "tm_indicator_list_followers" ).value = arrayFollowers; }; - -window.eoxiaJS.taskManager.indicator.createCanvas = function( triggeredElement, response ) { - -}; - window.eoxiaJS.taskManager.indicator.markedAsReadSuccess = function ( triggeredElement, response ) { triggeredElement.closest( '.activity' ).hide(); }; -window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek = function( response ){ +/** + * Affichage de deux canvas supplémaitres lors de la sélection 'semaine' + * ces canvas résument la semaine, en traitant les données contenu dans le parametre 'data' + * @param {[type]} data [données des taches effectuées] + * @return {[type]} [description] + * + * @since 1.9.0 - BETA + */ +window.eoxiaJS.taskManager.indicator.displaySpecificChartForWeek = function( data ){ jQuery( '#tm_indicator_chart_display' ).css( 'display', 'block' ); - console.log( response.data ); -} + var data_work_time = []; + var data_day_time = []; + var data_day = []; + var data_color = [ "#800000", "#9A6324","#808000","#469990","#000075", "#e6194B", "#f58231" ] + var data_time_work = []; + var data_point_id_work_ = []; + + for( var i = 0; i < data.length; i++ ){ + data_work_time.push( data[i]['duree_travail'] ); + data_day_time.push( data[i]['duree_journée'] ); + data_day.push( new Date( data[ i ][ 'jour' ] ).toLocaleDateString() ); + + if( data[ i ][ 'tache_effectue' ] != undefined && data[ i ][ 'tache_effectue' ].length > 0 ){ + for (var v = 0; v < data[ i ][ 'tache_effectue' ].length; v++) { + var point_already_create = false; + + for( var x = 0; x < data_point_id_work_.length; x++ ){ + if( data_point_id_work_[ x ] == data[ i ][ 'tache_effectue' ][ v ][ 'point_id' ] ){ + data_time_work[ x ] = data_time_work[ x ] + data[ i ][ 'tache_effectue' ][ v ][ 'duree' ]; + point_already_create = true; + break; + } + } + if( ! point_already_create ){ + data_point_id_work_.push( data[ i ][ 'tache_effectue' ][ v ][ 'point_id' ] ); + data_time_work.push( data[ i ][ 'tache_effectue' ][ v ][ 'duree' ] ); + } + } + } + } + data_time_work.push( 0 ); // Pour l'affichage un bel affichage canvas, en ajoutant un 0 à la fin + + jQuery( "#displaycanvas_specific_week" ).append( '
    ' ); + var canvasbar = document.getElementById( "tm_indicator_canvasbar_week" ).getContext('2d'); + + var data_canvas_bar = { + labels: data_day, + datasets: [{ + label: window.indicatorString.time_work,//window.indicator.time_work, + backgroundColor: "#3e95cd", + data: data_work_time, + borderWidth: 1 + }, { + label: window.indicatorString.time_day,//window.indicator.time_day, + backgroundColor: "#8e5ea2", + data: data_day_time, + borderWidth: 1 + }] + }; + + var options_canvas_bar = { + plugins: { + labels: { + render: 'label' + } + }, + legend: { display: true }, + title: { + display: true, + text: window.indicatorString.from + ' ' + data[ 0 ]['jour'] + ' ' + window.indicatorString.to + ' ' + data[ data.length - 1 ]['jour'] + }, + scales: { + yAxes: [{ + ticks: { + beginAtZero: true + } + }] + } + }; + + window.eoxiaJS.taskManager.indicator.generateCanvasDynamic( canvasbar, 'bar', data_canvas_bar, options_canvas_bar ); + +// - - - - - + + var canvasdonut = document.getElementById( "tm_indicator_canvasdoghnut_week" ).getContext('2d'); + + var data_canvas_donut = { + labels: data_point_id_work_, + datasets: [ + { + label: window.indicatorString.planning, + backgroundColor: ["#800000", "#9A6324","#808000","#469990","#000075", "#e6194B", "#f58231", "#ffe119", "#bfef45", "#3cb44b", "#42d4f4", "#4363d8", "#911eb4", "#f032e6", "#a9a9a9", "#fabebe", "#ffd8b1", "#fffac8", "#aaffc3", "#e6beff"], + data: data_time_work, + } + ] + }; + + var options_canvas_donut = { + title: { + display: true, + text: window.indicatorString.plan_week + } + }; + + window.eoxiaJS.taskManager.indicator.generateCanvasDynamic( canvasdonut, 'doughnut', data_canvas_donut, options_canvas_donut ); +} + +/** + * Modifie l'affichage des boutons lors de la sélection 'semaine' + * Et modifie l'affichage des canvas + * @param {[type]} triggeredElement [ ] + * @param {[type]} response [ ] + * + * @since 1.9.0 - BETA + */ window.eoxiaJS.taskManager.indicator.modifyTypeChart = function( triggeredElement, response ) { var chart_selected = jQuery( this ).attr( "data-chart-type" ); @@ -1358,17 +1520,172 @@ window.eoxiaJS.taskManager.indicator.modifyTypeChart = function( triggeredElemen if( chart_selected != data_chart_display ){ // on change d'affichage if( chart_selected == 'bar' ){ - jQuery( '#tm_indicator_chart_bar' ).addClass( 'button-disabled' ); - jQuery( '#tm_indicator_chart_horizontalBar' ).removeClass( 'button-disabled' ); + + jQuery( '#tm_indicator_chart_bar' ).removeClass( 'button-grey' ); + jQuery( '#tm_indicator_chart_horizontalBar' ).addClass( 'button-grey' ); jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display", "bar" ); + jQuery( '#displaycanvas' ).css( "display", "none" ); + jQuery( '#displaycanvas_specific_week' ).css( "display", "block" ); }else{ - jQuery( '#tm_indicator_chart_horizontalBar' ).addClass( 'button-disabled' ); - jQuery( '#tm_indicator_chart_bar' ).removeClass( 'button-disabled' ); + + jQuery( '#tm_indicator_chart_horizontalBar' ).removeClass( 'button-grey' ); + jQuery( '#tm_indicator_chart_bar' ).addClass( 'button-grey' ); jQuery( '#tm_indicator_chart_display' ).attr( "data-chart-display", "horizontalBar" ); + jQuery( '#displaycanvas' ).css( "display", "block" ); + jQuery( '#displaycanvas_specific_week' ).css( "display", "none" ); } } +}; +/** + * Sélectionne un utilisateur par défaut, si aucun n'a était choisis. + * Ici l'utilisateur actuel est pris en compte; + * @param {[type]} user_select [Utilisateur sélectionné ] // null si aucun + * @param {[type]} user_id [id de l'utilisateur actuel] + * + * @since 1.9.0 - BETA + */ +window.eoxiaJS.taskManager.indicator.isSelectOneUser = function( user_select, user_id ){ + if( ! user_select ){ + window.eoxiaJS.taskManager.indicator.addFollower( null, user_id ); + } }; + +/** + * [Créer le contenu du modal : + * => Génération du tableau + * => Génération de l'explication de chaque point (il suffirat de display block pour l'affichage)] + * @param {[type]} num_modal [Numéro du modal, chacun modal représente un canvas doghnut ] + * @param {[type]} data [toutes les données récupérés par le php => Liste des jours => liste des taches effectués] + * + * @since 1.9.0 - BETA + */ +window.eoxiaJS.taskManager.indicator.generateModalContent = function ( num_modal, data ){ + + if( ! jQuery( '#tm_indicator_modal_active_canvas .modal-container' ).data()[ 'update' ] ){ + + jQuery( '#tm_indicator_modal_active_canvas .modal-container' ).data('update', 'true' ); + + var oldwidth = jQuery( '#tm_indicator_modal_active_canvas .modal-container' ).css('max-width'); + var oldheight = jQuery( '#tm_indicator_modal_active_canvas .modal-container' ).css('max-height'); + + oldwidth = parseInt( oldwidth ) * 1.5; + oldheight = parseInt( oldheight ) * 1.5; + + jQuery( '#tm_indicator_modal_active_canvas .modal-container' ).css('max-width', oldwidth + 'px' ); + jQuery( '#tm_indicator_modal_active_canvas .modal-container' ).css('max-height', oldheight + 'px' ); + + } + + + jQuery( '#tm_indicator_day_taches' ).html( data['jour'] ); + + jQuery( '#display_modal' ).append( ''); + var array_top = ''; + var array_content = ''; + var block_text = ''; + + for( var i = 0; i < data['tache_effectue'].length; i++ ){ + var withoutbackline = '//gi'; + + var task_title = data[ 'tache_effectue' ][ i ][ 'tache_title' ]; + if( task_title.length > 40 ){ + task_title = task_title.substring( 0, 40 ) + ' ...'; + } + task_title = task_title.replace(/(
    )*/g,""); + + var point_title = data['tache_effectue'][ i ]['point_title']; + if( point_title.length > 20 ){ + point_title = point_title.substring( 0, 20 ) + ' ...'; + } + point_title = point_title.replace(/(
    )*/g,""); + + + var array_content = array_content + '
    '; + + + var block_task_date = '

    ' + data[ 'tache_effectue' ][ i ][ 'com_date' ] + '

    '; + var block_task_time = '

    ' + data[ 'tache_effectue' ][ i ][ 'duree' ] + ' minutes

    '; + var block_task_title = '

    ' + data[ 'tache_effectue' ][ i ][ 'tache_title' ] +'

    ( #' + data[ 'tache_effectue' ][ i ][ 'tache_id' ] + ' )'; + var block_text_point = '

    ' + data[ 'tache_effectue' ][ i ][ 'point_title' ] +'


    ( #' + data[ 'tache_effectue' ][ i ][ 'point_id' ] + ' )'; + + var block_text_com = ''; + var num_commentary = 0; + for( var t = data[ 'tache_effectue' ][ i ][ 'commentary' ].length - 1; t > -1 ; t-- ){ + var num_commentary = num_commentary + 1; + var block_text_com = block_text_com + '

    ' + num_commentary + '.

    ' + data[ 'tache_effectue' ][ i ][ 'commentary' ][ t ][ 'com_time' ] +' minutes


    ' + data[ 'tache_effectue' ][ i ][ 'commentary' ][ t ][ 'com_title' ] +'

    ( #' + data[ 'tache_effectue' ][ i ][ 'commentary' ][ t ][ 'com_id' ] + ' )
    '; + if( num_commentary > 10 ){ + return; + } + } + + var block_text_content = '

    ' + block_task_date + block_task_time + block_task_title + '
    ' + '
    ' + block_text_point + '
    '+ block_text_com; + + var block_text = block_text + ''; + } + + var array_bot = '
    IDTache TITLEPoint TITLEDuree
    ' + data['tache_effectue'][ i ]['point_id'] + '' + task_title + '' + point_title + '' + data['tache_effectue'][ i ]['duree'] + '
    '; + var array_full = array_top + array_content + array_bot + block_text; + jQuery( '#tm_indicator_modal_block' + num_modal).append( array_full ); +} + +/** + * Affiche tous les points du canvas ciblé (display block le modal généré à l'avance) + * Cette fonction est lancé lorsque l'utilisateur clic sur un canvas + * @param {[type]} numline [position de l'element cliqué dans le tableau principal] // peut etre null si l'utilisateur clic dans le vide + * @param {[type]} divcanvas [div de la canvas] + * + * @since 1.9.0 - BETA + */ +window.eoxiaJS.taskManager.indicator.displayAllPoint = function( numline, divcanvas ){ + + jQuery( '#display_modal' ).children().css( 'display', 'none' ); + var chart_selected = jQuery( divcanvas ).attr( "data-canvas-focus" ); + jQuery( '#displaycanvas_modal' ).css( 'display', 'block' ); + + jQuery( '#tm_indicator_modal_block' + chart_selected ).css( 'display' ,'block' ); + + jQuery( '#tm_indicator_modal_active_canvas' ).addClass( 'modal-active' ); + + jQuery( '#tm_indicator_table_' + chart_selected + '_' ).children().css( 'backgroundColor', '' ); + + var divmodal = jQuery( '#tm_indicator_modal_block' + chart_selected ).children().not('.wpeo-table'); + divmodal.css( 'display' , 'none' ); + + if( numline != -1 ){ + + jQuery( '#tm_indicator_task_' + chart_selected + '_' + numline ).css( 'backgroundColor', 'grey' ); + var data_attribute = jQuery( '#tm_indicator_task_' + chart_selected + '_' + numline ).data(); + var data_attribute_pointid = data_attribute[ 'tmindicatorpointid' ]; + jQuery( '#tm_indicator_point_' + data_attribute_pointid + '_' + chart_selected ).css( 'display', 'block' ); + } +} + +/** + * Affiche la div relié au point ciblé (sur le tableau) + * + * @param {[type]} event [ ] + * + * @since 1.9.0 - BETA + */ +window.eoxiaJS.taskManager.indicator.displayThisPoint = function( event ){ + + var data_attribute = jQuery( this ).data(); + var data_attribute_pointid = data_attribute[ 'tmindicatorpointid' ]; + + + var divtable = jQuery( this ).parent(); + divtable.children().css( "backgroundColor", '' ); + jQuery( this ).css( 'backgroundColor', 'grey' ); + + num_modal = divtable.data()[ 'chartselect' ]; + var divindicatormodal = jQuery( '#tm_indicator_point_' + data_attribute_pointid + '_' + num_modal ).parent(); + var divmodal = divindicatormodal.children().not('.wpeo-table'); + divmodal.css( 'display' , 'none' ); + + jQuery( '#tm_indicator_point_' + data_attribute_pointid + '_' + num_modal ).css( 'display', 'block' ); + + } /** * Initialise l'objet "point" ainsi que la méthode "navigation" obligatoire pour la bibliothèque EoxiaJS. @@ -2063,12 +2380,12 @@ window.eoxiaJS.taskManager.point.loadedPoint = function( triggeredElement, respo window.eoxiaJS.taskManager.point.undisplayPoint = function( event ) { var pointState = jQuery( this ).attr( 'data-point-state' ); // event.preventDefault(); - + jQuery( this ).removeClass( 'active' ).addClass( 'action-input' ); - + var points = this.closest( '.wpeo-project-task-container' ).querySelectorAll( '.points .point.edit[data-point-state="' + pointState + '"]' ); - for (var key in points) { - points[key].remove(); + for( var i = 0; i < points.length; i ++ ){ + points[i].remove(); } // jQuery( this ).closest( '.wpeo-project-task-container' ).find( '.points .point.edit[data-point-state="' + pointState + '"]' ).remove(); }; diff --git a/core/assets/js/frontend.min.js b/core/assets/js/frontend.min.js index a7bdebfa..4b23c3b7 100644 --- a/core/assets/js/frontend.min.js +++ b/core/assets/js/frontend.min.js @@ -75,172 +75,6 @@ window.eoxiaJS.taskManagerFrontend.activity.loadedLastActivity = function( trigg window.eoxiaJS.refresh(); }; -/** - * Initialise l'objet "comment" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. - * - * @since 1.0.0 - * @version 1.6.0 - */ -window.eoxiaJS.taskManagerFrontend.comment = {}; - -/** - * La méthode obligatoire pour la biblotèque EoxiaJS. - * - * @return {void} - * - * @since 1.0.0 - * @version 1.0.0 - */ -window.eoxiaJS.taskManagerFrontend.comment.init = function() { - window.eoxiaJS.taskManagerFrontend.comment.event(); -}; - -/** - * Initialise tous les évènements liés au comment de Task Manager. - * - * @return {void} - * - * @since 1.0.0 - * @version 1.5.0 - */ -window.eoxiaJS.taskManagerFrontend.comment.event = function() { - jQuery( document ).on( 'keyup', '.comment div[contenteditable="true"], .comment input[name="time"]', window.eoxiaJS.taskManagerFrontend.comment.triggerCreate ); - jQuery( document ).on( 'blur keyup paste keydown click', '.comments .comment .content', window.eoxiaJS.taskManagerFrontend.comment.updateHiddenInput ); - jQuery( document ).on( 'click', '.point.edit .point-container', window.eoxiaJS.taskManagerFrontend.comment.loadComments ); -}; - -/** - * Fermes les points.active ainsi que leurs commentaires - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManagerFrontend.comment.closePoint = function( event ) { - jQuery( '.point.active' ).removeClass( 'active' ); - if ( jQuery( 'div.point' ).find( '.comments' ).is( ':visible' ) ) { - jQuery( 'div.point .comments:visible' ).slideUp( 400, function() { - window.eoxiaJS.refresh(); - } ); - } -}; - -/** - * Stop propagation afin d'éviter la fermeture du point. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return {void} - */ -window.eoxiaJS.taskManagerFrontend.comment.preventClosePoint = function( event ) { - event.stopPropagation(); -}; - -window.eoxiaJS.taskManagerFrontend.comment.triggerCreate = function( event ) { - if ( event.ctrlKey && 13 === event.keyCode ) { - jQuery( this ).closest( '.comment' ).find( '.action-input' ).click(); - } -}; - -/** - * Met à jour le champ caché contenant le texte du comment écris dans la div "contenteditable". - * - * @param {MouseEvent} event L'évènement de la souris lors de l'action. - * @return {void} - * - * @since 1.0.0 - * @version 1.6.0 - */ -window.eoxiaJS.taskManagerFrontend.comment.updateHiddenInput = function( event ) { - if ( 0 < jQuery( this ).text().length ) { - jQuery( this ).closest( '.comment' ).find( '.placeholder' ).addClass( 'hidden' ); - jQuery( this ).closest( '.comment' ).removeClass( 'add' ).addClass( 'edit' ); - // window.eoxiaJS.taskManagerFrontend.core.initSafeExit( true ); - } else { - jQuery( this ).closest( '.comment' ).find( '.placeholder' ).removeClass( 'hidden' ); - jQuery( this ).closest( '.comment' ).removeClass( 'edit' ).addClass( 'add' ); - // window.eoxiaJS.taskManagerFrontend.core.initSafeExit( false ); - } - - jQuery( this ).closest( '.comment' ).find( 'input[name="content"]' ).val( jQuery( this ).html() ); - - window.eoxiaJS.refresh(); -}; - -/** - * Charges les commentaires au clic sur le content editable. - * - * @param {MouseEvent} event L'évènement du clic - * @return {void} - * - * @since 1.3.6.0 - * @version 1.3.6.0 - */ -window.eoxiaJS.taskManagerFrontend.comment.loadComments = function( event ) { - var data = {}; - - data.action = 'load_comments'; - data.task_id = jQuery( this ).closest( '.wpeo-project-task' ).data( 'id' ); - data.point_id = jQuery( this ).closest( '.point' ).data( 'id' ); - data.frontend = true; - - if ( ! jQuery( this ).closest( 'div.point' ).find( '.comments' ).is( ':visible' ) ) { - jQuery( 'div.point .comments:visible' ).slideUp( 400, function() { - window.eoxiaJS.refresh(); - } ); - - window.eoxiaJS.loader.display( jQuery( this ) ); - window.eoxiaJS.request.send( jQuery( this ), data ); - } -}; - -/** - * Le callback en cas de réussite à la requête Ajax "load_comments". - * Met le contenu dans la div.comments. - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - * @since 1.0.0.0 - * @version 1.0.0.0 - */ -window.eoxiaJS.taskManagerFrontend.comment.loadedCommentsSuccess = function( triggeredElement, response ) { - jQuery( triggeredElement ).closest( 'div.point' ).find( '.comments' ).html( response.data.view ); - - triggeredElement.removeClass( 'loading' ); - triggeredElement.closest( 'div.point' ).find( '.comments' ).slideDown( 400, function() { - window.eoxiaJS.refresh(); - } ); -}; - -/** - * Le callback en cas de réussite à la requête Ajax "edit_comment". - * Met le contenu dans la div.comments. - * - * @since 1.0.0 - * @version 1.5.0 - * - * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. - * @param {Object} response Les données renvoyées par la requête Ajax. - * @return {void} - * - */ -window.eoxiaJS.taskManagerFrontend.comment.addedCommentSuccess = function( triggeredElement, response ) { - triggeredElement.closest( '.comment' ).find( 'div.content' ).html( '' ); - - triggeredElement.closest( '.wpeo-project-task' ).find( '.wpeo-task-time-info .elapsed' ).text( response.data.time.task ); - triggeredElement.closest( '.comments' ).prev( '.form' ).find( '.wpeo-time-in-point' ).text( response.data.time.point ); - - triggeredElement.closest( 'div.point' ).find( '.comments' ).html( response.data.view ); - - jQuery( '.wpeo-project-task[data-id="' + response.data.comment.post_id + '"] .point[data-id="' + response.data.comment.parent_id + '"] .comment.new div.content' ).focus(); - - window.eoxiaJS.refresh(); - window.eoxiaJS.taskManagerFrontend.core.initSafeExit( false ); -}; /** * Initialise l'objet "point" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. * @@ -441,3 +275,170 @@ window.eoxiaJS.taskManagerFrontend.task.init = function() { window.eoxiaJS.taskManagerFrontend.task.refresh = function() { }; + +/** + * Initialise l'objet "comment" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. + * + * @since 1.0.0 + * @version 1.6.0 + */ +window.eoxiaJS.taskManagerFrontend.comment = {}; + +/** + * La méthode obligatoire pour la biblotèque EoxiaJS. + * + * @return {void} + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.eoxiaJS.taskManagerFrontend.comment.init = function() { + window.eoxiaJS.taskManagerFrontend.comment.event(); +}; + +/** + * Initialise tous les évènements liés au comment de Task Manager. + * + * @return {void} + * + * @since 1.0.0 + * @version 1.5.0 + */ +window.eoxiaJS.taskManagerFrontend.comment.event = function() { + jQuery( document ).on( 'keyup', '.comment div[contenteditable="true"], .comment input[name="time"]', window.eoxiaJS.taskManagerFrontend.comment.triggerCreate ); + jQuery( document ).on( 'blur keyup paste keydown click', '.comments .comment .content', window.eoxiaJS.taskManagerFrontend.comment.updateHiddenInput ); + jQuery( document ).on( 'click', '.point.edit .point-container', window.eoxiaJS.taskManagerFrontend.comment.loadComments ); +}; + +/** + * Fermes les points.active ainsi que leurs commentaires + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManagerFrontend.comment.closePoint = function( event ) { + jQuery( '.point.active' ).removeClass( 'active' ); + if ( jQuery( 'div.point' ).find( '.comments' ).is( ':visible' ) ) { + jQuery( 'div.point .comments:visible' ).slideUp( 400, function() { + window.eoxiaJS.refresh(); + } ); + } +}; + +/** + * Stop propagation afin d'éviter la fermeture du point. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return {void} + */ +window.eoxiaJS.taskManagerFrontend.comment.preventClosePoint = function( event ) { + event.stopPropagation(); +}; + +window.eoxiaJS.taskManagerFrontend.comment.triggerCreate = function( event ) { + if ( event.ctrlKey && 13 === event.keyCode ) { + jQuery( this ).closest( '.comment' ).find( '.action-input' ).click(); + } +}; + +/** + * Met à jour le champ caché contenant le texte du comment écris dans la div "contenteditable". + * + * @param {MouseEvent} event L'évènement de la souris lors de l'action. + * @return {void} + * + * @since 1.0.0 + * @version 1.6.0 + */ +window.eoxiaJS.taskManagerFrontend.comment.updateHiddenInput = function( event ) { + if ( 0 < jQuery( this ).text().length ) { + jQuery( this ).closest( '.comment' ).find( '.placeholder' ).addClass( 'hidden' ); + jQuery( this ).closest( '.comment' ).removeClass( 'add' ).addClass( 'edit' ); + // window.eoxiaJS.taskManagerFrontend.core.initSafeExit( true ); + } else { + jQuery( this ).closest( '.comment' ).find( '.placeholder' ).removeClass( 'hidden' ); + jQuery( this ).closest( '.comment' ).removeClass( 'edit' ).addClass( 'add' ); + // window.eoxiaJS.taskManagerFrontend.core.initSafeExit( false ); + } + + jQuery( this ).closest( '.comment' ).find( 'input[name="content"]' ).val( jQuery( this ).html() ); + + window.eoxiaJS.refresh(); +}; + +/** + * Charges les commentaires au clic sur le content editable. + * + * @param {MouseEvent} event L'évènement du clic + * @return {void} + * + * @since 1.3.6.0 + * @version 1.3.6.0 + */ +window.eoxiaJS.taskManagerFrontend.comment.loadComments = function( event ) { + var data = {}; + + data.action = 'load_comments'; + data.task_id = jQuery( this ).closest( '.wpeo-project-task' ).data( 'id' ); + data.point_id = jQuery( this ).closest( '.point' ).data( 'id' ); + data.frontend = true; + + if ( ! jQuery( this ).closest( 'div.point' ).find( '.comments' ).is( ':visible' ) ) { + jQuery( 'div.point .comments:visible' ).slideUp( 400, function() { + window.eoxiaJS.refresh(); + } ); + + window.eoxiaJS.loader.display( jQuery( this ) ); + window.eoxiaJS.request.send( jQuery( this ), data ); + } +}; + +/** + * Le callback en cas de réussite à la requête Ajax "load_comments". + * Met le contenu dans la div.comments. + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + * @since 1.0.0.0 + * @version 1.0.0.0 + */ +window.eoxiaJS.taskManagerFrontend.comment.loadedCommentsSuccess = function( triggeredElement, response ) { + jQuery( triggeredElement ).closest( 'div.point' ).find( '.comments' ).html( response.data.view ); + + triggeredElement.removeClass( 'loading' ); + triggeredElement.closest( 'div.point' ).find( '.comments' ).slideDown( 400, function() { + window.eoxiaJS.refresh(); + } ); +}; + +/** + * Le callback en cas de réussite à la requête Ajax "edit_comment". + * Met le contenu dans la div.comments. + * + * @since 1.0.0 + * @version 1.5.0 + * + * @param {HTMLDivElement} triggeredElement L'élement HTML déclenchant la requête Ajax. + * @param {Object} response Les données renvoyées par la requête Ajax. + * @return {void} + * + */ +window.eoxiaJS.taskManagerFrontend.comment.addedCommentSuccess = function( triggeredElement, response ) { + triggeredElement.closest( '.comment' ).find( 'div.content' ).html( '' ); + + triggeredElement.closest( '.wpeo-project-task' ).find( '.wpeo-task-time-info .elapsed' ).text( response.data.time.task ); + triggeredElement.closest( '.comments' ).prev( '.form' ).find( '.wpeo-time-in-point' ).text( response.data.time.point ); + + triggeredElement.closest( 'div.point' ).find( '.comments' ).html( response.data.view ); + + jQuery( '.wpeo-project-task[data-id="' + response.data.comment.post_id + '"] .point[data-id="' + response.data.comment.parent_id + '"] .comment.new div.content' ).focus(); + + window.eoxiaJS.refresh(); + window.eoxiaJS.taskManagerFrontend.core.initSafeExit( false ); +}; \ No newline at end of file diff --git a/core/assets/language/task-manager-fr_FR.mo b/core/assets/language/task-manager-fr_FR.mo index d51ce0b703ee54495a3dc6ac805dbb69e749c4a9..faaed301cb21bb611d9e06f4138fc547a1868801 100644 GIT binary patch delta 5499 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 delta 5376 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 diff --git a/core/assets/language/task-manager-fr_FR.po b/core/assets/language/task-manager-fr_FR.po index 23da6bb9..25ab5bc0 100644 --- a/core/assets/language/task-manager-fr_FR.po +++ b/core/assets/language/task-manager-fr_FR.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: WPProject\n" -"POT-Creation-Date: 2019-01-10 17:58+0100\n" -"PO-Revision-Date: 2019-01-10 18:03+0100\n" +"POT-Creation-Date: 2019-01-24 17:03+0100\n" +"PO-Revision-Date: 2019-01-24 17:03+0100\n" "Last-Translator: Equipe de développement de digirisk \n" "Language-Team: Eoxia\n" "Language: fr_FR\n" @@ -66,18 +66,32 @@ msgstr "" "Aucune données, configurer votre emplois du temps dans vos réglages " "utilisateur" -#: core/action/task_manager.action.php:137 +#: core/action/task_manager.action.php:109 +#: module/follower/view/backend/user-profile-planning.view.php:128 +#: module/follower/view/backend/user-profile-planning.view.php:131 +msgid "From" +msgstr "A partir de" + +#: core/action/task_manager.action.php:110 +msgid "to" +msgstr "au" + +#: core/action/task_manager.action.php:111 +msgid "Stats of the week" +msgstr "Recap de la semaine" + +#: core/action/task_manager.action.php:140 #: module/comment/view/backend/comment.view.php:52 msgid "Delete this comment ?" msgstr "Voulez vous supprimer ce commentaire ?" -#: core/action/task_manager.action.php:181 +#: core/action/task_manager.action.php:184 #: module/import/view/backend/import-textarea.view.php:20 #: module/task/action/task.action.php:455 msgid "Task" msgstr "Tâche" -#: core/action/task_manager.action.php:182 +#: core/action/task_manager.action.php:185 msgid "Customer" msgstr "Client" @@ -116,7 +130,7 @@ msgstr "Importer" msgid "Cancel" msgstr "Annuler" -#: module/activity/view/backend/list.view.php:64 +#: module/activity/view/backend/list.view.php:72 msgid "End of history" msgstr "Fin de l'historique" @@ -156,6 +170,7 @@ msgstr "Date de début" #: module/activity/view/backend/main.view.php:32 #: module/activity/view/backend/main.view.php:34 #: module/activity/view/backend/post-last-activity.view.php:34 +#: module/indicator/view/backend-indicator/indicator-main.view.php:22 #: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:32 #: module/indicator/view/backend/daily-activity.view.php:44 #: module/time-exceeded/view/backend/main.view.php:30 @@ -167,8 +182,8 @@ msgstr "Date de fin" msgid "View activity" msgstr "Voir l'activité" -#: module/activity/view/backend/post-last-activity.view.php:110 -#: module/indicator/view/backend/daily-activity.view.php:120 +#: module/activity/view/backend/post-last-activity.view.php:114 +#: module/indicator/view/backend/daily-activity.view.php:124 msgid "No activity found for now" msgstr "Pas d'activité trouvé pour le moment." @@ -263,7 +278,7 @@ msgstr "Exporter" msgid "Export content" msgstr "Votre export" -#: module/follower/class/follower.class.php:49 +#: module/follower/class/follower.class.php:59 msgid "My tasks" msgstr "Mes tâches" @@ -314,11 +329,6 @@ msgstr "Dimanche" msgid "To" msgstr "jusqu'à" -#: module/follower/view/backend/user-profile-planning.view.php:128 -#: module/follower/view/backend/user-profile-planning.view.php:131 -msgid "From" -msgstr "A partir de" - #: module/follower/view/backend/user-profile-planning.view.php:130 msgid "To now" msgstr "jusqu'à aujourd'hui" @@ -439,47 +449,47 @@ msgstr "Import de points depuis un fichier texte dans la tâche : %s" msgid "Point" msgstr "Point" -#: module/indicator/action/indicator.action.php:56 -#: module/indicator/action/indicator.action.php:58 +#: module/indicator/action/indicator.action.php:57 +#: module/indicator/action/indicator.action.php:59 #: module/indicator/view/backend/main.view.php:19 msgid "Indicator" msgstr "Indicateur" -#: module/indicator/action/indicator.action.php:57 +#: module/indicator/action/indicator.action.php:58 msgid "Daily activity" msgstr "Activité" -#: module/indicator/action/indicator.action.php:219 +#: module/indicator/action/indicator.action.php:239 #, php-format msgid "" "Given comment identifier does not correspond to a comment in task manager. " "Request id: %s" msgstr "" -#: module/indicator/action/indicator.action.php:225 +#: module/indicator/action/indicator.action.php:246 #, php-format msgid "" "The comment author role does not allowed support request. Request customer " "id: %d1$. Customer roles: %2$s" msgstr "" -#: module/indicator/action/indicator.action.php:230 -#: module/indicator/class/indicator.class.php:124 +#: module/indicator/action/indicator.action.php:252 +#: module/indicator/class/indicator.class.php:174 #, php-format msgid "Current support request list: %s" msgstr "" -#: module/indicator/action/indicator.action.php:231 +#: module/indicator/action/indicator.action.php:255 #, php-format msgid "Comment for adding in request %s" msgstr "" -#: module/indicator/action/indicator.action.php:248 +#: module/indicator/action/indicator.action.php:273 #, php-format msgid "New support ticket list: %s" msgstr "" -#: module/indicator/class/indicator.class.php:125 +#: module/indicator/class/indicator.class.php:177 #, php-format msgid "Comment for removing in request %s" msgstr "" @@ -488,20 +498,24 @@ msgstr "" msgid "Validate" msgstr "Valider" -#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:64 +#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:69 msgid "Day" msgstr "Jour" -#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:72 +#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:77 #: module/timeline/view/backend/week.view.php:12 msgid "Week" msgstr "Semaine" -#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:80 +#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:85 msgid "Month" msgstr "Mois" -#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:97 +#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:117 +msgid "Liste des points" +msgstr "Liste des points" + +#: module/indicator/view/backend-indicator/indicator-metabox-main.view.php:140 msgid "Change your settings here" msgstr "Modifié vos paramètres ici" @@ -517,11 +531,11 @@ msgstr "Toutes" msgid "Which customer" msgstr "Quel client" -#: module/indicator/view/backend/item.view.php:76 +#: module/indicator/view/backend/item.view.php:79 msgid "Mark as READ" msgstr "Marquer comme lu" -#: module/indicator/view/backend/request.view.php:45 +#: module/indicator/view/backend/request.view.php:50 msgid "No pending requests" msgstr "Pas de demande en attente" @@ -1324,9 +1338,6 @@ msgstr "%1$d tâches ont été marquées comme archivées sur %2$d" #~ msgid " archived tasks" #~ msgstr "Tâches archivées" -#~ msgid "Completed points" -#~ msgstr "Points completés" - #~ msgid "New task%1$s" #~ msgstr "Nouvelle tâche%1$s" @@ -1543,9 +1554,6 @@ msgstr "%1$d tâches ont été marquées comme archivées sur %2$d" #~ msgid "Move" #~ msgstr "Déplacer" -#~ msgid "Creator of the task" -#~ msgstr "Créateur de la tâche" - #~ msgid "Task properties: #" #~ msgstr "Propriété de la tâche: #" diff --git a/module/activity/action/class-activity-action.php b/module/activity/action/class-activity-action.php index 8bfb91bd..ac89bcb2 100644 --- a/module/activity/action/class-activity-action.php +++ b/module/activity/action/class-activity-action.php @@ -2,11 +2,11 @@ /** * Les actions relatives aux activitées. * - * @author Eoxia - * @since 1.5.0 - * @version 1.6.0 + * @author Eoxia + * @since 1.5.0 + * @version 1.6.0 * @copyright 2015-2018 Eoxia - * @package Task_Manager + * @package Task_Manager */ namespace task_manager; @@ -20,33 +20,31 @@ */ class Activity_Action { + /** * Initialise les actions liées aux activitées. * - * @since 1.5.0 + * @since 1.5.0 * @version 1.6.0 */ public function __construct() { add_action( 'wp_ajax_load_last_activity', array( $this, 'callback_load_last_activity' ) ); - add_action( 'wp_ajax_open_popup_user_activity', array( $this, 'load_customer_activity' ) ); + add_action( 'wp_ajax_open_popup_user_activity', array( $this, 'load_activity_customer' ) ); add_action( 'wp_ajax_open_popup_user_chart', array( $this, 'callback_open_popup_user_chart' ) ); add_action( 'wp_ajax_export_activity', array( $this, 'callback_export_activity' ) ); add_action( 'wp_ajax_validate_indicator', array( $this, 'callback_validate_indicator' ) ); - - //add_action( 'admin_init', array( $this, 'callback_update_db_planning' ) ); } /** * Charges les évènements liés à la tâche puis renvoie la vue. * - * @since 1.5.0 + * @since 1.5.0 * @version 1.6.0 * * @return void */ public function callback_load_last_activity() { - // check_ajax_referer( 'load_last_activity' ); - + // @comment check_ajax_referer( 'load_last_activity' ); $tasks_id = ! empty( $_POST['tasks_id'] ) ? sanitize_text_field( $_POST['tasks_id'] ) : ''; $task_id = $tasks_id; $offset = ! empty( $_POST['offset'] ) ? ( (int) $_POST['offset'] + \eoxia\Config_Util::$init['task-manager']->activity->activity_per_page ) : 0; @@ -68,90 +66,117 @@ public function callback_load_last_activity() { // On récupère les éléments pour lesquels il faut afficher l'historique. if ( empty( $tasks_id ) ) { - $tasks = Task_Class::g()->get_tasks( array( - 'posts_per_page' => \eoxia\Config_Util::$init['task-manager']->task->posts_per_page, - 'categories_id' => $categories_id_selected, - 'term' => $term, - 'users_id' => $follower_id_selected, - ) ); - - $tasks_id = array_map( function( $e ) { - return $e->data['id']; - }, $tasks ); + $tasks = Task_Class::g()->get_tasks( + array( + 'posts_per_page' => \eoxia\Config_Util::$init['task-manager']->task->posts_per_page, + 'categories_id' => $categories_id_selected, + 'term' => $term, + 'users_id' => $follower_id_selected, + ) + ); + + $tasks_id = array_map( + function ( $e ) { + return $e->data['id']; + }, + $tasks + ); } else { $tasks_id = explode( ',', $tasks_id ); } - $datas = Activity_Class::g()->get_activity( $tasks_id, 0, $date_start, $date_end ); + $datas = Activity_Class::g()->getActivity( $tasks_id, 0, $date_start, $date_end ); ob_start(); if ( ! empty( $tasks_id ) ) { - \eoxia\View_Util::exec( 'task-manager', 'activity', 'backend/post-last-activity', array( - 'tasks_id' => implode( ',', $tasks_id ), - 'datas' => $datas, - 'date_start' => $date_start, - 'date_end' => $date_end, - ) ); + \eoxia\View_Util::exec( + 'task-manager', + 'activity', + 'backend/post-last-activity', + array( + 'tasks_id' => implode( ',', $tasks_id ), + 'datas' => $datas, + 'date_start' => $date_start, + 'date_end' => $date_end, + ) + ); } $view = ob_get_clean(); - wp_send_json_success( array( - 'namespace' => ! $frontend ? 'taskManager' : 'taskManagerFrontend', - 'module' => 'activity', - 'callback_success' => 'loadedLastActivity', - 'view' => $view, - 'offset' => $offset, - 'last_date' => $last_date, - 'buttons_view' => '', - ) ); + wp_send_json_success( + array( + 'namespace' => ! $frontend ? 'taskManager' : 'taskManagerFrontend', + 'module' => 'activity', + 'callback_success' => 'loadedLastActivity', + 'view' => $view, + 'offset' => $offset, + 'last_date' => $last_date, + 'buttons_view' => '', + ) + ); } /** * Load user activity by date * - * @since 1.5.0 + * @since 1.5.0 * @version 1.5.0 + * + * @return void */ - public function load_customer_activity() { + public function load_activity_customer() { check_ajax_referer( 'load_user_activity' ); + $frontend = true; + $offset = 0; + $last_date = ''; + $user_id = ! empty( $_POST['user_id_selected'] ) ? (int) $_POST['user_id_selected'] : 0; $customer_id = ! empty( $_POST['user']['customer_id'] ) ? (int) $_POST['user']['customer_id'] : 0; $date_end = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_end'] ) ? $_POST['tm_abu_date_end'] : current_time( 'Y-m-d' ); $date_start = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_start'] ) ? $_POST['tm_abu_date_start'] : current_time( 'Y-m-d' ); - $datas = Activity_Class::g()->display_user_activity_by_date( $user_id, $date_end, $date_start, $customer_id ); + $datas = Activity_Class::g()->display_user_activity_by_date( $user_id, $date_end, $date_start, $customer_id ); ob_start(); - \eoxia\View_Util::exec( 'task-manager', 'indicator', 'backend/daily-activity', array( - 'date_end' => $date_end, - 'date_start' => $date_start, - 'user_id' => $user_id, - 'customer_id' => $customer_id, - 'datas' => $datas - ) ); + \eoxia\View_Util::exec( + 'task-manager', + 'indicator', + 'backend/daily-activity', + array( + 'date_end' => $date_end, + 'date_start' => $date_start, + 'user_id' => $user_id, + 'customer_id' => $customer_id, + 'datas' => $datas, + ) + ); $view = ob_get_clean(); - wp_send_json_success( array( - 'namespace' => ! $frontend ? 'taskManager' : 'taskManagerFrontend', - 'module' => 'activity', - 'callback_success' => 'loadedLastActivity', - 'view' => $view, - 'offset' => $offset, - 'last_date' => $last_date, - 'buttons_view' => '', - ) ); + wp_send_json_success( + array( + 'namespace' => 'taskManager', + 'module' => 'activity', + 'callback_success' => 'loadedLastActivity', + 'view' => $view, + 'offset' => $offset, + 'last_date' => $last_date, + 'buttons_view' => '', + ) + ); } /** * Export au format CSV les activités d'une personne. * - * @since 1.7.1 + * @since 1.7.1 + * + * @return void */ public function callback_export_activity() { $user_id = ! empty( $_POST['user_id_selected'] ) ? (int) $_POST['user_id_selected'] : 0; $customer_id = ! empty( $_POST['user']['customer_id'] ) ? (int) $_POST['user']['customer_id'] : 0; - $date_end = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_start'] ) ? $_POST['tm_abu_date_start'] : current_time( 'Y-m-d' ); - $date_start = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_end'] ) ? $_POST['tm_abu_date_end'] : current_time( 'Y-m-d' ); + $date_end = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_start'] ) ? $_POST['tm_abu_date_start'] : current_time( 'Y-m-d' ); + $date_start = ! empty( $_POST ) && ! empty( $_POST['tm_abu_date_end'] ) ? $_POST['tm_abu_date_end'] : current_time( 'Y-m-d' ); $datas = Activity_Class::g()->display_user_activity_by_date( $user_id, $date_end, $date_start, $customer_id ); @@ -166,32 +191,36 @@ public function callback_export_activity() { $csv_file = fopen( $filepath, 'a' ); - fputcsv( $csv_file, array( - 'date' => 'Date du commentaire', - 'user' => 'Auteur du commentaire', - 'customer' => 'Client', - 'task' => 'Tâche', - 'point' => 'Point', - 'comment' => 'Contenu du commentaire', - 'time' => 'Temps passé (minutes)', - ), ',' ); + fputcsv( + $csv_file, + array( + 'date' => 'Date du commentaire', + 'user' => 'Auteur du commentaire', + 'customer' => 'Client', + 'task' => 'Tâche', + 'point' => 'Point', + 'comment' => 'Contenu du commentaire', + 'time' => 'Temps passé (minutes)', + ), + ',' + ); if ( ! empty( $datas ) ) { foreach ( $datas as $data ) { - $date = \eoxia\Date_Util::g()->fill_date( $data->COM_DATE ); - $com_details = ( ! empty( $data->COM_DETAILS ) ? json_decode( $data->COM_DETAILS ) : '' ); - $user_data = get_userdata( $data->COM_author_id ); + $date = \eoxia\Date_Util::g()->fill_date( $data->com_date ); + $com_details = ( ! empty( $data->com_details ) ? json_decode( $data->com_details ) : '' ); + $user_data = get_userdata( $data->com_author_id ); - $search = array( '
    ', ' ', '>', '"', '&', ''' ); + $search = array( '
    ', ' ', '>', '"', '&', ''' ); $replace = array( PHP_EOL, ' ', '>', '"', 'é', '\'' ); $data_to_export = array( 'date' => $date['date_time'], 'user' => $user_data->user_nicename, - 'customer' => $data->PT_title, - 'task' => '#' . $data->T_ID . ' - ' . str_replace( $search, $replace, $data->T_title ), - 'point' => '#' . $data->POINT_ID . ' - ' . str_replace( $search, $replace, $data->POINT_title ), - 'comment' => str_replace( $search, $replace, $data->COM_title ), + 'customer' => $data->pt_title, + 'task' => '#' . $data->t_id . ' - ' . str_replace( $search, $replace, $data->t_title ), + 'point' => '#' . $data->point_id . ' - ' . str_replace( $search, $replace, $data->point_title ), + 'comment' => str_replace( $search, $replace, $data->com_title ), 'time' => ! empty( $com_details->time_info->elapsed ) ? $com_details->time_info->elapsed : 0, ); @@ -201,82 +230,95 @@ public function callback_export_activity() { fclose( $csv_file ); - wp_send_json_success( array( - 'namespace' => 'taskManager', - 'module' => 'activity', - 'callback_success' => 'exportedActivity', - 'url_to_file' => $url_to_file, - 'filename' => $current_time . '_activity.csv', - ) ); + wp_send_json_success( + array( + 'namespace' => 'taskManager', + 'module' => 'activity', + 'callback_success' => 'exportedActivity', + 'url_to_file' => $url_to_file, + 'filename' => $current_time . '_activity.csv', + ) + ); } -/** - * [Récupere les données utilisateurs | Affiche les canvas] - * @since 1.8.0 - * @author Corentin Eoxia - **/ - public function callback_validate_indicator(){ + /** + * [Récupere les données utilisateurs | Affiche les canvas] + * + * @since 1.8.0 + * @author Corentin Eoxia + * + * @return void + **/ + public function callback_validate_indicator() { check_ajax_referer( 'validate_indicator' ); $list_follower = ! empty( $_POST['list_follower'] ) ? sanitize_text_field( $_POST['list_follower'] ) : ''; $date_end = ! empty( $_POST['tm_indicator_date_end'] ) ? $_POST['tm_indicator_date_end'] : current_time( 'Y-m-d' ); $date_start = ! empty( $_POST['tm_indicator_date_start'] ) ? $_POST['tm_indicator_date_start'] : current_time( 'Y-m-d' ); - $time = ! empty( $_POST['time'] ) ? $_POST['time'] : ''; - $customer_id = 0; + $time = ! empty( $_POST['time'] ) ? $_POST['time'] : ''; + $customer_id = 0; - $datatime = ''; - $date_gap = ''; - $joursaffichagedonut = 0; - $error = ''; + $datatime = ''; + $date_gap = ''; + $joursaffichagedonut = 0; + $error = ''; $display_specific_week = false; + $user_select = true; ob_start(); - if( $list_follower ){ + if ( ! $list_follower ) { // @info aucun utilisateur sélectionné + $list_follower = get_current_user_id(); + $user_select = false; + } - if( $time == 'day' ){ // Jour actuel - $date_start = current_time( 'Y-m-d' ); - $date_end = current_time( 'Y-m-d' ); - }else if( $time == 'week' ){ // Semaine actuelle - $date_start = date( 'Y-m-d', strtotime( 'monday this week' ) ); - $date_end = current_time( 'Y-m-d' ); - $display_specific_week = true; - }else if( $time == 'month' ){ // Mois actuelle - $date_start = date('Y-m-01'); - $date_end = current_time( 'Y-m-d' ); - }else{ + if ( 'day' == $time ) { // @info Jour actuel + $date_start = current_time( 'Y-m-d' ); + $date_end = current_time( 'Y-m-d' ); - } + } elseif ( 'week' == $time ) { // @info Semaine actuelle + $date_start = date( 'Y-m-d', strtotime( 'monday this week' ) ); + $date_end = current_time( 'Y-m-d' ); + $display_specific_week = true; - $datas = Activity_Class::g()->display_user_activity_by_date( $list_follower, $date_end, $date_start ); + } elseif ( 'month' == $time ) { // @info Mois actuelle + $date_start = date( 'Y-m-01' ); + $date_end = current_time( 'Y-m-d' ); - $data_charset = Activity_Class::g()->get_data_chart( $datas, $date_end, $date_start, $time, $list_follower, $display_specific_week ); + } else { - $datatime = $data_charset['datatime']; - $date_gap = $data_charset['date_gap']; - $date_start = $data_charset['date_start']; - $date_end = $data_charset['date_end']; + } - if( $date_gap == 0 ){ - $error = 'date_error'; - } - }else{ - $error = 'person_error'; + $datas = Activity_Class::g()->display_user_activity_by_date( $list_follower, $date_end, $date_start ); + + $data_charset = Activity_Class::g()->getDataChart( $datas, $list_follower, $date_end, $date_start, $time ); + + $datatime = $data_charset['datatime']; + $date_gap = $data_charset['date_gap']; + $date_start = $data_charset['date_start']; + $date_end = $data_charset['date_end']; + + if ( 0 === $date_gap || null === $date_gap ) { + $error = 'date_error'; } - wp_send_json_success( array( - 'namespace' => 'taskManager', - 'module' => 'indicator', - 'callback_success' => 'loadedCustomerActivity', - 'view' => ob_get_clean(), - 'object' => $datatime, - 'date_gap' => $date_gap, - 'date_start' => $date_start, - 'date_end' => $date_end, - 'jourdonut' => $joursaffichagedonut, - 'error' => $error, - 'display_specific_week' => $display_specific_week - ) ); + wp_send_json_success( + array( + 'namespace' => 'taskManager', + 'module' => 'indicator', + 'callback_success' => 'loadedCustomerActivity', + 'view' => ob_get_clean(), + 'object' => $datatime, + 'date_gap' => $date_gap, + 'date_start' => $date_start, + 'date_end' => $date_end, + 'jourdonut' => $joursaffichagedonut, + 'error' => $error, + 'display_specific_week' => $display_specific_week, + 'user_select' => $user_select, + 'user_id' => $list_follower, + ) + ); } } diff --git a/module/activity/class/activity.class.php b/module/activity/class/activity.class.php index 19d14405..86f145d4 100644 --- a/module/activity/class/activity.class.php +++ b/module/activity/class/activity.class.php @@ -1,294 +1,347 @@ - - * @since 1.5.0 - * @version 1.6.0 - * @copyright 2015-2018 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} - -/** - * Gestion des activitées. - */ -class Activity_Class extends \eoxia\Singleton_Util { - /** - * Constructeur obligatoire pour Singleton_Util. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @return void - */ - protected function construct() {} - - /** - * Récupères les commentaires et les points dans l'ordre de date décroissante. - * - * @since 1.5.0 - * @version 1.6.0 - * - * @param array $tasks_id L'ID des tâches parents. - * @param integer $offset Le nombre de résultat à passer. - * @param integer $nb_per_page Le nombre d'élément à afficher par page. - * @param array $activities_type Le type des éléments que l'on souhaite afficher. - * - * @return array La liste des commentaires et points. - */ - public function get_activity( $tasks_id, $offset, $date_end = '', $date_start = '', $nb_per_page = 0, $activities_type = array( 'created-point', 'completed-point', 'created-comment' ) ) { - - if ( empty( $date_start ) ) { - $date_start = current_time( 'Y-m-d' ); - } - - if ( empty( $date_end ) ) { - $date_end = date( 'Y-m-d', strtotime( '-1 month', strtotime( $date_start ) ) ); - } - - $query_string = - "SELECT TASK.post_title AS T_title, TASK.ID as T_ID, - POINT.comment_content AS POINT_title, POINT.comment_ID AS POINT_ID, - CREATED_COMMENT.comment_content AS COM_title, CREATED_COMMENT.comment_ID as COM_ID, - COMMENTMETA.meta_value AS COM_DETAILS, CREATED_COMMENT.comment_date AS COM_DATE, - CREATED_COMMENT.user_id AS COM_author_id - FROM {$GLOBALS['wpdb']->comments} AS CREATED_COMMENT - INNER JOIN {$GLOBALS['wpdb']->commentmeta} AS COMMENTMETA ON COMMENTMETA.comment_id = CREATED_COMMENT.comment_ID - INNER JOIN {$GLOBALS['wpdb']->comments} AS POINT ON POINT.comment_ID = CREATED_COMMENT.comment_parent - INNER JOIN {$GLOBALS['wpdb']->posts} AS TASK ON TASK.ID = POINT.comment_post_ID - WHERE CREATED_COMMENT.comment_date >= %s - AND CREATED_COMMENT.comment_date <= %s - AND CREATED_COMMENT.comment_approved != 'trash' - AND TASK.ID IN( " . implode( ',', $tasks_id ) . " ) - AND TASK.post_status IN ( 'archive', 'publish', 'inherit' )"; - - $query_string .= "ORDER BY CREATED_COMMENT.comment_date DESC"; - - - $query = $GLOBALS['wpdb']->prepare( $query_string, $date_end . ' 00:00:00', $date_start . ' 23:59:59' ); - $datas = $GLOBALS['wpdb']->get_results( $query ); - return $datas; - } - - /** - * Récupères l'activité d'un utilisateur entre deux dates. - * - * @since 1.5.0 - * @version 1.5.0 - * - * @param integer $user_id L'ID de l'utilisateur. - * @param string $date_end Date de fin. - * @param string $date_start Date de début. - * - * @return array - */ - public function display_user_activity_by_date( $user_id, $date_end = '', $date_start = '', $customer_id = 0 ) { - - if ( empty( $date_end ) ) { - $date_end = current_time( 'Y-m-d' ); - } - if ( empty( $date_start ) ) { - $date_start = current_time( 'Y-m-d' ); - } - - $query_string = - "SELECT TASK_PARENT.post_title as PT_title, TASK_PARENT.ID as PT_ID, - TASK.post_title AS T_title, TASK.ID as T_ID, - POINT.comment_content AS POINT_title, POINT.comment_ID AS POINT_ID, - COMMENT.comment_content AS COM_title, COMMENT.comment_ID as COM_ID, - COMMENTMETA.meta_value AS COM_DETAILS, COMMENT.comment_date AS COM_DATE, - COMMENT.user_id AS COM_author_id - FROM {$GLOBALS['wpdb']->comments} AS COMMENT - INNER JOIN {$GLOBALS['wpdb']->commentmeta} AS COMMENTMETA ON COMMENTMETA.comment_id = COMMENT.comment_ID - INNER JOIN {$GLOBALS['wpdb']->users} AS USER ON COMMENT.user_id = USER.ID - INNER JOIN {$GLOBALS['wpdb']->usermeta} AS USERMETA ON USER.ID = USERMETA.user_id AND USERMETA.meta_key = 'wp_user_level' - INNER JOIN {$GLOBALS['wpdb']->comments} AS POINT ON POINT.comment_ID = COMMENT.comment_parent - INNER JOIN {$GLOBALS['wpdb']->posts} AS TASK ON TASK.ID = POINT.comment_post_ID - LEFT JOIN {$GLOBALS['wpdb']->posts} AS TASK_PARENT ON TASK_PARENT.ID = TASK.post_parent - WHERE COMMENT.comment_date >= %s - AND USERMETA.meta_value = 10 - AND COMMENT.comment_date <= %s - AND COMMENTMETA.meta_key = %s - AND COMMENT.comment_approved != 'trash' - AND POINT.comment_approved != 'trash' - AND TASK.post_status IN ( 'archive', 'publish', 'inherit' ) "; - - if ( ! empty( $user_id ) ) { - $query_string .= "AND COMMENT.user_id = " . $user_id . " "; - } - - if ( ! empty( $customer_id ) ) { - $query_string .= "AND TASK.post_parent = " . $customer_id . " "; - } - - $query_string .= "ORDER BY COMMENT.comment_date DESC"; - - $query = $GLOBALS['wpdb']->prepare( $query_string, $date_start . ' 00:00:00', $date_end . ' 23:59:59', 'wpeo_time' ); - $datas = $GLOBALS['wpdb']->get_results( $query ); - return $datas; - } - - public function get_data_chart( $datas, $date_end = '', $date_start = '', $time = '', $user_id, $display_specific_week ) { - - - $datatime = []; - $datatime_estimated = []; - $datatime_reel = []; - - if ( empty( $date_end ) ) { - $date_end = current_time( 'Y-m-d' ); - } - if ( empty( $date_start ) ) { - $date_start = current_time( 'Y-m-d' ); - } - - $date_start_strtotime = strtotime( $date_start ); // Debut 0 à 1:00 - $date_end_strtotime = strtotime( $date_end ) + 86400; // Debut à 1:00 + 24h -> Jour suivant - - //86 400 = Une journée en seconde - $date_gap = ( $date_end_strtotime - $date_start_strtotime ) / 86400; // Recupere le nombre jour d'ecart - - $data_full_planning = get_user_meta( $user_id, '_tm_planning_users', true ); - - $dates = array(); - $current = strtotime( $date_start ); - $last = strtotime( $date_end ); - - $temp_year = ''; - $temp_month = ''; - - $data_monthyear_db = array(); - - while( $current <= $last ) { - if( date( 'm', $current ) != $temp_month ){ - - $temp_month = date( 'm', $current ); - - $data_monthyear_db[ count( $data_monthyear_db ) ] = array( - 'month' => date( 'm', $current ), - 'year' => date( 'Y', $current ) - ); - } - - $dates[] = date( 'd/m/Y', $current ); - $current = strtotime( '+1 day', $current ); - } - - foreach ( $data_monthyear_db as $nbr => $month ) { // Recupere dans la db, le planning de la période ciblée - - $data_planningeachmonth_user[ count( $data_planningeachmonth_user ) ] = get_user_meta( $user_id, '_tm_planning_' . $month['year'] . '_' . $month['month'], true ); - } - - for( $p = 0; $p < $date_gap; $p++ ){ // BOUCLE FOR | Pour chaque jours (intervalle choisi) - $strtotime_int = $p * 86400; - - - $time_timestamp = $date_start_strtotime + $strtotime_int; - $time = date("l", $date_start_strtotime + $strtotime_int); - - $worktoday = false; - $default_value = 0; - - - foreach( $data_planningeachmonth_user as $keyyear => $valueyear ){ - $day_found = false; - foreach ( $valueyear as $key => $value) { - if( $time_timestamp == strtotime( $value['date'] ) ){ - if( $value['default'] > 0 ){ // On verifie que la personne travaille ce jour la - $worktoday = true; - $default_value = $value['default']; - } - $day_found = true; - break; - } - } - - if( $day_found ){ - break; - } - } - - if( ! $worktoday ){ - continue; - }else{ - - $datatime_length = count( $datatime ); - - $temp_day = strftime( '%d-%m-%Y', $date_start_strtotime + $strtotime_int ); - - $locale = get_locale(); - $date = new \DateTime( $temp_day ); - - $data['mysql'] = $current_time; - $data['iso8601'] = mysql_to_rfc3339( $current_time ); - - if ( class_exists( '\IntlDateFormatter' ) ) { - $formatter = new \IntlDateFormatter( $locale, \IntlDateFormatter::FULL, \IntlDateFormatter::NONE ); - $data['date'] = $formatter->format( $date ); - } - - $datatime[ $datatime_length ][ 'jour' ] = $data['date']; - - $datatime[ $datatime_length ][ 'strtotime' ] = $date_start_strtotime + $strtotime_int; - $datatime[ $datatime_length ][ 'duree_journée' ] = $default_value;// Nombre de journée de travail * la durée d'une journée de travail - $datatime[ $datatime_length ][ 'duree_travail' ] = 0; - - $work_ = false; - - foreach ($datas as $i => $data_user) { // BOUCLE FOR EACH | Pour chaque tache effectué par l'utilisateur - - if( strtotime( strftime( '%Y-%m-%d', strtotime( $data_user->COM_DATE ) ) ) == $time_timestamp ){ - $work_ = true; - - $data_comdetails = json_decode( $data_user->COM_DETAILS ); - $datatime[ $datatime_length ][ 'duree_travail' ] += $data_comdetails->time_info->elapsed; - $datatime[ $datatime_length ][ 'date' ] = $data_user->COM_DATE; - - - if( count( $datatime[ $datatime_length ][ 'tache_effectue' ] ) == 0 ){ - $temp = count( $datatime[ $datatime_length ][ 'tache_effectue' ] ); - $datatime[ $datatime_length ][ 'tache_effectue' ][ $temp ]['point_id'] = $data_user->POINT_ID; - $datatime[ $datatime_length ][ 'tache_effectue' ][ $temp ]['duree'] = $data_comdetails->time_info->elapsed; - }else{ - $datatime_tacheeffectue_length = count( $datatime[ $datatime_length ][ 'tache_effectue' ] ); - $tache_already_exist = false; - - for( $u = 0; $u < $datatime_tacheeffectue_length; $u ++ ) { // BOUCLE FOR | Pour chaque tache effectué un jours précis - - if( $datatime[ $datatime_length ][ 'tache_effectue' ][ $u ]['point_id'] == $data_user->POINT_ID ){ - $tache_already_exist = true; - $datatime[ $datatime_length ][ 'tache_effectue' ][ $u ]['duree'] += $data_comdetails->time_info->elapsed; - } - } - if( !$tache_already_exist ){ - $temp = count( $datatime[ $datatime_length ][ 'tache_effectue' ] ); - $datatime[ $datatime_length ][ 'tache_effectue' ][ $temp ]['point_id'] = $data_user->POINT_ID; - $datatime[ $datatime_length ][ 'tache_effectue' ][ $temp ]['duree'] = $data_comdetails->time_info->elapsed; - } - } - } - } - - if( $work_ == false ){ - $datatime[ $datatime_length ][ 'duree_travail' ] = 0; - $datatime[ $datatime_length ][ 'date' ] = ''; - } - } - } - - $date_return['datatime'] = $datatime; - $date_return['date_gap'] = $date_gap; - $date_return['date_start'] = $date_start; - $date_return['date_end'] = $date_end; - - return $date_return; - } -} - -Activity_Class::g(); + + * @since 1.5.0 + * @version 1.6.0 + * @copyright 2015-2018 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Gestion des activitées. + */ +class Activity_Class extends \eoxia\Singleton_Util { + + /** + * Constructeur obligatoire pour Singleton_Util. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @return void + */ + protected function construct() { + } + + /** + * Récupères les commentaires et les points dans l'ordre de date décroissante. + * + * @since 1.5.0 + * @version 1.6.0 + * + * @param array $tasks_id L'ID des tâches parents. + * @param integer $offset Le nombre de résultat à passer. + * @param date $date_end Date de début. + * @param date $date_start Date de fin. + * @param integer $nb_per_page Le nombre d'élément à afficher par page. + * @param array $activities_type Le type des éléments que l'on souhaite afficher. + * + * @return array La liste des commentaires et points. + */ + public function getActivity( $tasks_id, $offset, $date_end = '', $date_start = '', $nb_per_page = 0, $activities_type = array( 'created-point', 'completed-point', 'created-comment' ) ) { + + if ( empty( $date_start ) ) { + $date_start = current_time( 'Y-m-d' ); + } + + if ( empty( $date_end ) ) { + $date_end = date( 'Y-m-d', strtotime( '-1 month', strtotime( $date_start ) ) ); + } + + $query_string + = "SELECT TASK.post_title AS t_title, TASK.ID as t_id, + POINT.comment_content AS point_title, POINT.comment_ID AS point_id, + CREATED_COMMENT.comment_content AS com_title, CREATED_COMMENT.comment_ID as com_id, + COMMENTMETA.meta_value AS com_details, CREATED_COMMENT.comment_date AS com_date, + CREATED_COMMENT.user_id AS com_author_id + FROM {$GLOBALS['wpdb']->comments} AS CREATED_COMMENT + INNER JOIN {$GLOBALS['wpdb']->commentmeta} AS COMMENTMETA ON COMMENTMETA.comment_id = CREATED_COMMENT.comment_ID + INNER JOIN {$GLOBALS['wpdb']->comments} AS POINT ON POINT.comment_ID = CREATED_COMMENT.comment_parent + INNER JOIN {$GLOBALS['wpdb']->posts} AS TASK ON TASK.ID = POINT.comment_post_ID + WHERE CREATED_COMMENT.comment_date >= %s + AND CREATED_COMMENT.comment_date <= %s + AND CREATED_COMMENT.comment_approved != 'trash' + AND TASK.ID IN( " . implode( ',', $tasks_id ) . " ) + AND TASK.post_status IN ( 'archive', 'publish', 'inherit' )"; + + $query_string .= 'ORDER BY CREATED_COMMENT.comment_date DESC'; + + $query = $GLOBALS['wpdb']->prepare( $query_string, $date_end . ' 00:00:00', $date_start . ' 23:59:59' ); + $datas = $GLOBALS['wpdb']->get_results( $query ); + return $datas; + } + + /** + * Récupères l'activité d'un utilisateur entre deux dates. + * + * @since 1.5.0 + * @version 1.5.0 + * + * @param [type] $user_id L'ID de l'utilisateur. + * @param string $date_end Date de fin. + * @param string $date_start Date de + * début. + * @param int $customer_id id du customer. + * + * @return array + */ + public function display_user_activity_by_date( $user_id, $date_end = '', $date_start = '', $customer_id = 0 ) { + + if ( empty( $date_end ) ) { + $date_end = current_time( 'Y-m-d' ); + } + if ( empty( $date_start ) ) { + $date_start = current_time( 'Y-m-d' ); + } + + $query_string + = "SELECT TASK_PARENT.post_title as pt_title, TASK_PARENT.ID as pt_id, + TASK.post_title AS t_title, TASK.ID as t_id, + POINT.comment_content AS point_title, POINT.comment_ID AS point_id, + COMMENT.comment_content AS com_title, COMMENT.comment_ID as com_id, + COMMENTMETA.meta_value AS com_details, COMMENT.comment_date AS com_date, + COMMENT.user_id AS com_author_id + FROM {$GLOBALS['wpdb']->comments} AS COMMENT + INNER JOIN {$GLOBALS['wpdb']->commentmeta} AS COMMENTMETA ON COMMENTMETA.comment_id = COMMENT.comment_ID + INNER JOIN {$GLOBALS['wpdb']->users} AS USER ON COMMENT.user_id = USER.ID + INNER JOIN {$GLOBALS['wpdb']->usermeta} AS USERMETA ON USER.ID = USERMETA.user_id AND USERMETA.meta_key = 'wp_user_level' + INNER JOIN {$GLOBALS['wpdb']->comments} AS POINT ON POINT.comment_ID = COMMENT.comment_parent + INNER JOIN {$GLOBALS['wpdb']->posts} AS TASK ON TASK.ID = POINT.comment_post_ID + LEFT JOIN {$GLOBALS['wpdb']->posts} AS TASK_PARENT ON TASK_PARENT.ID = TASK.post_parent + WHERE COMMENT.comment_date >= %s + AND USERMETA.meta_value = 10 + AND COMMENT.comment_date <= %s + AND COMMENTMETA.meta_key = %s + AND COMMENT.comment_approved != 'trash' + AND POINT.comment_approved != 'trash' + AND TASK.post_status IN ( 'archive', 'publish', 'inherit' ) "; + + if ( ! empty( $user_id ) ) { + $query_string .= 'AND COMMENT.user_id = ' . $user_id . ' '; + } + + if ( ! empty( $customer_id ) ) { + $query_string .= 'AND TASK.post_parent = ' . $customer_id . ' '; + } + + $query_string .= 'ORDER BY COMMENT.comment_date DESC'; + + $query = $GLOBALS['wpdb']->prepare( $query_string, $date_start . ' 00:00:00', $date_end . ' 23:59:59', 'wpeo_time' ); + $datas = $GLOBALS['wpdb']->get_results( $query ); + return $datas; + } + + /** + * Recupere les données principales de chaque utilisateur, et les classe par jour / taches effectuées sur une période prédéfinie + * + * @param [type] $datas [toutes les donnes récupérées]. + * @param [type] $user_id [id de l'utilisateur ciblé]. + * @param string $date_end [date de fin]. + * @param string $date_start [date de début]. + * @param string $time [choix d'affichage] 4 types => null, 'day', 'week', 'month'. + * + * @return null + * @since 1.9.0 - BETA + **/ + public function getDataChart( $datas, $user_id, $date_end = '', $date_start = '', $time = '' ) { + if ( empty( $date_end ) ) { + $date_end = current_time( 'Y-m-d' ); + } + if ( empty( $date_start ) ) { + $date_start = current_time( 'Y-m-d' ); + } + + $date_start_strtotime = strtotime( $date_start ); // @info Debut 0 à 1:00 + $date_end_strtotime = strtotime( $date_end ) + 86400; // @info Debut à 1:00 + 24h -> Jour suivant + + $temp_month = ''; + + // 86 400 = Une journée en seconde + $date_gap = ( $date_end_strtotime - $date_start_strtotime ) / 86400; // @info Recupere le nombre jour d'ecart + + $data_full_planning = get_user_meta( $user_id, '_tm_planning_users', true ); + + $dates = array(); + $current = strtotime( $date_start ); + $last = strtotime( $date_end ); + + $data_monthyear_db = array(); + + while ( $current <= $last ) { + if ( date( 'm', $current ) != $temp_month ) { + + $temp_month = date( 'm', $current ); + + $data_monthyear_db[ count( $data_monthyear_db ) ] = array( + 'month' => date( 'm', $current ), + 'year' => date( 'Y', $current ), + ); + } + + $dates[] = date( 'd/m/Y', $current ); + $current = strtotime( '+1 day', $current ); + } + + $data_planningeachmonth_user = array(); + + foreach ( $data_monthyear_db as $nbr => $month ) { // @info Recupere dans la db, le planning de la période ciblée + + $data_planningeachmonth_user[ count( $data_planningeachmonth_user ) ] = get_user_meta( $user_id, '_tm_planning_' . $month['year'] . '_' . $month['month'], true ); + } + + $data_array_return = $this->forEachDay( $date_gap, $date_start_strtotime, $data_planningeachmonth_user, $datas ); + + $date_return['datatime'] = $data_array_return[0]; + $date_return['date_gap'] = $data_array_return[1]; + $date_return['date_start'] = $date_start; + $date_return['date_end'] = $date_end; + + return $date_return; + } + + /** + * Pour chaque jour d'écart entre la date de fin et la date Debut + * Cette fonction recupère les données et les classes par jour et par taches effectuées + * + * @param [type] $date_gap [ecart de jourt]. + * @param [type] $date_start_strtotime [date de début]. + * @param [type] $data_planningeachmonth_user [planning de l'utilisateur] => Planning prévu, minutes de présences chaque jour. + * @param [type] $datas [liste des taches effectuées par l'utilisateur]. + * + * @return [array] [0] => données utilisateurs | [1] => Jour d'écart + * @since 1.9.0 - BETA + */ + public function forEachDay( $date_gap, $date_start_strtotime, $data_planningeachmonth_user, $datas ) { + + $datatime = []; + $datatime_estimated = []; + $datatime_reel = []; + + for ( $p = 0; $p < $date_gap; $p++ ) { // @info BOUCLE FOR | Pour chaque jours (intervalle choisi) + $strtotime_int = $p * 86400; + + $time_timestamp = $date_start_strtotime + $strtotime_int; + $time = date( 'l', $date_start_strtotime + $strtotime_int ); + + $worktoday = false; + $default_value = 0; + foreach ( $data_planningeachmonth_user as $keyyear => $valueyear ) { + $day_found = false; + foreach ( $valueyear as $key => $value ) { + + if ( strtotime( $value['date'] ) == $time_timestamp ) { + if ( $value['default'] > 0 ) { // @info On verifie que la personne travaille ce jour la + $worktoday = true; + $default_value = $value['default']; + } + + $day_found = true; + break; + } + } + + if ( $day_found ) { + break; + } + } + + if ( ! $worktoday ) { + continue; + } else { + + $datatime_length = count( $datatime ); + + $temp_day = strftime( '%d-%m-%Y', $date_start_strtotime + $strtotime_int ); + + $locale = get_locale(); + $date = new \DateTime( $temp_day ); + + if ( class_exists( '\IntlDateFormatter' ) ) { + $formatter = new \IntlDateFormatter( $locale, \IntlDateFormatter::FULL, \IntlDateFormatter::NONE ); + $data['date'] = $formatter->format( $date ); + } + + $datatime[ $datatime_length ]['jour'] = $data['date']; + + $datatime[ $datatime_length ]['strtotime'] = $date_start_strtotime + $strtotime_int; + $datatime[ $datatime_length ]['duree_journée'] = $default_value;// @info Nombre de journée de travail * la durée d'une journée de travail + $datatime[ $datatime_length ]['duree_travail'] = 0; + + $work_ = false; + + foreach ( $datas as $i => $data_user ) { // @info BOUCLE FOR EACH | Pour chaque tache effectué par l'utilisateur + + if ( strtotime( strftime( '%Y-%m-%d', strtotime( $data_user->com_date ) ) ) == $time_timestamp ) { + + $work_ = true; + $data_comdetails = json_decode( $data_user->com_details ); + $datatime[ $datatime_length ]['duree_travail'] += $data_comdetails->time_info->elapsed; + $datatime[ $datatime_length ]['date'] = $data_user->com_date; + + if ( empty( $datatime[ $datatime_length ]['tache_effectue'] ) || count( $datatime[ $datatime_length ]['tache_effectue'] ) == 0 ) { // @info premiere tache effectué + $datatime[ $datatime_length ]['tache_effectue'][0]['tache_title'] = $data_user->t_title; + $datatime[ $datatime_length ]['tache_effectue'][0]['tache_id'] = $data_user->t_id; + $datatime[ $datatime_length ]['tache_effectue'][0]['point_title'] = $data_user->point_title; + $datatime[ $datatime_length ]['tache_effectue'][0]['point_id'] = $data_user->point_id; + $datatime[ $datatime_length ]['tache_effectue'][0]['commentary'][0]['com_title'] = $data_user->com_title; + $datatime[ $datatime_length ]['tache_effectue'][0]['commentary'][0]['com_id'] = $data_user->com_id; + $datatime[ $datatime_length ]['tache_effectue'][0]['commentary'][0]['com_time'] = $data_comdetails->time_info->elapsed; + $datatime[ $datatime_length ]['tache_effectue'][0]['duree'] = $data_comdetails->time_info->elapsed; + $datatime[ $datatime_length ]['tache_effectue'][0]['com_date'] = $data_user->com_date; + $datatime[ $datatime_length ]['tache_effectue'][0]['com_author'] = $data_user->com_author_id; + } else { + $datatime_tacheeffectue_length = count( $datatime[ $datatime_length ]['tache_effectue'] ); + $tache_already_exist = false; + + for ( $u = 0; $u < $datatime_tacheeffectue_length; $u ++ ) { // @info BOUCLE FOR | Pour chaque tache effectué un jours précis + + if ( $datatime[ $datatime_length ]['tache_effectue'][ $u ]['point_id'] == $data_user->point_id ) { + $tache_already_exist = true; + $length_nbrcommentary_forthispoint = count( $datatime[ $datatime_length ]['tache_effectue'][ $u ]['commentary'] ); + + $datatime[ $datatime_length ]['tache_effectue'][ $u ]['duree'] += $data_comdetails->time_info->elapsed; // @info Cumul la durée + $datatime[ $datatime_length ]['tache_effectue'][ $u ]['commentary'][ $length_nbrcommentary_forthispoint ]['com_title'] = $data_user->com_title; + $datatime[ $datatime_length ]['tache_effectue'][ $u ]['commentary'][ $length_nbrcommentary_forthispoint ]['com_id'] = $data_user->com_id; + $datatime[ $datatime_length ]['tache_effectue'][ $u ]['commentary'][ $length_nbrcommentary_forthispoint ]['com_time'] = $data_comdetails->time_info->elapsed; + } + } + if ( ! $tache_already_exist ) { + $temp = count( $datatime[ $datatime_length ]['tache_effectue'] ); + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['tache_title'] = $data_user->t_title; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['tache_id'] = $data_user->t_id; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['point_title'] = $data_user->point_title; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['point_id'] = $data_user->point_id; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['commentary'][0]['com_title'] = $data_user->com_title; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['commentary'][0]['com_id'] = $data_user->com_id; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['commentary'][0]['com_time'] = $data_comdetails->time_info->elapsed; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['duree'] = $data_comdetails->time_info->elapsed; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['com_date'] = $data_user->com_date; + $datatime[ $datatime_length ]['tache_effectue'][ $temp ]['com_author'] = $data_user->com_author_id; + } + } + } + } + + if ( false == $work_ ) { + $datatime[ $datatime_length ]['duree_travail'] = 0; + $datatime[ $datatime_length ]['date'] = ''; + } + } + } + + $return[0] = $datatime; + $return[1] = $date_gap; + + return $return; + } + +} +Activity_Class::g(); diff --git a/module/activity/filter/class-activity-filter.php b/module/activity/filter/class-activity-filter.php index 6599810b..cb744a27 100644 --- a/module/activity/filter/class-activity-filter.php +++ b/module/activity/filter/class-activity-filter.php @@ -37,9 +37,14 @@ public function __construct() { */ public function task_display_type_choice( $current_output, $task ) { ob_start(); - \eoxia\View_Util::exec( 'task-manager', 'activity', 'backend/task-header-button', array( - 'task' => $task, - ) ); + \eoxia\View_Util::exec( + 'task-manager', + 'activity', + 'backend/task-header-button', + array( + 'task' => $task, + ) + ); $current_output .= ob_get_clean(); return $current_output; diff --git a/module/activity/filter/index.php b/module/activity/filter/index.php new file mode 100644 index 00000000..62200328 --- /dev/null +++ b/module/activity/filter/index.php @@ -0,0 +1,2 @@ + - * @since 1.5.0 - * @version 1.6.0 - * @copyright 2015-2018 Eoxia - * @package Task_Manager - */ - -namespace task_manager; -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?> - -
    - data['parent']->data['id'] . ' ' . $element->data['parent']->data['content']; ?> - data['time_info']['elapsed'] ) ? $element->data['time_info']['elapsed'] : 0; ?> -
    - -data['content']; ?> + + * @since 1.5.0 + * @version 1.6.0 + * @copyright 2015-2018 Eoxia + * @package Task_Manager + */ + +namespace task_manager; +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?> + +
    + data['parent']->data['id'] . ' ' . $element->data['parent']->data['content']; ?> + data['time_info']['elapsed'] ) ? $element->data['time_info']['elapsed'] : 0; ?> +
    + +data['content']; ?> diff --git a/module/activity/view/backend/created-point.view.php b/module/activity/view/backend/created-point.view.php index 434cbc9e..7b1e848c 100644 --- a/module/activity/view/backend/created-point.view.php +++ b/module/activity/view/backend/created-point.view.php @@ -1,18 +1,18 @@ - - * @since 1.5.0 - * @version 1.6.0 - * @copyright 2015-2018 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?> - -data['id'] . ' ' . $element->data['content']; ?> + + * @since 1.5.0 + * @version 1.6.0 + * @copyright 2015-2018 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?> + +data['id'] . ' ' . $element->data['content']; ?> diff --git a/module/activity/view/backend/list.view.php b/module/activity/view/backend/list.view.php index f822e0b4..13b2547a 100644 --- a/module/activity/view/backend/list.view.php +++ b/module/activity/view/backend/list.view.php @@ -1,66 +1,74 @@ - - * @since 1.5.0 - * @version 1.6.0 - * @copyright 2015-2018 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} -if ( ! empty( $datas ) ) : - foreach ( $datas as $date => $data ) : - if ( ! empty( $data ) && is_array( $data ) ) : - if ( $date !== $last_date || 5 === $offset ) : - ?> -
    - -
    - $elements ) : - if ( ! empty( $elements ) ) : - foreach ( $elements as $element ) : ?> -
    -
    - data['displayed_author_id'] . '" size="30"]' ); ?> - - data['view'] ) { - case 'created-comment': - echo ''; - break; - case 'created-point': - echo ''; - break; - case 'completed-point': - echo ''; - break; - } - ?> - - -
    -
    data['view'], array( - 'element' => $element, - ) ); ?> -
    -
    + + * @since 1.5.0 + * @version 1.6.0 + * @copyright 2015-2018 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} +if ( ! empty( $datas ) ) : + foreach ( $datas as $date => $data ) : + if ( ! empty( $data ) && is_array( $data ) ) : + if ( $date !== $last_date || 5 === $offset ) : + ?> +
    + +
    + $elements ) : + if ( ! empty( $elements ) ) : + foreach ( $elements as $element ) : + ?> +
    +
    + data['displayed_author_id'] . '" size="30"]' ); ?> + + data['view'] ) { + case 'created-comment': + echo ''; + break; + case 'created-point': + echo ''; + break; + case 'completed-point': + echo ''; + break; + } + ?> + + +
    +
    + data['view'], + array( + 'element' => $element, + ) + ); + ?> +
    +
    diff --git a/module/activity/view/backend/mail/action-completed-point.view.php b/module/activity/view/backend/mail/action-completed-point.view.php index 396e1f5f..3de73a62 100644 --- a/module/activity/view/backend/mail/action-completed-point.view.php +++ b/module/activity/view/backend/mail/action-completed-point.view.php @@ -1,16 +1,16 @@ - - * @since 1.5.0 - * @version 1.5.0 - * @copyright 2015-2017 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?>  + + * @since 1.5.0 + * @version 1.5.0 + * @copyright 2015-2017 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>  diff --git a/module/activity/view/backend/mail/action-created-comment.view.php b/module/activity/view/backend/mail/action-created-comment.view.php index fe7e09f5..24bc4207 100644 --- a/module/activity/view/backend/mail/action-created-comment.view.php +++ b/module/activity/view/backend/mail/action-created-comment.view.php @@ -1,16 +1,16 @@ - - * @since 1.5.0 - * @version 1.5.0 - * @copyright 2015-2017 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?>  data['parent']->data['id'] . ' ' . $element->data['parent']->data['content']; ?> + + * @since 1.5.0 + * @version 1.5.0 + * @copyright 2015-2017 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>  data['parent']->data['id'] . ' ' . $element->data['parent']->data['content']; ?> diff --git a/module/activity/view/backend/mail/action-created-point.view.php b/module/activity/view/backend/mail/action-created-point.view.php index dcba9037..79727155 100644 --- a/module/activity/view/backend/mail/action-created-point.view.php +++ b/module/activity/view/backend/mail/action-created-point.view.php @@ -1,16 +1,16 @@ - - * @since 1.5.0 - * @version 1.5.0 - * @copyright 2015-2017 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?>  + + * @since 1.5.0 + * @version 1.5.0 + * @copyright 2015-2017 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>  diff --git a/module/activity/view/backend/mail/completed-point.view.php b/module/activity/view/backend/mail/completed-point.view.php index 15ed0b20..6ad6a316 100644 --- a/module/activity/view/backend/mail/completed-point.view.php +++ b/module/activity/view/backend/mail/completed-point.view.php @@ -1,16 +1,16 @@ - - * @since 1.5.0 - * @version 1.5.0 - * @copyright 2015-2017 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?>

    data['id'] . ' ' . $element->data['content']; ?>

    + + * @since 1.5.0 + * @version 1.5.0 + * @copyright 2015-2017 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>

    data['id'] . ' ' . $element->data['content']; ?>

    diff --git a/module/activity/view/backend/mail/created-comment.view.php b/module/activity/view/backend/mail/created-comment.view.php index 2c273043..42eaa50e 100644 --- a/module/activity/view/backend/mail/created-comment.view.php +++ b/module/activity/view/backend/mail/created-comment.view.php @@ -1,16 +1,16 @@ - - * @since 1.5.0 - * @version 1.5.0 - * @copyright 2015-2017 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?>

    data['content']; ?>

    + + * @since 1.5.0 + * @version 1.5.0 + * @copyright 2015-2017 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>

    data['content']; ?>

    diff --git a/module/activity/view/backend/mail/created-point.view.php b/module/activity/view/backend/mail/created-point.view.php index 1eedaf50..8f32029f 100644 --- a/module/activity/view/backend/mail/created-point.view.php +++ b/module/activity/view/backend/mail/created-point.view.php @@ -1,16 +1,16 @@ - - * @since 1.5.0 - * @version 1.5.0 - * @copyright 2015-2017 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?>

    data['id'] . ' ' . $element->data['content']; ?>

    + + * @since 1.5.0 + * @version 1.5.0 + * @copyright 2015-2017 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?>

    data['id'] . ' ' . $element->data['content']; ?>

    diff --git a/module/activity/view/backend/mail/list.view.php b/module/activity/view/backend/mail/list.view.php index 6e8a68be..9a591c95 100644 --- a/module/activity/view/backend/mail/list.view.php +++ b/module/activity/view/backend/mail/list.view.php @@ -1,49 +1,49 @@ - - * @since 1.5.0 - * @version 1.6.0 - * @copyright 2015-2018 Eoxia - * @package Task_Manager - */ - -namespace task_manager; - -if ( ! defined( 'ABSPATH' ) ) { - exit; -} ?> - -
    - -
    - -
    -

    - - -
    -

    - - COM_DATE ) ) . ' ' . mysql2date( 'd/m/Y', $activity->COM_DATE ) ); ?> -  à COM_DATE, true ) ); ?> sur le point - POINT_ID . ' ' . $activity->POINT_title; ?> - -

    -
    - COM_title; ?> -
    -
    - COM_DATE ); - endforeach; - else : - echo esc_html_e( 'No activity for now', 'task-manager' ); - endif; - ?> -
    \ No newline at end of file + + * @since 1.5.0 + * @version 1.6.0 + * @copyright 2015-2018 Eoxia + * @package Task_Manager + */ + +namespace task_manager; + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} ?> + +
    + +
    + +
    +

    + + +
    +

    + + com_date ) ) . ' ' . mysql2date( 'd/m/Y', $activity->com_date ) ); ?> +  à com_date, true ) ); ?> sur le point + point_id . ' ' . $activity->point_title; ?> + +

    +
    + com_title; ?> +
    +
    + com_date ); + endforeach; + else : + echo esc_html_e( 'No activity for now', 'task-manager' ); + endif; + ?> +
    diff --git a/module/activity/view/backend/post-last-activity.view.php b/module/activity/view/backend/post-last-activity.view.php index 50b8695e..294fa938 100644 --- a/module/activity/view/backend/post-last-activity.view.php +++ b/module/activity/view/backend/post-last-activity.view.php @@ -16,11 +16,11 @@ } ?>
    - + -