Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

publicController.php 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. class publicController extends mainController {
  3. function __construct() {
  4. parent::__construct();
  5. //To change for every Controller
  6. $this->viewDir = 'Public';
  7. }
  8. public function beforeRender($content=null) {
  9. return false;
  10. }
  11. public function getGloablJs() {
  12. return $this->setView('getGloablJs');
  13. }
  14. public function recoveryPassword() {
  15. $email = $this->getPost('email', '');
  16. $validate = $this->utility->validateEmail($email);
  17. if (!$validate) {
  18. return $this->setRawJsonResponse('err', null);
  19. }
  20. $user = $this->db->where('email', $email, 'like')->getOne('users');
  21. if (is_array($user) && !empty($user)) {
  22. $passwd = uniqid();
  23. $encrPasswd = md5($passwd);
  24. $upadate = $this->db->where('id', $user['id'])->update('users', ['password'=>$encrPasswd]);
  25. if ($upadate) {
  26. $recipientName = ucwords(strtolower($user['name'].' '.$user['surname']));
  27. $recipientUsername = $user['username'];
  28. $loginPage = '<a href="'.$this->config['settings']['email']['footer-home-link'].'" target="_blank">'.$this->config['settings']['email']['footer-home-link'].'</a>';
  29. $defaultGreeting = $this->config['settings']['email']['final-greeting'];
  30. $mailID = uniqid();
  31. $mailContent = _("Dear %s,<br>
  32. you've just requested a Temporary Password:<br><br><b>Username</b>: %s<br><b>Password</b>: %s<br><b>Login Page</b>: %s<br><br>After logging in, you can change the password in your <b>Profile</b> page.<br><br>%s");
  33. $mailSubject = _('Password recovery');
  34. $mailHTML = $this->partial('Message/Email/template', ['mailID'=>$mailID, 'body'=>vsprintf($mailContent, [$recipientName, $recipientUsername, $passwd, $loginPage, $defaultGreeting]), 'showTemplate'=>true]);
  35. $this->notification->sendEmail($email, $mailSubject, $mailHTML, $mailID);
  36. } else {
  37. return $this->setRawJsonResponse('err', null);
  38. }
  39. } else{
  40. return $this->setRawJsonResponse('err', null);
  41. }
  42. return $this->setRawJsonResponse('ok', null, []);
  43. }
  44. public function emailPreview() {
  45. $args = func_get_args();
  46. $emailId = isset($args[0]['id']) ? $args[0]['id'] : null;
  47. $mailResult = $this->db->where('id', $emailId)->getOne('log_notifications');
  48. $mailBody = isset($mailResult['mail_body']) ? $mailResult['mail_body'] : null;
  49. $showTemplate = is_null($mailBody) ? true : false;
  50. $mailBody = is_null($mailBody) ? _('Invalid e-mail content.') : $mailBody;
  51. $this->view->html = $this->partial('Message/Email/template', ['mailID'=>$emailId, 'body'=>$mailBody, 'showTemplate'=>$showTemplate]);
  52. return $this->setView('emailPreview');
  53. }
  54. public function showAttachementsInDream() {
  55. $request_code = $this->getPost('request_code', null);
  56. $handleRequest = new HandleRequest();
  57. $this->view->request = [];
  58. $this->view->attachments = [];
  59. $this->view->groupedAttachments = [];
  60. $this->actionTitle = 'Request';
  61. $this->view->patientInfo = '';
  62. if (!is_null($request_code)) {
  63. $request = $this->db
  64. ->join('requests_registry rr', 'rr.request_id=r.id')
  65. ->where('r.unique_code', $request_code)
  66. ->getOne('requests r', "r.*, rr.name patient_name, rr.surname patient_surname, rr.birthdate patient_dob");
  67. if (isset($request['id'])) {
  68. $this->actionTitle = 'Request #'.$request['id'];
  69. $this->view->patientInfo = $request['patient_surname'].' '.$request['patient_name'].', '.$this->helper->getDateString($request['patient_dob'], false);
  70. $this->view->request = $request;
  71. $this->view->attachments = $handleRequest->getAttachmentsByRequestId($request['id']);
  72. //Group attachments by date
  73. if (is_array($this->view->attachments) && !empty($this->view->attachments)) {
  74. foreach($this->view->attachments as $attachment) {
  75. //$ext = $this->helper->getExtension($attachment['file_name']);
  76. $attachment['previewType'] = $this->helper->getPreviewType($attachment['file_name']);
  77. $this->view->groupedAttachments[date('Y-m-d 00:00:00', strtotime($attachment['created_at']))][] = $attachment;
  78. }
  79. if (!empty($this->view->groupedAttachments)) {
  80. foreach($this->view->groupedAttachments as $ext => $attachList) {
  81. sort($attachList);
  82. $this->view->groupedAttachments[$ext] = $attachList;
  83. }
  84. }
  85. }
  86. }
  87. }
  88. return $this->setJsonView('showAttachementsInDream');
  89. }
  90. }