2016-08-04 05:59:04 +02:00
|
|
|
<?php
|
2016-08-20 23:06:41 +02:00
|
|
|
use RedBeanPHP\Facade as RedBean;
|
2016-08-04 05:59:04 +02:00
|
|
|
|
|
|
|
class Department extends DataStore {
|
|
|
|
const TABLE = 'department';
|
|
|
|
|
2016-08-05 01:21:51 +02:00
|
|
|
public static function getProps() {
|
2016-08-04 05:59:04 +02:00
|
|
|
return [
|
|
|
|
'name',
|
|
|
|
'sharedTicketList'
|
|
|
|
];
|
|
|
|
}
|
2016-08-20 23:06:41 +02:00
|
|
|
|
|
|
|
public static function getDepartmentNames() {
|
|
|
|
$departmentsQuantity = RedBean::count(Department::TABLE);
|
|
|
|
$departmentsNameList = [];
|
|
|
|
|
|
|
|
for ($departmentIndex = 1; $departmentIndex <= $departmentsQuantity; ++$departmentIndex) {
|
|
|
|
$departmentsNameList[] = Department::getDataStore($departmentIndex)->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $departmentsNameList;
|
|
|
|
}
|
2016-09-24 21:26:37 +02:00
|
|
|
|
|
|
|
public static function getAllDepartments() {
|
|
|
|
$departmentsQuantity = RedBean::count(Department::TABLE);
|
|
|
|
$departmentList = new DataStoreList();
|
|
|
|
|
|
|
|
for ($departmentIndex = 1; $departmentIndex <= $departmentsQuantity; ++$departmentIndex) {
|
|
|
|
$departmentList->add(Department::getDataStore($departmentIndex));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $departmentList;
|
|
|
|
}
|
2016-08-04 05:59:04 +02:00
|
|
|
}
|