Units and Total duration

Home Forums Legacy Support Support queries How-to & Troubleshooting Units and Total duration

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #48856
    ateya3d
    Spectator
    Hello i have a problem in Units and Total duration if i have 50 units with 1 hour / unit the total must be 50 hours but it's shown 2 Days , 2 Hours   how to solve this problem ??? i want alwais the total duration in course details shown and calculated in Hours  
    #48861
    ateya3d
    Spectator
    This is the current functions after your modifications for Multi-language Attached in tex
    #49075
    Anshuman Sahu
    Keymaster
    Change the function " wplms_show_unit_count_and_time " in your code :   function wplms_show_unit_count_and_time($course_details){             $course_id = get_the_ID();             $units=bp_course_get_curriculum_units($course_id);   $unit_text = translate(' Units','vibe-customtypes'); if(defined('ICL_LANGUAGE_CODE')){ switch(ICL_LANGUAGE_CODE){ case 'fr': $unit_text='conférences'; break; case 'en': $unit_text='lectures'; break; case 'ar': $unit_text='محاضرة'; break; } } //tranlsate the MINUTES text  if(defined('ICL_LANGUAGE_CODE')){ switch(ICL_LANGUAGE_CODE){ case 'fr': $minute_text='MINUTES in french'; break; case 'en': $minute_text='Minutes'; break; case 'ar': $minute_text='MINUTES in arabic'; break; } }         $course_details['units'] = '<li><i class="icon-grid-alt"></i>'.count($units).' '.$unit_text.'</li>';             $duration = 0;             foreach($units as $unit){                 $duration = $duration + get_post_meta($unit,'vibe_duration',true);             }             $unit_duration_parameter = apply_filters('vibe_unit_duration_parameter',60);             $course_details['units_duration'] = '<li><i class="icon-clock-1"></i>'.$duration.' '.$minute_text.'</li>';             return $course_details;           } Do not forget to put the translated texts for the MINUTES in above code just like " UNITS  " text.
    #49334
    ateya3d
    Spectator
    its solve the problem but the total time calculated in minutes i want it in hours and minuts as example in the old code total time  1Day , 3Hours, 10Minuts   now after your modifications total time   1630 Minuts   i want it like this total time   27 hours , 10 Minuts    
    #49517
    Anshuman Sahu
    Keymaster
    Change this line in the code : $course_details['units_duration'] = '<li><i class="icon-clock-1"></i>'.tofriendlytime($duration).'</li>';
    #49588
    ateya3d
    Spectator
    After Change in code it's convert 1675 minuts to 27 minuts , 55 seconds  
    #49824
    Anshuman Sahu
    Keymaster
    Please try changing " wplms_show_unit_count_and_time" function :    function wplms_show_unit_count_and_time($course_details){             $course_id = get_the_ID();             $units=bp_course_get_curriculum_units($course_id); $unit_text = translate(' Units','vibe-customtypes'); if(defined('ICL_LANGUAGE_CODE')){ switch(ICL_LANGUAGE_CODE){ case 'fr': $unit_text='conférences'; break; case 'en': $unit_text='lectures'; break; case 'ar': $unit_text='محاضرة'; break; } }   $course_details['units'] = '<li><i class="icon-grid-alt"></i>'.count($units).' '.$unit_text.'</li>'; $duration = 0; foreach($units as $unit){                $unit_duration_parameter = apply_filters('vibe_unit_duration_parameter',60,$unit);                $duration = $duration + ($unit_duration_parameter *  get_post_meta($unit,'vibe_duration',true)); }   $course_details['units_duration'] = '<li><i class="icon-clock-1"></i>'.tofriendlytime($duration ).'</li>';             return $course_details;   }
    #49883
    ateya3d
    Spectator
    after last modification total time EXPIRED attached pictures after and before edit
    #50041
    Anshuman Sahu
    Keymaster
    Updated the above code a little bit please refer code again .
    #50239
    ateya3d
    Spectator
    after last code modifiy return to the first problem illustrate 27 hours as (1 Day , 3 Hours) can you login and solve this problem directlly ???
    #50240
    ateya3d
    Spectator
    http://arch-school.com/wp-admin User : cgway Password : cgway@2020 refere to this course http://arch-school.com/course/3dsmax-modeling-techniques/ Thanks  
    #50405
    ateya3d
    Spectator
    Waiting
    #50602
    Anshuman Sahu
    Keymaster
    Well the duration parameter you are asking is not possible. The tofriendlytime functions has some special values after it changes the duration parameter . So it will never show 27 hours 10 minutes .Coz on 24 hours it will began to show this duration in days and hours . We can show the unit duration in just one format (either hours minutes weeks or years) if not using the   " tofriendlytime  " function .  
    #50754
    ateya3d
    Spectator
    depend on your illustration " We can show the unit duration in just one format (either hours minutes weeks or years) if not using the " tofriendlytime " function ." can you give me the final code to show the total time in Hours as example if we have a total time 28 hour will be shown 28 hours not 1 day, 4 hours
    #50812
    ateya3d
    Spectator
    any replay please
Viewing 15 posts - 1 through 15 (of 26 total)
  • The topic ‘Units and Total duration’ is closed to new replies.