/**
  * This function tests retrieving the skills list.  Currently the result is hard-coded
  * so the test will have to be updated.
  *
  */
 public function test_get_skills_list()
 {
     $this->configure_settings();
     // Now test the returned skills list.
     $gr = new group_records($this->courseid);
     $skillsnames = $gr->get_skills_list();
     $i = 1;
     foreach ($skillsnames as $skillsname) {
         // The test data adds a "?" to the end.
         $this->assertEquals('skill ' . $i++ . '?', $skillsname);
     }
 }
 /**
  * This is function grabs the records from a particular folder, encodes them in json, and writes
  * the records to the page.
  *
  */
 private function get_group_stats()
 {
     global $USER;
     $this->courseid = required_param('courseid', PARAM_INT);
     $gr = new group_records($this->courseid);
     $tablerows = $gr->get_table_rows();
     $skillslist = $gr->get_skills_list();
     $table = array('skills' => $skillslist, 'rows' => $tablerows);
     echo json_encode($table);
 }
Exemplo n.º 3
0
/**
 * This function draws the group stats table.
 *
 */
function display_group_stats($groupid)
{
    global $DB;
    $courseid = required_param('courseid', PARAM_INT);
    $members = $DB->get_records('groups_members', array('groupid' => $groupid));
    $fullscores = array();
    foreach ($members as $member) {
        $sgs = new skills_group_student($courseid, $member->userid);
        $fullscores[] = $sgs->get_scores();
    }
    $gr = new group_records($courseid);
    $skillslist = $gr->get_skills_list(true, 'multichoice');
    $labellist = $gr->get_skills_list(true, 'label');
    echo html_writer::start_div('yui3-skin-sam', array('id' => 'viewgroup'));
    echo html_writer::start_tag('table', array('class' => 'yui3-datatable-table'));
    draw_table_header($members);
    draw_table_results($members, $skillslist, $labellist, $fullscores, $courseid);
    echo html_writer::end_tag('table');
    echo html_writer::end_div();
}