AllSkillItemsResult->SkillItem; # Alias to save typing if ($_SERVER['PHP_SELF'] == '/staff/agency.php') $is_a=TRUE; if ($is_a) { $resobjList = GetHashedObj('GetFullAgencyList','GetAgencyListHash'); $staffObjs =& $resobjList->GetFullAgencyListResult->FullStaffItem; } else { $resobjList = GetHashedObj('GetFullStaffList','GetStaffListHash'); $staffObjs =& $resobjList->GetFullStaffListResult->FullStaffItem; } function echo_staff() { global $skills,$skills2sort; asort($skills2sort); echo ''; $skills2sort = array(); $skills = array(); } function printORnoprint($incexc, $flag) { global $i_limit,$lumps,$resobjItems,$resobjList,$lumps_this,$lumps_open,$skills,$skills2sort,$staffObjs; $i_open=0; reset($lumps); while (current($lumps)->Path == FALSE) { next($lumps); } # Skip any NULL paths - A way to hide records from the web if desired. do { $lumps_this = explode('|',strip_tags(current($lumps)->Path)); # Cached data is NOT trusted if (in_array($lumps_this[0],(array)$incexc) == $flag) continue; # Include/exclude $lump_=strtolower(strtr($lumps_this[0],' ','_')); # for the stylesheet for ($i_diff=0; $i_diff<=count($lumps_this); $i_diff++) { if ($lumps_this[$i_diff] != $lumps_open[$i_diff]) break; # Count the similar elements of the two paths if ($i_diff == $i_limit) break; # Limit levels of nesting } # $i_diff contains the index of the first differing path element or $i_limit; whichever is lower #echo '',current($lumps)->Path,':',$i_open,':',$i_diff,':',$i_limit,':',"\n"; # Now decide wether to print out this time around if ($skills and ($i_open > $i_diff or $i_limit > $i_diff)) echo_staff(); $lumps_rem = implode(' ',array_slice($lumps_this,$i_limit)); # These bits are to be appended to any names. # $lumps_rem = str_replace(' ',' ',$lumps_rem); if ($lumps_rem) $lumps_rem = "".$lumps_rem.', '; # BUG: This actually gives the wrong result for "Adobe Premier" with l=1 foreach ($staffObjs as $staffObj) { # Loop thro the staff if (in_array((int)current($lumps)->ID,(array)$staffObj->SkillIDs->int)) { # Have they the skill? if (!array_key_exists($staffObj->ID,$skills)) { $skills[$staffObj->ID] = ''.strip_tags($staffObj->FirstName.' '.$staffObj->LastName).' - '; # Name first in the string $skills2sort[$staffObj->ID] = strtolower(strip_tags($staffObj->LastName.$staffObj->FirstName)); # Array to sort, Surname first } $skills[$staffObj->ID] .= $lumps_rem; # Append this skill } } if ($skills and ($i_open>$i_diff or $i_limit>$i_diff)) { # These come from ** below echo @str_repeat('',$i_open-$i_diff),"\n"; # Close down