public function display()
 {
     global $CFG, $PARSER;
     if (!empty($this->data)) {
         //set up the flexible table for displaying
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('hcc_attendance', true, '');
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         $headers[] = 'Course';
         $headers[] = 'Code';
         //$headers[] = 'Performance';
         $headers[] = 'Attendance';
         $headers[] = 'Punctuality';
         $columns[] = 'course';
         $columns[] = 'code';
         //$columns[] = 'performance';
         $columns[] = 'attendance';
         $columns[] = 'punctuality';
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         foreach ($this->data as $d) {
             $data['course'] = $d[$this->fields['coursetitle']];
             $data['code'] = $d[$this->fields['coursecode']];
             $attendance = $d[$this->fields['positivemarks']] / ($d[$this->fields['totalmarks']] - $d[$this->fields['missedmarks']]) * 100;
             $punctuality = ($d[$this->fields['totalmarks']] - $d[$this->fields['missedmarks']] - $d[$this->fields['latemarks']]) / ($d[$this->fields['totalmarks']] - $d[$this->fields['missedmarks']]) * 100;
             //$colour					=	$this->performane_css($d['performance']);
             //$data['performance'] 	= "<span style='background-color: {$colour}'>{$d['performance']}</span>";
             $data['attendance'] = round($attendance, 0);
             $data['punctuality'] = round($punctuality, 0);
             $flextable->add_data_keyed($data);
         }
         ob_start();
         $flextable->print_html();
         $output = ob_get_contents();
         ob_end_clean();
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             $output = '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
     return $output;
 }
 /**
  * 
  * @see ilp_mis_plugin::display()
  */
 function display()
 {
     global $CFG;
     // set up the flexible table for displaying the data
     if (!empty($this->data)) {
         // set up the flexible table for displaying the portfolios
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('exam_timetable', true, 'ilp_mis_misc_performance_ind');
         //create headers
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         $headers[] = get_string('ilp_mis_misc_performance_ind_title_disp', 'block_ilp');
         $headers[] = get_string('ilp_mis_misc_performance_ind_score_disp', 'block_ilp');
         $columns[] = 'title';
         $columns[] = 'score';
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         //add the row to table
         foreach ($this->data as $k => $v) {
             $data = array();
             $string = strtolower("ilp_mis_misc_performance_ind_{$k}_disp");
             $data['title'] = get_string($string, 'block_ilp');
             $data['score'] = $v;
             $flextable->add_data_keyed($data);
         }
         //buffer out as flextable sends its data straight to the screen we dont want this
         ob_start();
         //call the html file for the plugin which has the flextable print statement
         $flextable->print_html();
         $pluginoutput = ob_get_contents();
         ob_end_clean();
         return $pluginoutput;
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             echo '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
 }
 public function display()
 {
     if (!empty($this->courselist) && !empty($this->mcbdata)) {
         //set up the flexible table for displaying
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('monthly_breakdown', true, 'ilp_mis_attendance_plugin_mcb');
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         $headers[] = get_string('ilp_mis_attendance_plugin_course_course', 'block_ilp');
         $headers[] = get_string('ilp_mis_attendance_plugin_course_attendance', 'block_ilp');
         $headers[] = get_string('ilp_mis_attendance_plugin_course_punctuality', 'block_ilp');
         $columns[] = 'course';
         $columns[] = 'attendance';
         $columns[] = 'punctuality';
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         foreach ($this->courselist as $cid => $cname) {
             //we start the month counter from the first month
             $data['course'] = $cname;
             $data['attendance'] = $this->percent_format($this->mcbdata[$cid]['attendance'], true);
             //. '%';
             $data['punctuality'] = $this->percent_format($this->mcbdata[$cid]['punctuality'], true);
             //. '%';
             $flextable->add_data_keyed($data);
         }
         ob_start();
         $flextable->print_html();
         $pluginoutput = ob_get_contents();
         ob_end_clean();
         return $pluginoutput;
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             echo '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
 }
 public function display()
 {
     global $CFG;
     if (!empty($this->data)) {
         // set up the flexible table for displaying the data
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('attendance_plugin_simple', true, 'ilp_mis_attendance_plugin_simple');
         $flextable->set_attribute('class', 'flexible generaltable');
         //create headers
         $headers = array(get_string('ilp_mis_attendance_plugin_simple_attendance', 'block_ilp'), get_string('ilp_mis_attendance_plugin_simple_punctuality', 'block_ilp'));
         //create columns
         $columns = array('attendance', 'punctuality');
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         //setup the flextable
         $flextable->setup();
         //add the row to table
         foreach ($this->data as $row) {
             $data = array();
             $att = $this->percent_format($row[0]);
             $punc = $this->percent_format($row[1]);
             $data['attendance'] = $att;
             $data['punctuality'] = $punc;
             $flextable->add_data_keyed($data);
         }
         //buffer out as flextable sends its data straight to the screen we dont want this
         ob_start();
         //call the html file for the plugin which has the flextable print statement
         require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/mis/ilp_mis_attendance_plugin_simple.html';
         $pluginoutput = ob_get_contents();
         ob_end_clean();
         //echo the output
         return $pluginoutput;
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             echo '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
 }
 public function display()
 {
     global $CFG, $PARSER, $PAGE;
     $misperiod_id = $PARSER->optional_param('mis_period_id', NULL, PARAM_INT);
     $miscourse_id = $PARSER->optional_param('mis_course_id', NULL, PARAM_INT);
     $params = explode('&', $_SERVER['QUERY_STRING']);
     $hiddenparams = "";
     foreach ($params as $v) {
         if (strpos($v, 'mis_course_id') === FALSE && strpos($v, 'mis_period_id') === FALSE) {
             $p = explode('=', $v);
             $hiddenparams .= "<input type='hidden' name='{$p[0]}' value='{$p[1]}' />";
         }
     }
     if (!empty($this->normdata)) {
         $this->init_bgcolours();
         //set up the flexible table for displaying
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('attendance_byclass', true, 'ilp_mis_attendance_plugin_byclass_container');
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         if (get_config('block_ilp', 'mis_plugin_course_byclass_datetime')) {
             $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_day', 'block_ilp');
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_room')) {
             $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_room', 'block_ilp');
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_starttime')) {
             $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_start', 'block_ilp');
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_endtime')) {
             $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_end', 'block_ilp');
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_tutor')) {
             $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_tutor', 'block_ilp');
         }
         $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_overall', 'block_ilp');
         $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_punct', 'block_ilp');
         $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_attend', 'block_ilp');
         $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_unauth', 'block_ilp');
         $headers[] = get_string('ilp_mis_attendance_plugin_byclass_disp_late', 'block_ilp');
         if (get_config('block_ilp', 'mis_plugin_course_byclass_datetime')) {
             $columns[] = 'day';
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_room')) {
             $columns[] = 'room';
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_starttime')) {
             $columns[] = 'start';
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_endtime')) {
             $columns[] = 'end';
         }
         if (get_config('block_ilp', 'mis_plugin_course_byclass_tutor')) {
             $columns[] = 'tutor';
         }
         $columns[] = 'overall';
         $columns[] = 'present';
         $columns[] = 'absent';
         $columns[] = 'unauth';
         $columns[] = 'late';
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         foreach ($this->normdata as $dayid => $data) {
             foreach ($data as $d) {
                 if (get_config('block_ilp', 'mis_plugin_course_byclass_datetime')) {
                     $data['day'] = $d['day'];
                 }
                 if (get_config('block_ilp', 'mis_plugin_course_byclass_room')) {
                     $data['room'] = $d['room'];
                 }
                 if (get_config('block_ilp', 'mis_plugin_course_byclass_starttime')) {
                     $data['start'] = $d['starttime'];
                 }
                 if (get_config('block_ilp', 'mis_plugin_course_byclass_endtime')) {
                     $data['end'] = $d['endtime'];
                 }
                 if (get_config('block_ilp', 'mis_plugin_course_byclass_tutor')) {
                     $data['tutor'] = $d['tutor'];
                 }
                 $data['overall'] = $this->format_background_by_value($d['attendance'] . '%');
                 $data['present'] = $d['markspresent'];
                 $data['absent'] = $d['marksabsent'];
                 $data['unauth'] = $d['marksauthabsent'];
                 $data['late'] = $d['markslate'];
                 $flextable->add_data_keyed($data);
             }
         }
         ob_start();
         $flextable->print_html();
         $pluginoutput = ob_get_contents();
         ob_end_clean();
         ob_start();
         require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/mis/ilp_mis_attendance_plugin_byclass.html';
         $output = ob_get_contents();
         ob_end_clean();
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             $pluginoutput = '<div id="plugin_nodata">' . $msg . '</div>';
         }
         ob_start();
         require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/mis/ilp_mis_attendance_plugin_byclass.html';
         $output = ob_get_contents();
         ob_end_clean();
     }
     return $output;
 }
 public function display()
 {
     global $CFG, $PARSER, $PAGE;
     if (!empty($this->data)) {
         //set up the flexible table for displaying
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('hcc_attendance', true, '');
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         $headers[] = 'Course';
         $headers[] = 'Code';
         $headers[] = 'Target';
         $headers[] = 'Aug';
         $headers[] = 'Sept';
         $headers[] = 'Oct';
         $headers[] = 'Nov';
         $headers[] = 'Dec';
         $headers[] = 'Jan';
         $headers[] = 'Feb';
         $headers[] = 'Mar';
         $headers[] = 'Apr';
         $headers[] = 'May';
         $headers[] = 'June';
         $headers[] = 'July';
         $columns[] = 'course';
         $columns[] = 'code';
         $columns[] = 'target';
         $columns[] = 'aug';
         $columns[] = 'sep';
         $columns[] = 'oct';
         $columns[] = 'nov';
         $columns[] = 'dec';
         $columns[] = 'jan';
         $columns[] = 'feb';
         $columns[] = 'mar';
         $columns[] = 'apr';
         $columns[] = 'may';
         $columns[] = 'jun';
         $columns[] = 'jul';
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         foreach ($this->data as $d) {
             $data['course'] = $d[$this->fields['mname']];
             $data['code'] = $d[$this->fields['mreference']];
             $data['target'] = $d[$this->fields['target']];
             $data['aug'] = $this->tooltip_span($d[$this->fields['auggrade']], $d[$this->fields['augnote']], 'augtooltip');
             $data['sep'] = $this->tooltip_span($d[$this->fields['sepgrade']], $d[$this->fields['sepnote']], 'septooltip');
             $data['oct'] = $this->tooltip_span($d[$this->fields['octgrade']], $d[$this->fields['octnote']], 'octtooltip');
             $data['nov'] = $this->tooltip_span($d[$this->fields['novgrade']], $d[$this->fields['novnote']], 'novtooltip');
             $data['dec'] = $this->tooltip_span($d[$this->fields['decgrade']], $d[$this->fields['decnote']], 'dectooltip');
             $data['jan'] = $this->tooltip_span($d[$this->fields['jangrade']], $d[$this->fields['jannote']], 'jantooltip');
             $data['feb'] = $this->tooltip_span($d[$this->fields['febgrade']], $d[$this->fields['febnote']], 'febtooltip');
             $data['mar'] = $this->tooltip_span($d[$this->fields['margrade']], $d[$this->fields['marnote']], 'martooltip');
             $data['apr'] = $this->tooltip_span($d[$this->fields['aprgrade']], $d[$this->fields['aprnote']], 'aprtooltip');
             $data['may'] = $this->tooltip_span($d[$this->fields['maygrade']], $d[$this->fields['maynote']], 'maytooltip');
             $data['jun'] = $this->tooltip_span($d[$this->fields['jungrade']], $d[$this->fields['junnote']], 'juntooltip');
             $data['jul'] = $this->tooltip_span($d[$this->fields['julgrade']], $d[$this->fields['julnote']], 'jultooltip');
             $flextable->add_data_keyed($data);
         }
         ob_start();
         $flextable->print_html();
         $output = ob_get_contents();
         $jsmodule = array('name' => 'ilp_mis_learner_profile_hcc_tracker', 'fullpath' => '/blocks/ilp/classes/dashboard/mis/ilp_mis_learner_profile_hcc_tracker.js', 'requires' => array('yahoo', 'event', 'dom', 'element', 'connection', 'array'));
         $PAGE->requires->js_init_call('M.ilp_mis_learner_profile_hcc_tracker.init', null, true, $jsmodule);
         ob_end_clean();
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             $output = '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
     return $output;
 }
 public function display()
 {
     global $CFG, $PARSER;
     if (!empty($this->data)) {
         $summarydata = $this->summary_data($this->data);
         $sixtermformat = get_config('block_ilp', 'mis_plugin_term_termformat');
         //set up the flexible table for displaying
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('monthly_breakdown', true, 'ilp_mis_attendance_plugin_term');
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         $headers[] = '';
         $headers[] = $this->addlinks(get_config('block_ilp', 'mis_plugin_registerterm_overallheader'), array('mis_term_id' => 0));
         $headers[] = $this->addlinks(get_config('block_ilp', 'mis_plugin_registerterm_term1header'), array('mis_term_id' => 1));
         $headers[] = $this->addlinks(get_config('block_ilp', 'mis_plugin_registerterm_term2header'), array('mis_term_id' => 2));
         $headers[] = $this->addlinks(get_config('block_ilp', 'mis_plugin_registerterm_term3header'), array('mis_term_id' => 3));
         if (!empty($sixtermformat)) {
             $headers[] = $this->addlinks(get_config('block_ilp', 'mis_plugin_registerterm_term4header'), array('mis_term_id' => 4));
             $headers[] = $this->addlinks(get_config('block_ilp', 'mis_plugin_registerterm_term5header'), array('mis_term_id' => 5));
             $headers[] = $this->addlinks(get_config('block_ilp', 'mis_plugin_registerterm_term6header'), array('mis_term_id' => 6));
         }
         $columns[] = 'metric';
         $columns[] = 'overall';
         $columns[] = 'one';
         $columns[] = 'two';
         $columns[] = 'three';
         if (!empty($sixtermformat)) {
             $columns[] = 'four';
             $columns[] = 'five';
             $columns[] = 'six';
         }
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         $terms = empty($sixtermformat) ? 4 : 7;
         $data['metric'] = get_string('ilp_mis_attendance_plugin_registerterm_disp_attendance', 'block_ilp');
         $data['overall'] = $this->percent_format($summarydata['att_prec'][0], true);
         $data['one'] = $this->percent_format($summarydata['att_prec'][1], true);
         $data['two'] = $this->percent_format($summarydata['att_prec'][2], true);
         $data['three'] = $this->percent_format($summarydata['att_prec'][3], true);
         if (!empty($sixtermformat)) {
             $data['four'] = $this->percent_format($summarydata['att_prec'][4], true);
             $data['five'] = $this->percent_format($summarydata['att_prec'][5], true);
             $data['six'] = $this->percent_format($summarydata['att_prec'][6], true);
         }
         $flextable->add_data_keyed($data);
         $data['metric'] = get_string('ilp_mis_attendance_plugin_registerterm_disp_punctuality', 'block_ilp');
         $data['overall'] = $this->percent_format($summarydata['pun_perc'][0], true);
         $data['one'] = $this->percent_format($summarydata['pun_perc'][1], true);
         $data['two'] = $this->percent_format($summarydata['pun_perc'][2], true);
         $data['three'] = $this->percent_format($summarydata['pun_perc'][3], true);
         if (!empty($sixtermformat)) {
             $data['four'] = $this->percent_format($summarydata['pun_perc'][4], true);
             $data['five'] = $this->percent_format($summarydata['pun_perc'][5], true);
             $data['six'] = $this->percent_format($summarydata['pun_perc'][6], true);
         }
         $flextable->add_data_keyed($data);
         ob_start();
         $flextable->print_html();
         $output = ob_get_contents();
         ob_end_clean();
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             $output = '<div id="plugin_nodata">*******************' . $msg . '</div>';
         }
     }
     return $output;
 }
 /**
  * 
  * @see ilp_mis_plugin::display()
  */
 function display()
 {
     global $CFG;
     // set up the flexible table for displaying the data
     if (!empty($this->data)) {
         // set up the flexible table
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('exam_timetable', true, 'ilp_mis_misc_exam_timetable');
         //create headers
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         $headers[] = get_string('ilp_mis_misc_exam_timetable_day_disp', 'block_ilp');
         $headers[] = get_string('ilp_mis_misc_exam_timetable_date_disp', 'block_ilp');
         $headers[] = get_string('ilp_mis_misc_exam_timetable_exam_disp', 'block_ilp');
         $headers[] = get_string('ilp_mis_misc_exam_timetable_room_disp', 'block_ilp');
         $headers[] = get_string('ilp_mis_misc_exam_timetable_starttime_disp', 'block_ilp');
         $headers[] = get_string('ilp_mis_misc_exam_timetable_endtime_disp', 'block_ilp');
         $columns[] = 'day';
         $columns[] = 'date';
         $columns[] = 'exam';
         $columns[] = 'room';
         $columns[] = 'starttime';
         $columns[] = 'endtime';
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         $i = 0;
         $total = 0;
         //add the row to table
         foreach ($this->data as $row) {
             $date = $row[get_config('block_ilp', 'mis_misc_exam_timetable_date')];
             $datetimestamp = strtotime($date);
             $data['day'] = date('D', $datetimestamp);
             $data['date'] = date('d/m', $datetimestamp);
             $data['exam'] = $row[get_config('block_ilp', 'mis_misc_exam_timetable_exam')];
             $data['room'] = $row[get_config('block_ilp', 'mis_misc_exam_timetable_room')];
             $start = strtotime($row[get_config('block_ilp', 'mis_misc_exam_timetable_starttime')]);
             $data['starttime'] = date('G:i', $start);
             $end = strtotime($row[get_config('block_ilp', 'mis_misc_exam_timetable_endtime')]);
             $data['endtime'] = date('G:i', $end);
             $flextable->add_data_keyed($data);
         }
         //calculate the average of the students qualification points
         $average = !empty($total) ? $total / $i : 0;
         //buffer out as flextable sends its data straight to the screen we dont want this
         ob_start();
         //call the html file for the plugin which has the flextable print statement
         $flextable->print_html();
         $pluginoutput = ob_get_contents();
         ob_end_clean();
         return $pluginoutput;
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             echo '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
 }
 public function display()
 {
     $this->init_bgcolours();
     if (!empty($this->courselist) && !empty($this->mcbdata)) {
         //set up the flexible table for displaying
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('monthly_breakdown', true, 'ilp_mis_attendance_plugin_mcb');
         //setup the headers and columns with the fields that have been requested
         $headers = array();
         $columns = array();
         $headers[] = get_string('ilp_mis_attendance_plugin_mcb_course', 'block_ilp');
         $headers[] = get_string('ilp_mis_attendance_plugin_mcb_attendance', 'block_ilp');
         $columns[] = 'course';
         $columns[] = 'overall';
         $startmonth = get_config('block_ilp', 'mis_plugin_mcb_startmonth');
         $endmonth = get_config('block_ilp', 'mis_plugin_mcb_endmonth');
         //we start the month counter from the first month
         $month = $startmonth;
         do {
             //get a string representation of the month
             $monthstr = strtolower(date('M', strtotime("1-{$month}-2011")));
             //pass the lang string for the month
             $headers[] = get_string($monthstr, 'block_ilp');
             //cast the month to a int
             $columns[] = "{$month}month";
             $month++;
             if ($month >= 13) {
                 $month = 1;
             }
         } while ($month != $endmonth + 1);
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         foreach ($this->courselist as $cid => $cname) {
             //we start the month counter from the first month
             $month = $startmonth;
             $data['course'] = $cname;
             $cellcontents = $this->mcbdata[$cid]['overallpercent'] . '%';
             $data['overall'] = $this->format_background_by_value($cellcontents);
             do {
                 $cellcontents = !empty($this->mcbdata[$cid][$month]) ? $this->addlinks(round($this->mcbdata[$cid][$month]['percent'], 0) . "%", array('mis_period_id' => $month)) : "";
                 //the value when the condition is not met will fill the blank cells in the table row
                 $data["{$month}month"] = $this->format_background_by_value($cellcontents);
                 //? $this->addlinks($this->mcbdata[$cid][$month] . "%", array('mis_period_id' => $month))
                 $month++;
                 if ($month >= 13) {
                     $month = 1;
                 }
             } while ($month != $endmonth + 1);
             $flextable->add_data_keyed($data);
         }
         ob_start();
         $flextable->print_html();
         $pluginoutput = ob_get_contents();
         ob_end_clean();
         return $pluginoutput;
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             echo '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
 }
 /**
  * 
  * @see ilp_mis_plugin::display()
  */
 function display()
 {
     global $CFG;
     // set up the flexible table for displaying the data
     if (!empty($this->data)) {
         // set up the flexible table for displaying the portfolios
         //instantiate the ilp_ajax_table class
         $flextable = new ilp_mis_ajax_table('learner_profile_qualifications', true, 'ilp_mis_learner_profile_qualifications');
         //create headers
         $headers = array();
         $columns = array();
         //setup the headers and columns with the fields that have been requested
         foreach ($this->fields as $k => $v) {
             if ("mis_learner_qualifications_{$k}" != 'mis_learner_qualifications_weight') {
                 $string = "ilp_mis_learner_qualifications_{$k}_disp";
                 $headers[] = get_string($string, 'block_ilp');
                 $string = "mis_learner_qualifications_{$k}";
                 $columns[] = get_config('block_ilp', $string);
             }
         }
         //define the columns in the tables
         $flextable->define_columns($columns);
         //define the headers in the tables
         $flextable->define_headers($headers);
         //we do not need the intialbars
         $flextable->initialbars(false);
         $flextable->set_attribute('class', 'flexible generaltable');
         //setup the flextable
         $flextable->setup();
         $i = 0;
         $total = 0;
         //add the row to table
         foreach ($this->data as $row) {
             foreach ($this->fields as $k => $v) {
                 $string = "mis_learner_qualifications_{$k}";
                 $configvar = get_config('block_ilp', $string);
                 //we dont need to display the weight data
                 if ($configvar != get_config('block_ilp', 'mis_learner_qualifications_weight')) {
                     $data[$configvar] = $row[$configvar];
                 }
             }
             $flextable->add_data_keyed($data);
             if (!empty($row[get_config('block_ilp', 'mis_learner_qualifications_points')])) {
                 $i++;
                 $weight = $row[get_config('block_ilp', 'mis_learner_qualifications_weight')];
                 $points = $row[get_config('block_ilp', 'mis_learner_qualifications_points')];
                 $total += !empty($weight) ? $points * $weight : $points;
             }
         }
         //calculate the average of the students qualification points
         $average = !empty($total) ? $total / $i : 0;
         //buffer out as flextable sends its data straight to the screen we dont want this
         ob_start();
         $flextable->wrap_finish_extra = !empty($row[get_config('block_ilp', 'mis_learner_qualifications_points')]) ? "<div id='ilp_mis_learner_profile_qualifications_average'><label>" . get_string('ilp_mis_learner_qualifications_average', 'block_ilp') . "</label>" . number_format($average, 0) . "</div>" : "";
         //call the html file for the plugin which has the flextable print statement
         //require_once($CFG->dirroot.'/blocks/ilp/classes/dashboard/mis/ilp_mis_learner_profile_qualifications.html');
         $flextable->print_html();
         $pluginoutput = ob_get_contents();
         ob_end_clean();
         return $pluginoutput;
     } else {
         if ($msg = get_string('nodataornoconfig', 'block_ilp')) {
             echo '<div id="plugin_nodata">' . $msg . '</div>';
         }
     }
 }