SettingController.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * @author darkredz
  4. */
  5. class SettingController extends DooController {
  6. public function beforeRun($resource, $action) {
  7. }
  8. function __construct() {
  9. if (isset ( $_COOKIE ["staff"] )) {
  10. if (! empty ( $_COOKIE ["staff"] )) {
  11. Doo::loadModel ( 'staff' );
  12. $staff = new staff ();
  13. $this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] );
  14. return "/";
  15. }
  16. }
  17. Doo::loadCore ( 'uri/DooUriRouter' );
  18. $router = new DooUriRouter ();
  19. $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
  20. if ($routeRs ['1'] != "login") {
  21. header ( 'Content-Type:text/html;charset=utf-8' );
  22. @header ( "Location: /login" );
  23. }
  24. }
  25. /**
  26. * 员工信息
  27. */
  28. function settingEmployeeInfo(){
  29. $data ['staff'] = $this->staff;
  30. $birArray = explode ( '-', $this->staff [0] ['birthday'] );
  31. $data ['year'] = $birArray [0];
  32. $year = date ( 'Y' );
  33. $yearHtml = "";
  34. for(; $year >= 1900; $year --) {
  35. $yearHtml .= '<option ';
  36. if ($data ['year'] == $year)
  37. $yearHtml .= 'selected';
  38. $yearHtml .= ' value="' . $year . '">' . $year . '</option>';
  39. }
  40. $data ['yearHtml'] = $yearHtml;
  41. $data ['month'] = 01;
  42. $data ['day'] = 01;
  43. if (isset ( $birArray [1] )) {
  44. $data ['month'] = $birArray [1];
  45. $data ['day'] = $birArray [2];
  46. }
  47. $data ['msg'] = urldecode ( $this->params ['msg'] );
  48. $this->data ['memu'] = "adminmyinfo";
  49. $this->data ['hrMemu'] = "settingEmployeeInfo";
  50. $this->render ( "/setting/settingEmployeeInfo", $this->data );
  51. }
  52. /**
  53. * 获取get或者POST值
  54. *
  55. * @param string $name 属性名称
  56. * @return fixed 值
  57. */
  58. function get_args($name) {
  59. if (isset ( $_GET [$name] )) {
  60. if (is_array ( $_GET [$name] ))
  61. return $_GET [$name];
  62. else
  63. return addslashes ( $_GET [$name] );
  64. } elseif (isset ( $_POST [$name] )) {
  65. if (is_array ( $_POST [$name] ))
  66. return $_POST [$name];
  67. else
  68. return addslashes ( $_POST [$name] );
  69. } else
  70. return false;
  71. }
  72. }
  73. ?>