<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
static $_pcpLinks = NULL;
/**
- *
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
* 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 array $params
+ * Reference array contains the values submitted by the form.
+ * @param bool $pcpBlock
+ * If true, create or update PCPBlock, else PCP.
*
- * @access public
* @static
*
* @return object
*/
- static function add(&$params, $pcpBlock = TRUE) {
+ public static function add(&$params, $pcpBlock = TRUE) {
if ($pcpBlock) {
// action is taken depending upon the mode
$dao = new CRM_PCP_DAO_PCPBlock();
// set currency for CRM-1496
if (!isset($dao->currency)) {
- $config = & CRM_Core_Config::singleton();
+ $config = &CRM_Core_Config::singleton();
$dao->currency = $config->defaultCurrency;
}
/**
* 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
+ * @return null|string
+ * Dispaly name of the contact if found
* @static
- * @access public
*/
- static function displayName($id) {
+ public static function displayName($id) {
$id = CRM_Utils_Type::escape($id, 'Integer');
$query = "
*
* @param int $contactId
*
- * @return array array of Pcp if found
- * @access public
+ * @return array
+ * array of Pcp if found
* @static
*/
- static function getPcpDashboardInfo($contactId) {
+ public static function getPcpDashboardInfo($contactId) {
$links = self::pcpLinks();
$query = "
$pcpBlock[] = array(
'pageId' => $pcpBlockDao->target_entity_id,
'pageTitle' => $pageTitle,
+ 'component' => $pcpBlockDao->target_entity_type,
'action' => $action,
);
}
/**
* Show the total amount for Personal Campaign Page on thermometer
*
- * @param array $pcpId contains the pcp ID
+ * @param array $pcpId
+ * Contains the pcp ID.
*
- * @access public
* @static
*
- * @return total amount
+ * @return total
+ * amount
*/
- static function thermoMeter($pcpId) {
+ public static function thermoMeter($pcpId) {
$query = "
SELECT SUM(cc.total_amount) as total
FROM civicrm_pcp pcp
/**
* Show the amount, nickname on honor roll
*
- * @param array $pcpId contains the pcp ID
+ * @param array $pcpId
+ * Contains the pcp ID.
*
- * @access public
* @static
*
- * @return array $honor
+ * @return array
*/
- static function honorRoll($pcpId) {
+ public static function honorRoll($pcpId) {
$query = "
SELECT cc.id, cs.pcp_roll_nickname, cs.pcp_personal_note,
cc.total_amount, cc.currency
/**
* Get action links
*
- * @return array (reference) of action links
+ * @return array
+ * (reference) of action links
* @static
*/
- static function &pcpLinks() {
+ public static function &pcpLinks() {
if (!(self::$_pcpLinks)) {
$deleteExtra = ts('Are you sure you want to delete this Personal Campaign Page?') . '\n' . ts('This action cannot be undone.');
/**
* Delete the campaign page
*
- * @param int $id campaign page id
+ * @param int $id
+ * Campaign page id.
*
* @return null
- * @access public
* @static
- *
*/
public static function deleteById($id) {
CRM_Utils_Hook::pre('delete', 'Campaign', $id, CRM_Core_DAO::$_nullArray);
/**
* Build the form object
*
- * @param CRM_Core_Form $form form object
+ * @param CRM_Core_Form $form
+ * Form object.
*
* @return void
- * @access public
*/
public static function buildPCPForm($form) {
$form->addElement('checkbox', 'pcp_active', ts('Enable Personal Campaign Pages?'), NULL, array('onclick' => "return showHideByValue('pcp_active',true,'pcpFields','block','radio',false);"));
}
CRM_Core_DAO::commonRetrieveAll('CRM_Core_DAO_UFGroup', 'is_cms_user', $isUserRequired, $profiles, array(
'title',
- 'is_active'
+ 'is_active',
));
if (!empty($profiles)) {
foreach ($profiles as $key => $value) {
}
- /*
- * Add PCP form elements to a form
- */
/**
- * @param integer $pcpId
+ * Add PCP form elements to a form
+ *
+ * @param int $pcpId
* @param CRM_Core_Page $page
* @param null $elements
*/
- function buildPcp($pcpId, &$page, &$elements = NULL) {
+ public function buildPcp($pcpId, &$page, &$elements = NULL) {
$prms = array('id' => $pcpId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
if ($pcpInfo['page_type'] == 'event') {
$pcp_supporter_text = ts('This event registration is being made thanks to effort of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'event');
- if(!empty($text)) {
+ if (!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the registration, you will be able to create your own Personal Campaign Page!";
}
}
else {
$pcp_supporter_text = ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'contribute');
- if(!empty($text)) {
+ if (!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!";
}
}
);
$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[] = &$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/
- */
/**
+ * Process a PCP contribution
+ *
* @param int $pcpId
* @param $component
* @param $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.');
/**
* Approve / Reject the campaign page
*
- * @param int $id campaign page id
+ * @param int $id
+ * Campaign page id.
*
* @param $is_active
*
* @return null
- * @access public
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
switch ($is_active) {
case 0:
$is_active = 3;
CRM_Core_Session::setStatus(ts("%1 status has been updated to %2.", array(
1 => $pcpTitle,
- 2 => $pcpStatus
+ 2 => $pcpStatus,
)), 'Status Updated', 'success');
// send status change mail
* 1. when their PCP status is changed by site admin.
* 2. when supporter initially creates a Personal Campaign Page ($isInitial set to true).
*
- * @param int $pcpId campaign page id
- * @param int $newStatus pcp status id
+ * @param int $pcpId
+ * Campaign page id.
+ * @param int $newStatus
+ * Pcp status id.
* @param bool|int $isInitial is it the first time, campaign page has been created by the user
*
* @param string $component
*
* @throws Exception
* @return null
- * @access public
* @static
*/
- static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE, $component = 'contribute') {
+ public static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE, $component = 'contribute') {
$pcpStatusName = CRM_Core_OptionGroup::values("pcp_status", FALSE, FALSE, FALSE, NULL, 'name');
$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
$config = CRM_Core_Config::singleton();
/**
* Enable / Disable the campaign page
*
- * @param int $id campaign page id
+ * @param int $id
+ * Campaign page id.
*
* @param $is_active
* @return null
- * @access public
* @static
*/
- static function setDisable($id, $is_active) {
+ public static function setDisable($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_PCP_DAO_PCP', $id, 'is_active', $is_active);
}
* @param $component
*
* @return int
- * @access public
* @static
*/
- static function getStatus($pcpId, $component) {
+ public static function getStatus($pcpId, $component) {
$query = "
SELECT pb.is_active
FROM civicrm_pcp pcp
* @param $component
*
* @return string
- * @access public
* @static
*/
- static function getPcpBlockStatus($pageId, $component) {
+ public static function getPcpBlockStatus($pageId, $component) {
$query = "
SELECT pb.link_text as linkText
FROM civicrm_pcp_block pb
/**
* Find out if the PCP block is in use by one or more PCP page
*
- * @param int $id pcp block id
+ * @param int $id
+ * Pcp block id.
*
* @return Boolean
- * @access public
* @static
- *
*/
- static function getPcpBlockInUse($id) {
+ public static function getPcpBlockInUse($id) {
$query = "
SELECT count(*)
FROM civicrm_pcp pcp
/**
* Get email is enabled for supporter's profile
*
- * @param int $profileId supporter's profile id
+ * @param int $profileId
+ * Supporter's profile id.
*
* @return boolean
- * @access public
* @static
*/
- static function checkEmailProfile($profileId) {
+ public static function checkEmailProfile($profileId) {
$query = "
SELECT field_name
FROM civicrm_uf_field
* @param $component
*
* @return int
- * @access public
* @static
*/
- static function getPcpPageTitle($pcpId, $component) {
+ public static function getPcpPageTitle($pcpId, $component) {
if ($component == 'contribute') {
$query = "
SELECT cp.title
* @param $component
*
* @return String
- * @access public
* @static
*/
- static function getPcpBlockEntityId($pcpId, $component) {
+ public static function getPcpBlockEntityId($pcpId, $component) {
$entity_table = self::getPcpEntityTable($component);
$query = "
* @param $component
*
* @return String
- * @access public
* @static
*/
- static function getPcpEntityTable($component) {
+ public static function getPcpEntityTable($component) {
$entity_table_map = array(
'event' => 'civicrm_event',
'civicrm_event' => 'civicrm_event',
* @param string $component
*
* @return int
- * @access public
* @static
*/
public static function getSupporterProfileId($component_id, $component = 'contribute') {
}
}
}
-