本文整理汇总了PHP中LogManager类的典型用法代码示例。如果您正苦于以下问题:PHP LogManager类的具体用法?PHP LogManager怎么用?PHP LogManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChildCompanyStuctures
public function getChildCompanyStuctures($companyStructId)
{
$childIds = array();
$childIds[] = $companyStructId;
$nodeIdsAtLastLevel = $childIds;
$count = 0;
do {
$count++;
$companyStructTemp = new CompanyStructure();
if (empty($nodeIdsAtLastLevel) || empty($childIds)) {
break;
}
$idQuery = "parent in (" . implode(",", $nodeIdsAtLastLevel) . ") and id not in(" . implode(",", $childIds) . ")";
LogManager::getInstance()->debug($idQuery);
$list = $companyStructTemp->Find($idQuery, array());
if (!$list) {
LogManager::getInstance()->debug($companyStructTemp->ErrorMsg());
}
$nodeIdsAtLastLevel = array();
foreach ($list as $item) {
$childIds[] = $item->id;
$nodeIdsAtLastLevel[] = $item->id;
}
} while (count($list) > 0 && $count < 10);
return $childIds;
}
示例2: cancel
public function cancel($req)
{
$employee = $this->baseService->getElement('Employee', $this->getCurrentProfileId(), null, true);
$class = $this->getModelClass();
$itemName = $this->getItemName();
$obj = new $class();
$obj->Load("id = ?", array($req->id));
if ($obj->id != $req->id) {
return new IceResponse(IceResponse::ERROR, "{$itemName} record not found");
}
if ($this->user->user_level != 'Admin' && $this->getCurrentProfileId() != $obj->employee) {
return new IceResponse(IceResponse::ERROR, "Only an admin or owner of the {$itemName} can do this");
}
if ($obj->status != 'Approved') {
return new IceResponse(IceResponse::ERROR, "Only an approved {$itemName} can be cancelled");
}
$obj->status = 'Cancellation Requested';
$ok = $obj->Save();
if (!$ok) {
LogManager::getInstance()->error("Error occurred while cancelling the {$itemName}:" . $obj->ErrorMsg());
return new IceResponse(IceResponse::ERROR, "Error occurred while cancelling the {$itemName}. Please contact admin.");
}
$this->baseService->audit(IceConstants::AUDIT_ACTION, "Expense cancellation | start:" . $obj->date_start . "| end:" . $obj->date_end);
$notificationMsg = $employee->first_name . " " . $employee->last_name . " cancelled a expense. Visit expense management module to approve";
$this->baseService->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"' . $this->getModuleTabUrl() . '"}', $this->getModuleTabUrl(), null, false, true);
return new IceResponse(IceResponse::SUCCESS, $obj);
}
示例3: execute
protected function execute($report, $query, $parameters)
{
//var_dump($query);
//return;
$report->DB()->SetFetchMode(ADODB_FETCH_ASSOC);
LogManager::getInstance()->debug("Query: " . $query);
LogManager::getInstance()->debug("Parameters: " . json_encode($parameters));
$rs = $report->DB()->Execute($query, $parameters);
if (!$rs) {
LogManager::getInstance()->info($report->DB()->ErrorMsg());
return array("ERROR", "Error generating report");
}
$reportNamesFilled = false;
$columnNames = array();
$reportData = array();
foreach ($rs as $rowId => $row) {
$reportData[] = array();
if (!$reportNamesFilled) {
$countIt = 0;
foreach ($row as $name => $value) {
$countIt++;
$columnNames[$countIt] = $name;
$reportData[count($reportData) - 1][] = $value;
}
$reportNamesFilled = true;
} else {
foreach ($row as $name => $value) {
$reportData[count($reportData) - 1][] = $this->transformData($name, $value);
}
}
}
array_unshift($reportData, $columnNames);
return $reportData;
}
示例4: init
public function init()
{
//Add Employee time sheets if it is not already created for current week
$empId = $this->getCurrentProfileId();
if (date('w', strtotime("now")) == 0) {
$start = date("Y-m-d", strtotime("now"));
} else {
$start = date("Y-m-d", strtotime("last Sunday"));
}
if (date('w', strtotime("now")) == 6) {
$end = date("Y-m-d", strtotime("now"));
} else {
$end = date("Y-m-d", strtotime("next Saturday"));
}
$timeSheet = new EmployeeTimeSheet();
$timeSheet->Load("employee = ? and date_start = ? and date_end = ?", array($empId, $start, $end));
if ($timeSheet->date_start == $start && $timeSheet->employee == $empId) {
} else {
if (!empty($empId)) {
$timeSheet->employee = $empId;
$timeSheet->date_start = $start;
$timeSheet->date_end = $end;
$timeSheet->status = "Pending";
$ok = $timeSheet->Save();
if (!$ok) {
LogManager::getInstance()->info("Error creating time sheet : " . $timeSheet->ErrorMsg());
}
}
}
//Generate missing timesheets
}
示例5: getWhereQuery
public function getWhereQuery($request)
{
$employeeList = array();
if (!empty($request['employee'])) {
$employeeList = json_decode($request['employee'], true);
}
if (in_array("NULL", $employeeList)) {
$employeeList = array();
}
if (!empty($employeeList) && ($request['project'] != "NULL" && !empty($request['project']))) {
$query = "where employee in (" . implode(",", $employeeList) . ") and date_start >= ? and date_end <= ? and project = ?;";
$params = array($request['date_start'], $request['date_end'], $request['project']);
} else {
if (!empty($employeeList)) {
$query = "where employee in (" . implode(",", $employeeList) . ") and date_start >= ? and date_end <= ?;";
$params = array($request['date_start'], $request['date_end']);
} else {
if ($request['project'] != "NULL" && !empty($request['project'])) {
$query = "where project = ? and date_start >= ? and date_end <= ?;";
$params = array($request['project'], $request['date_start'], $request['date_end']);
} else {
$query = "where date_start >= ? and date_end <= ?;";
$params = array($request['date_start'], $request['date_end']);
}
}
}
LogManager::getInstance()->info("Query:" . $query);
LogManager::getInstance()->info("Params:" . json_encode($params));
return array($query, $params);
}
示例6: sendWelcomeUserEmail
public function sendWelcomeUserEmail($user, $password, $profile = NULL)
{
$params = array();
if (!empty($profile)) {
$params['name'] = $profile->first_name . " " . $profile->last_name;
} else {
$params['name'] = $user->username;
}
$params['url'] = CLIENT_BASE_URL;
$params['password'] = $password;
$params['email'] = $user->email;
$params['username'] = $user->username;
$email = $this->subActionManager->getEmailTemplate('welcomeUser.html');
$emailTo = null;
if (!empty($user)) {
$emailTo = $user->email;
}
if (!empty($emailTo)) {
if (!empty($this->emailSender)) {
LogManager::getInstance()->info("[sendWelcomeUserEmail] sending email to {$emailTo} : " . $email);
$this->emailSender->sendEmail("Your IceHrm account is ready", $emailTo, $email, $params);
}
} else {
LogManager::getInstance()->info("[sendWelcomeUserEmail] email is empty");
}
}
示例7: getLeavesForMeAndSubordinates
public function getLeavesForMeAndSubordinates($req)
{
$map = json_decode('{"employee":["Employee","id","first_name+last_name"],"leave_type":["LeaveType","id","name"]}');
$employee = $this->baseService->getElement('Employee', $this->getCurrentProfileId(), null, true);
$employeeLeave = new EmployeeLeave();
$startDate = date("Y-m-d H:i:s", $req->start);
$endDate = date("Y-m-d H:i:s", $req->end);
$list = $employeeLeave->Find("status in ('Approved','Pending') and ((date_start >= ? and date_start <= ? ) or (date_end >= ? and date_end <= ?))", array($startDate, $endDate, $startDate, $endDate));
if (!$list) {
LogManager::getInstance()->info($employeeLeave->ErrorMsg());
}
if (!empty($map)) {
$list = $this->baseService->populateMapping($list, $map);
}
$data = array();
$leaveType = new LeaveType();
$leaveTypesTemp = $leaveType->Find("1=1");
$leaveTypes = array();
foreach ($leaveTypesTemp as $leaveType) {
$leaveTypes[$leaveType->name] = $leaveType;
}
foreach ($list as $leave) {
$data[] = $this->leaveToEvent($leave, $leaveTypes);
}
$holiday = new HoliDay();
$holidays = $holiday->Find("1=1", array());
foreach ($holidays as $holiday) {
$data[] = $this->holidayToEvent($holiday);
}
echo json_encode($data);
exit;
}
示例8: getLeavesForMeAndSubordinates
public function getLeavesForMeAndSubordinates($req){
$shareCalendar = $this->baseService->settingsManager->getSetting("Leave: Share Calendar to Whole Company");
$map = json_decode('{"employee":["Employee","id","first_name+last_name"],"leave_type":["LeaveType","id","name"]}');
$employee = $this->baseService->getElement('Employee',$this->getCurrentProfileId(),null,true);
if($shareCalendar != "1"){
$subordinate = new Employee();
$subordinates = $subordinate->Find("supervisor = ?",array($employee->id));
$subordinatesIds = $employee->id;
foreach($subordinates as $sub){
if($subordinatesIds != ""){
$subordinatesIds.=",";
}
$subordinatesIds.=$sub->id;
}
$employeeLeave = new EmployeeLeave();
$startDate = date("Y-m-d H:i:s",$req->start);
$endDate = date("Y-m-d H:i:s",$req->end);
$list = $employeeLeave->Find("employee in (".$subordinatesIds.") and status in ('Approved','Pending') and ((date_start >= ? and date_start <= ? ) or (date_end >= ? and date_end <= ?))",array($startDate,$endDate,$startDate,$endDate));
}else{
$employeeLeave = new EmployeeLeave();
$startDate = date("Y-m-d H:i:s",$req->start);
$endDate = date("Y-m-d H:i:s",$req->end);
$list = $employeeLeave->Find("status in ('Approved','Pending') and ((date_start >= ? and date_start <= ? ) or (date_end >= ? and date_end <= ?))",array($startDate,$endDate,$startDate,$endDate));
}
if(!$list){
LogManager::getInstance()->info($employeeLeave->ErrorMsg());
}
if(!empty($map)){
$list = $this->baseService->populateMapping($list,$map);
}
$data = array();
foreach($list as $leave){
$data[] = $this->leaveToEvent($leave);
}
$holiday = new HoliDay();
$holidays = $holiday->Find("1=1",array());
foreach($holidays as $holiday){
$data[] = $this->holidayToEvent($holiday);
}
echo json_encode($data);
exit();
}
示例9: getInstance
/**
* @static
* @return LogManager
*/
public static function getInstance()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例10: getInstance
public static function getInstance()
{
if (empty(self::$me)) {
self::$me = new LogManager();
self::$me->log = new Logger(APP_NAME);
self::$me->log->pushHandler(new StreamHandler(ini_get('error_log'), LOG_LEVEL));
}
return self::$me;
}
示例11: 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);
}
}
}
示例12: getInstance
public static function getInstance()
{
if (empty(self::$me)) {
self::$me = new LogManager();
self::$me->log = new Logger(APP_NAME);
if (is_writable(ini_get('error_log'))) {
self::$me->log->pushHandler(new StreamHandler(ini_get('error_log'), LOG_LEVEL));
} else {
self::$me->log->pushHandler(new StreamHandler(CLIENT_BASE_PATH . 'data/app.log', LOG_LEVEL));
}
}
return self::$me;
}
示例13: debug
function debug($message, $file = null, $line = null)
{
$logManager =& LogManager::getInstance();
$logger = $logManager->getLogger('debuglogger');
$options = array('m' => $message, 'N' => 'DEBUG', 'p' => LEVEL_DEBUG);
if ($file) {
$options['f'] = $file;
}
if ($line) {
$options['l'] = $line;
}
$message =& new Message($options);
$logger->log($message);
}
示例14: deleteObject
public function deleteObject($bucket, $key)
{
$res = null;
try {
$res = $this->s3->deleteObject(array('Bucket' => $bucket, 'Key' => $key));
} catch (Exception $e) {
LogManager::getInstance()->info($e->getMessage());
return NULL;
}
LogManager::getInstance()->info("Response from s3:" . print_r($res, true));
$result = $res->get('RequestId');
if (!empty($result)) {
return $result;
}
return NULL;
}
示例15: 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();
}
}