OSB enhancements to date

This commit is contained in:
Deon George
2010-11-30 09:41:08 +11:00
parent 8715a2059b
commit ec6a542bc3
478 changed files with 23423 additions and 9309 deletions

View File

@@ -29,6 +29,56 @@
* @subpackage Module:Staff
*/
class staff extends OSB_module {
/**
* Get the staff who are a member of a department
*
* @param string $dep Department to find users
* @return array Staff Ids who are a member of the department
* @uses staff_department
*/
public function sDepartmentMember($dep) {
require_once(PATH_MODULES.'staff_department/staff_department.inc.php');
$sdo = new staff_department;
if (! $department = $sdo->sql_GetRecords(array('where'=>array('name'=>$dep))))
return array();
$department = array_pop($department);
$result = array();
foreach ($this->sql_GetRecords(array('where'=>'department_avail IS NOT NULL')) as $record) {
$department_avail = unserialize($record['department_avail']);
if (in_array($department['id'],$department_avail))
array_push($result,$record['account_id']);
}
return $result;
}
/**
* Get the list of emails and names of users in a department
*
* @param string $dep Name of Department to obtain
* @return array Emails and Full Names
* @uses account
*/
public function sDepartmentMemberEmail($dep) {
$result = array();
$members = $this->sDepartmentMember($dep);
if (count($members)) {
require_once(PATH_MODULES.'account/account.inc.php');
$ao = new account;
foreach ($ao->sql_GetRecords(array('where'=>sprintf('id IN (%s)',implode(',',$members)))) as $record)
$result[$record['email']] = sprintf('%s %s',$record['first_name'],$record['last_name']);
}
return $result;
}
/**
* EMAIL ONE STAFF MEMBER
*/