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


PHP CRM_Core_Config::domainID方法代码示例

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


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

示例1: browse

 /**
  * Browse all mail settings.
  *
  * @return void
  */
 public function browse()
 {
     //get all mail settings.
     $allMailSettings = array();
     $mailSetting = new CRM_Core_DAO_MailSettings();
     $allProtocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
     //multi-domain support for mail settings. CRM-5244
     $mailSetting->domain_id = CRM_Core_Config::domainID();
     //find all mail settings.
     $mailSetting->find();
     while ($mailSetting->fetch()) {
         //replace protocol value with name
         $mailSetting->protocol = CRM_Utils_Array::value($mailSetting->protocol, $allProtocols);
         CRM_Core_DAO::storeValues($mailSetting, $allMailSettings[$mailSetting->id]);
         //form all action links
         $action = array_sum(array_keys($this->links()));
         // disallow the DELETE action for the default set of settings
         if ($mailSetting->is_default) {
             $action &= ~CRM_Core_Action::DELETE;
         }
         //add action links.
         $allMailSettings[$mailSetting->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $mailSetting->id), ts('more'), FALSE, 'mailSetting.manage.action', 'MailSetting', $mailSetting->id);
     }
     $this->assign('rows', $allMailSettings);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:30,代码来源:MailSettings.php

示例2: __construct

 /**
  * Initialize the constants used during lock acquire / release
  *
  * @param string  $name name of the lock. Please prefix with component / functionality
  *                      e.g. civimail.cronjob.JOB_ID
  * @param int     $timeout the number of seconds to wait to get the lock. 1 if not set
  * @param boolean $serverWideLock should this lock be applicable across your entire mysql server
  *                                this is useful if you have mutliple sites running on the same
  *                                mysql server and you want to limit the number of parallel cron
  *                                jobs - CRM-91XX
  *
  * @return object the lock object
  *
  */
 function __construct($name, $timeout = NULL, $serverWideLock = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $dsnArray = DB::parseDSN($config->dsn);
     $database = $dsnArray['database'];
     $domainID = CRM_Core_Config::domainID();
     if ($serverWideLock) {
         $this->_name = $name;
     } else {
         $this->_name = $database . '.' . $domainID . '.' . $name;
     }
     if (defined('CIVICRM_LOCK_DEBUG')) {
         CRM_Core_Error::debug_log_message('trying to construct lock for ' . $this->_name);
     }
     static $jobLog = FALSE;
     if ($jobLog && CRM_Core_DAO::singleValueQuery("SELECT IS_USED_LOCK( '{$jobLog}')")) {
         return $this->hackyHandleBrokenCode($jobLog);
     }
     if (stristr($name, 'civimail.job.')) {
         $jobLog = $this->_name;
     }
     //if (defined('CIVICRM_LOCK_DEBUG')) {
     //CRM_Core_Error::debug_var('backtrace', debug_backtrace());
     //}
     $this->_timeout = $timeout !== NULL ? $timeout : self::TIMEOUT;
     $this->acquire();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:41,代码来源:Lock.php

示例3: setLocale

 /**
  * Sets the tsLocale and dbLocale for multi-lingual sites.
  * Some code duplication from CRM/Core/BAO/ConfigSetting.php retrieve()
  * to avoid regressions from refactoring.
  * @param $lcMessagesRequest
  * @throws \API_Exception
  */
 public function setLocale($lcMessagesRequest)
 {
     // We must validate whether the locale is valid, otherwise setting a bad
     // dbLocale could probably lead to sql-injection.
     $domain = new \CRM_Core_DAO_Domain();
     $domain->id = \CRM_Core_Config::domainID();
     $domain->find(TRUE);
     if ($domain->config_backend) {
         $defaults = unserialize($domain->config_backend);
         // are we in a multi-language setup?
         $multiLang = $domain->locales ? TRUE : FALSE;
         $lcMessages = NULL;
         // on multi-lang sites based on request and civicrm_uf_match
         if ($multiLang) {
             $languageLimit = array();
             if (array_key_exists('languageLimit', $defaults) && is_array($defaults['languageLimit'])) {
                 $languageLimit = $defaults['languageLimit'];
             }
             if (in_array($lcMessagesRequest, array_keys($languageLimit))) {
                 $lcMessages = $lcMessagesRequest;
             } else {
                 throw new \API_Exception(ts('Language not enabled: %1', array(1 => $lcMessagesRequest)));
             }
         }
         global $dbLocale;
         // set suffix for table names - use views if more than one language
         if ($lcMessages) {
             $dbLocale = $multiLang && $lcMessages ? "_{$lcMessages}" : '';
             // FIXME: an ugly hack to fix CRM-4041
             global $tsLocale;
             $tsLocale = $lcMessages;
         }
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:41,代码来源:I18nSubscriber.php

示例4: getMetadata

 /**
  * WARNING: This interface may change.
  *
  * This provides information about the setting - similar to the fields concept for DAO information.
  * As the setting is serialized code creating validation setting input needs to know the data type
  * This also helps move information out of the form layer into the data layer where people can interact with
  * it via the API or other mechanisms. In order to keep this consistent it is important the form layer
  * also leverages it.
  *
  * Note that this function should never be called when using the runtime getvalue function. Caching works
  * around the expectation it will be called during setting administration
  *
  * Function is intended for configuration rather than runtime access to settings
  *
  * The following params will filter the result. If none are passed all settings will be returns
  *
  * @param array $filters
  * @param int $domainID
  *
  * @return array
  *   the following information as appropriate for each setting
  *   - name
  *   - type
  *   - default
  *   - add (CiviCRM version added)
  *   - is_domain
  *   - is_contact
  *   - description
  *   - help_text
  */
 public static function getMetadata($filters = array(), $domainID = NULL)
 {
     if ($domainID === NULL) {
         $domainID = \CRM_Core_Config::domainID();
     }
     $cache = \Civi::cache('settings');
     $cacheString = 'settingsMetadata_' . $domainID . '_';
     // the caching into 'All' seems to be a duplicate of caching to
     // settingsMetadata__ - I think the reason was to cache all settings as defined & then those altered by a hook
     $settingsMetadata = $cache->get($cacheString);
     $cached = is_array($settingsMetadata);
     if (!$cached) {
         $settingsMetadata = $cache->get(self::ALL);
         if (empty($settingsMetadata)) {
             global $civicrm_root;
             $metaDataFolders = array($civicrm_root . '/settings');
             \CRM_Utils_Hook::alterSettingsFolders($metaDataFolders);
             $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders);
             $cache->set(self::ALL, $settingsMetadata);
         }
     }
     \CRM_Utils_Hook::alterSettingsMetaData($settingsMetadata, $domainID, NULL);
     if (!$cached) {
         $cache->set($cacheString, $settingsMetadata);
     }
     self::_filterSettingsSpecification($filters, $settingsMetadata);
     return $settingsMetadata;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:58,代码来源:SettingsMetadata.php

示例5: smarty_function_crmNavigationMenu

/**
 * Output navigation script tag
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param CRM_Core_Smarty $smarty
 *   The Smarty object.
 *
 * @return string
 *   HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    $config = CRM_Core_Config::singleton();
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($config->userFrameworkFrontend) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            // These params force the browser to refresh the js file when switching user, domain, or language
            // We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
            // @see CRM_Admin_Page_AJAX::getNavigationMenu
            $lang = $config->lcMessages;
            $domain = CRM_Core_Config::domainID();
            $key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
            $src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}");
            // CRM-15493 QFkey needed for quicksearch bar - must be unique on each page refresh so adding it directly to markup
            $qfKey = CRM_Core_Key::get('CRM_Contact_Controller_Search', TRUE);
            return '<script id="civicrm-navigation-menu" type="text/javascript" src="' . $src . '" data-qfkey=' . json_encode($qfKey) . '></script>';
        }
    }
    return '';
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:40,代码来源:function.crmNavigationMenu.php

示例6: array

 static function &values($name, $flip = FALSE, $grouping = FALSE, $localize = FALSE, $condition = NULL, $valueColumnName = 'label', $onlyActive = TRUE)
 {
     static $_cache = array();
     $cacheKey = "CRM_OG_{$name}_{$flip}_{$grouping}_{$localize}_{$condition}_{$valueColumnName}_{$onlyActive}";
     if (array_key_exists($cacheKey, $_cache)) {
         return $_cache[$cacheKey];
     }
     $cache = CRM_Utils_Cache::singleton();
     $var = $cache->get($cacheKey);
     if ($var) {
         return $var;
     }
     $query = "\nSELECT  v.{$valueColumnName} as {$valueColumnName} ,v.value as value, v.grouping as grouping\nFROM   civicrm_option_value v,\n       civicrm_option_group g\nWHERE  v.option_group_id = g.id\n  AND  g.name            = %1\n  AND  g.is_active       = 1 ";
     if ($onlyActive) {
         $query .= " AND  v.is_active = 1 ";
     }
     if (in_array($name, self::$_domainIDGroups)) {
         $query .= " AND v.domain_id = " . CRM_Core_Config::domainID();
     }
     if ($condition) {
         $query .= $condition;
     }
     $query .= "  ORDER BY v.weight";
     $p = array(1 => array($name, 'String'));
     $dao = CRM_Core_DAO::executeQuery($query, $p);
     $var = self::valuesCommon($dao, $flip, $grouping, $localize, $valueColumnName);
     // call option value hook
     CRM_Utils_Hook::optionValues($var, $name);
     $_cache[$cacheKey] = $var;
     $cache->set($cacheKey, $var);
     return $var;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:32,代码来源:OptionGroup.php

示例7: civicrm_api3_domain_get

/**
 * Get CiviCRM domain details
 * {@getfields domain_create}
 * @example DomainGet.php
 */
function civicrm_api3_domain_get($params)
{
    $params['version'] = CRM_Utils_Array::value('domain_version', $params);
    unset($params['version']);
    $bao = new CRM_Core_BAO_Domain();
    if (CRM_Utils_Array::value('current_domain', $params)) {
        $domainBAO = CRM_Core_Config::domainID();
        $params['id'] = $domainBAO;
    }
    _civicrm_api3_dao_set_filter($bao, $params, true, 'domain');
    $domains = _civicrm_api3_dao_to_array($bao, $params, true, 'domain');
    foreach ($domains as $domain) {
        if (!empty($domain['contact_id'])) {
            $values = array();
            $locparams = array('contact_id' => $domain['contact_id']);
            $values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
            $address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
            if (!empty($values['location']['email'])) {
                $domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
            }
            if (!empty($values['location']['phone'])) {
                $domain['domain_phone'] = array('phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]));
            }
            if (!empty($values['location']['address'])) {
                foreach ($address_array as $value) {
                    $domain['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
                }
            }
            list($domain['from_name'], $domain['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
            $domains[$domain['id']] = array_merge($domains[$domain['id']], $domain);
        }
    }
    return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao);
}
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:39,代码来源:Domain.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $params = array('contact_type_a' => 'Individual', 'contact_type_b' => 'Organization', 'name_a_b' => 'Test Employee of', 'name_b_a' => 'Test Employer of');
     $this->_relationshipTypeId = $this->relationshipTypeCreate($params);
     $this->_orgContactID = $this->organizationCreate();
     $this->_financialTypeId = 1;
     $this->_membershipTypeName = 'Mickey Mouse Club Member';
     $params = array('name' => $this->_membershipTypeName, 'description' => NULL, 'minimum_fee' => 10, 'duration_unit' => 'year', 'member_of_contact_id' => $this->_orgContactID, 'period_type' => 'fixed', 'duration_interval' => 1, 'financial_type_id' => $this->_financialTypeId, 'relationship_type_id' => $this->_relationshipTypeId, 'visibility' => 'Public', 'is_active' => 1, 'fixed_period_start_day' => 101, 'fixed_period_rollover_day' => 1231, 'domain_id' => CRM_Core_Config::domainID());
     $membershipType = $this->callAPISuccess('membership_type', 'create', $params);
     $this->_membershipTypeID = $membershipType['id'];
     $this->_orgContactID2 = $this->organizationCreate();
     $params = array('name' => 'General', 'duration_unit' => 'year', 'duration_interval' => 1, 'period_type' => 'rolling', 'member_of_contact_id' => $this->_orgContactID2, 'domain_id' => 1, 'financial_type_id' => 1, 'is_active' => 1, 'sequential' => 1, 'visibility' => 'Public');
     $membershipType2 = $this->callAPISuccess('membership_type', 'create', $params);
     $this->_membershipTypeID2 = $membershipType2['id'];
     $this->_membershipStatusID = $this->membershipStatusCreate('test status');
     $this->_contactID = $this->individualCreate();
     $contact2Params = array('first_name' => 'Anthonita', 'middle_name' => 'J.', 'last_name' => 'Anderson', 'prefix_id' => 3, 'suffix_id' => 3, 'email' => 'b@c.com', 'contact_type' => 'Individual');
     $this->_contactID2 = $this->individualCreate($contact2Params);
     $this->_contactID3 = $this->individualCreate(array('first_name' => 'bobby', 'email' => 'c@d.com'));
     $this->_contactID4 = $this->individualCreate(array('first_name' => 'bobbynita', 'email' => 'c@de.com'));
     $session = CRM_Core_Session::singleton();
     $session->set('dateTypes', 1);
     $this->_sethtmlGlobals();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:25,代码来源:EntryTest.php

示例9: preProcess

 function preProcess()
 {
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false);
     $this->_system = CRM_Utils_Request::retrieve('system', 'Boolean', $this, false, true);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'update');
     if (isset($action)) {
         $this->assign('action', $action);
     }
     $session = CRM_Core_Session::singleton();
     require_once 'CRM/Core/DAO/Preferences.php';
     $this->_config = new CRM_Core_DAO_Preferences();
     $this->_config->domain_id = CRM_Core_Config::domainID();
     if ($this->_system) {
         if (CRM_Core_Permission::check('administer CiviCRM')) {
             $this->_contactID = null;
         } else {
             CRM_Utils_System::fatal('You do not have permission to edit preferences');
         }
         $this->_config->is_domain = 1;
         $this->_config->contact_id = null;
     } else {
         if (!$this->_contactID) {
             $this->_contactID = $session->get('userID');
             if (!$this->_contactID) {
                 CRM_Utils_System::fatal('Could not retrieve contact id');
             }
             $this->set('cid', $this->_contactID);
         }
         $this->_config->is_domain = 0;
         $this->_config->contact_id = $this->_contactID;
     }
     $this->_config->find(true);
     $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/setting', 'reset=1'));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:34,代码来源:Preferences.php

示例10: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 function postProcess()
 {
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         CRM_Core_BAO_LocationType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Location type has been deleted.'));
     } else {
         // store the submitted values in an array
         $params = $this->exportValues();
         $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
         $params['is_default'] = CRM_Utils_Array::value('is_default', $params, false);
         // action is taken depending upon the mode
         $locationType =& new CRM_Core_DAO_LocationType();
         $locationType->domain_id = CRM_Core_Config::domainID();
         $locationType->name = $params['name'];
         $locationType->vcard_name = $params['vcard_name'];
         $locationType->description = $params['description'];
         $locationType->is_active = $params['is_active'];
         $locationType->is_default = $params['is_default'];
         if ($params['is_default']) {
             $unsetDefault =& new CRM_Core_DAO();
             $query = 'UPDATE civicrm_location_type SET is_default = 0';
             $unsetDefault->query($query);
         }
         if ($this->_action & CRM_CORE_ACTION_UPDATE) {
             $locationType->id = $this->_id;
         }
         $locationType->save();
         CRM_Core_Session::setStatus(ts('The location type "%1" has been saved.', array(1 => $locationType->name)));
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:36,代码来源:LocationType.php

示例11: getAngularModules

 /**
  * Get AngularJS modules and their dependencies
  *
  * @return array
  *   list of modules; same format as CRM_Utils_Hook::angularModules(&$angularModules)
  * @see CRM_Utils_Hook::angularModules
  */
 public function getAngularModules()
 {
     // load angular files only if valid permissions are granted to the user
     if (!CRM_Core_Permission::check('access CiviMail') && !CRM_Core_Permission::check('create mailings') && !CRM_Core_Permission::check('schedule mailings') && !CRM_Core_Permission::check('approve mailings')) {
         return array();
     }
     $result = array();
     $result['crmMailing'] = array('ext' => 'civicrm', 'js' => array('ang/crmMailing.js', 'ang/crmMailing/*.js'), 'css' => array('ang/crmMailing.css'), 'partials' => array('ang/crmMailing'));
     $result['crmMailingAB'] = array('ext' => 'civicrm', 'js' => array('ang/crmMailingAB.js', 'ang/crmMailingAB/*.js', 'ang/crmMailingAB/*/*.js'), 'css' => array('ang/crmMailingAB.css'), 'partials' => array('ang/crmMailingAB'));
     $result['crmD3'] = array('ext' => 'civicrm', 'js' => array('ang/crmD3.js', 'bower_components/d3/d3.min.js'));
     $config = CRM_Core_Config::singleton();
     $session = CRM_Core_Session::singleton();
     $contactID = $session->get('userID');
     // Get past mailings
     // CRM-16155 - Limit to a reasonable number
     $civiMails = civicrm_api3('Mailing', 'get', array('is_completed' => 1, 'mailing_type' => array('IN' => array('standalone', 'winner')), 'return' => array('id', 'name', 'scheduled_date'), 'sequential' => 1, 'options' => array('limit' => 500, 'sort' => 'is_archived asc, scheduled_date desc')));
     // Generic params
     $params = array('options' => array('limit' => 0), 'sequential' => 1);
     $groupNames = civicrm_api3('Group', 'get', $params + array('is_active' => 1, 'check_permissions' => TRUE, 'return' => array('title', 'visibility', 'group_type', 'is_hidden')));
     $headerfooterList = civicrm_api3('MailingComponent', 'get', $params + array('is_active' => 1, 'return' => array('name', 'component_type', 'is_default', 'body_html', 'body_text')));
     $emailAdd = civicrm_api3('Email', 'get', array('sequential' => 1, 'return' => "email", 'contact_id' => $contactID));
     $mesTemplate = civicrm_api3('MessageTemplate', 'get', $params + array('sequential' => 1, 'is_active' => 1, 'return' => array("id", "msg_title"), 'workflow_id' => array('IS NULL' => "")));
     $mailTokens = civicrm_api3('Mailing', 'gettokens', array('entity' => array('contact', 'mailing'), 'sequential' => 1));
     $fromAddress = civicrm_api3('OptionValue', 'get', $params + array('option_group_id' => "from_email_address", 'domain_id' => CRM_Core_Config::domainID()));
     CRM_Core_Resources::singleton()->addSetting(array('crmMailing' => array('civiMails' => $civiMails['values'], 'campaignEnabled' => in_array('CiviCampaign', $config->enableComponents), 'groupNames' => $groupNames['values'], 'headerfooterList' => $headerfooterList['values'], 'mesTemplate' => $mesTemplate['values'], 'emailAdd' => $emailAdd['values'], 'mailTokens' => $mailTokens['values'], 'contactid' => $contactID, 'requiredTokens' => CRM_Utils_Token::getRequiredTokens(), 'enableReplyTo' => (int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'replyTo'), 'disableMandatoryTokensCheck' => (int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'disable_mandatory_tokens_check'), 'fromAddress' => $fromAddress['values'], 'defaultTestEmail' => civicrm_api3('Contact', 'getvalue', array('id' => 'user_contact_id', 'return' => 'email')), 'visibility' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::groupVisibility()), 'workflowEnabled' => CRM_Mailing_Info::workflowEnabled())))->addPermissions(array('view all contacts', 'access CiviMail', 'create mailings', 'schedule mailings', 'approve mailings', 'delete in CiviMail', 'edit message templates'));
     return $result;
 }
开发者ID:vincent1892,项目名称:contact_report,代码行数:34,代码来源:Info.php

示例12: 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 object CRM_Report_DAO_ReportInstance object
  * @access public
  * @static
  */
 static function add(&$params)
 {
     $instance = new CRM_Report_DAO_ReportInstance();
     if (empty($params)) {
         return NULL;
     }
     $config = CRM_Core_Config::singleton();
     $params['domain_id'] = CRM_Core_Config::domainID();
     // 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 (!isset($params['id'])) {
         $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
     }
     $instanceID = CRM_Utils_Array::value('id', $params);
     if (!empty($params['instance_id'])) {
         $instanceID = CRM_Utils_Array::value('instance_id', $params);
     }
     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 ($config->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;
         } else {
             if ($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:archcidburnziso,项目名称:civicrm-core,代码行数:73,代码来源:ReportInstance.php

示例13: smarty_function_crmNavigationMenu

/**
 * Output navigation script tag
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param object $smarty the Smarty object
 *
 * @return string HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    $config = CRM_Core_Config::singleton();
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($config->userFrameworkFrontend) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            // These params force the browser to refresh the js file when switching user, domain, or language
            // We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
            // We end the string with .js to trick apache mods into sending pro-caching headers
            // @see CRM_Admin_Page_AJAX::getNavigationMenu
            $lang = $config->lcMessages;
            $domain = CRM_Core_Config::domainID();
            $key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
            $src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}.js");
            return '<script type="text/javascript" src="' . $src . '"></script>';
        }
    }
    return '';
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:37,代码来源:function.crmNavigationMenu.php

示例14: getStore

 /**
  * Return the proper mail store implementation, based on config settings
  *
  * @param  string $name  name of the settings set from civimail_mail_settings to use (null for default)
  * @return object        mail store implementation for processing CiviMail-bound emails
  */
 function getStore($name = null)
 {
     $dao = new CRM_Core_DAO_MailSettings();
     $dao->domain_id = CRM_Core_Config::domainID();
     $name ? $dao->name = $name : ($dao->is_default = 1);
     if (!$dao->find(true)) {
         throw new Exception("Could not find entry named {$name} in civicrm_mail_settings");
     }
     $protocols =& CRM_Core_PseudoConstant::mailProtocol();
     switch ($protocols[$dao->protocol]) {
         case 'IMAP':
             require_once 'CRM/Mailing/MailStore/Imap.php';
             return new CRM_Mailing_MailStore_Imap($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl, $dao->source);
         case 'POP3':
             require_once 'CRM/Mailing/MailStore/Pop3.php';
             return new CRM_Mailing_MailStore_Pop3($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl);
         case 'Maildir':
             require_once 'CRM/Mailing/MailStore/Maildir.php';
             return new CRM_Mailing_MailStore_Maildir($dao->source);
         case 'Localdir':
             require_once 'CRM/Mailing/MailStore/Localdir.php';
             return new CRM_Mailing_MailStore_Localdir($dao->source);
             // DO NOT USE the mbox transport for anything other than testing
             // in particular, it does not clear the mbox afterwards
         // DO NOT USE the mbox transport for anything other than testing
         // in particular, it does not clear the mbox afterwards
         case 'mbox':
             require_once 'CRM/Mailing/MailStore/Mbox.php';
             return new CRM_Mailing_MailStore_Mbox($dao->source);
         default:
             throw new Exception("Unknown protocol {$dao->protocol}");
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:39,代码来源:MailStore.php

示例15: array

 /**
  * Get all the mailing components of a particular type
  *
  * @param $type the type of component needed
  * @access public
  * @return array - array reference of all mailing components
  * @static
  */
 function &component($type = null)
 {
     $name = $type ? $type : 'ALL';
     if (!$GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'] || !array_key_exists($name, $GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'])) {
         if (!$GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component']) {
             $GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'] = array();
         }
         if (!$type) {
             $GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'][$name] = null;
             CRM_Core_PseudoConstant::populate($GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'][$name], 'CRM_Mailing_DAO_Component');
         } else {
             // we need to add an additional filter for $type
             $GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'][$name] = array();
             require_once 'CRM/Mailing/DAO/Component.php';
             $object =& new CRM_Mailing_DAO_Component();
             $object->domain_id = CRM_Core_Config::domainID();
             $object->component_type = $type;
             $object->selectAdd();
             $object->selectAdd("id, name");
             $object->orderBy('is_default, name');
             $object->is_active = 1;
             $object->find();
             while ($object->fetch()) {
                 $GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'][$name][$object->id] = $object->name;
             }
         }
     }
     return $GLOBALS['_CRM_MAILING_PSEUDOCONSTANT']['component'][$name];
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:37,代码来源:PseudoConstant.php


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