dc_jt Posted June 21, 2007 Share Posted June 21, 2007 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; } } } Quote Link to comment https://forums.phpfreaks.com/topic/56526-complicated-method-need-help/ Share on other sites More sharing options...
dc_jt Posted June 21, 2007 Author Share Posted June 21, 2007 *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 Quote Link to comment https://forums.phpfreaks.com/topic/56526-complicated-method-need-help/#findComment-279179 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.