Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › Units and Total duration
- This topic has 25 replies, 6 voices, and was last updated 3 years, 3 months ago by
Diana.
-
AuthorPosts
-
May 18, 2016 at 9:23 pm #48856
ateya3d
SpectatorHello 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 HoursMay 18, 2016 at 9:40 pm #48861ateya3d
SpectatorThis is the current functions after your modifications for Multi-language Attached in texMay 19, 2016 at 1:37 pm #49075Anshuman Sahu
KeymasterChange 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.May 20, 2016 at 11:55 am #49334ateya3d
Spectatorits 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 MinutsMay 21, 2016 at 12:48 pm #49517Anshuman Sahu
KeymasterChange this line in the code : $course_details['units_duration'] = '<li><i class="icon-clock-1"></i>'.tofriendlytime($duration).'</li>';May 22, 2016 at 12:36 am #49588ateya3d
SpectatorAfter Change in code it's convert 1675 minuts to 27 minuts , 55 secondsMay 23, 2016 at 1:26 pm #49824Anshuman Sahu
KeymasterPlease 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; }May 24, 2016 at 1:40 am #49883ateya3d
Spectatorafter last modification total time EXPIRED attached pictures after and before editMay 24, 2016 at 1:01 pm #50041Anshuman Sahu
KeymasterUpdated the above code a little bit please refer code again .May 25, 2016 at 12:47 pm #50239ateya3d
Spectatorafter last code modifiy return to the first problem illustrate 27 hours as (1 Day , 3 Hours) can you login and solve this problem directlly ???May 25, 2016 at 1:01 pm #50240ateya3d
Spectatorhttp://arch-school.com/wp-admin User : cgway Password : cgway@2020 refere to this course http://arch-school.com/course/3dsmax-modeling-techniques/ ThanksMay 26, 2016 at 12:57 pm #50405ateya3d
SpectatorWaitingMay 27, 2016 at 12:39 pm #50602Anshuman Sahu
KeymasterWell 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 .May 28, 2016 at 11:54 am #50754ateya3d
Spectatordepend 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 hoursMay 29, 2016 at 4:42 pm #50812ateya3d
Spectatorany replay please -
AuthorPosts
- The topic ‘Units and Total duration’ is closed to new replies.