本文整理汇总了PHP中UserDAO::getUsersByDepartment方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDAO::getUsersByDepartment方法的具体用法?PHP UserDAO::getUsersByDepartment怎么用?PHP UserDAO::getUsersByDepartment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDAO
的用法示例。
在下文中一共展示了UserDAO::getUsersByDepartment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findDepartAndUser
function findDepartAndUser($departID, $userID)
{
$departDAO = new DepartmentDAO();
$depart = $departDAO->getDepartmentByID($departID);
if ($depart === null) {
return false;
}
$result = array();
$subDepart = $departDAO->getChildDepartments($depart);
if ($subDepart !== null) {
foreach ($subDepart as $subDep) {
if ($subDep->getDepartmentID() === $subDep->getParentID()) {
continue;
}
$node = array();
$node["type"] = 1;
$node["id"] = $subDep->getDepartmentID();
$node["name"] = $subDep->getDepartmentName();
$result[] = $node;
}
}
$userDAO = new UserDAO();
$users = $userDAO->getUsersByDepartment($depart);
if ($users !== null) {
foreach ($users as $user) {
if ($user->getUserID() == $userID) {
continue;
}
$node = array();
$node["type"] = 2;
$node["id"] = $user->getUserID();
$node["name"] = $user->getFirstName() . " " . $user->getLastName();
$result[] = $node;
}
}
return $result;
}