2014-02-15 23:30:30 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'fancytokens.civix.php';
|
|
|
|
|
|
|
|
|
|
|
|
function fancytokens_civicrm_tokens( &$tokens ){
|
2014-09-01 23:51:04 +02:00
|
|
|
$tokens['communitynews'] = array(
|
2014-11-12 06:35:39 +01:00
|
|
|
'communitynews.upcomingevents___day_7' => 'Events in the next 7 days :: Events',
|
|
|
|
'communitynews.upcomingevents___day_14' => 'Events in the next 14 days :: Events',
|
|
|
|
'communitynews.upcomingevents___day_30' => 'Events in the next 30 days :: Events',
|
|
|
|
'communitynews.upcomingevents___week_3' => 'Events in the next 3 weeks :: Events',
|
|
|
|
'communitynews.upcomingevents___month_3' => 'Events in the next 3 months :: Events',
|
2014-09-01 23:51:04 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create tokens for the next x events that allow online registration
|
|
|
|
$event_sql = "select e.id, e.title, date(e.start_date) as start_date FROM civicrm_event e
|
|
|
|
WHERE e.start_date >= now() and e.is_active =1 AND e.is_online_registration = 1
|
|
|
|
AND e.is_template <> 1
|
|
|
|
AND ( e.registration_end_date is null || now() <= e.registration_end_date )
|
|
|
|
AND ( e.registration_start_date is null || now() >= e.registration_start_date )
|
|
|
|
ORDER BY e.start_date
|
|
|
|
LIMIT 15 ";
|
|
|
|
|
|
|
|
$dao =& CRM_Core_DAO::executeQuery( $event_sql, CRM_Core_DAO::$_nullArray ) ;
|
|
|
|
|
|
|
|
while($dao->fetch()){
|
|
|
|
$e_id = $dao->id;
|
|
|
|
$e_title = $dao->title;
|
|
|
|
$e_start_date = $dao->start_date;
|
Update 'fancytokens.php'
Changed format of date and texts
Résumé des changements
31: $e_start_date = $dao->start_date;
32: - $label = 'Registration Page: '.$e_title.' on '.$e_start_date.' (id: '.$e_id.') :: Events';
33: + $label = 'Registration Page: '.$e_title.' '.$e_start_date.' (id: '.$e_id.') :: Events';
34: $key = 'communitynews.event_registrationpage___'.$e_id ;
502: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
503: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
504: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
505: if( e.is_online_registration = 1 AND
553: }
554: - $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> on ".
555: + $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> ".
556: $e_start_date.$register_html.$summary_html;
576: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
577: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
578: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
579: if( e.is_online_registration = 1 AND
627: }
628: - $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." on ".
629: + $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." ".
630: $e_start_date.$register_html.$summary_html;
2019-10-30 09:33:15 +01:00
|
|
|
$label = 'Registration Page: '.$e_title.' '.$e_start_date.' (id: '.$e_id.') :: Events';
|
2014-09-01 23:51:04 +02:00
|
|
|
$key = 'communitynews.event_registrationpage___'.$e_id ;
|
|
|
|
|
|
|
|
$tokens['communitynews'][$key] = $label;
|
|
|
|
}
|
|
|
|
$dao->free();
|
|
|
|
|
2014-02-15 23:30:30 +01:00
|
|
|
|
2014-09-01 23:51:04 +02:00
|
|
|
// Create tokens for all active Contribution Pages
|
2014-02-15 23:30:30 +01:00
|
|
|
$params = array(
|
|
|
|
'version' => 3,
|
|
|
|
'sequential' => 1,
|
|
|
|
'is_active' => 1,
|
|
|
|
);
|
|
|
|
$result = civicrm_api('ContributionPage', 'get', $params);
|
|
|
|
if( $result['is_error'] <> 0 ){
|
|
|
|
print "<br><br>Error calling get API for ContributionPage";
|
|
|
|
print_r($result);
|
|
|
|
}else{
|
|
|
|
$contrib_pages = $result['values'] ;
|
|
|
|
foreach($contrib_pages as $cur){
|
|
|
|
|
|
|
|
$key = 'communitynews.contributionpage___'.$cur['id'] ;
|
2014-11-12 06:35:39 +01:00
|
|
|
$label = $cur['title'].' (id: '.$cur['id'].') :: Contribution Pages';
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
$tokens['communitynews'][$key] = $label;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 12:00:29 +02:00
|
|
|
// Create tokens for all active Petitions ( part of CiviCampaign)
|
|
|
|
$params = array(
|
|
|
|
'sequential' => 1,
|
|
|
|
'is_active' => 1,
|
|
|
|
'activity_type_id.name' => 'Petition',
|
|
|
|
);
|
|
|
|
$result = civicrm_api3('Survey', 'get', $params);
|
|
|
|
if( $result['is_error'] <> 0 ){
|
|
|
|
print "<br><br>Error calling get API for Survey-Petition";
|
|
|
|
print_r($result);
|
|
|
|
}else{
|
|
|
|
$petitions = $result['values'] ;
|
|
|
|
foreach($petitions as $cur){
|
|
|
|
|
|
|
|
$key = 'communitynews.signpetition___'.$cur['id'] ;
|
|
|
|
$label = $cur['title'].' (id: '.$cur['id'].') :: Petitions';
|
|
|
|
|
|
|
|
$tokens['communitynews'][$key] = $label;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-15 23:30:30 +01:00
|
|
|
|
2014-09-01 23:51:04 +02:00
|
|
|
// Get all active profiles and create tokens for the ones that can be stand-alone.
|
2014-02-15 23:30:30 +01:00
|
|
|
$params = array(
|
|
|
|
'version' => 3,
|
|
|
|
'sequential' => 1,
|
|
|
|
'is_active' => 1,
|
|
|
|
'options' => array( 'limit' => 100),
|
|
|
|
);
|
|
|
|
$result = civicrm_api('UFGroup', 'get', $params);
|
|
|
|
|
|
|
|
if( $result['is_error'] <> 0 ){
|
|
|
|
print "<br><br>Error calling get API for UFGroup (aka Profiles)";
|
|
|
|
print_r($result);
|
|
|
|
}else{
|
|
|
|
$standalone_profiles = $result['values'] ;
|
|
|
|
foreach($standalone_profiles as $cur){
|
|
|
|
|
2014-09-02 00:05:43 +02:00
|
|
|
$p_type = "";
|
|
|
|
if( isset( $cur['group_type'])){
|
|
|
|
$p_type = $cur['group_type'];
|
2016-05-20 06:10:22 +02:00
|
|
|
// Some group_types are arrays, if the profile is used on an event form
|
|
|
|
$p_type = is_array($p_type) ? $p_type[0] : $p_type;
|
|
|
|
|
|
|
|
$type_array = explode( "," , $p_type); // Contributions Activity
|
|
|
|
if ( false == ( in_array("Participant", $type_array ) || in_array("Membership", $type_array ) || in_array("Household", $type_array ) || in_array("Contributions", $type_array ) || in_array("Activity", $type_array ) )) {
|
2014-02-15 23:30:30 +01:00
|
|
|
|
2016-05-20 06:10:22 +02:00
|
|
|
$key = 'communitynews.standaloneprofile___'.$cur['id'] ;
|
|
|
|
$label = $cur['title'].' (id: '.$cur['id'].') :: Forms';
|
2014-02-15 23:30:30 +01:00
|
|
|
|
2016-05-20 06:10:22 +02:00
|
|
|
$tokens['communitynews'][$key] = $label;
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
|
2016-05-20 06:10:22 +02:00
|
|
|
}
|
2014-02-15 23:30:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-09-04 00:53:46 +02:00
|
|
|
// Check if this is Drupal, and if so check if the 'WebForm CiviCRM' module is installed.
|
|
|
|
// Then generate tokens for each published Drupal WebForm that uses CiviCRM integration.
|
|
|
|
$config = CRM_Core_Config::singleton();
|
|
|
|
//print "<br><br>";
|
|
|
|
//print_r($config);
|
|
|
|
if ($config->userSystem->is_drupal){
|
2015-11-21 21:06:00 +01:00
|
|
|
if (function_exists("module_exists") && module_exists("webform_civicrm")) {
|
2014-09-04 00:53:46 +02:00
|
|
|
|
2015-11-21 20:20:29 +01:00
|
|
|
//$drupal_db = getUserFrameworkDatabaseName();
|
|
|
|
//$sql = "SELECT cforms.nid, node.title FROM $drupal_db.webform_civicrm_forms cforms
|
|
|
|
// JOIN $drupal_db.node ON cforms.nid = node.nid AND node.status = 1 ";
|
2014-09-04 00:53:46 +02:00
|
|
|
|
2015-11-21 20:20:29 +01:00
|
|
|
$dsql = "SELECT cforms.nid, node.title FROM {webform_civicrm_forms} cforms
|
|
|
|
JOIN {node} node ON cforms.nid = node.nid AND node.status = 1 ";
|
2014-09-04 00:53:46 +02:00
|
|
|
|
2015-11-21 20:20:29 +01:00
|
|
|
$dq_result = db_query( $dsql );
|
|
|
|
|
|
|
|
foreach ($dq_result as $record) {
|
|
|
|
$nid = $record->nid;
|
|
|
|
$title = $record->title;
|
|
|
|
|
|
|
|
$key = 'communitynews.dwform___'.$nid ;
|
|
|
|
$label = "$title (nid: $nid) :: Forms";
|
|
|
|
|
|
|
|
$tokens['communitynews'][$key] = $label;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-04 00:53:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-02-15 23:30:30 +01:00
|
|
|
|
2016-08-26 15:29:35 +02:00
|
|
|
|
2016-08-26 15:49:51 +02:00
|
|
|
$tok_category_label = " :: Greetings";
|
2016-08-26 15:29:35 +02:00
|
|
|
|
|
|
|
$tokens['greetings'] = array(
|
|
|
|
'greetings.joint_casual' => 'Casual: Mike and Judy Kline (Uses nickname if available) '.$tok_category_label,
|
|
|
|
'greetings.solo_casual' => 'Casual: Mike Kline (Uses nickname if available, does not show spouse) '.$tok_category_label,
|
|
|
|
'greetings.joint_casual_firstname_lastname' => 'Casual first name and last name: Michael and Judith Kline'.$tok_category_label,
|
|
|
|
'greetings.joint_casual_nickname_only' => 'Casual nickname only: Mike and Judy (Uses nickname if available)'.$tok_category_label,
|
|
|
|
'greetings.solo_casual_nickname_only' => 'Casual nickname only: Mike(Uses nickname if available, does not show spouse)'.$tok_category_label,
|
|
|
|
'greetings.joint_casual_firstname_only' => 'Casual first name only: Michael and Judith'.$tok_category_label,
|
|
|
|
'greetings.joint_formal' => 'Formal: Mr. and Mrs. Kline'.$tok_category_label,
|
|
|
|
'greetings.joint_formal_firstname' => 'Formal with first name: Mr. and Mrs. Michael Kline'.$tok_category_label,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2016-09-05 21:08:57 +02:00
|
|
|
$tok_category_label = " :: Dates";
|
|
|
|
|
|
|
|
$tokens['dates'] = array(
|
|
|
|
'dates.today' => 'Today (m/d/yyyy)'.$tok_category_label,
|
|
|
|
'dates.today___j_F_yyyy' => 'Today (d monthname yyyy)'.$tok_category_label,
|
|
|
|
'dates.today___F_j_yyyy' => 'Today (monthname d, yyyy)'.$tok_category_label,
|
|
|
|
'dates.birth_date___F_j' => 'Birth Date (monthname d)'.$tok_category_label,
|
2019-05-28 10:36:29 +02:00
|
|
|
'dates.checksum_expiration' => 'Checksum Expiration Date '.$tok_category_label,
|
2016-09-05 21:08:57 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$tok_category_label = " :: Communication";
|
|
|
|
$tokens['communication'] = array(
|
|
|
|
'communication.phone_all' => 'All Phone Numbers'.$tok_category_label,
|
|
|
|
'communication.email_all' => 'All Email Addresses'.$tok_category_label,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-04 00:53:46 +02:00
|
|
|
}
|
2016-08-26 15:29:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-15 23:30:30 +01:00
|
|
|
|
2014-09-04 00:53:46 +02:00
|
|
|
function getUserFrameworkDatabaseName(){
|
2014-11-12 06:35:39 +01:00
|
|
|
// ['userFrameworkDSN'] => mysql://dev1_username:mypassword@localhost/dev1_main?new_link=true
|
2014-09-04 00:53:46 +02:00
|
|
|
|
|
|
|
$cms_db_name = "";
|
|
|
|
$config = CRM_Core_Config::singleton();
|
|
|
|
$cms_dsn_str = $config->userFrameworkDSN ;
|
|
|
|
|
|
|
|
$cms_tmp1 = explode( '@', $cms_dsn_str) ;
|
|
|
|
$cms_tmp2 = explode( '/', $cms_tmp1[1]);
|
|
|
|
$cms_tmp3 = explode( '?', $cms_tmp2[1]);
|
|
|
|
|
|
|
|
//print "<br><br>".$cms_tmp2[1];
|
|
|
|
if( strlen($cms_tmp3[0]) > 0){
|
|
|
|
$cms_db_name = $cms_tmp3[0];
|
|
|
|
}
|
|
|
|
return $cms_tmp3[0];
|
|
|
|
}
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
function fancytokens_civicrm_tokenValues( &$values, &$contactIDs, $job = null, $tokens = array(), $context = null) {
|
2016-04-02 19:15:00 +02:00
|
|
|
|
|
|
|
|
2016-09-05 21:08:57 +02:00
|
|
|
|
|
|
|
if(!empty($tokens['dates'])){
|
|
|
|
// deal with tokens for 'today', birth_date', and similar.
|
|
|
|
|
|
|
|
$today = date_create();
|
|
|
|
|
2019-05-28 10:39:35 +02:00
|
|
|
$checksum_expire_result = civicrm_api3('Setting', 'get', [ 'sequential' => 1, 'return' => ["checksum_timeout"], ]);
|
|
|
|
$checksum_expire_date_tmp = "" ;
|
|
|
|
|
2019-05-28 10:36:29 +02:00
|
|
|
if ($checksum_expire_result['is_error'] == 0 && $checksum_expire_result['count'] == 1){
|
|
|
|
$tmp_checksum_int = $checksum_expire_result['values'][0]['checksum_timeout'];
|
|
|
|
$interval_str = $tmp_checksum_int." days" ;
|
|
|
|
$exp_date = date_create();
|
|
|
|
date_add($exp_date, date_interval_create_from_date_string($interval_str));
|
|
|
|
$checksum_expire_date_tmp = date_format($exp_date, 'F j');
|
|
|
|
}else{
|
|
|
|
|
|
|
|
# print_r( $checksum_expire_result );
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ( $contactIDs as $cid ) {
|
|
|
|
$values[$cid]['dates.today'] = date("n/j/Y");
|
|
|
|
$values[$cid]['dates.today___j_F_yyyy'] = date("j F Y");
|
|
|
|
$values[$cid]['dates.today___F_j_yyyy'] = date("F j, Y");
|
|
|
|
$values[$cid]['dates.checksum_expiration'] = $checksum_expire_date_tmp ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-09-05 21:08:57 +02:00
|
|
|
$birthday_token = 'dates.birth_date___F_j' ;
|
|
|
|
|
|
|
|
|
|
|
|
while( $cur_token_raw = current( $tokens['dates'] )){
|
|
|
|
|
|
|
|
$tmp_key = key($tokens['dates']);
|
|
|
|
$cur_token = '';
|
|
|
|
if( is_numeric( $tmp_key)){
|
|
|
|
$cur_token = $cur_token_raw;
|
|
|
|
}else{
|
|
|
|
// Its being used by CiviMail.
|
|
|
|
$cur_token = $tmp_key;
|
|
|
|
}
|
|
|
|
|
|
|
|
$token_to_fill = 'dates.'.$cur_token;
|
|
|
|
|
|
|
|
if($token_to_fill == $birthday_token ){
|
|
|
|
|
|
|
|
$sql_cids = implode( ",", $contactIDs);
|
|
|
|
|
|
|
|
if( strlen( $sql_cids) > 0 ){
|
|
|
|
$sql = "select c.id as contact_id, date_format( c.birth_date, '%M %e') as birth_date
|
|
|
|
FROM civicrm_contact c
|
|
|
|
WHERE c.id IN ( ".$sql_cids." )
|
|
|
|
ORDER BY c.id" ;
|
|
|
|
$dao =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray ) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while($dao->fetch()){
|
|
|
|
$cid = $dao->contact_id ;
|
|
|
|
$birth_date_formatted = $dao->birth_date;
|
|
|
|
|
|
|
|
$values[$cid][$birthday_token] = $birth_date_formatted ;
|
|
|
|
}
|
|
|
|
|
|
|
|
$dao->free();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
next($tokens['dates']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!empty($tokens['communication'] )){
|
|
|
|
$phone_token = 'communication.phone_all' ;
|
|
|
|
|
|
|
|
$email_token = 'communication.email_all' ;
|
|
|
|
|
|
|
|
require_once( 'utils/CommunicationTokenHelper.php');
|
|
|
|
$commUtils = new CommunicationTokenHelper();
|
|
|
|
|
|
|
|
$commUtils->getTableOfPhones($contactIDs, $values, $phone_token );
|
|
|
|
$commUtils->getTableOfEmails($contactIDs, $values, $email_token );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-08-26 15:29:35 +02:00
|
|
|
if (!empty($tokens['greetings'])) {
|
|
|
|
|
|
|
|
$greetings_token_names = array(
|
|
|
|
'greetings.joint_casual' => 'greetings.joint_casual',
|
|
|
|
'greetings.joint_casual_firstname_lastname' => 'greetings.joint_casual_firstname_lastname',
|
|
|
|
'greetings.joint_casual_nickname_only' => 'greetings.joint_casual_nickname_only',
|
|
|
|
'greetings.joint_casual_firstname_only' => 'greetings.joint_casual_firstname_only',
|
|
|
|
'greetings.solo_casual' => 'greetings.solo_casual',
|
|
|
|
'greetings.solo_casual_nickname_only' => 'greetings.solo_casual_nickname_only',
|
|
|
|
|
|
|
|
'greetings.joint_formal' => 'greetings.joint_formal',
|
|
|
|
'greetings.joint_formal_firstname' => 'greetings.joint_formal_firstname',
|
|
|
|
|
|
|
|
);
|
|
|
|
if ( is_array( $contactIDs ) ) {
|
|
|
|
|
|
|
|
require_once ('utils/GreetingHelper.php');
|
|
|
|
|
|
|
|
$tmpGreetingHelper = new GreetingHelper();
|
|
|
|
$prefixes = $tmpGreetingHelper->get_all_prefixes();
|
|
|
|
$suffixes = $tmpGreetingHelper->get_all_suffixes();
|
|
|
|
|
|
|
|
$tmp_contactIds = $contactIDs ;
|
|
|
|
// process all spouses using 'Spouse of' relationships.
|
|
|
|
$household_id = '';
|
|
|
|
$tmpGreetingHelper->process_spouses( $suffixes, $prefixes, $values, $contactIDs , $greetings_token_names, $household_id );
|
|
|
|
$tmpGreetingHelper->process_households( $suffixes, $prefixes, $values, $contactIDs , $greetings_token_names);
|
|
|
|
// process people not in households and without spouses.
|
|
|
|
$tmpGreetingHelper->process_singles( $suffixes, $prefixes, $values, $greetings_token_names);
|
|
|
|
|
|
|
|
// process organizations
|
|
|
|
$tmpGreetingHelper->process_organizations( $suffixes, $prefixes, $values, $greetings_token_names);
|
2016-08-26 19:22:36 +02:00
|
|
|
|
|
|
|
// Deal with 'solo' type greetings, no need to worry about relationships.
|
|
|
|
$tmpGreetingHelper->process_solo_greetings( $suffixes, $prefixes, $values, $contactIDs , $greetings_token_names);
|
|
|
|
|
|
|
|
|
2016-08-26 21:40:17 +02:00
|
|
|
// if any token is empty, use display_name of contact.
|
|
|
|
// $tmpGreetingHelper->avoid_empty_tokens( $values, $contactIDs , $greetings_token_names);
|
2016-08-26 15:29:35 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-09-01 23:51:04 +02:00
|
|
|
|
|
|
|
if(!empty($tokens['communitynews'])){
|
2019-05-30 05:39:59 +02:00
|
|
|
/*
|
2016-04-02 19:15:00 +02:00
|
|
|
$civi_url = CRM_Utils_System::url('civicrm/example', NULL, TRUE, NULL, FALSE);
|
|
|
|
$website_host_name = parse_url( $civi_url, PHP_URL_HOST );
|
|
|
|
|
2019-05-30 05:39:59 +02:00
|
|
|
|
2019-05-28 12:37:55 +02:00
|
|
|
$isSecure = false;
|
|
|
|
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
|
|
|
|
$isSecure = true;
|
|
|
|
}elseif ( ( !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') ||
|
|
|
|
(!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower( $_SERVER['HTTP_X_FORWARDED_SSL']) == 'on') ) {
|
|
|
|
$isSecure = true;
|
|
|
|
}
|
|
|
|
$protocol = $isSecure ? 'https://' : 'http://';
|
2019-05-30 05:39:59 +02:00
|
|
|
*/
|
2019-05-28 12:37:55 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
if ( array_key_exists( 'HTTPS', $_SERVER )){
|
|
|
|
$ssl_in_use = $_SERVER['HTTPS'];
|
|
|
|
if( strlen($ssl_in_use) > 0){
|
|
|
|
$protocol = "https://";
|
|
|
|
}else{
|
|
|
|
$protocol = "http://";
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$protocol = "http://";
|
|
|
|
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
while( $cur_token_raw = current( $tokens['communitynews'] )){
|
|
|
|
$tmp_key = key($tokens['communitynews']);
|
|
|
|
|
|
|
|
$font_size = "10px";
|
|
|
|
// CiviCRM is buggy here, if token is being used in CiviMail, we need to use the key
|
|
|
|
// as the token. Otherwise ( PDF Letter, one-off email, etc) we
|
|
|
|
// need to use the value.
|
|
|
|
$cur_token = '';
|
|
|
|
if( is_numeric( $tmp_key)){
|
|
|
|
$cur_token = $cur_token_raw;
|
|
|
|
}else{
|
|
|
|
// Its being used by CiviMail.
|
|
|
|
$cur_token = $tmp_key;
|
|
|
|
}
|
|
|
|
|
|
|
|
$token_to_fill = 'communitynews.'.$cur_token;
|
|
|
|
//print "<br><br>Token to fill: ".$token_to_fill."<br>";
|
|
|
|
|
|
|
|
$token_as_array = explode("___", $cur_token );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$partial_token = $token_as_array[0];
|
|
|
|
|
|
|
|
if($partial_token == 'standaloneprofile'){
|
|
|
|
$profile_id = $token_as_array[1];
|
2015-01-26 17:09:51 +01:00
|
|
|
$partial_profile_link_url = CRM_Utils_System::url('civicrm/profile/edit', 'reset=1&gid=', TRUE, NULL, TRUE, TRUE);
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
if( is_numeric( $profile_id )){
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'version' => 3,
|
|
|
|
'sequential' => 1,
|
|
|
|
'id' => $profile_id,
|
|
|
|
);
|
|
|
|
$result = civicrm_api('UFGroup', 'getsingle', $params);
|
|
|
|
$link_label = $result['title'];
|
|
|
|
|
|
|
|
foreach ( $contactIDs as $cid ) {
|
|
|
|
|
|
|
|
$tmp_checksum = CRM_Contact_BAO_Contact_Utils::generateChecksum($cid);
|
|
|
|
$full_profile_link = $partial_profile_link_url.$profile_id."&cs=".$tmp_checksum."&id=".$cid;
|
|
|
|
$tmp_profile_html = "<a href='".$full_profile_link."'>".$link_label."</a>";
|
|
|
|
|
|
|
|
$values[$cid][$token_to_fill] = $tmp_profile_html;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else if( $partial_token == 'contributionpage' ){
|
|
|
|
$contrib_page_id = $token_as_array[1];
|
2015-01-26 17:09:51 +01:00
|
|
|
$partial_contrib_page_link_url = CRM_Utils_System::url('civicrm/contribute/transact', 'reset=1&id=', TRUE, NULL, TRUE, TRUE);
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
if( is_numeric( $contrib_page_id )){
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'version' => 3,
|
|
|
|
'sequential' => 1,
|
|
|
|
'id' => $contrib_page_id,
|
|
|
|
);
|
|
|
|
$result = civicrm_api('ContributionPage', 'getsingle', $params);
|
|
|
|
$link_label = $result['title'];
|
|
|
|
|
|
|
|
foreach ( $contactIDs as $cid ) {
|
|
|
|
|
|
|
|
$tmp_checksum = CRM_Contact_BAO_Contact_Utils::generateChecksum($cid);
|
|
|
|
$full_contrib_page_link = $partial_contrib_page_link_url.$contrib_page_id."&cs=".$tmp_checksum."&cid=".$cid;
|
|
|
|
$tmp_contrib_page_html = "<a href='".$full_contrib_page_link."'>".$link_label."</a>";
|
|
|
|
|
|
|
|
$values[$cid][$token_to_fill] = $tmp_contrib_page_html;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-05-28 12:00:29 +02:00
|
|
|
}else if( $partial_token == 'signpetition'){
|
|
|
|
|
|
|
|
# https://something.org/civicrm/petition/sign?reset=1&sid=IDNUMBER&{contact.checksum}&cid={contact.contact_id}
|
|
|
|
$petition_id = $token_as_array[1];
|
|
|
|
$partial_petition_link_url = CRM_Utils_System::url('civicrm/petition/sign', 'reset=1&sid=', TRUE, NULL, TRUE, TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
if( is_numeric( $petition_id )){
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'version' => 3,
|
|
|
|
'sequential' => 1,
|
|
|
|
'id' => $petition_id,
|
|
|
|
);
|
|
|
|
$result = civicrm_api('Survey', 'getsingle', $params);
|
|
|
|
$link_label = $result['title'];
|
|
|
|
|
|
|
|
foreach ( $contactIDs as $cid ) {
|
|
|
|
|
|
|
|
$tmp_checksum = CRM_Contact_BAO_Contact_Utils::generateChecksum($cid);
|
|
|
|
$full_petition_link = $partial_petition_link_url.$petition_id."&cs=".$tmp_checksum."&cid=".$cid;
|
|
|
|
$tmp_petition_html = "<a href='".$full_petition_link."'>".$link_label."</a>";
|
|
|
|
|
|
|
|
$values[$cid][$token_to_fill] = $tmp_petition_html;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-02-15 23:30:30 +01:00
|
|
|
}else if( $partial_token == 'upcomingevents'){
|
|
|
|
|
|
|
|
$token_date = $token_as_array[1];
|
|
|
|
$date_array = explode("_", $token_date);
|
|
|
|
$date_unit = $date_array[0];
|
|
|
|
$date_number = $date_array[1];
|
|
|
|
|
|
|
|
|
|
|
|
$tmp_event_html = "";
|
|
|
|
if( is_numeric( $date_number) && ( $date_unit == 'day' || $date_unit == 'week' || $date_unit == 'month' )){
|
|
|
|
// get event data
|
|
|
|
$sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
|
Update 'fancytokens.php'
Changed format of date and texts
Résumé des changements
31: $e_start_date = $dao->start_date;
32: - $label = 'Registration Page: '.$e_title.' on '.$e_start_date.' (id: '.$e_id.') :: Events';
33: + $label = 'Registration Page: '.$e_title.' '.$e_start_date.' (id: '.$e_id.') :: Events';
34: $key = 'communitynews.event_registrationpage___'.$e_id ;
502: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
503: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
504: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
505: if( e.is_online_registration = 1 AND
553: }
554: - $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> on ".
555: + $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> ".
556: $e_start_date.$register_html.$summary_html;
576: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
577: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
578: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
579: if( e.is_online_registration = 1 AND
627: }
628: - $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." on ".
629: + $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." ".
630: $e_start_date.$register_html.$summary_html;
2019-10-30 09:33:15 +01:00
|
|
|
date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
|
2014-02-15 23:30:30 +01:00
|
|
|
if( e.is_online_registration = 1 AND
|
|
|
|
( e.registration_end_date is null || now() <= e.registration_end_date ) AND
|
|
|
|
( e.registration_start_date is null || now() >= e.registration_start_date ), '1', '0') as
|
|
|
|
show_registration_link
|
|
|
|
FROM civicrm_event e
|
|
|
|
WHERE e.is_active = 1 AND e.is_public = 1 AND e.is_template <> 1 AND
|
|
|
|
e.start_date >= now() AND e.start_date <= date_add(now(), INTERVAL ".$date_number." ".$date_unit." )
|
|
|
|
ORDER BY e.start_date";
|
|
|
|
|
|
|
|
// print "<br>SQL: ".$sql;
|
|
|
|
|
2015-01-26 17:09:51 +01:00
|
|
|
$event_info_link_url = CRM_Utils_System::url('civicrm/event/info', 'reset=1&id=', TRUE, NULL, TRUE, TRUE);
|
|
|
|
$event_register_link_url = CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=', TRUE, NULL, TRUE, TRUE);
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
// print "<br>contacts: ";
|
|
|
|
// print_r($contactIDs);
|
|
|
|
foreach ( $contactIDs as $cid ) {
|
2014-09-01 23:51:04 +02:00
|
|
|
$tmp_event_html = "";
|
|
|
|
$dao =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray ) ;
|
|
|
|
while($dao->fetch()){
|
|
|
|
$eid = $dao->id;
|
|
|
|
$e_title = $dao->title;
|
|
|
|
$e_start_date = $dao->start_date;
|
|
|
|
$e_short_summary = $dao->summary;
|
|
|
|
$e_show_registration_link = $dao->show_registration_link;
|
|
|
|
$registration_link_text = $dao->registration_link_text;
|
|
|
|
|
|
|
|
$register_html = "";
|
|
|
|
if( $e_show_registration_link == "1" ){
|
|
|
|
|
|
|
|
$tmp_checksum = CRM_Contact_BAO_Contact_Utils::generateChecksum($cid);
|
|
|
|
// print "<br>checksum: ".$tmp_checksum;
|
|
|
|
// If you want to use the checksum style URL, then add this to the end of the URL
|
|
|
|
// "&cs=".$tmp_checksum."&cid=".$cid
|
|
|
|
$full_register_link = $event_register_link_url.$eid."&cs=".$tmp_checksum."&cid=".$cid;
|
|
|
|
$register_html = "<br> <b><a href='".$full_register_link."'>".$registration_link_text."</b></a>";
|
|
|
|
}else{
|
|
|
|
$register_html = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(strlen( $e_short_summary ) > 0){
|
|
|
|
$summary_html = " <br> ".$e_short_summary;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
$summary_html = "";
|
|
|
|
|
|
|
|
}
|
Update 'fancytokens.php'
Changed format of date and texts
Résumé des changements
31: $e_start_date = $dao->start_date;
32: - $label = 'Registration Page: '.$e_title.' on '.$e_start_date.' (id: '.$e_id.') :: Events';
33: + $label = 'Registration Page: '.$e_title.' '.$e_start_date.' (id: '.$e_id.') :: Events';
34: $key = 'communitynews.event_registrationpage___'.$e_id ;
502: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
503: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
504: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
505: if( e.is_online_registration = 1 AND
553: }
554: - $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> on ".
555: + $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> ".
556: $e_start_date.$register_html.$summary_html;
576: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
577: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
578: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
579: if( e.is_online_registration = 1 AND
627: }
628: - $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." on ".
629: + $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." ".
630: $e_start_date.$register_html.$summary_html;
2019-10-30 09:33:15 +01:00
|
|
|
$tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> ".
|
2014-09-01 23:51:04 +02:00
|
|
|
$e_start_date.$register_html.$summary_html;
|
|
|
|
}
|
|
|
|
$dao->free();
|
|
|
|
|
|
|
|
// Populate the token value for this contact.
|
|
|
|
$values[$cid][$token_to_fill] = $tmp_event_html;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}else if( $partial_token == 'event_registrationpage'){
|
|
|
|
|
|
|
|
// communitynews.event_registrationpage___'.$e_id
|
|
|
|
$token_event_id = $token_as_array[1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tmp_event_html = "";
|
|
|
|
if( is_numeric( $token_event_id) ){
|
|
|
|
// get event data
|
|
|
|
$sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
|
Update 'fancytokens.php'
Changed format of date and texts
Résumé des changements
31: $e_start_date = $dao->start_date;
32: - $label = 'Registration Page: '.$e_title.' on '.$e_start_date.' (id: '.$e_id.') :: Events';
33: + $label = 'Registration Page: '.$e_title.' '.$e_start_date.' (id: '.$e_id.') :: Events';
34: $key = 'communitynews.event_registrationpage___'.$e_id ;
502: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
503: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
504: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
505: if( e.is_online_registration = 1 AND
553: }
554: - $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> on ".
555: + $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> ".
556: $e_start_date.$register_html.$summary_html;
576: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
577: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
578: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
579: if( e.is_online_registration = 1 AND
627: }
628: - $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." on ".
629: + $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." ".
630: $e_start_date.$register_html.$summary_html;
2019-10-30 09:33:15 +01:00
|
|
|
date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
|
2014-09-01 23:51:04 +02:00
|
|
|
if( e.is_online_registration = 1 AND
|
|
|
|
( e.registration_end_date is null || now() <= e.registration_end_date ) AND
|
|
|
|
( e.registration_start_date is null || now() >= e.registration_start_date ), '1', '0') as
|
|
|
|
show_registration_link
|
|
|
|
FROM civicrm_event e
|
2019-05-27 15:22:10 +02:00
|
|
|
WHERE e.is_active = 1 AND e.is_template <> 1 AND
|
2014-09-01 23:51:04 +02:00
|
|
|
e.start_date >= now() AND e.id = '".$token_event_id."'
|
|
|
|
ORDER BY e.start_date";
|
|
|
|
|
|
|
|
// print "<br>SQL: ".$sql;
|
|
|
|
|
|
|
|
// $event_info_link_url = $protocol.$website_host_name."/civicrm/event/info?reset=1&id=";
|
2015-01-26 17:09:51 +01:00
|
|
|
$event_register_link_url = CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=', TRUE, NULL, TRUE, TRUE);
|
2014-09-01 23:51:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
// print "<br>contacts: ";
|
|
|
|
// print_r($contactIDs);
|
|
|
|
foreach ( $contactIDs as $cid ) {
|
|
|
|
$tmp_event_html = "";
|
2014-02-15 23:30:30 +01:00
|
|
|
$dao =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray ) ;
|
|
|
|
while($dao->fetch()){
|
|
|
|
$eid = $dao->id;
|
|
|
|
$e_title = $dao->title;
|
|
|
|
$e_start_date = $dao->start_date;
|
|
|
|
$e_short_summary = $dao->summary;
|
|
|
|
$e_show_registration_link = $dao->show_registration_link;
|
|
|
|
$registration_link_text = $dao->registration_link_text;
|
|
|
|
|
|
|
|
$register_html = "";
|
|
|
|
if( $e_show_registration_link == "1" ){
|
|
|
|
|
|
|
|
$tmp_checksum = CRM_Contact_BAO_Contact_Utils::generateChecksum($cid);
|
|
|
|
// print "<br>checksum: ".$tmp_checksum;
|
|
|
|
// If you want to use the checksum style URL, then add this to the end of the URL
|
|
|
|
// "&cs=".$tmp_checksum."&cid=".$cid
|
|
|
|
$full_register_link = $event_register_link_url.$eid."&cs=".$tmp_checksum."&cid=".$cid;
|
|
|
|
$register_html = "<br> <b><a href='".$full_register_link."'>".$registration_link_text."</b></a>";
|
|
|
|
}else{
|
|
|
|
$register_html = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(strlen( $e_short_summary ) > 0){
|
|
|
|
$summary_html = " <br> ".$e_short_summary;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
$summary_html = "";
|
|
|
|
|
|
|
|
}
|
Update 'fancytokens.php'
Changed format of date and texts
Résumé des changements
31: $e_start_date = $dao->start_date;
32: - $label = 'Registration Page: '.$e_title.' on '.$e_start_date.' (id: '.$e_id.') :: Events';
33: + $label = 'Registration Page: '.$e_title.' '.$e_start_date.' (id: '.$e_id.') :: Events';
34: $key = 'communitynews.event_registrationpage___'.$e_id ;
502: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
503: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
504: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
505: if( e.is_online_registration = 1 AND
553: }
554: - $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> on ".
555: + $tmp_event_html = $tmp_event_html."\n<br><br><a href='".$event_info_link_url.$eid."'>".$e_title."</a> ".
556: $e_start_date.$register_html.$summary_html;
576: $sql = "SELECT e.id , e.summary, e.title, e.registration_link_text,
577: - date_format( e.start_date, '%W %b %e at %l:%i %p' ) as start_date ,
578: + date_format( e.start_date, '%d/%m/%Y à %Hh%i' ) as start_date ,
579: if( e.is_online_registration = 1 AND
627: }
628: - $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." on ".
629: + $tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." ".
630: $e_start_date.$register_html.$summary_html;
2019-10-30 09:33:15 +01:00
|
|
|
$tmp_event_html = $tmp_event_html."\n<br><br>".$e_title." ".
|
2014-02-15 23:30:30 +01:00
|
|
|
$e_start_date.$register_html.$summary_html;
|
|
|
|
}
|
|
|
|
$dao->free();
|
|
|
|
|
|
|
|
// Populate the token value for this contact.
|
|
|
|
$values[$cid][$token_to_fill] = $tmp_event_html;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-09-01 23:51:04 +02:00
|
|
|
|
2014-09-04 00:53:46 +02:00
|
|
|
}else if( $partial_token == 'dwform' ){
|
|
|
|
$token_node_id = $token_as_array[1];
|
|
|
|
|
|
|
|
|
2015-11-21 20:20:29 +01:00
|
|
|
// $drupal_db = getUserFrameworkDatabaseName();
|
2014-09-04 00:53:46 +02:00
|
|
|
|
|
|
|
if( is_numeric( $token_node_id) ){
|
|
|
|
// get Drupal WebForm data for this node id.
|
2015-11-21 20:20:29 +01:00
|
|
|
$dsql = "SELECT cforms.nid, node.title, ua.alias
|
|
|
|
FROM {webform_civicrm_forms} cforms
|
|
|
|
JOIN {node} node ON cforms.nid = node.nid AND node.status = 1
|
|
|
|
LEFT JOIN {url_alias} ua ON cforms.nid = SUBSTRING( ua.source, 6 )
|
|
|
|
AND ua.source LIKE 'node/%'
|
|
|
|
WHERE node.nid = $token_node_id";
|
|
|
|
|
|
|
|
$dq_result = db_query( $dsql );
|
|
|
|
foreach ($dq_result as $record) {
|
|
|
|
$tmp_title = $record->title;
|
|
|
|
$tmp_alias = $record->alias;
|
|
|
|
$tmp_nid = $record->nid;
|
|
|
|
if( strlen( $tmp_alias) > 0){
|
2019-05-30 05:54:25 +02:00
|
|
|
//$partial_webform_link_url = $protocol.$website_host_name."/".$tmp_alias;
|
|
|
|
$partial_webform_link_url = CRM_Utils_System::url($tmp_alias, "", TRUE, NULL, TRUE, TRUE);
|
|
|
|
|
2015-11-21 20:20:29 +01:00
|
|
|
}else{
|
2019-05-30 05:54:25 +02:00
|
|
|
//$partial_webform_link_url = $protocol.$website_host_name."/node/".$tmp_nid;
|
|
|
|
$partial_webform_link_url = CRM_Utils_System::url("/node/".$tmp_nid , "", TRUE, NULL, TRUE, TRUE);
|
2015-11-21 20:20:29 +01:00
|
|
|
}
|
|
|
|
$link_label = $tmp_title;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-09-04 00:53:46 +02:00
|
|
|
$sql = "SELECT cforms.nid, node.title, ua.alias
|
|
|
|
FROM $drupal_db.webform_civicrm_forms cforms
|
|
|
|
JOIN $drupal_db.node ON cforms.nid = node.nid AND node.status = 1
|
|
|
|
LEFT JOIN $drupal_db.url_alias ua ON cforms.nid = SUBSTRING( ua.source, 6 )
|
|
|
|
AND ua.source LIKE 'node/%'
|
|
|
|
WHERE node.nid = $token_node_id";
|
|
|
|
$dao =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray ) ;
|
|
|
|
while($dao->fetch()){
|
|
|
|
$tmp_title = $dao->title;
|
|
|
|
$tmp_alias = $dao->alias;
|
|
|
|
$tmp_nid = $dao->nid;
|
|
|
|
if( strlen( $tmp_alias) > 0){
|
|
|
|
$partial_webform_link_url = $protocol.$website_host_name."/".$tmp_alias;
|
|
|
|
}else{
|
|
|
|
$partial_webform_link_url = $protocol.$website_host_name."/node/".$tmp_nid;
|
|
|
|
}
|
|
|
|
$link_label = $tmp_title;
|
|
|
|
|
|
|
|
}
|
|
|
|
$dao->free();
|
2015-11-21 20:20:29 +01:00
|
|
|
*/
|
2014-09-04 00:53:46 +02:00
|
|
|
|
|
|
|
foreach ( $contactIDs as $cid ) {
|
|
|
|
|
|
|
|
$tmp_checksum = CRM_Contact_BAO_Contact_Utils::generateChecksum($cid);
|
2019-05-30 06:25:18 +02:00
|
|
|
$full_webform_link = $partial_webform_link_url."cs=".$tmp_checksum."&cid=".$cid;
|
2014-09-04 00:53:46 +02:00
|
|
|
$tmp_webform_html = "<a href='".$full_webform_link."'>".$link_label."</a>";
|
|
|
|
|
|
|
|
$values[$cid][$token_to_fill] = $tmp_webform_html;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-02-15 23:30:30 +01:00
|
|
|
}
|
|
|
|
next($tokens['communitynews']);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-01 23:51:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-15 23:30:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_config
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_config(&$config) {
|
|
|
|
_fancytokens_civix_civicrm_config($config);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_xmlMenu
|
|
|
|
*
|
|
|
|
* @param $files array(string)
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_xmlMenu
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_xmlMenu(&$files) {
|
|
|
|
_fancytokens_civix_civicrm_xmlMenu($files);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_install
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_install() {
|
|
|
|
return _fancytokens_civix_civicrm_install();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_uninstall
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_uninstall() {
|
|
|
|
return _fancytokens_civix_civicrm_uninstall();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_enable
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_enable() {
|
|
|
|
return _fancytokens_civix_civicrm_enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_disable
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_disable() {
|
|
|
|
return _fancytokens_civix_civicrm_disable();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_upgrade
|
|
|
|
*
|
|
|
|
* @param $op string, the type of operation being performed; 'check' or 'enqueue'
|
|
|
|
* @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks
|
|
|
|
*
|
|
|
|
* @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
|
|
|
|
* for 'enqueue', returns void
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_upgrade
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
|
|
|
|
return _fancytokens_civix_civicrm_upgrade($op, $queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_managed
|
|
|
|
*
|
|
|
|
* Generate a list of entities to create/deactivate/delete when this module
|
|
|
|
* is installed, disabled, uninstalled.
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_managed
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_managed(&$entities) {
|
|
|
|
return _fancytokens_civix_civicrm_managed($entities);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_caseTypes
|
|
|
|
*
|
|
|
|
* Generate a list of case-types
|
|
|
|
*
|
|
|
|
* Note: This hook only runs in CiviCRM 4.4+.
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_caseTypes
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_caseTypes(&$caseTypes) {
|
|
|
|
_fancytokens_civix_civicrm_caseTypes($caseTypes);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of hook_civicrm_alterSettingsFolders
|
|
|
|
*
|
|
|
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterSettingsFolders
|
|
|
|
*/
|
|
|
|
function fancytokens_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
|
|
|
|
_fancytokens_civix_civicrm_alterSettingsFolders($metaDataFolders);
|
2014-03-29 13:26:26 +01:00
|
|
|
}
|