index.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. // check for right of current admin on this module
  3. if (cfr('EMPLOYEEDIR')) {
  4. $ubCache = new UbillingCache();
  5. //new employee creation
  6. if (ubRouting::checkPost(array('addemployee', 'employeename'))) {
  7. $newEmpName = ubRouting::post('employeename');
  8. $newEmpJob = ubRouting::post('employeejob');
  9. $newEmpMobile = ubRouting::post('employeemobile');
  10. $newEmpTlg = ubRouting::post('employeetelegram');
  11. $newEmpAdmLogin = ubRouting::post('employeeadmlogin');
  12. $newEmpTagId = ubRouting::post('editadtagid');
  13. $newEmpAmLim = ubRouting::post('amountLimit');
  14. em_EmployeeAdd($newEmpName, $newEmpJob, $newEmpMobile, $newEmpTlg, $newEmpAdmLogin, $newEmpTagId, $newEmpAmLim);
  15. $ubCache->delete('EMPLOYEE_LOGINS');
  16. ubRouting::nav('?module=employee');
  17. }
  18. //existing employee deletion
  19. if (ubRouting::checkGet('deleteemployee', false)) {
  20. em_EmployeeDelete(ubRouting::get('deleteemployee'));
  21. $ubCache->delete('EMPLOYEE_LOGINS');
  22. ubRouting::nav('?module=employee');
  23. }
  24. //jobtype creation
  25. if (ubRouting::checkPost(array('addjobtype', 'newjobtype'))) {
  26. stg_add_jobtype(ubRouting::post('newjobtype'), ubRouting::post('newjobcolor'));
  27. ubRouting::nav('?module=employee');
  28. }
  29. //existing jobtype deletion
  30. if (ubRouting::checkGet('deletejob', false)) {
  31. stg_delete_jobtype(ubRouting::get('deletejob'));
  32. ubRouting::nav('?module=employee');
  33. }
  34. //existing job type editing
  35. if (ubRouting::checkGet('editjob', false)) {
  36. $editjobId = ubRouting::get('editjob', 'int');
  37. //updating jobtype
  38. if (ubRouting::checkPost('editjobtype')) {
  39. em_JobTypeSave($editjobId);
  40. ubRouting::nav('?module=employee');
  41. }
  42. //rendering job type editing form
  43. show_window(__('Edit') . ' ' . __('Job type'), em_JobTypeEditForm($editjobId));
  44. show_window('', wf_BackLink('?module=employee', 'Back', true, 'ubButton'));
  45. }
  46. //existing employee editing
  47. if (ubRouting::checkGet('editemployee', false)) {
  48. $editemployee = ubRouting::get('editemployee', 'int');
  49. //updating employee
  50. if (ubRouting::checkPost('editname')) {
  51. em_EmployeeSave($editemployee);
  52. $ubCache->delete('EMPLOYEE_LOGINS');
  53. ubRouting::nav('?module=employee');
  54. }
  55. //rendering employee editing form
  56. show_window(__('Edit') . ' ' . __('Worker'), em_employeeEditForm($editemployee));
  57. show_window('', wf_BackLink('?module=employee', 'Back', true, 'ubButton'));
  58. }
  59. //listing available employee and jobtypes
  60. if (!ubRouting::checkGet('editemployee') AND ! ubRouting::checkGet('editjob')) {
  61. em_EmployeeRenderList();
  62. em_JobTypeRenderList();
  63. }
  64. } else {
  65. show_error(__('You cant control this module'));
  66. }