<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
public $_action;
/**
- * the id of the pledge that we are proceessing
+ * The id of the pledge that we are proceessing
*
* @var int
- * @public
*/
public $_id;
/**
- * the id of the contact associated with this pledge
+ * The id of the contact associated with this pledge
*
* @var int
- * @public
*/
public $_contactID;
/**
* The Pledge values if an existing pledge
- * @public
*/
public $_values;
/**
* The Pledge frequency Units
- * @public
*/
public $_freqUnits;
/**
- * is current pledge pending.
- * @public
+ * Is current pledge pending.
*/
public $_isPending = FALSE;
/**
- * Function to set variables up before form is built
+ * Set variables up before form is built
*
* @return void
- * @access public
*/
public function preProcess() {
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
// check for action permissions.
if (!CRM_Core_Permission::checkActionPermission('CiviPledge', $this->_action)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
+ CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$this->assign('action', $this->_action);
if ($this->_contactID) {
list($this->userDisplayName,
$this->userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
$this->assign('displayName', $this->userDisplayName);
}
/**
- * This function sets the default values for the form.
+ * Set default values for the form.
* the default values are retrieved from the database
*
- * @access public
*
* @return void
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = $this->_values;
$fields = array();
$defaults['max_reminders'] = 1;
$defaults['additional_reminder_day'] = 5;
$defaults['frequency_unit'] = array_search('month', $this->_freqUnits);
- $defaults['financial_type_id'] = array_search( 'Donation', CRM_Contribute_PseudoConstant::financialType() );
+ $defaults['financial_type_id'] = array_search('Donation', CRM_Contribute_PseudoConstant::financialType());
}
$pledgeStatus = CRM_Contribute_PseudoConstant::contributionStatus();
//assign status.
$this->assign('status', CRM_Utils_Array::value(CRM_Utils_Array::value('status_id', $this->_values),
- $pledgeStatus,
- $defaultPledgeStatus
- ));
+ $pledgeStatus,
+ $defaultPledgeStatus
+ ));
if (isset($this->userEmail)) {
$this->assign('email', $this->userEmail);
}
/**
- * Function to build the form
+ * Build the form object
*
* @return void
- * @access public
*/
public function buildQuickForm() {
if ($this->_action & CRM_Core_Action::DELETE) {
}
if ($this->_context == 'standalone') {
- $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
+ $this->addEntityRef('contact_id', ts('Contact'), array(
+ 'create' => TRUE,
+ 'api' => array('extra' => array('email'))
+ ), TRUE);
}
$showAdditionalInfo = FALSE;
);
foreach ($paneNames as $name => $type) {
$urlParams = "snippet=4&formType={$type}";
- $allPanes[$name] = array('url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams),
+ $allPanes[$name] = array(
+ 'url' => CRM_Utils_System::url('civicrm/contact/view/pledge', $urlParams),
'open' => 'false',
'id' => $type,
);
$element = &$this->add('select', 'frequency_unit',
ts('Frequency'),
array(
- '' => ts('- select -')) + $freqUnitsDisplay,
+ '' => ts('- select -')
+ ) + $freqUnitsDisplay,
TRUE
);
$element->freeze();
}
- $this->add('text', 'eachPaymentAmount', ts('each'), array('size' => 10, 'style' => "background-color:#EBECE4", 'READONLY'));
+ $this->add('text', 'eachPaymentAmount', ts('each'), array(
+ 'size' => 10,
+ 'style' => "background-color:#EBECE4",
+ 'READONLY'
+ ));
//add various dates
if (!$this->_id || $this->_isPending) {
$this->addDate('acknowledge_date', ts('Acknowledgment Date'));
- $this->add('select', 'financial_type_id',
- ts( 'Financial Type' ),
- array(''=>ts( '- select -' )) + CRM_Contribute_PseudoConstant::financialType( ),
+ $this->add('select', 'financial_type_id',
+ ts('Financial Type'),
+ array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(),
TRUE
);
}
$ele = $this->add('select', 'contribution_page_id', ts('Self-service Payments Page'),
array(
- '' => ts('- select -')) + $pledgePages
+ '' => ts('- select -')
+ ) + $pledgePages
);
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
}
/**
- * global form rule
+ * Global form rule
*
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
+ * @param array $fields
+ * The input form values.
+ * @param array $files
+ * The uploaded files if any.
* @param $self
*
- * @internal param array $options additional user data
*
- * @return true if no errors, else array of errors
- * @access public
- * @static
+ * @return bool|array
+ * true if no errors, else array of errors
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = array();
if ($fields['amount'] <= 0) {
}
/**
- * Function to process the form
+ * Process the form submission
*
- * @access public
*
* @return void
*/
if (!isset($this->userEmail)) {
list($this->userDisplayName,
$this->userEmail
- ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
+ ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
}
$statusMsg .= ' ' . ts("An acknowledgment email has been sent to %1.<br />", array(1 => $this->userEmail));
"billing_mode IN ( 1, 3 )"
);
if (count($processors) > 0) {
- $statusMsg .= ' ' . ts("If a payment is due now, you can record <a href='%1'>a check, EFT, or cash payment for this pledge</a> OR <a href='%2'>submit a credit card payment</a>.", array(1 => $contribURL, 2 => $creditURL));
+ $statusMsg .= ' ' . ts("If a payment is due now, you can record <a href='%1'>a check, EFT, or cash payment for this pledge</a> OR <a href='%2'>submit a credit card payment</a>.", array(
+ 1 => $contribURL,
+ 2 => $creditURL
+ ));
}
else {
$statusMsg .= ' ' . ts("If a payment is due now, you can record <a href='%1'>a check, EFT, or cash payment for this pledge</a>.", array(1 => $contribURL));
if ($this->_context == 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/pledge/add',
- 'reset=1&action=add&context=standalone'
- ));
+ 'reset=1&action=add&context=standalone'
+ ));
}
else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view',
- "reset=1&cid={$this->_contactID}&selectedChild=pledge"
- ));
+ "reset=1&cid={$this->_contactID}&selectedChild=pledge"
+ ));
}
}
elseif ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/pledge',
- "reset=1&action=add&context=pledge&cid={$this->_contactID}"
- ));
+ "reset=1&action=add&context=pledge&cid={$this->_contactID}"
+ ));
}
}
}
-