* @static
*/
static $_pcpLinks = NULL;
+
function __construct() {
parent::__construct();
}
* function to add or update either a Personal Campaign Page OR a PCP Block
*
* @param array $params reference array contains the values submitted by the form
- * @param bool $pcpBlock if true, create or update PCPBlock, else PCP
+ * @param bool $pcpBlock if true, create or update PCPBlock, else PCP
* @access public
* @static
*
// set currency for CRM-1496
if (!isset($dao->currency)) {
- $config = &CRM_Core_Config::singleton();
- $dao->currency = $config->defaultCurrency;
+ $config = & CRM_Core_Config::singleton();
+ $dao->currency = $config->defaultCurrency;
}
$dao->save();
/**
* function to get the Display name of a contact for a PCP
*
- * @param int $id id for the PCP
+ * @param int $id id for the PCP
*
* @return null|string Dispaly name of the contact if found
* @static
$params = array(1 => array($contactId, 'Integer'));
- $pcpInfoDao = CRM_Core_DAO::executeQuery($query, $params);
- $pcpInfo = array();
- $hide = $mask = array_sum(array_keys($links['all']));
+ $pcpInfoDao = CRM_Core_DAO::executeQuery($query, $params);
+ $pcpInfo = array();
+ $hide = $mask = array_sum(array_keys($links['all']));
$contactPCPPages = array();
- $event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
+ $event = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$contribute = CRM_Contribute_PseudoConstant::contributionPage();
- $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
- $approved = CRM_Utils_Array::key('Approved', $pcpStatus);
+ $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus();
+ $approved = CRM_Utils_Array::key('Approved', $pcpStatus);
while ($pcpInfoDao->fetch()) {
$mask = $hide;
else {
$mask -= CRM_Core_Action::DISABLE;
}
- $action = CRM_Core_Action::formLink($pcpLink, $mask, $replace);
+ $action = CRM_Core_Action::formLink($pcpLink, $mask, $replace);
$component = $pcpInfoDao->page_type;
$pageTitle = CRM_Utils_Array::value($pcpInfoDao->page_id, $$component);
ORDER BY target_entity_type, target_entity_id
";
$pcpBlockDao = CRM_Core_DAO::executeQuery($query);
- $pcpBlock = array();
- $mask = 0;
+ $pcpBlock = array();
+ $mask = 0;
while ($pcpBlockDao->fetch()) {
if ($links) {
'pageComponent' => $pcpBlockDao->target_entity_type,
);
}
- $pcpLink = $links['add'];
- $action = CRM_Core_Action::formLink($pcpLink, $mask, $replace);
- $component = $pcpBlockDao->target_entity_type;
- $pageTitle = CRM_Utils_Array::value($pcpBlockDao->target_entity_id, $$component);
+ $pcpLink = $links['add'];
+ $action = CRM_Core_Action::formLink($pcpLink, $mask, $replace);
+ $component = $pcpBlockDao->target_entity_type;
+ $pageTitle = CRM_Utils_Array::value($pcpBlockDao->target_entity_id, $$component);
$pcpBlock[] = array(
'pageId' => $pcpBlockDao->target_entity_id,
'pageTitle' => $pageTitle,
$deleteExtra = ts('Are you sure you want to delete this Personal Campaign Page?') . '\n' . ts('This action cannot be undone.');
self::$_pcpLinks['add'] = array(
- CRM_Core_Action::ADD => array('name' => ts('Create a Personal Campaign Page'),
+ CRM_Core_Action::ADD => array(
+ 'name' => ts('Create a Personal Campaign Page'),
'url' => 'civicrm/contribute/campaign',
'qs' => 'action=add&reset=1&pageId=%%pageId%%&component=%%pageComponent%%',
'title' => ts('Configure'),
);
self::$_pcpLinks['all'] = array(
- CRM_Core_Action::UPDATE => array('name' => ts('Edit Your Page'),
+ CRM_Core_Action::UPDATE => array(
+ 'name' => ts('Edit Your Page'),
'url' => 'civicrm/pcp/info',
'qs' => 'action=update&reset=1&id=%%pcpId%%&component=%%pageComponent%%',
'title' => ts('Configure'),
),
- CRM_Core_Action::DETACH => array('name' => ts('Tell Friends'),
+ CRM_Core_Action::DETACH => array(
+ 'name' => ts('Tell Friends'),
'url' => 'civicrm/friend',
'qs' => 'eid=%%pcpId%%&blockId=%%pcpBlock%%&reset=1&pcomponent=pcp&component=%%pageComponent%%',
'title' => ts('Tell Friends'),
),
- CRM_Core_Action::BROWSE => array('name' => ts('Update Contact Information'),
+ CRM_Core_Action::BROWSE => array(
+ 'name' => ts('Update Contact Information'),
'url' => 'civicrm/pcp/info',
'qs' => 'action=browse&reset=1&id=%%pcpId%%&component=%%pageComponent%%',
'title' => ts('Update Contact Information'),
),
- CRM_Core_Action::ENABLE => array('name' => ts('Enable'),
+ CRM_Core_Action::ENABLE => array(
+ 'name' => ts('Enable'),
'url' => 'civicrm/pcp',
'qs' => 'action=enable&reset=1&id=%%pcpId%%&component=%%pageComponent%%',
'title' => ts('Enable'),
),
- CRM_Core_Action::DISABLE => array('name' => ts('Disable'),
+ CRM_Core_Action::DISABLE => array(
+ 'name' => ts('Disable'),
'url' => 'civicrm/pcp',
'qs' => 'action=disable&reset=1&id=%%pcpId%%&component=%%pageComponent%%',
'title' => ts('Disable'),
),
- CRM_Core_Action::DELETE => array('name' => ts('Delete'),
+ CRM_Core_Action::DELETE => array(
+ 'name' => ts('Delete'),
'url' => 'civicrm/pcp',
'qs' => 'action=delete&reset=1&id=%%pcpId%%&component=%%pageComponent%%',
'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"',
$form->addElement('checkbox', 'is_approval_needed', ts('Approval required'));
- $profile = array();
+ $profile = array();
$isUserRequired = NULL;
- $config = CRM_Core_Config::singleton();
+ $config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Standalone') {
$isUserRequired = 2;
}
- CRM_Core_DAO::commonRetrieveAll('CRM_Core_DAO_UFGroup', 'is_cms_user', $isUserRequired, $profiles, array('title', 'is_active'));
+ CRM_Core_DAO::commonRetrieveAll('CRM_Core_DAO_UFGroup', 'is_cms_user', $isUserRequired, $profiles, array(
+ 'title',
+ 'is_active'
+ ));
if (!empty($profiles)) {
foreach ($profiles as $key => $value) {
if ($value['is_active']) {
$form->assign('profile', $profile);
}
- $form->add('select', 'supporter_profile_id', ts('Supporter profile'), array('' => ts('- select -')) + $profile, true);
+ $form->add('select', 'supporter_profile_id', ts('Supporter profile'), array('' => ts('- select -')) + $profile, TRUE);
$form->addElement('checkbox', 'is_tellfriend_enabled', ts("Allow 'Tell a friend' functionality"), NULL, array('onclick' => "return showHideByValue('is_tellfriend_enabled',true,'tflimit','table-row','radio',false);"));
array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );")
);
$extraOption = array('onclick' => "return pcpAnonymous( );");
- $elements = array();
- $elements[] = &$page->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
- $elements[] = &$page->createElement('radio', NULL, '', ts('List my support anonymously'), 1, $extraOption);
+ $elements = array();
+ $elements[] = & $page->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
+ $elements[] = & $page->createElement('radio', NULL, '', ts('List my support anonymously'), 1, $extraOption);
$page->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$page->_defaults['pcp_is_anonymous'] = 0;
/*
* Process a PCP contribution/
*/
- function handlePcp($pcpId, $component, $entity) {
+ public static function handlePcp($pcpId, $component, $entity) {
- $entity_table = self::getPcpEntityTable($component);
+ self::getPcpEntityTable($component);
if (!$pcpId) {
return FALSE;
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $params, $pcpBlock);
$params = array('id' => $pcpInfo['page_id']);
- $now = time();
+ $now = time();
if ($component == 'event') {
// figure out where to redirect if an exception occurs below based on target entity
// ignore startDate for events - PCP's can be active long before event start date
$startDate = 0;
- $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $entity));
+ $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $entity));
}
-
elseif ($component == 'contribute') {
$urlBase = 'civicrm/contribute/transact';
//start and end date of the contribution page
$startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('start_date', $entity));
- $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $entity));
+ $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $entity));
}
// define redirect url back to contrib page or event if needed
- $url = CRM_Utils_System::url($urlBase,
- "reset=1&id={$pcpBlock['entity_id']}",
- FALSE, NULL, FALSE, TRUE
- );
+ $url = CRM_Utils_System::url($urlBase, "reset=1&id={$pcpBlock['entity_id']}", FALSE, NULL, FALSE, TRUE );
if ($pcpBlock['target_entity_id'] != $entity['id']) {
$statusMessage = ts('This page is not related to the Personal Campaign Page you have just visited. However you can still make a contribution here.');
);
$statusMessage = ts('The event linked to the Personal Campaign Page you have just visited is over (as of %1).', array(1 => $customEndDate));
CRM_Core_Error::statusBounce($statusMessage, $url);
- } else {
+ }
+ else {
$statusMessage = ts('The Personal Campaign Page you have just visited is no longer active (as of %1). However you can still support the campaign here.', array(1 => $customEndDate));
CRM_Core_Error::statusBounce($statusMessage, $url);
}
CRM_Core_DAO::setFieldValue('CRM_PCP_DAO_PCP', $id, 'status_id', $is_active);
- $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $id, 'title');
- $pcpPageType = CRM_Core_DAO::getFieldValue( 'CRM_PCP_DAO_PCP', $id, 'page_type' );
+ $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $id, 'title');
+ $pcpPageType = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $id, 'page_type');
$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
$pcpStatus = $pcpStatus[$is_active];
- CRM_Core_Session::setStatus(ts("%1 status has been updated to %2.", array(1 => $pcpTitle, 2 => $pcpStatus)), 'Status Updated', 'success');
+ CRM_Core_Session::setStatus(ts("%1 status has been updated to %2.", array(
+ 1 => $pcpTitle,
+ 2 => $pcpStatus
+ )), 'Status Updated', 'success');
// send status change mail
$result = self::sendStatusUpdate($id, $is_active, FALSE, $pcpPageType);