Created
January 29, 2013 19:37
-
-
Save musicalbigfoot/4667005 to your computer and use it in GitHub Desktop.
PHP: NOC2 Employees List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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