public function environment_check_table($result, $environment_results)
 {
     global $CFG;
     $servertable = new html_table();
     $servertable->head = array(get_string('name'), get_string('info'), get_string('report'), get_string('status'));
     $servertable->attributes['class'] = 'table table-striped table-hover';
     $serverdata = array('success' => array(), 'warning' => array(), 'important' => array());
     $othertable = new html_table();
     $othertable->head = array(get_string('info'), get_string('report'), get_string('status'));
     $othertable->attributes['class'] = 'table table-striped table-hover';
     $otherdata = array('success' => array(), 'warning' => array(), 'important' => array());
     // Iterate over each environment_result
     $continue = true;
     foreach ($environment_results as $environment_result) {
         $errorline = false;
         $warningline = false;
         $stringtouse = '';
         if ($continue) {
             $type = $environment_result->getPart();
             $info = $environment_result->getInfo();
             $status = $environment_result->getStatus();
             $error_code = $environment_result->getErrorCode();
             // Process Report field
             $rec = new stdClass();
             // Something has gone wrong at parsing time
             if ($error_code) {
                 $stringtouse = 'environmentxmlerror';
                 $rec->error_code = $error_code;
                 $status = get_string('error');
                 $errorline = true;
                 $continue = false;
             }
             if ($continue) {
                 if ($rec->needed = $environment_result->getNeededVersion()) {
                     // We are comparing versions
                     $rec->current = $environment_result->getCurrentVersion();
                     if ($environment_result->getLevel() == 'required') {
                         $stringtouse = 'environmentrequireversion';
                     } else {
                         $stringtouse = 'environmentrecommendversion';
                     }
                 } else {
                     if ($environment_result->getPart() == 'custom_check') {
                         // We are checking installed & enabled things
                         if ($environment_result->getLevel() == 'required') {
                             $stringtouse = 'environmentrequirecustomcheck';
                         } else {
                             $stringtouse = 'environmentrecommendcustomcheck';
                         }
                     } else {
                         if ($environment_result->getPart() == 'php_setting') {
                             if ($status) {
                                 $stringtouse = 'environmentsettingok';
                             } else {
                                 if ($environment_result->getLevel() == 'required') {
                                     $stringtouse = 'environmentmustfixsetting';
                                 } else {
                                     $stringtouse = 'environmentshouldfixsetting';
                                 }
                             }
                         } else {
                             if ($environment_result->getLevel() == 'required') {
                                 $stringtouse = 'environmentrequireinstall';
                             } else {
                                 $stringtouse = 'environmentrecommendinstall';
                             }
                         }
                     }
                 }
                 // Calculate the status value
                 if ($environment_result->getBypassStr() != '') {
                     //Handle bypassed result (warning)
                     $status = get_string('bypassed');
                     $warningline = true;
                 } else {
                     if ($environment_result->getRestrictStr() != '') {
                         //Handle restricted result (error)
                         $status = get_string('restricted');
                         $errorline = true;
                     } else {
                         if ($status) {
                             //Handle ok result (ok)
                             $status = get_string('ok');
                         } else {
                             if ($environment_result->getLevel() == 'optional') {
                                 //Handle check result (warning)
                                 $status = get_string('check');
                                 $warningline = true;
                             } else {
                                 //Handle error result (error)
                                 $status = get_string('check');
                                 $errorline = true;
                             }
                         }
                     }
                 }
             }
             // Build the text
             $linkparts = array();
             $linkparts[] = 'admin/environment';
             $linkparts[] = $type;
             if (!empty($info)) {
                 $linkparts[] = $info;
             }
             if (empty($CFG->docroot)) {
                 $report = get_string($stringtouse, 'admin', $rec);
             } else {
                 $report = $this->doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
             }
             // Format error or warning line
             if ($errorline || $warningline) {
                 $messagetype = $errorline ? 'important' : 'warning';
             } else {
                 $messagetype = 'success';
             }
             $status = label::make($messagetype, $status);
             // Here we'll store all the feedback found
             $feedbacktext = '';
             // Append the feedback if there is some
             $feedbacktext .= $environment_result->strToReport($environment_result->getFeedbackStr(), 'alert alert-' . $messagetype);
             //Append the bypass if there is some
             $feedbacktext .= $environment_result->strToReport($environment_result->getBypassStr(), 'alert');
             //Append the restrict if there is some
             $feedbacktext .= $environment_result->strToReport($environment_result->getRestrictStr(), 'alert alert-important');
             $report .= $feedbacktext;
             // Add the row to the table
             if ($environment_result->getPart() == 'custom_check') {
                 $otherdata[$messagetype][] = array($info, $report, $status);
             } else {
                 $serverdata[$messagetype][] = array($type, $info, $report, $status);
             }
         }
     }
     $servertable->data = array_merge($serverdata['important'], $serverdata['warning'], $serverdata['success']);
     $othertable->data = array_merge($otherdata['important'], $otherdata['warning'], $otherdata['success']);
     $output = $this->heading(get_string('serverchecks', 'admin'));
     $output .= html_writer::table($servertable);
     if (count($othertable->data)) {
         $output .= $this->heading(get_string('customcheck', 'admin'));
         $output .= html_writer::table($othertable);
     }
     // Finally, if any error has happened, print the summary box.
     if (!$result) {
         $output .= bootstrap::alert_error(get_string('environmenterrortodo', 'admin'));
     }
     return $output;
 }