Skip to content

Instantly share code, notes, and snippets.

@musicalbigfoot
Created January 29, 2013 19:37
Show Gist options
  • Save musicalbigfoot/4667005 to your computer and use it in GitHub Desktop.
Save musicalbigfoot/4667005 to your computer and use it in GitHub Desktop.
PHP: NOC2 Employees List
$employees = ORM::factory('user')
->where('type','=','employee')
->and_where('active','=',TRUE)
->find_all();
$locs = ORM::factory('location')
->where('active','=',TRUE)
->order_by('location','asc')
->find_all();
$active_employees = array('0'=>'');
foreach ($locs as $loc) {
$list = array();
foreach ($employees as $employee) {
if ($employee->location_id == $loc->id) {
$list[$employee->id] = $employee->name;
}
}
$active_employees[$loc->location] = $list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment