Jump to content

Complicated method, need help!!


dc_jt

Recommended Posts

Hi

 

Now listen carefully, this could get complicated.

 

I have to find all staff who have submitted ALL groups on time for a particular phase.

 

If you see my code below, you can see what ive done so far. This only results in showing staff who have NOT completed all groups on time. If I take the ! off if (!$aCompletedGroups[$aStaff['staff_id']][$aGroup['reflection_id']]) then this could still find staff members who have completed 2 out of 3 because this looks for staff who have completed any not all.

 

If you dont understand fully, let me know and Ill try and explain in more detail but you should be able to see by my code what Im trying to do.

 

Thanks

 

By the way reflection_id is basically group_id.

 

$aCulpritStaff = array();

//Get all completed groups for this phase.
$aGetCompletedGroups = $oTblReflections->GetCompletedGroups($_GET['iPhaseId']);

//Loop through each completed group and set $aCompletedGroups array as a row.
foreach ($aGetCompletedGroups as $aRow)
{
$aCompletedGroups[$aRow['staff_id']][$aRow['reflection_id']] = 1;

}

//Get all staff for this course
$aGetStaff = $oTblStaff->GetCourseStaff($_GET['iCourseId']);

//Get all groups for this phase
$aGetGroups = $oTblReflections->GetAllGroups($_GET['iPhaseId']);

//Loop through each staff member
foreach ($aGetStaff as $aStaff)
{
//Loop through each document
foreach ($aGetGroups as $aGroup)
{
	//If $aCompletedGroups array doesnt match the $aCompletedGroups set above using the staff loop and 
	//the group loop to populate it, then add this staff member to the $aCulpritStaff array which holds all data
	//on staff member.
	if (!$aCompletedGroups[$aStaff['staff_id']][$aGroup['reflection_id']])
	{
		$aCulpritStaff[] = $aStaff;
		break;
	}
}
}

Link to comment
Share on other sites

*UPDATE* I have realised now, everyone who lands in $aCulpritStaff[] = $aStaff;, I need to remove from $aCompletedGroups because these people have not completed all groups.

 

Therefore, how would I loop through $aCulpritStaff and remove these from aCompletedGroups ??

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.