本文整理汇总了PHP中ts函数的典型用法代码示例。如果您正苦于以下问题:PHP ts函数的具体用法?PHP ts怎么用?PHP ts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$multipleCustomData = CRM_Core_BAO_CustomGroup::getMultipleFieldGroup();
$this->add('select', 'multipleCustomData', ts('Multi-value Custom Data'), array('' => ts('- select -')) + $multipleCustomData, TRUE);
$this->addContactTypeSelector();
}
示例2: array
/**
* Get action Links
*
* @return array (reference) of action links
*/
function &links()
{
if (!self::$_links) {
self::$_links = array(CRM_Core_Action::BROWSE => array('name' => ts('Accounts'), 'url' => 'civicrm/admin/financial/financialType/accounts', 'qs' => 'reset=1&action=browse&aid=%%id%%', 'title' => ts('Accounts')), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/financial/financialType', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Financial Type')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Financial_BAO_FinancialType' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Financial Type')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Financial_BAO_FinancialType' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Financial Type')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/financial/financialType', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Financial Type')));
}
return self::$_links;
}
示例3: buildQuickForm
/**
* Build the form - it consists of
* - displaying the QILL (query in local language)
* - displaying elements for saving the search
*
* @access public
* @return void
*/
function buildQuickForm()
{
//
// just need to add a javacript to popup the window for printing
//
$this->addButtons(array(array('type' => 'next', 'name' => ts('Print Pledge List'), 'js' => array('onclick' => 'window.print()'), 'isDefault' => true), array('type' => 'back', 'name' => ts('Done'))));
}
示例4: civicrm_api3_membership_status_update
/**
* Update an existing membership status.
*
* This api is used for updating an existing membership status.
* Required parameters: id of a membership status
*
* @param array $params
* Array of name/value property values of civicrm_membership_status.
*
* @deprecated - should just use create
*
* @return array
* Array of updated membership status property values
*/
function civicrm_api3_membership_status_update($params)
{
civicrm_api3_verify_mandatory($params, NULL, array('id'));
//don't allow duplicate names.
$name = CRM_Utils_Array::value('name', $params);
if ($name) {
$status = new CRM_Member_DAO_MembershipStatus();
$status->name = $params['name'];
if ($status->find(TRUE) && $status->id != $params['id']) {
return civicrm_api3_create_error(ts('A membership status with this name already exists.'));
}
}
$membershipStatusBAO = new CRM_Member_BAO_MembershipStatus();
$membershipStatusBAO->id = $params['id'];
if ($membershipStatusBAO->find(TRUE)) {
$fields = $membershipStatusBAO->fields();
foreach ($fields as $name => $field) {
if (array_key_exists($name, $params)) {
$membershipStatusBAO->{$name} = $params[$name];
}
}
$membershipStatusBAO->save();
}
$membershipStatus = array();
_civicrm_api3_object_to_array(clone $membershipStatusBAO, $membershipStatus);
$membershipStatus['is_error'] = 0;
return $membershipStatus;
}
示例5: run
function run()
{
$upgrade = new CRM_Upgrade_Form();
$message = ts('CiviCRM upgrade successful');
if ($upgrade->checkVersion($upgrade->latestVersion)) {
$message = ts('Your database has already been upgraded to CiviCRM %1', array(1 => $upgrade->latestVersion));
} elseif ($upgrade->checkVersion('2.1.2') || $upgrade->checkVersion('2.1.3') || $upgrade->checkVersion('2.1.4') || $upgrade->checkVersion('2.1.5')) {
// do nothing, db version is changed for all upgrades
} elseif ($upgrade->checkVersion('2.1.0') || $upgrade->checkVersion('2.1') || $upgrade->checkVersion('2.1.1')) {
// 2.1 to 2.1.2
$this->runTwoOneTwo();
} else {
// 2.0 to 2.1
for ($i = 1; $i <= 4; $i++) {
$this->runForm($i);
}
// 2.1 to 2.1.2
$this->runTwoOneTwo();
}
// just change the ver in the db, since nothing to upgrade
$upgrade->setVersion($upgrade->latestVersion);
// also cleanup the templates_c directory
$config = CRM_Core_Config::singleton();
$config->cleanup(1);
$template = CRM_Core_Smarty::singleton();
$template->assign('message', $message);
$template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $upgrade->latestVersion)));
$template->assign('menuRebuildURL', CRM_Utils_System::url('civicrm/menu/rebuild', 'reset=1'));
$contents = $template->fetch('CRM/common/success.tpl');
echo $contents;
}
示例6: buildQuickForm
/**
* build the form elements for an email object
*
* @return void
* @access public
*/
public function buildQuickForm()
{
CRM_Contact_Form_Edit_CommunicationPreferences::buildQuickForm($this);
$this->addFormRule(array('CRM_Contact_Form_Edit_CommunicationPreferences', 'formRule'), $this);
$buttons = array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
$this->addButtons($buttons);
}
示例7: array
/**
* Get action Links
*
* @return array (reference) of action links
*/
function &links()
{
if (!self::$_links) {
self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/paymentProcessorType', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Payment ProcessorType')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable Payment ProcessorType')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable Payment ProcessorType')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/paymentProcessorType', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Payment ProcessorType')));
}
return self::$_links;
}
示例8: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
CRM_Utils_System::setTitle(ts('Add Contacts to Organization'));
$this->addElement('text', 'name', ts('Find Target Organization'));
$this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getRelationType("Organization"), TRUE);
$searchRows = $this->get('searchRows');
$searchCount = $this->get('searchCount');
if ($searchRows) {
$checkBoxes = array();
$chekFlag = 0;
foreach ($searchRows as $id => $row) {
if (!$chekFlag) {
$chekFlag = $id;
}
$checkBoxes[$id] = $this->createElement('radio', NULL, NULL, NULL, $id);
}
$this->addGroup($checkBoxes, 'contact_check');
if ($chekFlag) {
$checkBoxes[$chekFlag]->setChecked(TRUE);
}
$this->assign('searchRows', $searchRows);
}
$this->assign('searchCount', $searchCount);
$this->assign('searchDone', $this->get('searchDone'));
$this->assign('contact_type_display', ts('Organization'));
$this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), array('class' => 'crm-form-submit'));
$this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'crm-form-submit'));
$this->addButtons(array(array('type' => 'next', 'name' => ts('Add to Organization'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例9: addRelationships
/**
* Add relationships from form.
*/
public function addRelationships()
{
if (!is_array($this->_contactIds)) {
// Could this really happen?
return;
}
$relationshipTypeParts = explode('_', $this->params['relationship_type_id']);
$params = array('relationship_type_id' => $relationshipTypeParts[0], 'is_active' => 1);
$secondaryRelationshipSide = $relationshipTypeParts[1];
$primaryRelationshipSide = $relationshipTypeParts[2];
$primaryFieldName = 'contact_id_' . $primaryRelationshipSide;
$secondaryFieldName = 'contact_id_' . $secondaryRelationshipSide;
$relationshipLabel = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $params['relationship_type_id'], "label_{$secondaryRelationshipSide}_{$primaryRelationshipSide}");
$params[$secondaryFieldName] = $this->_contactIds;
$params[$primaryFieldName] = $this->params['contact_check'];
$outcome = CRM_Contact_BAO_Relationship::createMultiple($params, $primaryRelationshipSide);
$relatedContactName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$primaryFieldName], 'display_name');
$status = array(ts('%count %2 %3 relationship created', array('count' => $outcome['valid'], 'plural' => '%count %2 %3 relationships created', 2 => $relationshipLabel, 3 => $relatedContactName)));
if ($outcome['duplicate']) {
$status[] = ts('%count was skipped because the contact is already %2 %3', array('count' => $outcome['duplicate'], 'plural' => '%count were skipped because the contacts are already %2 %3', 2 => $relationshipLabel, 3 => $relatedContactName));
}
if ($outcome['invalid']) {
$status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array('count' => $outcome['invalid'], 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship'));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts('Relationship created.', array('count' => $outcome['valid'], 'plural' => 'Relationships created.')), 'success', array('expires' => 0));
}
示例10: array
/**
* Get action Links
*
* @return array (reference) of action links
*/
function &links()
{
if (!self::$_links) {
self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=update&id=%%id%%', 'title' => ts('Edit Mailing Component')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Mailing_BAO_Component' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Mailing Component')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Mailing_BAO_Component' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Mailing Component')));
}
return self::$_links;
}
示例11: run
public function run()
{
$eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, TRUE);
$fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, NULL, $quest);
if (!$path) {
CRM_Core_Error::statusBounce('Could not retrieve the file');
}
$buffer = file_get_contents($path);
if (!$buffer) {
CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
}
if ($action & CRM_Core_Action::DELETE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
CRM_Core_BAO_File::deleteFileReferences($id, $eid, $fid);
CRM_Core_Session::setStatus(ts('The attached file has been deleted.'), ts('Complete'), 'success');
$session = CRM_Core_Session::singleton();
$toUrl = $session->popUserContext();
CRM_Utils_System::redirect($toUrl);
}
} else {
CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
}
}
示例12: array
/**
* Get action Links
*
* @return array (reference) of action links
*/
function &links()
{
if (!self::$_links) {
self::$_links = array(CRM_Core_Action::BROWSE => array('name' => ts('Multiple Choice Options'), 'url' => 'civicrm/admin/optionValue', 'qs' => 'reset=1&action=browse&gid=%%id%%', 'title' => ts('View and Edit Multiple Choice Options')), CRM_Core_Action::UPDATE => array('name' => ts('Edit Group'), 'url' => 'civicrm/admin/optionGroup', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Option')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionGroup' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Option')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionGroup' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Option')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/optionGroup', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Option')));
}
return self::$_links;
}
示例13: run
function run()
{
$sql = "SELECT * FROM civicrm_metrics_server ORDER BY site_name, timestamp";
$dao =& CRM_Core_DAO::executeQuery($sql);
$rows = array();
while ($dao->fetch()) {
$row = array();
$row['id'] = $dao->id;
$row['site_name'] = $dao->site_name;
$row['site_url'] = $dao->site_url;
$row['timestamp'] = $dao->timestamp;
$row['type'] = $dao->type;
$row['data'] = $dao->data;
$rows[] = $row;
}
if (array_key_exists("export", $_REQUEST) && $_REQUEST['export'] == 'csv') {
header('Content-type: text/csv');
header('Content-disposition: attachment;filename=metrics_data_' . date("Ymd_HiO") . '.csv');
$output = fopen('php://output', 'w');
$headers = array("Id", "Site Name", "Site URL", "Timestamp", "Metric Type", "Metric Data");
fputcsv($output, $headers);
foreach ($rows as $row) {
fputcsv($output, $row);
}
fclose($output);
die;
} else {
CRM_Utils_System::setTitle(ts('Metrics Report'));
$this->assign('data', $rows);
$this->assign('headers', array_keys($rows[0]));
parent::run();
}
}
示例14: _validateParams
/**
* Function to validate parameters
*
* @param array $params
* @return string $errorMessage
*/
function _validateParams($params)
{
$errorMessage = '';
if (!isset($params['id']) && empty($params['label'])) {
return ts('Label can not be empty when adding a new CiviRule Trigger');
}
if (_checkClassNameObjectNameOperation($params) == FALSE) {
return ts('Either class_name or a combination of object_name and op is mandatory');
}
if (isset($params['cron']) && $params['cron'] == 1) {
$params['object_name'] = null;
$params['op'] = null;
if (!isset($params['class_name']) || empty($params['class_name'])) {
return ts('For a cron type trigger the class_name is mandatory');
}
}
if (isset($params['object_name']) && !empty($params['object_name'])) {
$extensionConfig = CRM_Civirules_Config::singleton();
if (!in_array($params['object_name'], $extensionConfig->getValidTriggerObjectNames())) {
return ts('ObjectName passed in parameters (' . $params['object_name'] . ')is not a valid object for a CiviRule Trigger');
}
}
if (isset($params['op']) && !empty($params['op'])) {
$extensionConfig = CRM_Civirules_Config::singleton();
if (!in_array($params['op'], $extensionConfig->getValidTriggerOperations())) {
return ts('Operation passed in parameters (' . $params['op'] . ')is not a valid operation for a CiviRule Trigger');
}
}
if (CRM_Civirules_BAO_Trigger::triggerExists($params) == TRUE) {
return ts('There is already a trigger for this class_name or combination of object_name and op');
}
return $errorMessage;
}
示例15: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
// Make sure case types have been configured for the component
require_once 'CRM/Core/OptionGroup.php';
$caseType = CRM_Core_OptionGroup::values('case_type');
if (empty($caseType)) {
$this->assign('notConfigured', 1);
return;
}
$session =& CRM_Core_Session::singleton();
$allCases = CRM_Utils_Request::retrieve('all', 'Positive', $session);
CRM_Utils_System::setTitle(ts('CiviCase Dashboard'));
$userID = $session->get('userID');
if (!$allCases) {
$this->assign('myCases', true);
} else {
$this->assign('myCases', false);
}
$this->assign('newClient', false);
if (CRM_Core_Permission::check('add contacts')) {
$this->assign('newClient', true);
}
require_once 'CRM/Case/BAO/Case.php';
$summary = CRM_Case_BAO_Case::getCasesSummary($allCases, $userID);
$upcoming = CRM_Case_BAO_Case::getCases($allCases, $userID, 'upcoming');
$recent = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent');
$this->assign('casesSummary', $summary);
if (!empty($upcoming)) {
$this->assign('upcomingCases', $upcoming);
}
if (!empty($recent)) {
$this->assign('recentCases', $recent);
}
}