PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/eimadmin/emailNotificationConfiguration.php

https://github.com/solusee/OrangeEarthstoneHRM
PHP | 207 lines | 157 code | 28 blank | 22 comment | 19 complexity | 6e596cfdb3a2a9b6d7d786fc2672df61 MD5 | raw file
  1. <?php
  2. /**
  3. * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
  4. * all the essential functionalities required for any enterprise.
  5. * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
  6. *
  7. * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
  8. * the GNU General Public License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  12. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with this program;
  16. * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA
  18. *
  19. */
  20. require_once($lan->getLangPath("full.php"));
  21. $locRights=$_SESSION['localRights'];
  22. $editArr = $this->popArr['editArr'];
  23. $allNotifications = array( EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_LEAVE_PENDING_APPROVAL => $lang_Admin_ENS_LeaveApplications,
  24. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_LEAVE_APPROVED => $lang_Admin_ENS_LeaveApprovals,
  25. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_LEAVE_CANCELLED => $lang_Admin_ENS_LeaveCancellations,
  26. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_LEAVE_REJECTED => $lang_Admin_ENS_LeaveRejections,
  27. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_JOB_APPLIED => $lang_Admin_ENS_JobApplications,
  28. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_SEEK_HIRE_APPROVAL => $lang_Admin_ENS_SeekHireApproval,
  29. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_HIRE_TASKS => $lang_Admin_ENS_HiringTasks,
  30. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_HIRE_APPROVED => $lang_Admin_ENS_HiringApproved,
  31. EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_HSP => $lang_Admin_ENS_HspNotifications);
  32. $statusArr = null;
  33. $notificationEmail = "";
  34. if (isset($editArr) && is_array($editArr)) {
  35. $notificationObj = current($editArr);
  36. $notificationEmail = $notificationObj->getEmail();
  37. foreach ($editArr as $notificationObj) {
  38. $notificationObjs[$notificationObj->getNotifcationTypeId()] = $notificationObj;
  39. }
  40. }
  41. $formAction = $_SERVER['PHP_SELF'] . "?uniqcode=ENS&amp;capturemode=updatemode&amp;id=1";
  42. $token = $this->popArr['token'];
  43. ?>
  44. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  45. <html xmlns="http://www.w3.org/1999/xhtml">
  46. <head>
  47. <title><?php echo $lang_Admin_SubscribeToMailNotifications; ?></title>
  48. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  49. <script type="text/javascript" src="../../scripts/archive.js"></script>
  50. <script type="text/javascript">
  51. //<![CDATA[
  52. var editMode = false;
  53. function validate() {
  54. error = false;
  55. mailRegExp = /^(([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.[a-zA-Z])$/;
  56. obj = $('txtMailAddress');
  57. if (!checkEmail(obj.value)) {
  58. error = true;
  59. alert('<?php echo $lang_Error_InvalidEmail; ?>')
  60. }
  61. if (!error) {
  62. $('sqlState').value = 'UpdateRecord';
  63. $('mailSubscription').submit();
  64. }
  65. }
  66. function validate() {
  67. var err = false;
  68. var msg = '<?php echo $lang_Error_PleaseCorrectTheFollowing; ?>\n\n';
  69. var mailRegExp = /^(([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.[a-zA-Z])$/;
  70. obj = $('txtMailAddress');
  71. if (!checkEmail(obj.value)) {
  72. err = true;
  73. msg += "\t- <?php echo $lang_Error_InvalidEmail; ?>\n";
  74. }
  75. if (err) {
  76. alert(msg);
  77. return false;
  78. } else {
  79. return true;
  80. }
  81. }
  82. function reset() {
  83. $('mailSubscription').reset();
  84. }
  85. function edit() {
  86. <?php if($locRights['edit']) { ?>
  87. if (editMode) {
  88. if (validate()) {
  89. $('mailSubscription').submit();
  90. }
  91. return;
  92. }
  93. editMode = true;
  94. var frm = $('mailSubscription');
  95. for (var i=0; i < frm.elements.length; i++) {
  96. frm.elements[i].disabled = false;
  97. }
  98. $('editBtn').value="<?php echo $lang_Common_Save; ?>";
  99. $('editBtn').title="<?php echo $lang_Common_Save; ?>";
  100. $('editBtn').className = "savebutton";
  101. <?php } else {?>
  102. alert('<?php echo $lang_Common_AccessDenied;?>');
  103. <?php } ?>
  104. }
  105. //]]>
  106. </script>
  107. <script type="text/javascript" src="../../themes/<?php echo $styleSheet;?>/scripts/style.js"></script>
  108. <link href="../../themes/<?php echo $styleSheet;?>/css/style.css" rel="stylesheet" type="text/css"/>
  109. <!--[if lte IE 6]>
  110. <link href="../../themes/<?php echo $styleSheet; ?>/css/IE6_style.css" rel="stylesheet" type="text/css"/>
  111. <![endif]-->
  112. <!--[if IE]>
  113. <link href="../../themes/<?php echo $styleSheet; ?>/css/IE_style.css" rel="stylesheet" type="text/css"/>
  114. <![endif]-->
  115. </head>
  116. <body>
  117. <div class="formpageNarrow">
  118. <div class="outerbox">
  119. <div class="mainHeading"><h2><?php echo $lang_Admin_SubscribeToMailNotifications;?></h2></div>
  120. <?php $message = isset($this->getArr['msg']) ? $this->getArr['msg'] : (isset($this->getArr['message']) ? $this->getArr['message'] : null);
  121. if (isset($message)) {
  122. $messageType = CommonFunctions::getCssClassForMessage($message);
  123. $message = "lang_Common_" . $message;
  124. ?>
  125. <div class="messagebar">
  126. <span class="<?php echo $messageType; ?>"><?php echo (isset($$message)) ? $$message: ""; ?></span>
  127. </div>
  128. <?php } ?>
  129. <form name="mailSubscription" id="mailSubscription" method="post" onsubmit="return validate()" action="<?php echo $formAction;?>">
  130. <input type="hidden" name="token" value="<?php echo $token;?>" />
  131. <input type="hidden" name="sqlState" value="UpdateRecord"/>
  132. <label for="txtMailAddress"><?php echo $lang_Commn_Email; ?><span class="required">*</span></label>
  133. <input type="text" name="txtMailAddress" id="txtMailAddress" class="formInputText"
  134. value="<?php echo $notificationEmail; ?>" disabled="disabled"/>
  135. <br class="clear"/>
  136. <?php
  137. $i=0;
  138. foreach ($allNotifications as $notificationType=>$notificationName) {
  139. $checked = "checked='checked'";
  140. if (isset($notificationObjs[$notificationType])) {
  141. $notificationStatus = $notificationObjs[$notificationType]->getNotificationStatus();
  142. if ($notificationStatus == 0) {
  143. $checked = "";
  144. }
  145. }
  146. ?>
  147. <label for="txtSkillName"><?php echo $notificationName; ?></label>
  148. <input type="hidden" name="notificationMessageId[<?php echo $i; ?>]" value="<?php echo $notificationType; ?>" />
  149. <input type="hidden" name="notificationMessageStatus[<?php echo $i; ?>]" value="0" />
  150. <input type="checkbox" <?php echo $checked; ?> name="notificationMessageStatus[<?php echo $i; ?>]"
  151. value="1" class="formCheckbox" disabled="disabled"/>
  152. <br class="clear"/>
  153. <?php
  154. $i++;
  155. }
  156. ?>
  157. <div class="formbuttons">
  158. <?php if($locRights['edit']) { ?>
  159. <input type="button" class="editbutton" id="editBtn"
  160. onclick="edit();" onmouseover="moverButton(this);" onmouseout="moutButton(this);"
  161. value="<?php echo $lang_Common_Edit;?>" />
  162. <input type="button" class="clearbutton" onclick="reset();" tabindex="3"
  163. onmouseover="moverButton(this);" onmouseout="moutButton(this);"
  164. value="<?php echo $lang_Common_Reset;?>" />
  165. <?php } ?>
  166. </div>
  167. </form>
  168. </div>
  169. <script type="text/javascript">
  170. //<![CDATA[
  171. if (document.getElementById && document.createElement) {
  172. roundBorder('outerbox');
  173. }
  174. //]]>
  175. </script>
  176. <div class="requirednotice"><?php echo preg_replace('/#star/', '<span class="required">*</span>', $lang_Commn_RequiredFieldMark); ?>.</div>
  177. </div>
  178. </body>
  179. </html>