public function cutDepartment($id) { $id = (int) $id; $this->_db->query("UPDATE employee SET salary = salary / 2 WHERE did = " . $id); $department = new Application_Model_DbTable_Department(); $subdepartments = $department->getDepartmentsForDepartment($id); foreach ($subdepartments as $dep) { $depId = $dep[id]; $this->cutDepartment($depId); } }
public function fillLists($id) { $department = new Application_Model_DbTable_Department(); $departments = $department->getDepartmentsForDepartment($id); foreach ($departments as $dep) { $this->departmentList->addMultiOption($dep[id], $dep[name]); } $employee = new Application_Model_DbTable_Employee(); $employees = $employee->getEmployeesForDepartment($id); foreach ($employees as $emp) { if ($emp[manager] == 0) { $this->employeeList->addMultiOption($emp[id], $emp[name]); } } }