예제 #1
0
/**
 * Get the students task work allocation
 * @param int currentgroup
 * return array of rank members by work allocation
 */
function RankMembersTasksDistribution($currentgroup)
{
    global $DB;
    $groups_members = $DB->get_records('groups_members', array('groupid' => $currentgroup));
    //Get the members of a current group
    $tasks = $DB->get_records('project_task', array('group_id' => $currentgroup), '', 'id,members,hours');
    //Get the tasks assigned to a group, return an array of task id, members assigned, and total hours
    //Iterate all members in a group
    $total_hours = 0;
    $member_rank = array();
    foreach ($groups_members as $member) {
        //For every member, find their associated tasks and estimated hours.
        $hours = 0;
        foreach ($tasks as $task_hours) {
            $names = getStudentID($task_hours->members);
            //Get an array of users in the project group
            if (in_array($member->userid, $names)) {
                //If member is in the array of assigned members add hours
                if (count($names) > 1) {
                    //If there is more than one member assigned, split the workload by all members
                    $hours += $task_hours->hours / count($names);
                } else {
                    //Otherwise just assign all hours to assigned member
                    $hours += $task_hours->hours;
                }
            }
        }
        //end inner foreach
        $member_rank[$member->userid] = $hours;
        $total_hours += $hours;
        //Add hours of a task to the overall
    }
    //end outer foreach
    return $member_rank;
}
예제 #2
0
?>
<a href="./"><img src="images/campusreconnectionlogo.png" style="border:0px;" alt="Campus Reconnection" /></a>
<div id="pagediv">
<?php 
include "includes/menustrip.php";
?>
<span class="title">Student Profile:</span>
<br /><br />
<ul id="tabs">
  <li><a href="#about">About</a></li>
  <li><a href="#contact">Contact</a></li>
  <li><a href="#emergency">Emergency</a></li>
</ul>
<div id="profileDiv">
<?php 
$id = ($r = getStudentID($_SESSION['cruser'])) ? $r : "";
$name = ($r = getStudentFullName($_SESSION['cruser'])) ? $r : "";
$dob = ($r = getStudentDateOfBirth($_SESSION['cruser'])) ? date_create($r) : date_create("1990-00-00");
$age = date_diff(date_create(), $dob)->format("%y");
$status = ($r = getStudentStatus($_SESSION['cruser'])) ? $r : "";
$enroll = ($r = getStudentEnrollment($_SESSION['cruser'])) ? $r : "";
$type = ($r = getStudentType($_SESSION['cruser'])) ? $r : "";
$aService = getActiveService($_SESSION['cruser']) ? "Yes" : "No";
$majors = ($r = getStudentMajors($_SESSION['cruser'])) ? $r : null;
$major1 = isset($majors[0]) ? $majors[0][0] : "Undeclared";
$major2 = isset($majors[1]) ? $majors[1][0] : "";
$major3 = isset($majors[2]) ? $majors[2][0] : "";
$minors = ($r = getStudentMinors($_SESSION['cruser'])) ? $r : null;
$minor1 = isset($minors[0]) ? $minors[0][0] : "---";
$minor2 = isset($minors[1]) ? $minors[1][0] : "";
$minor3 = isset($minors[2]) ? $minors[2][0] : "";