function definition() { global $CFG, $DB; $history = $this->_customdata['history']; $convo_members = $this->_customdata['convo_members']; $group_members = $this->_customdata['group_members']; $history_records = $this->_customdata['history_records']; $member_count = count($convo_members) - 1; $mform = $this->_form; //Get users from mapped table based on group id $users_map = $DB->get_records('project_user_mapping', array('group_id' => $history->groupid)); $mform->addElement('header', 'general', 'Conversation Mapping'); $mform->addElement('hidden', 'history_records'); $mform->setType("history_records", PARAM_TEXT); $mform->setDefault('history_records', $history_records); //Return number of Users found $count_convo_members = count($convo_members) - 1; //less one for the blank option $mform->addElement('html', 'Found ' . $count_convo_members . ' conversation members. Please match members of this group to their respected conversation username. <br /><br />'); $mform->addElement('static', 'LabelConvo', 'Group Members', 'Conversation Members'); foreach ($users_map as $key => $user) { //$mform->addElement('select', 'member_map--'.$user->user_id, studentidToLMS_Name($user->user_id), $convo_members); //Check if Name is already saved in the database for mapping if (empty($user->skype)) { //$mform->setDefault('member_map--'.$user->user_id, $user->skype); //}//end if //else if not saved, take a guess //else{ $mform->addElement('select', 'member_map--' . $user->user_id, studentidToLMS_Name($user->user_id), $convo_members); $user_sort = array(); foreach ($convo_members as $key => $convo_member) { $user_sort[$key] = similar_text(studentidToLMS_Name($user->user_id), $convo_member, $similar); if ($similar >= 60) { //If the probability of the chat user is >= 60% similar to a student name, set it $mform->setDefault('member_map--' . $user->user_id, $key); } } //end foreach } //end else } //end foreach $mform->addElement('hidden', 'cmid'); $mform->setType('cmid', PARAM_INT); $mform->addElement('hidden', 'map_users'); $mform->setType('map_users', PARAM_INT); $mform->setDefault('map_users', true); $mform->addElement('hidden', 'method'); $mform->setType('method', PARAM_RAW); $mform->addElement('hidden', 'groupid'); $mform->setType('groupid', PARAM_RAW); $this->set_data($history); $this->add_action_buttons(true); }
$total_hours = array_sum($member_rank); if ($total_hours > 0) { $equal_hours = $total_hours / count($member_rank); $html = "Individual Recommended Hours: " . round($equal_hours, 2) . " Hours<br /><br />"; //If large variance occurs, display column for table if (AlertWorkloadDistribution($currentgroup)) { $html .= "<table style='border:1px solid black;'><tr style='background-color:lightgrey;'><th>Member</th><th>Assigned Hours</th><th>% of Workload</th><th>Variance</th></tr>"; } else { $html .= "<table style='border:1px solid black;'><tr style='background-color:lightgrey;'><th>Member</th><th>Assigned Hours</th><th>% of Workload</th><th></th></tr>"; } foreach ($member_rank as $key => $member) { if ($key == $USER->id) { //Bold the current student $html .= "<tr><td><b>" . studentidToLMS_Name($key) . "</b></td>"; } else { $html .= "<tr><td>" . studentidToLMS_Name($key) . "</td>"; } $html .= "<td style='text-align:center;'>" . $member . "</td>"; $html .= "<td style='text-align:center;'''>" . round($member / $total_hours * 100, 2) . "</td>"; $distribution = MemberWorkloadDistribution($member, $equal_hours); if (!empty($distribution)) { //If distribution occus, display variance and icon. $html .= "<td style='text-align:center;color:crimson;'>" . MemberWorkloadDistribution($member, $equal_hours) . " <img src='pix\\alert_icon.png'' width='12px' height='12px'/></td>"; } else { $html .= "<td></td>"; } $html .= "</tr>"; } $html .= "<td><u>Total</u></td><td style='text-align:center;'>" . $total_hours . "</td><td style='text-align:center;'>" . round($total_hours / $total_hours * 100, 2) . "</td><td></td></tr>"; $html .= "</table>"; } else {