当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_Session::getLoggedInContactID方法代码示例

本文整理汇总了PHP中CRM_Core_Session::getLoggedInContactID方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Session::getLoggedInContactID方法的具体用法?PHP CRM_Core_Session::getLoggedInContactID怎么用?PHP CRM_Core_Session::getLoggedInContactID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_Session的用法示例。


在下文中一共展示了CRM_Core_Session::getLoggedInContactID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run dashboard.
  */
 public function run()
 {
     // Add dashboard js and css
     $resources = CRM_Core_Resources::singleton();
     $resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE);
     $resources->addStyleFile('civicrm', 'css/dashboard.css');
     $this->assign('contactDashlets', CRM_Core_BAO_Dashboard::getContactDashletsForJS());
     CRM_Utils_System::setTitle(ts('CiviCRM Home'));
     $contactID = CRM_Core_Session::getLoggedInContactID();
     // call hook to get html from other modules
     // ignored but needed to prevent warnings
     $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
     $html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement);
     if (is_array($html)) {
         $this->assign_by_ref('hookContent', $html);
         $this->assign('hookContentPlacement', $contentPlacement);
     }
     $communityMessages = CRM_Core_CommunityMessages::create();
     if ($communityMessages->isEnabled()) {
         $message = $communityMessages->pick();
         if ($message) {
             $this->assign('communityMessages', $communityMessages->evalMarkup($message['markup']));
         }
     }
     return parent::run();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:29,代码来源:DashBoard.php

示例2: checkProjectPerms

 /**
  * Checks whether the logged in user has permission to perform an action
  * against a specified project.
  *
  * @param int $op
  *   See the constants in CRM_Core_Action.
  * @param int $projectId
  *   Required for some but not all operations.
  * @return boolean
  *   TRUE is the action is allowed; else FALSE.
  */
 public static function checkProjectPerms($op, $projectId = NULL)
 {
     $opsRequiringProjectId = array(CRM_Core_Action::UPDATE, CRM_Core_Action::DELETE);
     if (in_array($op, $opsRequiringProjectId) && empty($projectId)) {
         CRM_Core_Error::fatal('Missing required parameter Project ID');
     }
     $contactId = CRM_Core_Session::getLoggedInContactID();
     switch ($op) {
         case CRM_Core_Action::ADD:
             return self::check('create volunteer projects');
         case CRM_Core_Action::UPDATE:
             if (self::check('edit all volunteer projects')) {
                 return TRUE;
             }
             $projectOwners = CRM_Volunteer_BAO_Project::getContactsByRelationship($projectId, 'volunteer_owner');
             if (self::check('edit own volunteer projects') && in_array($contactId, $projectOwners)) {
                 return TRUE;
             }
             break;
         case CRM_Core_Action::DELETE:
             if (self::check('delete all volunteer projects')) {
                 return TRUE;
             }
             $projectOwners = CRM_Volunteer_BAO_Project::getContactsByRelationship($projectId, 'volunteer_owner');
             if (self::check('delete own volunteer projects') && in_array($contactId, $projectOwners)) {
                 return TRUE;
             }
             break;
         case CRM_Core_Action::VIEW:
             if (self::check('register to volunteer') || self::check('edit all volunteer projects')) {
                 return TRUE;
             }
     }
     return FALSE;
 }
开发者ID:JohnFF,项目名称:org.civicrm.volunteer,代码行数:46,代码来源:Permission.php

示例3: add

 /**
  * Takes an associative array and creates an instance object.
  *
  * the function extract all the params it needs to initialize the create a
  * instance object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @return CRM_Report_DAO_ReportInstance
  */
 public static function add(&$params)
 {
     $instance = new CRM_Report_DAO_ReportInstance();
     if (empty($params)) {
         return NULL;
     }
     $instanceID = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('instance_id', $params));
     // convert roles array to string
     if (isset($params['grouprole']) && is_array($params['grouprole'])) {
         $grouprole_array = array();
         foreach ($params['grouprole'] as $key => $value) {
             $grouprole_array[$value] = $value;
         }
         $params['grouprole'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($grouprole_array));
     }
     if (!$instanceID || !isset($params['id'])) {
         $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
         $params['domain_id'] = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
         // CRM-17256 set created_id on report creation.
         $params['created_id'] = isset($params['created_id']) ? $params['created_id'] : CRM_Core_Session::getLoggedInContactID();
     }
     if ($instanceID) {
         CRM_Utils_Hook::pre('edit', 'ReportInstance', $instanceID, $params);
     } else {
         CRM_Utils_Hook::pre('create', 'ReportInstance', NULL, $params);
     }
     $instance = new CRM_Report_DAO_ReportInstance();
     $instance->copyValues($params);
     if (CRM_Core_Config::singleton()->userFramework == 'Joomla') {
         $instance->permission = 'null';
     }
     // explicitly set to null if params value is empty
     if (!$instanceID && empty($params['grouprole'])) {
         $instance->grouprole = 'null';
     }
     if ($instanceID) {
         $instance->id = $instanceID;
     }
     if (!$instanceID) {
         if ($reportID = CRM_Utils_Array::value('report_id', $params)) {
             $instance->report_id = $reportID;
         } elseif ($instanceID) {
             $instance->report_id = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
         } else {
             // just take it from current url
             $instance->report_id = CRM_Report_Utils_Report::getValueFromUrl();
         }
     }
     $instance->save();
     if ($instanceID) {
         CRM_Utils_Hook::pre('edit', 'ReportInstance', $instance->id, $instance);
     } else {
         CRM_Utils_Hook::pre('create', 'ReportInstance', $instance->id, $instance);
     }
     return $instance;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:68,代码来源:ReportInstance.php

示例4: setDefaultValues

 /**
  * This virtual function is used to set the default values of
  * various form elements
  *
  * access        public
  *
  * @return array
  *   reference to the array of default values
  */
 public function setDefaultValues()
 {
     // CRM-11761 retrieve user's activity filter preferences
     $defaults = array();
     $userID = CRM_Core_Session::getLoggedInContactID();
     if ($userID) {
         $defaults = Civi::service('settings_manager')->getBagByContact(NULL, $userID)->get('activity_tab_filter');
     }
     return $defaults;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:19,代码来源:ActivityFilter.php

示例5: checkFilePerms

 public static function checkFilePerms($op, $file, $user)
 {
     $opsRequiringProjectId = array(CRM_Core_Action::UPDATE, CRM_Core_Action::DELETE);
     if (in_array($op, $opsRequiringProjectId) && empty($projectId)) {
         CRM_Core_Error::fatal('Missing required parameter Project ID');
     }
     //Run the hook that allows third party extensions to
     //Alter the permissions of a file operation.
     //If true, they have permission
     //If False, they expressly do not
     //If null, fallback on the following checks.
     $validByHook = CRM_Securefiles_Hooks::checkPermissions($op, $file, $user);
     if (!is_null($validByHook)) {
         return $validByHook;
     }
     $contactId = CRM_Core_Session::getLoggedInContactID();
     $checkUserRelationship = !($contactId == $user);
     switch ($op) {
         case CRM_Core_Action::ADD:
         case CRM_Core_Action::UPDATE:
             if ($checkUserRelationship) {
                 return self::check('upload others secure files');
                 //Todo: Check relationships and allow for permissioned relationships
             } else {
                 return self::check('upload own secure files');
             }
             break;
         case CRM_Core_Action::DELETE:
             if ($checkUserRelationship) {
                 return self::check("delete all secure files");
                 //Todo: Check relationships and allow for permissioned relationships
             } else {
                 return self::check("delete own secure files");
             }
             break;
         case CRM_Core_Action::VIEW:
             if ($checkUserRelationship) {
                 return self::check('view all secure files');
                 //Todo: Check relationships and allow for permissioned relationships
             } else {
                 return self::check('view own secure files');
             }
             break;
         case self::LIST_SECURE_FILES:
             if ($checkUserRelationship) {
                 return self::check('list all secure files');
                 //Todo: Check relationships and allow for permissioned relationships
             } else {
                 return self::check('list own secure files');
             }
             break;
     }
     return FALSE;
 }
开发者ID:ginkgostreet,项目名称:com.ginkgostreet.securefiles,代码行数:54,代码来源:Permission.php

示例6: registerScripts

 static function registerScripts()
 {
     static $loaded = FALSE;
     if ($loaded) {
         return;
     }
     $loaded = TRUE;
     CRM_Core_Resources::singleton()->addSettingsFactory(function () {
         global $user;
         $settings = array();
         $config = CRM_Core_Config::singleton();
         $extensions = CRM_Core_PseudoConstant::getExtensions();
         return array('Appraisals' => array('extensionPath' => CRM_Core_Resources::singleton()->getUrl('uk.co.compucorp.civicrm.appraisals'), 'settings' => $settings, 'permissions' => array()), 'adminId' => CRM_Core_Session::getLoggedInContactID(), 'contactId' => CRM_Utils_Request::retrieve('cid', 'Integer'), 'debug' => $config->debug);
     });
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:15,代码来源:Base.php

示例7: html2doc

 /**
  * @param array $pages
  * @param string $fileName
  * @param array|int $format
  */
 public static function html2doc($pages, $fileName, $format = array())
 {
     if (is_array($format)) {
         // PDF Page Format parameters passed in - merge with defaults
         $format += CRM_Core_BAO_PdfFormat::getDefaultValues();
     } else {
         // PDF Page Format ID passed in
         $format = CRM_Core_BAO_PdfFormat::getById($format);
     }
     $paperSize = CRM_Core_BAO_PaperSize::getByName($format['paper_size']);
     $metric = CRM_Core_BAO_PdfFormat::getValue('metric', $format);
     $pageStyle = array('orientation' => CRM_Core_BAO_PdfFormat::getValue('orientation', $format), 'pageSizeW' => self::toTwip($paperSize['width'], $paperSize['metric']), 'pageSizeH' => self::toTwip($paperSize['height'], $paperSize['metric']), 'marginTop' => self::toTwip(CRM_Core_BAO_PdfFormat::getValue('margin_top', $format), $metric), 'marginRight' => self::toTwip(CRM_Core_BAO_PdfFormat::getValue('margin_right', $format), $metric), 'marginBottom' => self::toTwip(CRM_Core_BAO_PdfFormat::getValue('margin_bottom', $format), $metric), 'marginLeft' => self::toTwip(CRM_Core_BAO_PdfFormat::getValue('margin_left', $format), $metric));
     $ext = pathinfo($fileName, PATHINFO_EXTENSION);
     $phpWord = new \PhpOffice\PhpWord\PhpWord();
     $phpWord->getDocInfo()->setCreator(CRM_Core_DAO::getFieldValue('CRM_Contact_BAO_Contact', CRM_Core_Session::getLoggedInContactID(), 'display_name'));
     foreach ((array) $pages as $page => $html) {
         $section = $phpWord->addSection($pageStyle + array('breakType' => 'nextPage'));
         \PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);
     }
     self::printDoc($phpWord, $ext, $fileName);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:26,代码来源:Document.php

示例8: run

 function run($args = NULL)
 {
     if (CRM_Utils_Array::value(0, $args) !== 'civicrm' || CRM_Utils_Array::value(1, $args) !== 'volunteer') {
         CRM_Core_Error::fatal('Invalid page callback config.');
         return;
     }
     switch (CRM_Utils_Array::value(2, $args)) {
         /**
          * This routes civicrm/volunteer/join to CiviVolunteer's reserved profile for volunteer interest.
          */
         case 'join':
             // the profile expects the ID (and some other parameters) to be passed via URL; since we are providing
             // a nice clean URL, these parameters won't be there, so we fake it
             $_REQUEST['gid'] = civicrm_api3('UFGroup', 'getvalue', array('sequential' => 1, 'name' => "volunteer_interest", 'return' => "id"));
             $_REQUEST['force'] = '1';
             // if the user is logged in, serve edit mode profile; else serve create mode
             $contact_id = CRM_Core_Session::getLoggedInContactID();
             // set params for controller
             $class = 'CRM_Profile_Form_Edit';
             $title = NULL;
             $mode = isset($contact_id) ? CRM_Core_Action::UPDATE : CRM_Core_Action::ADD;
             $imageUpload = FALSE;
             $addSequence = FALSE;
             $ignoreKey = TRUE;
             $attachUpload = FALSE;
             $controller = new CRM_Core_Controller_Simple($class, $title, $mode, $imageUpload, $addSequence, $ignoreKey, $attachUpload);
             if (isset($contact_id)) {
                 $controller->set('edit', 1);
             }
             $controller->process();
             return $controller->run();
         default:
             CRM_Core_Error::fatal('Invalid page callback config.');
             return;
     }
 }
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:36,代码来源:Router.php

示例9: create

 /**
  * Create the event.
  *
  * @param array $params
  *   Reference array contains the values submitted by the form.
  *
  * @return object
  */
 public static function create(&$params)
 {
     $transaction = new CRM_Core_Transaction();
     if (empty($params['is_template'])) {
         $params['is_template'] = 0;
     }
     // check if new event, if so set the created_id (if not set)
     // and always set created_date to now
     if (empty($params['id'])) {
         if (empty($params['created_id'])) {
             $session = CRM_Core_Session::singleton();
             $params['created_id'] = $session->get('userID');
         }
         $params['created_date'] = date('YmdHis');
     }
     $event = self::add($params);
     CRM_Price_BAO_PriceSet::setPriceSets($params, $event, 'event');
     if (is_a($event, 'CRM_Core_Error')) {
         CRM_Core_DAO::transaction('ROLLBACK');
         return $event;
     }
     $contactId = CRM_Core_Session::getLoggedInContactID();
     if (!$contactId) {
         $contactId = CRM_Utils_Array::value('contact_id', $params);
     }
     // Log the information on successful add/edit of Event
     $logParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id, 'modified_id' => $contactId, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     if (!empty($params['custom']) && is_array($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_event', $event->id);
     }
     $transaction->commit();
     return $event;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:42,代码来源:Event.php

示例10: saveDashletChanges

 /**
  * Save changes made by user to the Dashlet.
  *
  * @param array $columns
  *
  * @param int $contactID
  *
  * @throws RuntimeException
  */
 public static function saveDashletChanges($columns, $contactID = NULL)
 {
     if (!$contactID) {
         $contactID = CRM_Core_Session::getLoggedInContactID();
     }
     if (empty($contactID)) {
         throw new RuntimeException("Failed to determine contact ID");
     }
     $dashletIDs = array();
     if (is_array($columns)) {
         foreach ($columns as $colNo => $dashlets) {
             if (!is_int($colNo)) {
                 continue;
             }
             $weight = 1;
             foreach ($dashlets as $dashletID => $isMinimized) {
                 $dashletID = (int) $dashletID;
                 $query = "INSERT INTO civicrm_dashboard_contact\n                    (weight, column_no, is_active, dashboard_id, contact_id)\n                    VALUES({$weight}, {$colNo}, 1, {$dashletID}, {$contactID})\n                    ON DUPLICATE KEY UPDATE weight = {$weight}, column_no = {$colNo}, is_active = 1";
                 // fire update query for each column
                 CRM_Core_DAO::executeQuery($query);
                 $dashletIDs[] = $dashletID;
                 $weight++;
             }
         }
     }
     // Disable inactive widgets
     $dashletClause = $dashletIDs ? "dashboard_id NOT IN  (" . implode(',', $dashletIDs) . ")" : '(1)';
     $updateQuery = "UPDATE civicrm_dashboard_contact\n                    SET is_active = 0\n                    WHERE {$dashletClause} AND contact_id = {$contactID}";
     CRM_Core_DAO::executeQuery($updateQuery);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:39,代码来源:Dashboard.php

示例11: group

 /**
  * Get all the groups the user has access to for the given operation.
  *
  * @param int $type
  *   The type of permission needed.
  * @param int $contactID
  *   The contactID for whom the check is made.
  *
  * @param string $tableName
  * @param null $allGroups
  * @param null $includedGroups
  *
  * @return array
  *   the ids of the groups for which the user has permissions
  */
 public static function group($type, $contactID = NULL, $tableName = 'civicrm_saved_search', $allGroups = NULL, $includedGroups = NULL)
 {
     if ($contactID == NULL) {
         $contactID = CRM_Core_Session::getLoggedInContactID();
     }
     if (!$contactID) {
         // anonymous user
         $contactID = 0;
     }
     return CRM_ACL_BAO_ACL::group($type, $contactID, $tableName, $allGroups, $includedGroups);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:26,代码来源:API.php

示例12: _volunteerGetProjectRelationshipDefaults

/**
 * Helper function to get the default project relationships for a new project.
 *
 * @return array
 */
function _volunteerGetProjectRelationshipDefaults()
{
    $defaults = array();
    $relTypes = CRM_Core_OptionGroup::values("volunteer_project_relationship", true, FALSE, FALSE, NULL, 'name');
    $ownerType = $relTypes['volunteer_owner'];
    $managerType = $relTypes['volunteer_manager'];
    $beneficiaryType = $relTypes['volunteer_beneficiary'];
    $contactId = CRM_Core_Session::getLoggedInContactID();
    $defaults[$ownerType] = array($contactId);
    $defaults[$managerType] = array($contactId);
    $employerRelationshipTypeId = civicrm_api3('RelationshipType', 'getvalue', array('return' => "id", 'name_b_a' => "Employer of"));
    try {
        $result = civicrm_api3('Relationship', 'getvalue', array('return' => "contact_id_b", 'contact_id_a' => $contactId, 'relationship_type_id' => $employerRelationshipTypeId, 'is_active' => 1));
        $defaultBeneficiary = array($result);
    } catch (Exception $e) {
        $domain = civicrm_api3('Domain', 'getsingle', array('current_domain' => 1));
        $defaultBeneficiary = array($domain['contact_id']);
    }
    $defaults[$beneficiaryType] = $defaultBeneficiary;
    return $defaults;
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:26,代码来源:VolunteerUtil.php

示例13: addSelectWhereClause

 /**
  * @inheritDoc
  */
 public function addSelectWhereClause()
 {
     // We always return an array with these keys, even if they are empty,
     // because this tells the query builder that we have considered these fields for acls
     $clauses = array('id' => array(), 'is_deleted' => CRM_Core_Permission::check('administer CiviCase') ? array() : array("= 0"));
     // Ensure the user has permission to view the case client
     $contactClause = CRM_Utils_SQL::mergeSubquery('Contact');
     if ($contactClause) {
         $contactClause = implode(' AND contact_id ', $contactClause);
         $clauses['id'][] = "IN (SELECT case_id FROM civicrm_case_contact WHERE contact_id {$contactClause})";
     }
     // The api gatekeeper ensures the user has at least "access my cases and activities"
     // so if they do not have permission to see all cases we'll assume they can only access their own
     if (!CRM_Core_Permission::check('access all cases and activities')) {
         $user = (int) CRM_Core_Session::getLoggedInContactID();
         $clauses['id'][] = "IN (\n        SELECT r.case_id FROM civicrm_relationship r, civicrm_case_contact cc WHERE r.is_active = 1 AND cc.case_id = r.case_id AND (\n          (r.contact_id_a = cc.contact_id AND r.contact_id_b = {$user}) OR (r.contact_id_b = cc.contact_id AND r.contact_id_a = {$user})\n        )\n      )";
     }
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
     return $clauses;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:23,代码来源:Case.php

示例14: postProcess

 /**
  * Post process function.
  *
  * @param CRM_Core_Form $form
  * @param bool $redirect
  */
 public static function postProcess(&$form, $redirect = TRUE)
 {
     $params = $form->getVar('_params');
     $instanceID = $form->getVar('_id');
     if ($isNew = $form->getVar('_createNew')) {
         // set the report_id since base template is going to be same, and we going to unset $instanceID
         // which will make it difficult later on, to compute report_id
         $params['report_id'] = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
         // Unset $instanceID so a new copy would be created.
         $instanceID = NULL;
     }
     $params['instance_id'] = $instanceID;
     if (!empty($params['is_navigation'])) {
         $params['navigation'] = $form->_navigation;
     } elseif ($instanceID) {
         // Delete navigation if exists.
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceID, 'navigation_id', 'id');
         if ($navId) {
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
     }
     // make a copy of params
     $formValues = $params;
     // unset params from $formValues that doesn't match with DB columns of instance tables, and also not required in form-values for sure
     $unsetFields = array('title', 'to_emails', 'cc_emails', 'header', 'footer', 'qfKey', 'id', '_qf_default', 'report_header', 'report_footer', 'grouprole', 'task');
     foreach ($unsetFields as $field) {
         unset($formValues[$field]);
     }
     $view_mode = $formValues['view_mode'];
     // 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::getLoggedInContactID();
     } else {
         $params['owner_id'] = 'null';
     }
     unset($formValues['add_to_my_reports']);
     // pass form_values as string
     $params['form_values'] = serialize($formValues);
     $instance = CRM_Report_BAO_ReportInstance::create($params);
     $form->set('id', $instance->id);
     if ($instanceID && !$isNew) {
         // updating existing instance
         $statusMsg = ts('"%1" report has been updated.', array(1 => $instance->title));
     } elseif ($form->getVar('_id') && $isNew) {
         $statusMsg = ts('Your report has been successfully copied as "%1". You are currently viewing the new copy.', array(1 => $instance->title));
     } else {
         $statusMsg = ts('"%1" report has been successfully created. You are currently viewing the new report instance.', array(1 => $instance->title));
     }
     CRM_Core_Session::setStatus($statusMsg);
     if ($redirect) {
         $urlParams = array('reset' => 1);
         if ($view_mode == 'view') {
             $urlParams['force'] = 1;
         } else {
             $urlParams['output'] = 'criteria';
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/report/instance/{$instance->id}", $urlParams));
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:67,代码来源:Instance.php

示例15: getPrimaryEmail

 /**
  * @todo Is there a better way to do this?
  * @return string
  */
 private function getPrimaryEmail()
 {
     $uid = CRM_Core_Session::getLoggedInContactID();
     $primary = '';
     $emails = CRM_Core_BAO_Email::allEmails($uid);
     foreach ($emails as $eid => $e) {
         if ($e['is_primary']) {
             if ($e['email']) {
                 $primary = $e['email'];
                 break;
             }
         }
         if (count($emails) == 1) {
             $primary = $e['email'];
             break;
         }
     }
     return $primary;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:23,代码来源:ICalendar.php


注:本文中的CRM_Core_Session::getLoggedInContactID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。