Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SubmissionLog.inc.php
1 <?php
2 
22 
32  static function logEvent($request, $submission, $eventType, $messageKey, $params = array()) {
33  // Create a new entry object
34  $submissionEventLogDao = DAORegistry::getDAO('SubmissionEventLogDAO');
35  $entry = $submissionEventLogDao->newDataObject();
36 
37  // Set implicit parts of the log entry
38  $entry->setDateLogged(Core::getCurrentDate());
39  $entry->setIPAddress($request->getRemoteAddr());
40 
42  // If user is logged in as another user log with real userid
43  $sessionManager = SessionManager::getManager();
44  $session = $sessionManager->getUserSession();
45  $userId = $session->getSessionVar('signedInAs');
46  if ($userId) $entry->setUserId($userId);
47  } else {
48  $user = $request->getUser();
49  if ($user) $entry->setUserId($user->getId());
50  }
51 
52  $entry->setSubmissionId($submission->getId());
53 
54  // Set explicit parts of the log entry
55  $entry->setEventType($eventType);
56  $entry->setMessage($messageKey);
57  $entry->setParams($params);
58  $entry->setIsTranslated(0); // Legacy for old entries. All messages now use locale keys.
59 
60  // Insert the resulting object
61  $submissionEventLogDao->insertObject($entry);
62  return $entry;
63  }
64 }
65 
66 ?>
static & getDAO($name, $dbconn=null)
Static class for adding / accessing PKP log entries.
static logEvent($request, $submission, $eventType, $messageKey, $params=array())
static getCurrentDate($ts=null)
Definition: Core.inc.php:95