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


PHP CRM_Core_I18n::languages方法代码示例

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


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

示例1: buildQuickForm

 public function buildQuickForm()
 {
     $parent = $this->controller->getParent();
     $nameTextLabel = $parent->_sms ? ts('SMS Name') : ts('Mailing Name');
     $this->add('text', 'mailing_name', $nameTextLabel, CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title'));
     CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE);
     $this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($this);
     // CRM-15434 - Fix mailing search by status in non-English languages
     $statusVals = CRM_Core_SelectValues::getMailingJobStatus();
     foreach ($statusVals as $statusId => $statusName) {
         $this->addElement('checkbox', "mailing_status[{$statusId}]", NULL, $statusName);
     }
     $this->addElement('checkbox', 'status_unscheduled', NULL, ts('Draft / Unscheduled'));
     $this->addYesNo('is_archived', ts('Mailing is Archived'), TRUE);
     // Search by language, if multi-lingual
     $enabledLanguages = CRM_Core_I18n::languages(TRUE);
     if (count($enabledLanguages) > 1) {
         $this->addElement('select', 'language', ts('Language'), array('' => ts('- all languages -')) + $enabledLanguages, array('class' => 'crm-select2'));
     }
     if ($parent->_sms) {
         $this->addElement('hidden', 'sms', $parent->_sms);
     }
     $this->add('hidden', 'hidden_find_mailings', 1);
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:26,代码来源:Search.php

示例2: buildQuickForm

 public function buildQuickForm()
 {
     $config = CRM_Core_Config::singleton();
     global $tsLocale;
     $this->_locales = array_keys($config->languageLimit);
     // get the part of the database we want to edit and validate it
     $table = CRM_Utils_Request::retrieve('table', 'String', $this);
     $field = CRM_Utils_Request::retrieve('field', 'String', $this);
     $id = CRM_Utils_Request::retrieve('id', 'Int', $this);
     $this->_structure = CRM_Core_I18n_SchemaStructure::columns();
     if (!isset($this->_structure[$table][$field])) {
         CRM_Core_Error::fatal("{$table}.{$field} is not internationalized.");
     }
     $this->addElement('hidden', 'table', $table);
     $this->addElement('hidden', 'field', $field);
     $this->addElement('hidden', 'id', $id);
     $cols = array();
     foreach ($this->_locales as $locale) {
         $cols[] = "{$field}_{$locale} {$locale}";
     }
     $query = 'SELECT ' . implode(', ', $cols) . " FROM {$table} WHERE id = {$id}";
     $dao = new CRM_Core_DAO();
     $dao->query($query, FALSE);
     $dao->fetch();
     // get html type and attributes for this field
     $widgets = CRM_Core_I18n_SchemaStructure::widgets();
     $widget = $widgets[$table][$field];
     // attributes
     $attributes = array('class' => '');
     if (isset($widget['rows'])) {
         $attributes['rows'] = $widget['rows'];
     }
     if (isset($widget['cols'])) {
         $attributes['cols'] = $widget['cols'];
     }
     $required = !empty($widget['required']);
     if ($widget['type'] == 'RichTextEditor') {
         $widget['type'] = 'wysiwyg';
         $attributes['class'] .= ' collapsed';
     }
     $languages = CRM_Core_I18n::languages(TRUE);
     foreach ($this->_locales as $locale) {
         $attr = $attributes;
         $name = "{$field}_{$locale}";
         if ($locale == $tsLocale) {
             $attr['class'] .= ' default-lang';
         }
         $this->add($widget['type'], $name, $languages[$locale], $attr, $required);
         $this->_defaults[$name] = $dao->{$locale};
     }
     $this->addDefaultButtons(ts('Save'), 'next', NULL);
     CRM_Utils_System::setTitle(ts('Languages'));
     $this->assign('locales', $this->_locales);
     $this->assign('field', $field);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:55,代码来源:Form.php

示例3: buildQuickForm

 function buildQuickForm()
 {
     $config = CRM_Core_Config::singleton();
     $this->_locales = array_keys($config->languageLimit);
     // get the part of the database we want to edit and validate it
     $table = CRM_Utils_Request::retrieve('table', 'String', $this);
     $field = CRM_Utils_Request::retrieve('field', 'String', $this);
     $id = CRM_Utils_Request::retrieve('id', 'Int', $this);
     $this->_structure = CRM_Core_I18n_SchemaStructure::columns();
     if (!isset($this->_structure[$table][$field])) {
         CRM_Core_Error::fatal("{$table}.{$field} is not internationalized.");
     }
     $this->addElement('hidden', 'table', $table);
     $this->addElement('hidden', 'field', $field);
     $this->addElement('hidden', 'id', $id);
     $cols = array();
     foreach ($this->_locales as $locale) {
         $cols[] = "{$field}_{$locale} {$locale}";
     }
     $query = 'SELECT ' . implode(', ', $cols) . " FROM {$table} WHERE id = {$id}";
     $dao = new CRM_Core_DAO();
     $dao->query($query, FALSE);
     $dao->fetch();
     // we want TEXTAREAs for long fields and INPUTs for short ones
     $this->_structure[$table][$field] == 'text' ? $type = 'textarea' : ($type = 'text');
     $languages = CRM_Core_I18n::languages(TRUE);
     foreach ($this->_locales as $locale) {
         $this->addElement($type, "{$field}_{$locale}", $languages[$locale], array('cols' => 60, 'rows' => 3));
         $this->_defaults["{$field}_{$locale}"] = $dao->{$locale};
     }
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE)));
     global $tsLocale;
     $this->assign('tsLocale', $tsLocale);
     $this->assign('locales', $this->_locales);
     $this->assign('field', $field);
     $this->assign('context', CRM_Utils_Request::retrieve('context', 'String', $this));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:37,代码来源:Form.php

示例4: initialize

 private function initialize()
 {
     $config = CRM_Core_Config::singleton();
     if (isset($config->customTemplateDir) && $config->customTemplateDir) {
         $this->template_dir = array_merge(array($config->customTemplateDir), $config->templateDir);
     } else {
         $this->template_dir = $config->templateDir;
     }
     $this->compile_dir = CRM_Utils_File::addTrailingSlash(CRM_Utils_File::addTrailingSlash($config->templateCompileDir) . $this->getLocale());
     CRM_Utils_File::createDir($this->compile_dir);
     CRM_Utils_File::restrictAccess($this->compile_dir);
     // check and ensure it is writable
     // else we sometime suppress errors quietly and this results
     // in blank emails etc
     if (!is_writable($this->compile_dir)) {
         echo "CiviCRM does not have permission to write temp files in {$this->compile_dir}, Exiting";
         exit;
     }
     //Check for safe mode CRM-2207
     if (ini_get('safe_mode')) {
         $this->use_sub_dirs = FALSE;
     } else {
         $this->use_sub_dirs = TRUE;
     }
     $customPluginsDir = NULL;
     if (isset($config->customPHPPathDir)) {
         $customPluginsDir = $config->customPHPPathDir . DIRECTORY_SEPARATOR . 'CRM' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR;
         if (!file_exists($customPluginsDir)) {
             $customPluginsDir = NULL;
         }
     }
     $smartyDir = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR;
     $pluginsDir = __DIR__ . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR;
     if ($customPluginsDir) {
         $this->plugins_dir = array($customPluginsDir, $smartyDir . 'plugins', $pluginsDir);
     } else {
         $this->plugins_dir = array($smartyDir . 'plugins', $pluginsDir);
     }
     // add the session and the config here
     $session = CRM_Core_Session::singleton();
     $this->assign_by_ref('config', $config);
     $this->assign_by_ref('session', $session);
     global $tsLocale;
     $this->assign('tsLocale', $tsLocale);
     // CRM-7163 hack: we don’t display langSwitch on upgrades anyway
     if (!CRM_Core_Config::isUpgradeMode()) {
         $this->assign('langSwitch', CRM_Core_I18n::languages(TRUE));
     }
     $this->register_function('crmURL', array('CRM_Utils_System', 'crmURL'));
     $this->load_filter('pre', 'resetExtScope');
     $this->assign('crmPermissions', new CRM_Core_Smarty_Permissions());
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:52,代码来源:Smarty.php

示例5: buildQuickForm


//.........这里部分代码省略.........
         $sel =& $this->add('hierselect', 'entity', ts('Entity'), array('name' => 'entity[0]', 'style' => 'vertical-align: top;'));
         $sel->setOptions(array(CRM_Utils_Array::collectMethod('getLabel', $mappings), CRM_Core_BAO_ActionSchedule::getAllEntityValueLabels(), CRM_Core_BAO_ActionSchedule::getAllEntityStatusLabels()));
         if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
             // make second selector a multi-select -
             $sel->_elements[1]->setMultiple(TRUE);
             $sel->_elements[1]->setSize(5);
         }
         if (is_a($sel->_elements[2], 'HTML_QuickForm_select')) {
             // make third selector a multi-select -
             $sel->_elements[2]->setMultiple(TRUE);
             $sel->_elements[2]->setSize(5);
         }
     } else {
         // Dig deeper - this code is sublimely stupid.
         $allEntityStatusLabels = CRM_Core_BAO_ActionSchedule::getAllEntityStatusLabels();
         $options = $allEntityStatusLabels[$this->_mappingID][0];
         $attributes = array('multiple' => 'multiple', 'class' => 'crm-select2 huge', 'placeholder' => $options[0]);
         unset($options[0]);
         $this->add('select', 'entity', ts('Recipient(s)'), $options, TRUE, $attributes);
         $this->assign('context', $this->_context);
     }
     //get the frequency units.
     $this->_freqUnits = CRM_Core_SelectValues::getRecurringFrequencyUnits();
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
     //reminder_interval
     $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
     $isActive = ts('Send email');
     $recordActivity = ts('Record activity for automated email');
     if ($providersCount) {
         $this->assign('sms', $providersCount);
         $isActive = ts('Send email or SMS');
         $recordActivity = ts('Record activity for automated email or SMS');
         $options = CRM_Core_OptionGroup::values('msg_mode');
         $this->add('select', 'mode', ts('Send as'), $options);
         $providers = CRM_SMS_BAO_Provider::getProviders(NULL, NULL, TRUE, 'is_default desc');
         $providerSelect = array();
         foreach ($providers as $provider) {
             $providerSelect[$provider['id']] = $provider['title'];
         }
         $this->add('select', 'sms_provider_id', ts('SMS Provider'), $providerSelect, TRUE);
     }
     foreach ($this->_freqUnits as $val => $label) {
         $freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label));
     }
     $this->addDate('absolute_date', ts('Start Date'), FALSE, array('formatType' => 'mailing'));
     //reminder_frequency
     $this->add('select', 'start_action_unit', ts('Frequency'), $freqUnitsDisplay, TRUE);
     $condition = array('before' => ts('before'), 'after' => ts('after'));
     //reminder_action
     $this->add('select', 'start_action_condition', ts('Action Condition'), $condition);
     $this->add('select', 'start_action_date', ts('Date Field'), $selectedMapping->getDateFields(), TRUE);
     $this->addElement('checkbox', 'record_activity', $recordActivity);
     $this->addElement('checkbox', 'is_repeat', ts('Repeat'), NULL, array('onchange' => "return showHideByValue('is_repeat',true,'repeatFields','table-row','radio',false);"));
     $this->add('select', 'repetition_frequency_unit', ts('every'), $freqUnitsDisplay);
     $this->add('select', 'repetition_frequency_interval', ts('every'), $numericOptions);
     $this->add('select', 'end_frequency_unit', ts('until'), $freqUnitsDisplay);
     $this->add('select', 'end_frequency_interval', ts('until'), $numericOptions);
     $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE);
     $this->add('select', 'end_date', ts('Date Field'), $selectedMapping->getDateFields(), TRUE);
     $this->add('text', 'from_name', ts('From Name'));
     $this->add('text', 'from_email', ts('From Email'));
     $recipientListingOptions = array();
     if ($mappingID) {
         $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => $mappingID)));
     }
     $limitOptions = array('' => '-neither-', 1 => ts('Limit to'), 0 => ts('Also include'));
     $recipientLabels = array('activity' => ts('Recipients'), 'other' => ts('Limit or Add Recipients'));
     $this->assign('recipientLabels', $recipientLabels);
     $this->add('select', 'limit_to', ts('Limit Options'), $limitOptions, FALSE, array('onChange' => "showHideByValue('limit_to','','recipient', 'select','select',true);"));
     $this->add('select', 'recipient', $recipientLabels['other'], $entityRecipientLabels, FALSE, array('onchange' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);"));
     if (!empty($this->_submitValues['recipient_listing'])) {
         if (!empty($this->_context)) {
             $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_mappingID, $this->_submitValues['recipient']);
         } else {
             $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($_POST['entity'][0], $_POST['recipient']);
         }
     } elseif (!empty($this->_values['recipient_listing'])) {
         $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($this->_values['mapping_id'], $this->_values['recipient']);
     }
     $this->add('select', 'recipient_listing', ts('Recipient Roles'), $recipientListingOptions, FALSE, array('multiple' => TRUE, 'class' => 'crm-select2 huge', 'placeholder' => TRUE));
     $this->addEntityRef('recipient_manual_id', ts('Manual Recipients'), array('multiple' => TRUE, 'create' => TRUE));
     $this->add('select', 'group_id', ts('Group'), CRM_Core_PseudoConstant::nestedGroup('Mailing'), FALSE, array('class' => 'crm-select2 huge'));
     // multilingual only options
     $multilingual = CRM_Core_I18n::isMultilingual();
     if ($multilingual) {
         $smarty = CRM_Core_Smarty::singleton();
         $smarty->assign('multilingual', $multilingual);
         $languages = CRM_Core_I18n::languages(TRUE);
         $languageFilter = $languages + array(CRM_Core_I18n::NONE => ts('Contacts with no preferred language'));
         $element = $this->add('select', 'filter_contact_language', ts('Recipients language'), $languageFilter, FALSE, array('multiple' => TRUE, 'class' => 'crm-select2', 'placeholder' => TRUE));
         $communicationLanguage = array('' => ts('System default language'), CRM_Core_I18n::AUTO => ts('Follow recipient preferred language'));
         $communicationLanguage = $communicationLanguage + $languages;
         $this->add('select', 'communication_language', ts('Communication language'), $communicationLanguage);
     }
     CRM_Mailing_BAO_Mailing::commonCompose($this);
     $this->add('text', 'subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActionSchedule', 'subject'));
     $this->add('checkbox', 'is_active', $isActive);
     $this->addFormRule(array('CRM_Admin_Form_ScheduleReminders', 'formRule'), $this);
     $this->setPageTitle(ts('Scheduled Reminder'));
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:ScheduleReminders.php

示例6: getDefaultLocaleOptions

 /**
  * @return array
  */
 public static function getDefaultLocaleOptions()
 {
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
     $locales = CRM_Core_I18n::languages();
     if ($domain->locales) {
         // for multi-lingual sites, populate default language drop-down with available languages
         $defaultLocaleOptions = array();
         foreach ($locales as $loc => $lang) {
             if (substr_count($domain->locales, $loc)) {
                 $defaultLocaleOptions[$loc] = $lang;
             }
         }
     } else {
         $defaultLocaleOptions = $locales;
     }
     return $defaultLocaleOptions;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:21,代码来源:Localization.php

示例7: __construct

 /**
  * class constructor
  *
  * @return CRM_Core_Smarty
  * @access private
  */
 function __construct()
 {
     parent::__construct();
     $config =& CRM_Core_Config::singleton();
     if (isset($config->customTemplateDir) && $config->customTemplateDir) {
         $this->template_dir = array($config->customTemplateDir, $config->templateDir);
     } else {
         $this->template_dir = $config->templateDir;
     }
     $this->compile_dir = $config->templateCompileDir;
     //Check for safe mode CRM-2207
     if (ini_get('safe_mode')) {
         $this->use_sub_dirs = false;
     } else {
         $this->use_sub_dirs = true;
     }
     $this->plugins_dir = array($config->smartyDir . 'plugins', $config->pluginsDir);
     // add the session and the config here
     $session =& CRM_Core_Session::singleton();
     $this->assign_by_ref('config', $config);
     $this->assign_by_ref('session', $session);
     // check default editor and assign to template, store it in session to reduce db calls
     $defaultWysiwygEditor = $session->get('defaultWysiwygEditor');
     if (!$defaultWysiwygEditor && !CRM_Core_Config::isUpgradeMode()) {
         require_once 'CRM/Core/BAO/Preferences.php';
         $defaultWysiwygEditor = CRM_Core_BAO_Preferences::value('editor_id');
         $session->set('defaultWysiwygEditor', $defaultWysiwygEditor);
     }
     $this->assign('defaultWysiwygEditor', $defaultWysiwygEditor);
     global $tsLocale;
     $this->assign('langSwitch', CRM_Core_I18n::languages(true));
     $this->assign('tsLocale', $tsLocale);
     //check if logged in use has access CiviCRM permission and build menu
     require_once 'CRM/Core/Permission.php';
     $buildNavigation = CRM_Core_Permission::check('access CiviCRM');
     $this->assign('buildNavigation', $buildNavigation);
     if (!CRM_Core_Config::isUpgradeMode() && $buildNavigation) {
         require_once 'CRM/Core/BAO/Navigation.php';
         $contactID = $session->get('userID');
         if ($contactID) {
             $navigation =& CRM_Core_BAO_Navigation::createNavigation($contactID);
             $this->assign('navigation', $navigation);
         }
     }
     $this->register_function('crmURL', array('CRM_Utils_System', 'crmURL'));
     $printerFriendly = CRM_Utils_System::makeURL('snippet', false, false) . '2';
     $this->assign('printerFriendly', $printerFriendly);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:54,代码来源:Smarty.php

示例8: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     $config = CRM_Core_Config::singleton();
     $i18n = CRM_Core_I18n::singleton();
     CRM_Utils_System::setTitle(ts('Settings - Localization'));
     $locales = CRM_Core_I18n::languages();
     $warningTitle = json_encode(ts("Warning"));
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
     if ($domain->locales) {
         // for multi-lingual sites, populate default language drop-down with available languages
         $lcMessages = array();
         foreach ($locales as $loc => $lang) {
             if (substr_count($domain->locales, $loc)) {
                 $lcMessages[$loc] = $lang;
             }
         }
         $this->addElement('select', 'lcMessages', ts('Default Language'), $lcMessages);
         // add language limiter and language adder
         $this->addCheckBox('languageLimit', ts('Available Languages'), array_flip($lcMessages), NULL, NULL, NULL, NULL, '   ');
         $this->addElement('select', 'addLanguage', ts('Add Language'), array_merge(array('' => ts('- select -')), array_diff($locales, $lcMessages)));
         // add the ability to return to single language
         $warning = ts('This will make your CiviCRM installation a single-language one again. THIS WILL DELETE ALL DATA RELATED TO LANGUAGES OTHER THAN THE DEFAULT ONE SELECTED ABOVE (and only that language will be preserved).');
         $this->assign('warning', $warning);
         $warning = json_encode($warning);
         $this->addElement('checkbox', 'makeSinglelingual', ts('Return to Single Language'), NULL, array('onChange' => "if (this.checked) CRM.alert({$warning}, {$warningTitle})"));
     } else {
         // for single-lingual sites, populate default language drop-down with all languages
         $this->addElement('select', 'lcMessages', ts('Default Language'), $locales);
         $warning = ts('Enabling multiple languages changes the schema of your database, so make sure you know what you are doing when enabling this function; making a database backup is strongly recommended.');
         $this->assign('warning', $warning);
         $warning = json_encode($warning);
         $validTriggerPermission = CRM_Core_DAO::checkTriggerViewPermission(TRUE);
         if ($validTriggerPermission && !$config->logging) {
             $this->addElement('checkbox', 'makeMultilingual', ts('Enable Multiple Languages'), NULL, array('onChange' => "if (this.checked) CRM.alert({$warning}, {$warningTitle})"));
         }
     }
     $this->addElement('checkbox', 'inheritLocale', ts('Inherit CMS Language'));
     $this->addElement('text', 'monetaryThousandSeparator', ts('Thousands Separator'), array('size' => 2));
     $this->addElement('text', 'monetaryDecimalPoint', ts('Decimal Delimiter'), array('size' => 2));
     $this->addElement('text', 'moneyformat', ts('Monetary Amount Display'));
     $this->addElement('text', 'moneyvalueformat', ts('Monetary Value Display'));
     $country = array();
     CRM_Core_PseudoConstant::populate($country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active');
     $i18n->localizeArray($country, array('context' => 'country'));
     asort($country);
     $includeCountry =& $this->addElement('advmultiselect', 'countryLimit', ts('Available Countries') . ' ', $country, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
     $includeCountry->setButtonAttributes('add', array('value' => ts('Add >>')));
     $includeCountry->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $includeState =& $this->addElement('advmultiselect', 'provinceLimit', ts('Available States and Provinces') . ' ', $country, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
     $includeState->setButtonAttributes('add', array('value' => ts('Add >>')));
     $includeState->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $this->addElement('select', 'defaultContactCountry', ts('Default Country'), array('' => ts('- select -')) + $country);
     $this->addChainSelect('defaultContactStateProvince', array('label' => ts('Default State/Province')));
     // we do this only to initialize currencySymbols, kinda hackish but works!
     $config->defaultCurrencySymbol();
     $symbol = $config->currencySymbols;
     foreach ($symbol as $key => $value) {
         $this->_currencySymbols[$key] = "{$key}";
         if ($value) {
             $this->_currencySymbols[$key] .= " ({$value})";
         }
     }
     $this->addElement('select', 'defaultCurrency', ts('Default Currency'), $this->_currencySymbols);
     $includeCurrency =& $this->addElement('advmultiselect', 'currencyLimit', ts('Available Currencies') . ' ', $this->_currencySymbols, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
     $includeCurrency->setButtonAttributes('add', array('value' => ts('Add >>')));
     $includeCurrency->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $this->addElement('text', 'legacyEncoding', ts('Legacy Encoding'));
     $this->addElement('text', 'customTranslateFunction', ts('Custom Translate Function'));
     $this->addElement('text', 'fieldSeparator', ts('Import / Export Field Separator'), array('size' => 2));
     $this->addFormRule(array('CRM_Admin_Form_Setting_Localization', 'formRule'));
     parent::buildQuickForm();
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:78,代码来源:Localization.php

示例9: initialize

 private function initialize()
 {
     $config = CRM_Core_Config::singleton();
     if (isset($config->customTemplateDir) && $config->customTemplateDir) {
         $this->template_dir = array_merge(array($config->customTemplateDir), $config->templateDir);
     } else {
         $this->template_dir = $config->templateDir;
     }
     $this->compile_dir = $config->templateCompileDir;
     // check and ensure it is writable
     // else we sometime suppress errors quietly and this results
     // in blank emails etc
     if (!is_writable($this->compile_dir)) {
         echo "CiviCRM does not have permission to write temp files in {$this->compile_dir}, Exiting";
         exit;
     }
     //Check for safe mode CRM-2207
     if (ini_get('safe_mode')) {
         $this->use_sub_dirs = FALSE;
     } else {
         $this->use_sub_dirs = TRUE;
     }
     $customPluginsDir = NULL;
     if (isset($config->customPHPPathDir)) {
         $customPluginsDir = $config->customPHPPathDir . DIRECTORY_SEPARATOR . 'CRM' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR;
         if (!file_exists($customPluginsDir)) {
             $customPluginsDir = NULL;
         }
     }
     if ($customPluginsDir) {
         $this->plugins_dir = array($customPluginsDir, $config->smartyDir . 'plugins', $config->pluginsDir);
     } else {
         $this->plugins_dir = array($config->smartyDir . 'plugins', $config->pluginsDir);
     }
     // add the session and the config here
     $session = CRM_Core_Session::singleton();
     $this->assign_by_ref('config', $config);
     $this->assign_by_ref('session', $session);
     // check default editor and assign to template
     $defaultWysiwygEditor = $session->get('defaultWysiwygEditor');
     if (!$defaultWysiwygEditor && !CRM_Core_Config::isUpgradeMode()) {
         $defaultWysiwygEditor = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
         // For logged-in users, store it in session to reduce db calls
         if ($session->get('userID')) {
             $session->set('defaultWysiwygEditor', $defaultWysiwygEditor);
         }
     }
     $this->assign('defaultWysiwygEditor', $defaultWysiwygEditor);
     global $tsLocale;
     $this->assign('tsLocale', $tsLocale);
     // CRM-7163 hack: we don’t display langSwitch on upgrades anyway
     if (!CRM_Core_Config::isUpgradeMode()) {
         $this->assign('langSwitch', CRM_Core_I18n::languages(TRUE));
     }
     $this->register_function('crmURL', array('CRM_Utils_System', 'crmURL'));
     $this->load_filter('pre', 'resetExtScope');
     $this->assign('crmPermissions', new CRM_Core_Smarty_Permissions());
 }
开发者ID:kidaa30,项目名称:yes,代码行数:58,代码来源:Smarty.php

示例10: setCommunicationLanguage

 /**
  * @param $communication_language
  * @param $preferred_language
  */
 public static function setCommunicationLanguage($communication_language, $preferred_language)
 {
     $config = CRM_Core_Config::singleton();
     $language = $config->lcMessages;
     // prepare the language for the email
     if ($communication_language == CRM_Core_I18n::AUTO) {
         if (!empty($preferred_language)) {
             $language = $preferred_language;
         }
     } else {
         $language = $communication_language;
     }
     // language not in the existing language, use default
     $languages = CRM_Core_I18n::languages(TRUE);
     if (!in_array($language, $languages)) {
         $language = $config->lcMessages;
     }
     // change the language
     $i18n = CRM_Core_I18n::singleton();
     $i18n->setLanguage($language);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:25,代码来源:ActionSchedule.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();
     }
     $reportIds = array();
     $reportTypes = array('detail', 'opened', 'bounce', 'clicks');
     foreach ($reportTypes as $report) {
         $result = civicrm_api3('ReportInstance', 'get', array('sequential' => 1, 'report_id' => 'mailing/' . $report));
         $reportIds[$report] = $result['values'][0]['id'];
     }
     $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')), 'domain_id' => CRM_Core_Config::domainID(), '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()));
     $enabledLanguages = CRM_Core_I18n::languages(TRUE);
     $isMultiLingual = count($enabledLanguages) > 1;
     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) Civi::settings()->get('replyTo'), 'disableMandatoryTokensCheck' => (int) Civi::settings()->get('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(), 'reportIds' => $reportIds, 'enabledLanguages' => $enabledLanguages, 'isMultiLingual' => $isMultiLingual)))->addPermissions(array('view all contacts', 'edit all contacts', 'access CiviMail', 'create mailings', 'schedule mailings', 'approve mailings', 'delete in CiviMail', 'edit message templates'));
     return $result;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:42,代码来源:Info.php

示例12: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     $config =& CRM_Core_Config::singleton();
     $i18n =& CRM_Core_I18n::singleton();
     CRM_Utils_System::setTitle(ts('Settings - Localization'));
     $locales =& CRM_Core_I18n::languages();
     $domain =& new CRM_Core_DAO_Domain();
     $domain->find(true);
     if ($domain->locales) {
         // for multi-lingual sites, populate default language drop-down with available languages
         $lcMessages = array();
         foreach ($locales as $loc => $lang) {
             if (substr_count($domain->locales, $loc)) {
                 $lcMessages[$loc] = $lang;
             }
         }
         $this->addElement('select', 'lcMessages', ts('Default Language'), $lcMessages);
         // add language limiter and language adder
         $this->addCheckBox('languageLimit', ts('Available Languages'), array_flip($lcMessages), null, null, null, null, ' &nbsp; ');
         $this->addElement('select', 'addLanguage', ts('Add Language'), array_merge(array('' => ts('- select -')), array_diff($locales, $lcMessages)));
         // add the ability to return to single language
         $warning = ts('WARNING: This will make your CiviCRM installation a single-language one again. THIS WILL DELETE ALL DATA RELATED TO LANGUAGES OTHER THAN THE DEFAULT ONE SELECTED ABOVE (and only that language will be preserved).');
         $this->assign('warning', $warning);
         $this->addElement('checkbox', 'makeSinglelingual', ts('Return to Single Language'), null, array('onChange' => "if (this.checked) alert('{$warning}')"));
     } else {
         // for single-lingual sites, populate default language drop-down with all languages
         $this->addElement('select', 'lcMessages', ts('Default Language'), $locales);
         $warning = ts('WARNING: As of CiviCRM 3.0, this is still an experimental functionality. Enabling multiple languages irreversibly changes the schema of your database, so make sure you know what you are doing when enabling this function; making a database backup is strongly recommended.');
         $this->assign('warning', $warning);
         // test for create view and trigger permissions and if allowed, add the option to go multilingual
         CRM_Core_Error::ignoreException();
         $dao = new CRM_Core_DAO();
         $dao->query('CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain');
         $dao->query('CREATE TRIGGER civicrm_domain_trigger BEFORE INSERT ON civicrm_domain FOR EACH ROW BEGIN END');
         $dao->query('DROP TRIGGER IF EXISTS civicrm_domain_trigger');
         $dao->query('DROP VIEW IF EXISTS civicrm_domain_view');
         CRM_Core_Error::setCallback();
         if (!$dao->_lastError) {
             $this->addElement('checkbox', 'makeMultilingual', ts('Enable Multiple Languages'), null, array('onChange' => "if (this.checked) alert('{$warning}')"));
         }
     }
     $this->addElement('select', 'lcMonetary', ts('Monetary Locale'), $locales);
     $this->addElement('text', 'moneyformat', ts('Monetary Amount Display'));
     $this->addElement('text', 'moneyvalueformat', ts('Monetary Value Display'));
     $country = array();
     CRM_Core_PseudoConstant::populate($country, 'CRM_Core_DAO_Country', true, 'name', 'is_active');
     $i18n->localizeArray($country);
     asort($country);
     $includeCountry =& $this->addElement('advmultiselect', 'countryLimit', ts('Available Countries') . ' ', $country, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
     $includeCountry->setButtonAttributes('add', array('value' => ts('Add >>')));
     $includeCountry->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $includeState =& $this->addElement('advmultiselect', 'provinceLimit', ts('Available States and Provinces') . ' ', $country, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
     $includeState->setButtonAttributes('add', array('value' => ts('Add >>')));
     $includeState->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $this->addElement('select', 'defaultContactCountry', ts('Default Country'), array('' => ts('- select -')) + $country);
     // we do this only to initialize currencySymbols, kinda hackish but works!
     $config->defaultCurrencySymbol();
     $symbol = $config->currencySymbols;
     foreach ($symbol as $key => $value) {
         $currencySymbols[$key] = "{$key}";
         if ($value) {
             $currencySymbols[$key] .= " ({$value})";
         }
     }
     $this->addElement('select', 'defaultCurrency', ts('Default Currency'), $currencySymbols);
     $this->addElement('text', 'legacyEncoding', ts('Legacy Encoding'));
     $this->addElement('text', 'customTranslateFunction', ts('Custom Translate Function'));
     $this->addElement('text', 'fieldSeparator', ts('Import / Export Field Separator'), array('size' => 2));
     $this->addFormRule(array('CRM_Admin_Form_Setting_Localization', 'formRule'));
     parent::buildQuickForm();
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:77,代码来源:Localization.php

示例13: setCommunicationLanguage

 /**
  * @param $communication_language
  * @param $preferred_language
  */
 public static function setCommunicationLanguage($communication_language, $preferred_language)
 {
     $currentLocale = CRM_Core_I18n::getLocale();
     $language = $currentLocale;
     // prepare the language for the email
     if ($communication_language == CRM_Core_I18n::AUTO) {
         if (!empty($preferred_language)) {
             $language = $preferred_language;
         }
     } else {
         $language = $communication_language;
     }
     // language not in the existing language, use default
     $languages = CRM_Core_I18n::languages(TRUE);
     if (!array_key_exists($language, $languages)) {
         $language = $currentLocale;
     }
     // change the language
     $i18n = CRM_Core_I18n::singleton();
     $i18n->setLocale($language);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:25,代码来源:ActionSchedule.php


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