private function getEmployeeData($id, $obj) { $data = array(); $objs = $obj->Find("employee = ?", array($id)); foreach ($objs as $entry) { $data[] = BaseService::getInstance()->cleanUpAdoDB($entry); } return $data; }
function includeModuleManager($type,$name){ $moduleCapsName = ucfirst($name); $moduleTypeCapsName = ucfirst($type); // Admin or Modules $incFile = CLIENT_PATH.'/'.$type.'/'.$name.'/api/'.$moduleCapsName.$moduleTypeCapsName."Manager.php"; include ($incFile); $moduleManagerClass = $moduleCapsName.$moduleTypeCapsName."Manager"; BaseService::getInstance()->addModuleManager(new $moduleManagerClass()); }
public function addNotification($toEmployee, $message, $action, $type, $toUserId = null, $fromSystem = false, $sendEmail = false) { $userEmp = new User(); if (!empty($toEmployee)) { $userEmp->load("employee = ?", array($toEmployee)); if (!empty($userEmp->employee) && $userEmp->employee == $toEmployee) { $toUser = $userEmp->id; } else { return; } } else { if (!empty($toUserId)) { $toUser = $toUserId; } } $noti = new Notification(); if ($fromSystem) { $noti->fromUser = 0; $noti->fromEmployee = 0; $noti->image = BASE_URL . "images/icehrm.png"; } else { $user = $this->baseService->getCurrentUser(); $noti->fromUser = $user->id; $noti->fromEmployee = $user->employee; } $noti->toUser = $toUser; $noti->message = $message; if (!empty($noti->fromEmployee) && $noti->fromEmployee != 0) { $employee = $this->baseService->getElement('Employee', $noti->fromEmployee, null, true); if (!empty($employee)) { $employee = FileService::getInstance()->updateProfileImage($employee); $noti->image = $employee->image; } } if (empty($noti->image)) { if ($employee->gender == 'Male') { $noti->image = BASE_URL . "images/user_male.png"; } else { $noti->image = BASE_URL . "images/user_female.png"; } } $noti->action = $action; $noti->type = $type; $noti->time = date('Y-m-d H:i:s'); $noti->status = 'Unread'; $ok = $noti->Save(); if (!$ok) { error_log("Error adding notification: " . $noti->ErrorMsg()); } else { if ($sendEmail) { $emailSender = BaseService::getInstance()->getEmailSender(); if (!empty($emailSender)) { $emailSender->sendEmailFromNotification($noti); } } } }
protected function setUp() { parent::setUp(); include APP_BASE_PATH . "admin/users/api/UsersEmailSender.php"; include APP_BASE_PATH . "admin/users/api/UsersActionManager.php"; $this->obj = new UsersActionManager(); $this->obj->setUser($this->usersArray['admin']); $this->obj->setBaseService(BaseService::getInstance()); $this->obj->setEmailSender(BaseService::getInstance()->getEmailSender()); }
public function init() { if (SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1") { $user = BaseService::getInstance()->getCurrentUser(); $dbUser = new User(); $dbUser->Load("id = ?", array($user->id)); $resp = RestApiManager::getInstance()->getAccessTokenForUser($dbUser); if ($resp->getStatus() != IceResponse::SUCCESS) { LogManager::getInstance()->error("Error occured while creating REST Api acces token for " . $user->username); } } }
function includeModuleManager($type, $name, $data) { $moduleCapsName = ucfirst($name); $moduleTypeCapsName = ucfirst($type); // Admin or Modules $incFile = CLIENT_PATH . '/' . $type . '/' . $name . '/api/' . $moduleCapsName . $moduleTypeCapsName . "Manager.php"; include $incFile; $moduleManagerClass = $moduleCapsName . $moduleTypeCapsName . "Manager"; $moduleManagerObj = new $moduleManagerClass(); $moduleManagerObj->setModuleObject($data); $moduleManagerObj->setModuleType($type); BaseService::getInstance()->addModuleManager($moduleManagerObj); }
public function execute($cron) { $email = new IceEmail(); $emails = $email->Find("status = ? limit 10", array('Pending')); $emailSender = BaseService::getInstance()->getEmailSender(); foreach ($emails as $email) { try { $emailSender->sendEmailFromDB($email); } catch (Exception $e) { LogManager::getInstance()->error("Error sending email:" . $e->getMessage()); } $email->status = 'Sent'; $email->updated = date('Y-m-d H:i:s'); $email->Save(); } }
public function changeTimeSheetStatus($req) { $employee = $this->baseService->getElement('Employee', $this->getCurrentProfileId(), null, true); $subordinate = new Employee(); $subordinates = $subordinate->Find("supervisor = ?", array($employee->id)); $subordinatesIds = array(); foreach ($subordinates as $sub) { $subordinatesIds[] = $sub->id; } $timeSheet = new EmployeeTimeSheet(); $timeSheet->Load("id = ?", array($req->id)); if ($timeSheet->id != $req->id) { return new IceResponse(IceResponse::ERROR, "Timesheet not found"); } if ($req->status == 'Submitted' && $employee->id == $timeSheet->employee) { } else { if (!in_array($timeSheet->employee, $subordinatesIds) && $this->user->user_level != 'Admin') { return new IceResponse(IceResponse::ERROR, "This Timesheet does not belong to any of your subordinates"); } } $oldStatus = $timeSheet->status; $timeSheet->status = $req->status; //Auto approve admin timesheets if ($req->status == 'Submitted' && BaseService::getInstance()->getCurrentUser()->user_level == "Admin") { $timeSheet->status = 'Approved'; } if ($oldStatus == $req->status) { return new IceResponse(IceResponse::SUCCESS, ""); } $ok = $timeSheet->Save(); if (!$ok) { LogManager::getInstance()->info($timeSheet->ErrorMsg()); } $timeSheetEmployee = $this->baseService->getElement('Employee', $timeSheet->employee, null, true); $this->baseService->audit(IceConstants::AUDIT_ACTION, "Timesheet [" . $timeSheetEmployee->first_name . " " . $timeSheetEmployee->last_name . " - " . date("M d, Y (l)", strtotime($timeSheet->date_start)) . " to " . date("M d, Y (l)", strtotime($timeSheet->date_end)) . "] status changed from:" . $oldStatus . " to:" . $req->status); if ($timeSheet->status == "Submitted" && $employee->id == $timeSheet->employee) { $notificationMsg = $employee->first_name . " " . $employee->last_name . " submitted timesheet from " . date("M d, Y (l)", strtotime($timeSheet->date_start)) . " to " . date("M d, Y (l)", strtotime($timeSheet->date_end)); $this->baseService->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"g=modules&n=time_sheets&m=module_Time_Management#tabSubEmployeeTimeSheetAll"}', IceConstants::NOTIFICATION_TIMESHEET); } else { if ($timeSheet->status == "Approved" || $timeSheet->status == "Rejected") { $notificationMsg = $employee->first_name . " " . $employee->last_name . " " . $timeSheet->status . " timesheet from " . date("M d, Y (l)", strtotime($timeSheet->date_start)) . " to " . date("M d, Y (l)", strtotime($timeSheet->date_end)); $this->baseService->notificationManager->addNotification($timeSheet->employee, $notificationMsg, '{"type":"url","url":"g=modules&n=time_sheets&m=module_Time_Management#tabEmployeeTimeSheetApproved"}', IceConstants::NOTIFICATION_TIMESHEET); } } return new IceResponse(IceResponse::SUCCESS, ""); }
public function getUserLeaveTypes() { $ele = new LeaveType(); $empLeaveGroupId = NULL; $employeeId = BaseService::getInstance()->getCurrentProfileId(); $empLeaveGroup = new LeaveGroupEmployee(); $empLeaveGroup->Load("employee = ?", array($employeeId)); if ($empLeaveGroup->employee == $employeeId && !empty($empLeaveGroup->id)) { $empLeaveGroupId = $empLeaveGroup->leave_group; } if (empty($empLeaveGroupId)) { $list = $ele->Find('leave_group IS NULL', array()); } else { $list = $ele->Find('leave_group IS NULL or leave_group = ?', array($empLeaveGroupId)); } return $list; }
private function getLastTimeSheetHours() { $timeSheet = new EmployeeTimeSheet(); $timeSheet->Load("employee = ? order by date_end desc limit 1", array(BaseService::getInstance()->getCurrentProfileId())); if (empty($timeSheet->employee)) { return new IceResponse(IceResponse::SUCCESS, "0:00"); } $timeSheetEntry = new EmployeeTimeEntry(); $list = $timeSheetEntry->Find("timesheet = ?", array($timeSheet->id)); $seconds = 0; foreach ($list as $entry) { $seconds += strtotime($entry->date_end) - strtotime($entry->date_start); } $minutes = (int) ($seconds / 60); $rem = $minutes % 60; $hours = ($minutes - $rem) / 60; if ($rem < 10) { $rem = "0" . $rem; } return new IceResponse(IceResponse::SUCCESS, $hours . ":" . $rem); }
var baseUrl = '<?=CLIENT_BASE_URL?>service.php'; var CLIENT_BASE_URL = '<?=CLIENT_BASE_URL?>'; </script> <script type="text/javascript" src="<?=BASE_URL?>js/app-global.js"></script> </head> <body class="skin-blue"> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<?=BaseService::getInstance()->getGAKey()?>', 'gamonoid.com'); ga('send', 'pageview'); </script> <script type="text/javascript"> </script> <header id="delegationDiv" class="header"> <a href="<?=$homeLink?>" class="logo" style="font-family: 'Source Sans Pro', sans-serif;"> <?=APP_NAME?> </a> <!-- Header Navbar: style can be found in header.less --> <nav class="navbar navbar-static-top" role="navigation"> <!-- Sidebar toggle button-->
public function isModuleAllowedForUser($moduleManagerObj) { $moduleObject = $moduleManagerObj->getModuleObject(); //Check if the module is disabled if ($moduleObject['status'] == 'Disabled') { return false; } //Check if user has permissions to this module //Check Module Permissions $modulePermissions = BaseService::getInstance()->loadModulePermissions($moduleManagerObj->getModuleType(), $moduleObject['name'], BaseService::getInstance()->getCurrentUser()->user_level); if (!in_array(BaseService::getInstance()->getCurrentUser()->user_level, $modulePermissions['user'])) { if (!empty(BaseService::getInstance()->getCurrentUser()->user_roles)) { $userRoles = json_decode(BaseService::getInstance()->getCurrentUser()->user_roles, true); } else { $userRoles = array(); } $commonRoles = array_intersect($modulePermissions['user_roles'], $userRoles); if (empty($commonRoles)) { return false; } } return true; }
} else { if ($action == 'getFieldValues') { $ret['data'] = BaseService::getInstance()->getFieldValues($_REQUEST['t'], $_REQUEST['key'], $_REQUEST['value'], $_REQUEST['method'], $_REQUEST['methodParams']); if ($ret['data'] != null) { $ret['status'] = "SUCCESS"; } else { $ret['status'] = "ERROR"; } } else { if ($action == 'setAdminEmp') { BaseService::getInstance()->setCurrentAdminProfile($_REQUEST['empid']); $ret['status'] = "SUCCESS"; } else { if ($action == 'ca') { if (isset($_REQUEST['req'])) { $_REQUEST['req'] = BaseService::getInstance()->fixJSON($_REQUEST['req']); } $mod = $_REQUEST['mod']; $modPath = explode("=", $mod); $moduleCapsName = ucfirst($modPath[1]); $subAction = $_REQUEST['sa']; $apiFile = APP_BASE_PATH . $modPath[0] . "/" . $modPath[1] . "/api/" . $moduleCapsName . "ActionManager.php"; //echo $apiFile; LogManager::getInstance()->info("Api File:" . $apiFile); $emailSenderFile = APP_BASE_PATH . $modPath[0] . "/" . $modPath[1] . "/api/" . $moduleCapsName . "EmailSender.php"; if (file_exists($apiFile)) { include $apiFile; if (file_exists($emailSenderFile)) { include $emailSenderFile; } $cls = $moduleCapsName . "ActionManager";
} //============= End - Initializing Modules ============ BaseService::getInstance()->setFileFields($fileFields); BaseService::getInstance()->setUserTables($userTables); BaseService::getInstance()->setSqlErrors($mysqlErrors); include "includes.com.php"; if (file_exists(APP_BASE_PATH . 'admin/audit/api/AuditActionManager.php')) { include APP_BASE_PATH . 'admin/audit/api/AuditActionManager.php'; $auditManager = new AuditActionManager(); $auditManager->setBaseService($baseService); $auditManager->setUser($user); BaseService::getInstance()->setAuditManager($auditManager); } $emailEnabled = SettingsManager::getInstance()->getSetting("Email: Enable"); $emailMode = SettingsManager::getInstance()->getSetting("Email: Mode"); $emailSender = null; if ($emailEnabled == "1") { if ($emailMode == "SMTP") { $emailSender = new SMTPEmailSender($settingsManager); } else { if ($emailMode == "SES") { $emailSender = new SNSEmailSender($settingsManager); } else { if ($emailMode == "PHP Mailer") { $emailSender = new PHPMailer($settingsManager); } } } } BaseService::getInstance()->setEmailSender($emailSender);
} else { ?> modJsList[prop].initFieldMasterData(); <?php } ?> modJsList[prop].setBaseUrl('<?php echo BASE_URL; ?> '); modJsList[prop].setCurrentProfile(<?php echo json_encode($activeProfile); ?> ); modJsList[prop].setInstanceId('<?php echo BaseService::getInstance()->getInstanceId(); ?> '); modJsList[prop].setGoogleAnalytics(ga); modJsList[prop].setNoJSONRequests('<?php echo SettingsManager::getInstance()->getSetting("System: Do not pass JSON in request"); ?> '); } } //Other static js objects var timeUtils = new TimeUtils(); timeUtils.setServerGMToffset('<?php echo $diffHoursBetweenServerTimezoneWithGMT; ?> ');
include CLIENT_PATH . "/server.includes.inc.php"; $user = SessionUtils::getSessionObject('user'); $profileCurrent = null; $profileSwitched = null; $profileClass = ucfirst(SIGN_IN_ELEMENT_MAPPING_FIELD_NAME); $profileVar = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME; if (!empty($user->{$profileVar})) { $profileCurrent = BaseService::getInstance()->getElement($profileClass, $user->{$profileVar}, null, true); if (!empty($profileCurrent)) { $profileCurrent = FileService::getInstance()->updateProfileImage($profileCurrent); } } if ($user->user_level == 'Admin' || $user->user_level == 'Manager') { $switchedEmpId = BaseService::getInstance()->getCurrentProfileId(); if ($switchedEmpId != $user->{$profileVar} && !empty($switchedEmpId)) { $profileSwitched = BaseService::getInstance()->getElement($profileClass, $switchedEmpId, null, true); if (!empty($profileSwitched)) { $profileSwitched = FileService::getInstance()->updateProfileImage($profileSwitched); } } } $activeProfile = null; if (!empty($profileSwitched)) { $activeProfile = $profileSwitched; } else { $activeProfile = $profileCurrent; } //read field templates $fieldTemplates = array(); $fieldTemplates['hidden'] = file_get_contents(CLIENT_PATH . '/templates/fields/hidden.html'); $fieldTemplates['text'] = file_get_contents(CLIENT_PATH . '/templates/fields/text.html');
} ?> <?php } else { ?> refId = '<?php echo $_REQUEST['m']; ?> '; $("[ref = '"+refId+"'] a").first().click(); <?php } ?> <?php if (!isset($proVersion) && isset($moduleName) && $moduleName == 'dashboard' && $user->user_level == 'Admin' && !BaseService::getInstance()->validateInstance()) { ?> $("#verifyModel").modal({ backdrop: 'static' }); <?php } ?> }); </script> <?php include 'popups.php'; ?> <?php include APP_BASE_PATH . 'js/bootstrapDataTable.php';
public function savePunch($req) { $useServerTime = SettingsManager::getInstance()->getSetting('Attendance: Use Department Time Zone'); $currentEmployeeTimeZone = BaseService::getInstance()->getCurrentEmployeeTimeZone(); if ($useServerTime == '1' && !empty($currentEmployeeTimeZone)) { date_default_timezone_set('Asia/Colombo'); $date = new DateTime("now", new DateTimeZone('Asia/Colombo')); $date->setTimezone(new DateTimeZone($currentEmployeeTimeZone)); $req->time = $date->format('Y-m-d H:i:s'); } $req->date = $req->time; //check if there is an open punch $openPunch = $this->getPunch($req)->getData(); if (empty($openPunch)) { $openPunch = new Attendance(); } $dateTime = $req->date; $arr = explode(" ", $dateTime); $date = $arr[0]; $employee = $this->baseService->getElement('Employee', $this->getCurrentProfileId(), null, true); //check if dates are differnet $arr = explode(" ", $openPunch->in_time); $inDate = $arr[0]; if (!empty($openPunch->in_time) && $inDate != $date) { return new IceResponse(IceResponse::ERROR, "Attendance entry should be within a single day"); } //compare dates if (!empty($openPunch->in_time) && strtotime($dateTime) <= strtotime($openPunch->in_time)) { return new IceResponse(IceResponse::ERROR, "Punch-in time should be lesser than Punch-out time"); } //Find all punches for the day $attendance = new Attendance(); $attendanceList = $attendance->Find("employee = ? and DATE_FORMAT( in_time, '%Y-%m-%d' ) = ?", array($employee->id, $date)); foreach ($attendanceList as $attendance) { if (!empty($openPunch->in_time)) { if ($openPunch->id == $attendance->id) { continue; } if (strtotime($attendance->out_time) >= strtotime($dateTime) && strtotime($attendance->in_time) <= strtotime($dateTime)) { //-1---0---1---0 || ---0--1---1---0 return new IceResponse(IceResponse::ERROR, "Time entry is overlapping with an existing one"); } else { if (strtotime($attendance->out_time) >= strtotime($openPunch->in_time) && strtotime($attendance->in_time) <= strtotime($openPunch->in_time)) { //---0---1---0---1 || ---0--1---1---0 return new IceResponse(IceResponse::ERROR, "Time entry is overlapping with an existing one"); } else { if (strtotime($attendance->out_time) <= strtotime($dateTime) && strtotime($attendance->in_time) >= strtotime($openPunch->in_time)) { //--1--0---0--1-- return new IceResponse(IceResponse::ERROR, "Time entry is overlapping with an existing one " . $attendance->id); } } } } else { if (strtotime($attendance->out_time) >= strtotime($dateTime) && strtotime($attendance->in_time) <= strtotime($dateTime)) { //---0---1---0 return new IceResponse(IceResponse::ERROR, "Time entry is overlapping with an existing one"); } } } if (!empty($openPunch->in_time)) { $openPunch->out_time = $dateTime; $openPunch->note = $req->note; $this->baseService->audit(IceConstants::AUDIT_ACTION, "Punch Out \\ time:" . $openPunch->out_time); } else { $openPunch->in_time = $dateTime; $openPunch->out_time = '0000-00-00 00:00:00'; $openPunch->note = $req->note; $openPunch->employee = $employee->id; $this->baseService->audit(IceConstants::AUDIT_ACTION, "Punch In \\ time:" . $openPunch->in_time); } $ok = $openPunch->Save(); if (!$ok) { LogManager::getInstance()->info($openPunch->ErrorMsg()); return new IceResponse(IceResponse::ERROR, "Error occured while saving attendance"); } return new IceResponse(IceResponse::SUCCESS, $openPunch); }
public function sendEmployeeEmails($emailList, $subject) { foreach ($emailList as $employeeId => $emailData) { $ccList = array(); if (SettingsManager::getInstance()->getSetting('Notifications: Copy Document Expiry Emails to Manager') == '1') { $employee = new Employee(); $employee->Load("id = ?", array($employeeId)); if (!empty($employee->supervisor)) { $supperuser = BaseService::getInstance()->getUserFromProfileId($employee->supervisor); if (!empty($supperuser)) { $ccList[] = $supperuser->email; } } } $user = BaseService::getInstance()->getUserFromProfileId($employeeId); if (!empty($user) && !empty($user->email)) { $email = new IceEmail(); $email->subject = $subject; $email->toEmail = $user->email; $email->template = $emailData; $email->params = '[]'; $email->cclist = json_encode($ccList); $email->bcclist = '[]'; $email->status = 'Pending'; $email->created = date('Y-m-d H:i:s'); $email->updated = date('Y-m-d H:i:s'); $ok = $email->Save(); if (!$ok) { LogManager::getInstance()->error("Error Saving Email: " . $email->ErrorMsg()); } } } }
<div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-times"/></button> <h3 id="myModalLabel">Switch Profile</h3> </div> <div class="modal-body"> <p>Select the profile to Edit</p> <div style="border: solid 1px #EEE;"> <select id="switch_emp" style="width:100%;"> <!-- <option value="-1">No Profile</option> --> <?php $profileClass = ucfirst(SIGN_IN_ELEMENT_MAPPING_FIELD_NAME); $profiles = BaseService::getInstance()->get($profileClass); foreach ($profiles as $empTemp) { ?> <option value="<?php echo $empTemp->id; ?> "><?php echo $empTemp->first_name . " " . $empTemp->last_name; ?> </option> <?php } ?> </select> </div> </div>
LogManager::getInstance()->debug("Count Filter Query Data 3:" . json_encode($countFilterQueryData)); $rowCount = $obj->DB()->Execute($sql, $countFilterQueryData); } } if (!empty($rowCount)) { foreach ($rowCount as $cnt) { $totalRows = $cnt['count']; } } else { $totalRows = 0; } /* * Output */ $output = array("sEcho" => intval($_REQUEST['sEcho']), "iTotalRecords" => $totalRows, "iTotalDisplayRecords" => $totalRows, "aaData" => array()); /* $output['debug_data'] = print_r($data,true); $output['debug_col'] = print_r($columns,true); $output['debug_col_plain'] = $_REQUEST['cl']; $output['get_magic_quotes_gpc'] = get_magic_quotes_gpc(); */ foreach ($data as $item) { $row = array(); $colCount = count($columns); for ($i = 0; $i < $colCount; $i++) { $row[] = $item->{$columns}[$i]; } $row["_org"] = BaseService::getInstance()->cleanUpAdoDB($item); $output['aaData'][] = $row; } echo json_encode($output);
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>. ------------------------------------------------------------------ Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd] Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah) */ $moduleName = 'attendance'; define('MODULE_PATH', dirname(__FILE__)); include APP_BASE_PATH . 'header.php'; include APP_BASE_PATH . 'modulejslibs.inc.php'; $useServerTime = SettingsManager::getInstance()->getSetting('Attendance: Use Department Time Zone'); $currentEmployeeTimeZone = BaseService::getInstance()->getCurrentEmployeeTimeZone(); if (empty($currentEmployeeTimeZone)) { $useServerTime = 0; } ?> <div class="span9"> <ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;"> <li class="active"><a id="tabAttendance" href="#tabPageAttendance">Attendance</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tabPageAttendance"> <div id="Attendance" class="reviewBlock" data-content="List" style="padding-left:5px;"> </div>
public function executePreUpdateActions($obj) { $preApprove = SettingsManager::getInstance()->getSetting($this->preApproveSettingName); $sendNotificationEmail = true; $fieldsToCheck = $this->fieldsNeedToBeApproved(); $travelRequest = new EmployeeTravelRecord(); $travelRequest->Load('id = ?', array($obj->id)); $needToApprove = false; if ($preApprove != "1") { foreach ($fieldsToCheck as $field) { if ($obj->{$field} != $travelRequest->{$field}) { $needToApprove = true; break; } } } else { $sendNotificationEmail = false; } if ($preApprove) { return new IceResponse(IceResponse::SUCCESS, $obj); } if ($needToApprove && $obj->status != 'Pending') { $currentEmpId = BaseService::getInstance()->getCurrentProfileId(); //Auto approve if the current user is an admin if (!empty($currentEmpId)) { $employee = BaseService::getInstance()->getElement('Employee', $currentEmpId); if (!empty($employee->supervisor)) { $notificationMsg = $this->notificationUnitPrefix . " " . $this->notificationUnitName . " has been updated by " . $employee->first_name . " " . $employee->last_name . ". Please visit " . $this->notificationModuleName . " module to review it"; BaseService::getInstance()->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"' . $this->notificationUnitAdminUrl . '"}', $this->notificationModuleName, null, false, $sendNotificationEmail); } else { $user = BaseService::getInstance()->getCurrentUser(); if ($user->user_level == "Admin") { } else { //If the user do not have a supervisor, notify all admins $admins = BaseService::getInstance()->getAllAdmins(); foreach ($admins as $admin) { $notificationMsg = $this->notificationUnitPrefix . " " . $this->notificationUnitName . " request has been updated by " . $employee->first_name . " " . $employee->last_name . ". Please visit " . $this->notificationModuleName . " module to review it. You are getting this notification since you are an administrator and the user do not have any supervisor assigned."; BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"g=admin&n=travel&m=admin_Employees"}', "Travel Module", $admin->id, false, $sendNotificationEmail); } } } } } return new IceResponse(IceResponse::SUCCESS, $obj); }
define('MODULE_PATH', dirname(__FILE__)); include APP_BASE_PATH . 'header.php'; include APP_BASE_PATH . 'modulejslibs.inc.php'; ?> <div class="span9"> <div class="row"> <?php $moduleManagers = BaseService::getInstance()->getModuleManagers(); $dashBoardList = array(); foreach ($moduleManagers as $moduleManagerObj) { $allowed = BaseService::getInstance()->isModuleAllowedForUser($moduleManagerObj); if (!$allowed) { continue; } $item = $moduleManagerObj->getDashboardItem(); if (!empty($item)) { $index = $moduleManagerObj->getDashboardItemIndex(); $dashBoardList[$index] = $item; } } ksort($dashBoardList); foreach ($dashBoardList as $k => $v) { echo $v; } ?>
public function getQuickAccessMenuItemsHTML() { $html = ""; $user = BaseService::getInstance()->getCurrentUser(); foreach ($this->quickAccessMenuItems as $item) { if (empty($item[3]) || in_array($user->user_level, $item[3])) { $html .= '<a href="' . $item[2] . '"><i class="fa ' . $item[1] . '"></i> ' . $item[0] . '</a>'; } } return $html; }
<?php $moduleName = 'employees'; define('MODULE_PATH', dirname(__FILE__)); include APP_BASE_PATH . 'header.php'; include APP_BASE_PATH . 'modulejslibs.inc.php'; $fieldNameMap = BaseService::getInstance()->getFieldNameMappings("Employee"); $customFields = BaseService::getInstance()->getCustomFields("Employee"); ?> <div class="span9"> <ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;"> <?php if ($user->user_level != "Admin") { ?> <li class="active"><a id="tabEmployee" href="#tabPageEmployee">Employees (Direct Reports)</a></li> <?php } else { ?> <li class="active"><a id="tabEmployee" href="#tabPageEmployee">Employees</a></li> <?php } ?> <li><a id="tabEmployeeDependent" href="#tabPageEmployeeDependent">Dependents</a></li> <li><a id="tabEmergencyContact" href="#tabPageEmergencyContact">Emergency Contacts</a></li> <?php if ($user->user_level == "Admin") { ?> <li class="dropdown"> <a href="#" id="terminatedEmployeeMenu" class="dropdown-toggle" data-toggle="dropdown" aria-controls="terminatedEmployeeMenu-contents">Suspended Employees <span class="caret"></span></a> <ul class="dropdown-menu" role="menu" aria-labelledby="terminatedEmployeeMenu" id="terminatedEmployeeMenu-contents"> <li><a id="tabTerminatedEmployees" href="#tabPageTerminatedEmployees">Temporarily Suspended Employees</a></li>
echo BASE_URL; ?> js/app-global.js"></script> </head> <body class="skin-blue"> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<?php echo BaseService::getInstance()->getGAKey(); ?> ', 'gamonoid.com'); ga('send', 'pageview'); </script> <script type="text/javascript"> </script> <header id="delegationDiv" class="header"> <a href="<?php echo $homeLink; ?> " class="logo" style="font-family: 'Source Sans Pro', sans-serif;">
$key = $_POST['key']; if (empty($key)) { $ret['status'] = "ERROR"; $ret['message'] = "Instance key not found"; } else { $baseService->setInstanceKey($key); if ($baseService->validateInstance()) { $ret['status'] = "SUCCESS"; } else { $ret['status'] = "ERROR"; $ret['message'] = "Error Verifying IceHrm Instance due to invalid key. If you are keep getting this, please contact us through " . CONTACT_EMAIL; } } } else { if ($action == 'loadSub') { $ret['object'] = BaseService::getInstance()->getSubSetData($_REQUEST['t'], $_REQUEST['sm'], $_REQUEST['subSet'], $_REQUEST['subSetValue']); if ($ret['object'] != null) { $ret['status'] = "SUCCESS"; } else { $ret['status'] = "ERROR"; $ret['message'] = "Something went wrong , refresh page!"; } } } } } } } } } }