General developer forum

Display Course Completion along with courses. in the home Page

 
Picture of kiran kumar
Display Course Completion along with courses. in the home Page
 

I have added a course with single Activity format in that uploaded Scorm package. also working course completion.


But i want display Course completion status with course in the home page .




Iam usig code i courserender page  It is showig always false even i complete the scorm course


require_once("{$CFG->libdir}/completionlib.php");


require_once("{$CFG->libdir}/accesslib.php");

$course_object = $DB->get_record('course', array('id'=>$course->id));  

$cinfo = new completion_info($course_object);

$iscomplete = $cinfo->is_course_complete($USER->id);

if ($iscomplete) {

  echo '<img src="green.gif">';

} else {

  echo '<img src="red.gif">';

}

 
Average of ratings: -
Gareth J Barnard
Re: Display Course Completion along with courses. in the home Page
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Does the core system inform you that the course is complete (so ignore your own code for a moment)?

 
Average of ratings: -
Picture of kiran kumar
Re: Display Course Completion along with courses. in the home Page
 

 I want get course is completed or not . if course is completed show the tick marks in the home page along with course icons


 
Average of ratings: -
Gareth J Barnard
Re: Display Course Completion along with courses. in the home Page
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Hi Kiran,

I can see what you are trying to achieve, however, take the software engineering approach of ensuring that the test environment is setup correctly in order to provide the input to the code and therefore understand if your code is working or not or that it could be but the test environment is not setup correctly.  Hence ensure that Moodle, without using your code, knows that a course is complete first, then you'll know if your code is actually broken or not.

G

 
Average of ratings: -