<?php
global $user;
$instructor_role_id = 3;
if ($user->uid == 0) {
print l (t('You must log in to view this page'), 'user');
return;
}
else if (!array_key_exists($instructor_role_id, $user->roles)) {
print l(t('View your profile'), 'user/'. $user->uid);
return;
}
$items=array();
$per_page = 50;
$profile_field_id = 1; // last name profile field id
$student_role_id = 4;
$result = pager_query ("SELECT u.uid, u.name, pv.value FROM {users}
u JOIN {users_roles} ur ON u.uid = ur.uid JOIN
{profile_values} pv ON u.uid = pv.uid WHERE pv.fid = %d
AND ur.rid = %d ORDER BY pv.value, u.name", $per_page, 0,
NULL, $profile_field_id, $student_role_id);
while ($account = db_fetch_object($result)) {
$items[] = 1($account->name, 'tracker/'. $account->uid) .' | '.
$account->value;
}
$output = '<div class = "user-list">';
$output .= theme('item_list', $items);
$output .= '</div>';
$output .= theme ('pager', array(), $per_page);
print $output
?>
