本文整理汇总了PHP中BaseService::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseService::getInstance方法的具体用法?PHP BaseService::getInstance怎么用?PHP BaseService::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseService
的用法示例。
在下文中一共展示了BaseService::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEmployeeData
private function getEmployeeData($id, $obj)
{
$data = array();
$objs = $obj->Find("employee = ?", array($id));
foreach ($objs as $entry) {
$data[] = BaseService::getInstance()->cleanUpAdoDB($entry);
}
return $data;
}
示例2: includeModuleManager
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());
}
示例3: addNotification
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);
}
}
}
}
示例4: setUp
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());
}
示例5: init
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);
}
}
}
示例6: includeModuleManager
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);
}
示例7: execute
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();
}
}
示例8: changeTimeSheetStatus
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, "");
}
示例9: getUserLeaveTypes
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;
}
示例10: getLastTimeSheetHours
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);
}
示例11: Date
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-->
示例12: isModuleAllowedForUser
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;
}
示例13: explode
} 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";
示例14: AuditActionManager
}
//============= 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);
示例15: json_encode
} 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;
?>
');