コード例 #1
0
 /**
  * Course Progress
  *
  * @since 1.0.0
  */
 function course_progress($atts)
 {
     extract(shortcode_atts(array('course_id' => in_the_loop() ? get_the_ID() : '', 'decimal_places' => '0'), $atts, 'course_progress'));
     if (!empty($course_id)) {
         $course_id = (int) $course_id;
     }
     $decimal_places = sanitize_text_field($decimal_places);
     //			$completion = new Course_Completion( $course_id );
     //			$completion->init_student_status();
     //			return $completion->course_progress();
     return number_format_i18n(Student_Completion::calculate_course_completion(get_current_user_id(), $course_id), $decimal_places);
 }
コード例 #2
0
 /**
  * Check to see if the student has completed a given course.
  *
  * Better to use Course_Completion[] class. See code in this function.
  *
  * @see Course_Completion
  *
  * @param int $course_ID
  * @param string $user_ID
  *
  * @return bool True if course is complete.
  */
 function is_course_complete($course_ID = 0, $user_ID = '')
 {
     if ($user_ID == '') {
         $user_ID = $this->ID;
     }
     //			$completion	= new Course_Completion( $course_ID );
     //			$completion->init_student_status( $user_ID );
     //
     //			return $completion->is_course_complete();
     if (100 == (int) Student_Completion::calculate_course_completion($user_ID, $course_ID)) {
         return true;
     } else {
         return false;
     }
 }