*/
public static function check($str, $contactID = NULL) {
if ($contactID == NULL) {
- $session = CRM_Core_Session::singleton();
- $contactID = $session->get('userID');
+ $contactID = CRM_Core_Session::getLoggedInContactID();
}
if (!$contactID) {
$includedGroups = NULL
) {
if ($contactID == NULL) {
- $session = CRM_Core_Session::singleton();
- $contactID = $session->get('userID');
+ $contactID = CRM_Core_Session::getLoggedInContactID();
}
if (!$contactID) {
'GroupContact' => CRM_Contact_DAO_GroupContact::getTableName(),
);
- $session = CRM_Core_Session::singleton();
- $contact_id = $session->get('userID');
+ $contact_id = CRM_Core_Session::getLoggedInContactID();
$where = " {$t['ACL']}.operation = '" . CRM_Utils_Type::escape($operation, 'String') . "'";
* @return bool
*/
public static function logActivityAction($activity, $logMessage = NULL) {
- $session = CRM_Core_Session::singleton();
- $id = $session->get('userID');
+ $id = CRM_Core_Session::getLoggedInContactID();
if (!$id) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
) {
// get the contact details of logged in contact, which we set as from email
if ($userID == NULL) {
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = CRM_Core_Session::getLoggedInContactID();
}
list($fromDisplayName, $fromEmail, $fromDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($userID);
$userID = NULL
) {
if ($userID == NULL) {
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = CRM_Core_Session::getLoggedInContactID();
}
$text = &$activityParams['sms_text_message'];
$activityParams['id'] = $activity->activity_id;
}
// create activity with target contacts
- $session = CRM_Core_Session::singleton();
- $id = $session->get('userID');
+ $id = CRM_Core_Session::getLoggedInContactID();
if ($id) {
$activityParams['source_contact_id'] = $id;
$activityParams['target_contact_id'][] = $activity->contact_id;
return NULL;
}
- $session = CRM_Core_Session::singleton();
-
$followupParams = array();
$followupParams['parent_id'] = $activityId;
- $followupParams['source_contact_id'] = $session->get('userID');
+ $followupParams['source_contact_id'] = CRM_Core_Session::getLoggedInContactID();
$followupParams['status_id'] = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
$followupParams['activity_type_id'] = $params['followup_activity_type_id'];
* @return string
*/
private function getPrimaryEmail() {
- $session = &CRM_Core_Session::singleton();
- $uid = $session->get('userID');
+ $uid = CRM_Core_Session::getLoggedInContactID();
$primary = '';
$emails = CRM_Core_BAO_Email::allEmails($uid);
foreach ($emails as $eid => $e) {
}
$session = CRM_Core_Session::singleton();
- $this->_currentUserId = $session->get('userID');
+ $this->_currentUserId = CRM_Core_Session::getLoggedInContactID();
$this->_currentlyViewedContactId = $this->get('contactId');
if (!$this->_currentlyViewedContactId) {
public function setDefaultValues() {
// CRM-11761 retrieve user's activity filter preferences
$defaults = array();
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = CRM_Core_Session::getLoggedInContactID();
if ($userID) {
$defaults = Civi::service('settings_manager')
->getBagByContact(NULL, $userID)
$this->assign('contactDashlets', CRM_Core_BAO_Dashboard::getContactDashletsForJS());
CRM_Utils_System::setTitle(ts('CiviCRM Home'));
- $session = CRM_Core_Session::singleton();
- $contactID = $session->get('userID');
+ $contactID = CRM_Core_Session::getLoggedInContactID();
// call hook to get html from other modules
// ignored but needed to prevent warnings
* array of dashlets
*/
public static function getContactDashlets($contactID = NULL) {
- $contactID = $contactID ? $contactID : CRM_Core_Session::singleton()->getLoggedInContactID();
+ $contactID = $contactID ? $contactID : CRM_Core_Session::getLoggedInContactID();
$dashlets = array();
// Get contact dashboard dashlets.
'domain_id' => CRM_Core_Config::domainID(),
'option.limit' => 0,
));
- $contactID = CRM_Core_Session::singleton()->getLoggedInContactID();
+ $contactID = CRM_Core_Session::getLoggedInContactID();
$allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']);
$defaultDashlets = array();
$defaults = array('blog' => 1, 'getting-started' => '0');
* @throws CiviCRM_API3_Exception
*/
public function getLoggedInContactDisplayName() {
- $userContactID = CRM_Core_Session::singleton()->getLoggedInContactID();
+ $userContactID = CRM_Core_Session::getLoggedInContactID();
if (!$userContactID) {
return '';
}
$displayNames[$dao->id] = $dao->display_name;
}
- $userId = CRM_Core_Session::singleton()->getLoggedInContactID();
+ $userId = CRM_Core_Session::getLoggedInContactID();
foreach ($foundDupes as $dupes) {
$srcID = $dupes[1];
$dstID = $dupes[0];
return $event;
}
- $session = CRM_Core_Session::singleton();
- $contactId = $session->get('userID');
+ $contactId = CRM_Core_Session::getLoggedInContactID();
if (!$contactId) {
$contactId = CRM_Utils_Array::value('contact_id', $params);
}
$this->_contactID = $contactID;
}
else {
- $this->_contactID = CRM_Core_Session::singleton()->getLoggedInContactID();
+ $this->_contactID = CRM_Core_Session::getLoggedInContactID();
}
// mailing key check
// CRM-17310 my reports functionality - we should set owner if the checkbox is 1,
// it seems to be not set at all if unchecked.
if (!empty($formValues['add_to_my_reports'])) {
- $params['owner_id'] = CRM_Core_Session::singleton()->getLoggedInContactID();
+ $params['owner_id'] = CRM_Core_Session::getLoggedInContactID();
}
else {
$params['owner_id'] = 'null';