• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_PCP_BAO_PCP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CRM_PCP_BAO_PCP的典型用法代码示例。如果您正苦于以下问题:PHP CRM_PCP_BAO_PCP类的具体用法?PHP CRM_PCP_BAO_PCP怎么用?PHP CRM_PCP_BAO_PCP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CRM_PCP_BAO_PCP类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: allForContact

 public static function allForContact($contactId)
 {
     $statusNames = CRM_Core_OptionGroup::values("pcp_status", FALSE, FALSE, FALSE, NULL, 'name');
     $query = "SELECT\r\n           pcp.id,\r\n           pcp.title,\r\n           pcp.status_id,\r\n           pcp.page_id,\r\n           count(cc.total_amount) as contribution_count,\r\n           sum(cc.total_amount) as amount_raised,\r\n           pcp.goal_amount,\r\n           pcp.currency\r\n      FROM civicrm_pcp pcp\r\n      LEFT JOIN civicrm_contribution_soft cs ON ( pcp.id = cs.pcp_id )\r\n      LEFT JOIN civicrm_contribution cc ON ( cs.contribution_id = cc.id)\r\n      WHERE pcp.contact_id = %1\r\n      GROUP BY pcp.id";
     $cpages = CRM_Core_DAO::executeQuery($query, array(1 => array($contactId, 'Integer')));
     $pages = array();
     while ($cpages->fetch()) {
         $pages[] = array('id' => $cpages->id, 'title' => $cpages->title, 'status' => $statusNames[$cpages->status_id], 'page' => CRM_PCP_BAO_PCP::getPcpPageTitle($cpages->page_id, 'contribute'), 'contribution_count' => $cpages->contribution_count, 'amount_raised' => $cpages->amount_raised, 'goal_amount' => $cpages->goal_amount, 'currency' => $cpages->currency);
     }
     return $pages;
 }
开发者ID:Agares4,项目名称:info.agares.contactpcp,代码行数:11,代码来源:CampaignPages.php


示例2: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     $id = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
     if (CRM_PCP_BAO_PCP::checkEmailProfile($id)) {
         $this->assign('profileDisplay', TRUE);
     }
     $fields = NULL;
     if ($this->_contactID) {
         if (CRM_Core_BAO_UFGroup::filterUFGroups($id, $this->_contactID)) {
             $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
         }
         $this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
     } else {
         CRM_Core_BAO_CMSUser::buildForm($this, $id, TRUE);
         $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
     }
     if ($fields) {
         $this->assign('fields', $fields);
         $addCaptcha = FALSE;
         foreach ($fields as $key => $field) {
             if (isset($field['data_type']) && $field['data_type'] == 'File') {
                 // ignore file upload fields
                 continue;
             }
             CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
             $this->_fields[$key] = $field;
             // CRM-11316 Is ReCAPTCHA enabled for this profile AND is this an anonymous visitor
             if ($field['add_captcha'] && !$this->_contactID) {
                 $addCaptcha = TRUE;
             }
         }
         if ($addCaptcha) {
             $captcha =& CRM_Utils_ReCAPTCHA::singleton();
             $captcha->add($this);
             $this->assign('isCaptcha', TRUE);
         }
     }
     if ($this->_component == 'contribute') {
         $this->assign('campaignName', CRM_Contribute_PseudoConstant::contributionPage($this->_pageId));
     } elseif ($this->_component == 'event') {
         $this->assign('campaignName', CRM_Event_PseudoConstant::event($this->_pageId));
     }
     if ($this->_single) {
         $button = array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => '         ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
     } else {
         $button[] = array('type' => 'next', 'name' => ts('Continue >>'), 'spacing' => '         ', 'isDefault' => TRUE);
     }
     $this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
     $this->addButtons($button);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:56,代码来源:PCPAccount.php


示例3: setDefaultValues

 /**
  * Function used to set defaults for soft credit block.
  *
  * @param $defaults
  * @param $form
  */
 public static function setDefaultValues(&$defaults, &$form)
 {
     //Used to hide/unhide PCP and/or Soft-credit Panes
     $noPCP = $noSoftCredit = TRUE;
     if (!empty($form->_softCreditInfo['soft_credit'])) {
         $noSoftCredit = FALSE;
         foreach ($form->_softCreditInfo['soft_credit'] as $key => $value) {
             $defaults["soft_credit_amount[{$key}]"] = CRM_Utils_Money::format($value['amount'], NULL, '%a');
             $defaults["soft_credit_contact_id[{$key}]"] = $value['contact_id'];
             $defaults["soft_credit_type[{$key}]"] = $value['soft_credit_type'];
         }
     }
     if (!empty($form->_softCreditInfo['pcp_id'])) {
         $noPCP = FALSE;
         $pcpInfo = $form->_softCreditInfo;
         $pcpId = CRM_Utils_Array::value('pcp_id', $pcpInfo);
         $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title');
         $contributionPageTitle = CRM_PCP_BAO_PCP::getPcpPageTitle($pcpId, 'contribute');
         $defaults['pcp_made_through'] = CRM_Utils_Array::value('sort_name', $pcpInfo) . " :: " . $pcpTitle . " :: " . $contributionPageTitle;
         $defaults['pcp_made_through_id'] = CRM_Utils_Array::value('pcp_id', $pcpInfo);
         $defaults['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcpInfo);
         $defaults['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcpInfo);
         $defaults['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcpInfo);
     }
     $form->assign('noSoftCredit', $noSoftCredit);
     $form->assign('noPCP', $noPCP);
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:33,代码来源:SoftCredit.php


示例4: preProcess


//.........这里部分代码省略.........
                             } else {
                                 $paymentsDue = $payments;
                             }
                         }
                     }
                     if ($multipleDue) {
                         // Show link to pledge tab since more than one pledge has a payment due
                         $pledgeTab = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=pledge");
                         CRM_Core_Session::setStatus(ts('This contact has pending or overdue pledge payments. <a href="%1">Click here to view their Pledges tab</a> and verify whether this contribution should be applied as a pledge payment.', array(1 => $pledgeTab)));
                     } elseif ($paymentsDue) {
                         // Show user link to oldest Pending or Overdue pledge payment
                         $ppAmountDue = CRM_Utils_Money::format($payments['amount'], $payments['currency']);
                         $ppSchedDate = CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $payments['id'], 'scheduled_date'));
                         if ($this->_mode) {
                             $ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge&mode=live");
                         } else {
                             $ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge");
                         }
                         CRM_Core_Session::setStatus(ts('This contact has a pending or overdue pledge payment of %2 which is scheduled for %3. <a href="%1">Click here to enter a pledge payment</a>.', array(1 => $ppUrl, 2 => $ppAmountDue, 3 => $ppSchedDate)));
                     }
                 }
             }
         }
     }
     $this->_values = array();
     // current contribution id
     if ($this->_id) {
         //to get Premium id
         $sql = "\nSELECT *\nFROM   civicrm_contribution_product\nWHERE  contribution_id = {$this->_id}\n";
         $dao = CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray);
         if ($dao->fetch()) {
             $this->_premiumID = $dao->id;
             $this->_productDAO = $dao;
         }
         $dao->free();
         $ids = array();
         $params = array('id' => $this->_id);
         CRM_Contribute_BAO_Contribution::getValues($params, $this->_values, $ids);
         //do check for online / recurring contributions
         $fids = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnIds($this->_id, 'civicrm_contribution');
         $this->_online = CRM_Utils_Array::value('entityFinancialTrxnId', $fids);
         //don't allow to update all fields for recuring contribution.
         if (!$this->_online) {
             $this->_online = CRM_Utils_Array::value('contribution_recur_id', $this->_values);
         }
         $this->assign('isOnline', $this->_online ? TRUE : FALSE);
         //unset the honor type id:when delete the honor_contact_id
         //and edit the contribution, honoree infomation pane open
         //since honor_type_id is present
         if (!CRM_Utils_Array::value('honor_contact_id', $this->_values)) {
             unset($this->_values['honor_type_id']);
         }
         //to get note id
         $daoNote = new CRM_Core_BAO_Note();
         $daoNote->entity_table = 'civicrm_contribution';
         $daoNote->entity_id = $this->_id;
         if ($daoNote->find(TRUE)) {
             $this->_noteID = $daoNote->id;
             $this->_values['note'] = $daoNote->note;
         }
         $this->_contributionType = $this->_values['contribution_type_id'];
         $csParams = array('contribution_id' => $this->_id);
         $softCredit = CRM_Contribute_BAO_Contribution::getSoftContribution($csParams, TRUE);
         if (CRM_Utils_Array::value('soft_credit_to', $softCredit)) {
             $softCredit['sort_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $softCredit['soft_credit_to'], 'sort_name');
         }
         $this->_values['soft_credit_to'] = CRM_Utils_Array::value('sort_name', $softCredit);
         $this->_values['softID'] = CRM_Utils_Array::value('soft_credit_id', $softCredit);
         $this->_values['soft_contact_id'] = CRM_Utils_Array::value('soft_credit_to', $softCredit);
         if (CRM_Utils_Array::value('pcp_id', $softCredit)) {
             $pcpId = CRM_Utils_Array::value('pcp_id', $softCredit);
             $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title');
             $contributionPageTitle = CRM_PCP_BAO_PCP::getPcpPageTitle($pcpId, 'contribute');
             $this->_values['pcp_made_through'] = CRM_Utils_Array::value('sort_name', $softCredit) . " :: " . $pcpTitle . " :: " . $contributionPageTitle;
             $this->_values['pcp_made_through_id'] = CRM_Utils_Array::value('pcp_id', $softCredit);
             $this->_values['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $softCredit);
             $this->_values['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $softCredit);
             $this->_values['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $softCredit);
         }
         //display check number field only if its having value or its offline mode.
         if (CRM_Utils_Array::value('payment_instrument_id', $this->_values) == CRM_Core_OptionGroup::getValue('payment_instrument', 'Check', 'name') || CRM_Utils_Array::value('check_number', $this->_values)) {
             $this->assign('showCheckNumber', TRUE);
         }
     }
     // when custom data is included in this page
     if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
         $this->set('type', 'Contribution');
         $this->set('subType', CRM_Utils_Array::value('contribution_type_id', $_POST));
         $this->set('entityId', $this->_id);
         CRM_Custom_Form_CustomData::preProcess($this);
         CRM_Custom_Form_CustomData::buildQuickForm($this);
         CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     $this->_lineItems = array();
     if ($this->_id) {
         $lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution', 1);
         empty($lineItem) ? null : ($this->_lineItems[] = $lineItem);
     }
     $this->assign('lineItem', empty($this->_lineItems) ? FALSE : $this->_lineItems);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Contribution.php


示例5: civicrm_api3_pcpteams_delete

function civicrm_api3_pcpteams_delete($params)
{
    //check permission to delete
    $permParams = array('pcp_id' => $params['id']);
    if (!_civicrm_pcpteams_permission_check($permParams, CRM_Core_Permission::EDIT)) {
        return civicrm_api3_create_error('insufficient permission to delete this record');
    }
    $result = array();
    CRM_PCP_BAO_PCP::deleteById($params['id']);
    return civicrm_api3_create_success($result, $params);
}
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:11,代码来源:Pcpteams.php


示例6: postProcess

 /**
  * Process the form submission.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     // get the submitted form values.
     $formValues = $this->controller->exportValues($this->_name);
     $formValues['entity_id'] = $this->_entityId;
     $formValues['entity_table'] = $this->_entityTable;
     $formValues['source_contact_id'] = $this->_contactID;
     $formValues['is_test'] = $this->_action ? 1 : 0;
     $formValues['title'] = $this->_title;
     $formValues['campaign_id'] = $this->_campaignId;
     CRM_Friend_BAO_Friend::create($formValues);
     $this->assign('status', 'thankyou');
     $defaults = array();
     $defaults['entity_id'] = $this->_entityId;
     $defaults['entity_table'] = $this->_entityTable;
     CRM_Friend_BAO_Friend::getValues($defaults);
     if ($this->_entityTable == 'civicrm_pcp') {
         $defaults['thankyou_text'] = $defaults['thankyou_title'] = ts('Thank you for your support');
         $defaults['thankyou_text'] = ts('Thanks for supporting this campaign by spreading the word to your friends.');
     } elseif ($this->_entityTable == 'civicrm_contribution_page') {
         // If this is tell a friend after contributing, give donor link to create their own fundraising page
         if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($defaults['entity_id'], $defaults['entity_table'])) {
             $linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', "action=add&reset=1&pageId={$defaults['entity_id']}&component=contribute", FALSE, NULL, TRUE, TRUE);
             $this->assign('linkTextUrl', $linkTextUrl);
             $this->assign('linkText', $linkText);
         }
     } elseif ($this->_entityTable == 'civicrm_event') {
         // If this is tell a friend after registering for an event, give donor link to create their own fundraising page
         require_once 'CRM/PCP/BAO/PCP.php';
         if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($defaults['entity_id'], $defaults['entity_table'])) {
             $linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', "action=add&reset=1&pageId={$defaults['entity_id']}&component=event", FALSE, NULL, TRUE, TRUE);
             $this->assign('linkTextUrl', $linkTextUrl);
             $this->assign('linkText', $linkText);
         }
     }
     CRM_Utils_System::setTitle($defaults['thankyou_title']);
     $this->assign('thankYouText', $defaults['thankyou_text']);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:44,代码来源:Form.php


示例7: buildQuickForm


//.........这里部分代码省略.........
     if ($this->_priceSetId && empty($this->_ccid)) {
         $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
         if ($is_quick_config) {
             $this->_useForMember = 0;
             $this->set('useForMember', $this->_useForMember);
         }
     }
     //we allow premium for pledge during pledge creation only.
     if (empty($this->_values['pledge_id']) && empty($this->_ccid)) {
         CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE);
     }
     //don't build pledge block when mid is passed
     if (!$this->_mid && empty($this->_ccid)) {
         $config = CRM_Core_Config::singleton();
         if (in_array('CiviPledge', $config->enableComponents) && !empty($this->_values['pledge_block_id'])) {
             CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this);
         }
     }
     //to create an cms user
     if (!$this->_contactID && empty($this->_ccid)) {
         $createCMSUser = FALSE;
         if ($this->_values['custom_pre_id']) {
             $profileID = $this->_values['custom_pre_id'];
             $createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
         }
         if (!$createCMSUser && $this->_values['custom_post_id']) {
             if (!is_array($this->_values['custom_post_id'])) {
                 $profileIDs = array($this->_values['custom_post_id']);
             } else {
                 $profileIDs = $this->_values['custom_post_id'];
             }
             foreach ($profileIDs as $pid) {
                 if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $pid, 'is_cms_user')) {
                     $profileID = $pid;
                     $createCMSUser = TRUE;
                     break;
                 }
             }
         }
         if ($createCMSUser) {
             CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE);
         }
     }
     if ($this->_pcpId && empty($this->_ccid)) {
         if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($this->_pcpId)) {
             $pcp_supporter_text = ts('This contribution is being made thanks to the effort of <strong>%1</strong>, who supports our campaign.', array(1 => $pcpSupporter));
             // Only tell people that can also create a PCP if the contribution page has a non-empty value in the "Create Personal Campaign Page link" field.
             $text = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute');
             if (!empty($text)) {
                 $pcp_supporter_text .= ts("You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!");
             }
             $this->assign('pcpSupporterText', $pcp_supporter_text);
         }
         $prms = array('id' => $this->_pcpId);
         CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
         if ($pcpInfo['is_honor_roll']) {
             $this->assign('isHonor', TRUE);
             $this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );"));
             $extraOption = array('onclick' => "return pcpAnonymous( );");
             $elements = array();
             $elements[] =& $this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
             $elements[] =& $this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption);
             $this->addGroup($elements, 'pcp_is_anonymous', NULL, '&nbsp;&nbsp;&nbsp;');
             $this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
             $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
         }
     }
     if (empty($this->_values['fee']) && empty($this->_ccid)) {
         CRM_Core_Error::fatal(ts('This page does not have any price fields configured or you may not have permission for them. Please contact the site administrator for more details.'));
     }
     //we have to load confirm contribution button in template
     //when multiple payment processor as the user
     //can toggle with payment processor selection
     $billingModePaymentProcessors = 0;
     if (!empty($this->_paymentProcessors)) {
         foreach ($this->_paymentProcessors as $key => $values) {
             if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) {
                 $billingModePaymentProcessors++;
             }
         }
     }
     if ($billingModePaymentProcessors && count($this->_paymentProcessors) == $billingModePaymentProcessors) {
         $allAreBillingModeProcessors = TRUE;
     } else {
         $allAreBillingModeProcessors = FALSE;
     }
     if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) {
         $submitButton = array('type' => 'upload', 'name' => CRM_Utils_Array::value('is_confirm_enabled', $this->_values) ? ts('Confirm Contribution') : ts('Contribute'), 'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'isDefault' => TRUE);
         // Add submit-once behavior when confirm page disabled
         if (empty($this->_values['is_confirm_enabled'])) {
             $submitButton['js'] = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
         }
         //change button name for updating contribution
         if (!empty($this->_ccid)) {
             $submitButton['name'] = ts('Confirm Payment');
         }
         $this->addButtons(array($submitButton));
     }
     $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:101,代码来源:Main.php


示例8: browse

 /**
  * Browse all custom data groups.
  *
  *
  * @param null $action
  *
  * @return void
  * @access public
  * @static
  */
 function browse($action = NULL)
 {
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     if ($this->_sortByCharacter == 1 || !empty($_POST)) {
         $this->_sortByCharacter = '';
     }
     $status = CRM_PCP_BAO_PCP::buildOptions('status_id', 'create');
     $pcpSummary = $params = array();
     $whereClause = NULL;
     if (!empty($_POST) || !empty($_GET['page_type'])) {
         if (!empty($_POST['status_id'])) {
             $whereClause = ' AND cp.status_id = %1';
             $params['1'] = array($_POST['status_id'], 'Integer');
         }
         if (!empty($_POST['page_type'])) {
             $whereClause .= ' AND cp.page_type = %2';
             $params['2'] = array($_POST['page_type'], 'String');
         } elseif (!empty($_GET['page_type'])) {
             $whereClause .= ' AND cp.page_type = %2';
             $params['2'] = array($_GET['page_type'], 'String');
         }
         if (!empty($_POST['page_id'])) {
             $whereClause .= ' AND cp.page_id = %4 AND cp.page_type = "contribute"';
             $params['4'] = array($_POST['page_id'], 'Integer');
         }
         if (!empty($_POST['event_id'])) {
             $whereClause .= ' AND cp.page_id = %5 AND cp.page_type = "event"';
             $params['5'] = array($_POST['event_id'], 'Integer');
         }
         if ($whereClause) {
             $this->set('whereClause', $whereClause);
             $this->set('params', $params);
         } else {
             $this->set('whereClause', NULL);
             $this->set('params', NULL);
         }
     }
     $approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
     //check for delete CRM-4418
     $allowToDelete = CRM_Core_Permission::check('delete in CiviContribute');
     // get all contribution pages
     $query = "SELECT id, title, start_date, end_date FROM civicrm_contribution_page WHERE (1)";
     $cpages = CRM_Core_DAO::executeQuery($query);
     while ($cpages->fetch()) {
         $pages['contribute'][$cpages->id]['id'] = $cpages->id;
         $pages['contribute'][$cpages->id]['title'] = $cpages->title;
         $pages['contribute'][$cpages->id]['start_date'] = $cpages->start_date;
         $pages['contribute'][$cpages->id]['end_date'] = $cpages->end_date;
     }
     // get all event pages. pcp campaign start and end dates for event related pcp's use the online registration start and end dates,
     // altho if target is contribution page this might not be correct. fixme? dgg
     $query = "SELECT id, title, start_date, end_date, registration_start_date, registration_end_date\n                  FROM civicrm_event\n                  WHERE is_template IS NULL OR is_template != 1";
     $epages = CRM_Core_DAO::executeQuery($query);
     while ($epages->fetch()) {
         $pages['event'][$epages->id]['id'] = $epages->id;
         $pages['event'][$epages->id]['title'] = $epages->title;
         $pages['event'][$epages->id]['start_date'] = $epages->registration_start_date;
         $pages['event'][$epages->id]['end_date'] = $epages->registration_end_date;
     }
     $params = $this->get('params') ? $this->get('params') : array();
     $title = '1';
     if ($this->_sortByCharacter !== NULL) {
         $clauses[] = "cp.title LIKE '" . strtolower(CRM_Core_DAO::escapeWildCardString($this->_sortByCharacter)) . "%'";
     }
     $query = "\n        SELECT cp.id, cp.contact_id , cp.status_id, cp.title, cp.is_active, cp.page_type, cp.page_id\n        FROM civicrm_pcp cp\n        WHERE {$title}" . $this->get('whereClause') . " ORDER BY cp.status_id";
     $pcp = CRM_Core_DAO::executeQuery($query, $params);
     while ($pcp->fetch()) {
         $action = array_sum(array_keys($this->links()));
         $contact = CRM_Contact_BAO_Contact::getDisplayAndImage($pcp->contact_id);
         $class = '';
         if ($pcp->status_id != $approvedId || $pcp->is_active != 1) {
             $class = 'disabled';
         }
         switch ($pcp->status_id) {
             case 2:
                 $action -= CRM_Core_Action::RENEW;
                 break;
             case 3:
                 $action -= CRM_Core_Action::REVERT;
                 break;
         }
         switch ($pcp->is_active) {
             case 1:
                 $action -= CRM_Core_Action::ENABLE;
                 break;
             case 0:
                 $action -= CRM_Core_Action::DISABLE;
                 break;
         }
         if (!$allowToDelete) {
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:PCP.php


示例9: run

 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  *
  * @param
  *
  * @return void
  * @access public
  */
 function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     if ($action & CRM_Core_Action::REVERT) {
         $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
         CRM_PCP_BAO_PCP::setIsActive($id, 0);
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
     } elseif ($action & CRM_Core_Action::RENEW) {
         $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
         CRM_PCP_BAO_PCP::setIsActive($id, 1);
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
     } elseif ($action & CRM_Core_Action::DELETE) {
         $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
         $controller = new CRM_Core_Controller_Simple('CRM_PCP_Form_PCP', 'Personal Campaign Page', CRM_Core_Action::DELETE);
         //$this->setContext( $id, $action );
         $controller->set('id', $id);
         $controller->process();
         return $controller->run();
     }
     // finally browse
     $this->browse();
     // parent run
     parent::run();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:41,代码来源:PCP.php


示例10: formRule

 /**
  * Validation.
  *
  * @param array $params
  *   (ref.) an assoc array of name/value pairs.
  *
  * @param $files
  * @param $self
  *
  * @return bool|array
  *   mixed true or array of errors
  */
 public static function formRule($params, $files, $self)
 {
     $errors = array();
     if (!empty($params['is_active'])) {
         if (!empty($params['is_tellfriend_enabled']) && CRM_Utils_Array::value('tellfriend_limit', $params) <= 0) {
             $errors['tellfriend_limit'] = ts('if Tell Friend is enabled, Maximum recipients limit should be greater than zero.');
         }
         if (empty($params['supporter_profile_id'])) {
             $errors['supporter_profile_id'] = ts('Supporter profile is a required field.');
         } else {
             if (CRM_PCP_BAO_PCP::checkEmailProfile($params['supporter_profile_id'])) {
                 $errors['supporter_profile_id'] = ts('Profile is not configured with Email address.');
             }
         }
         if ($emails = CRM_Utils_Array::value('notify_email', $params)) {
             $emailArray = explode(',', $emails);
             foreach ($emailArray as $email) {
                 if ($email && !CRM_Utils_Rule::email(trim($email))) {
                     $errors['notify_email'] = ts('A valid Notify Email address must be specified');
                 }
             }
         }
     }
     return empty($errors) ? TRUE : $errors;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:37,代码来源:Contribute.php


示例11: postProcess

 /**
  * Process the form
  *
  * @param null
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_PCP_BAO_PCP::deleteById($this->_id);
         CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $this->_title)), ts('Page Deleted'), 'success');
     } else {
         $params = $this->controller->exportValues($this->_name);
         $parent = $this->controller->getParent();
         if (!empty($params)) {
             $fields = array('status_id', 'page_id');
             foreach ($fields as $field) {
                 if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) {
                     $parent->set($field, $params[$field]);
                 } else {
                     $parent->set($field, NULL);
                 }
             }
         }
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:28,代码来源:PCP.php


示例12: buildQuickForm


//.........这里部分代码省略.........
         if ($this->_values['is_monetary'] && $this->_values['is_recur'] && !CRM_Utils_Array::value('pledge_id', $this->_values)) {
             self::buildRecur($this);
         }
     } elseif (CRM_Utils_Array::value('amount_block_is_active', $this->_values) && !CRM_Utils_Array::value('pledge_id', $this->_values)) {
         $this->buildAmount($this->_separateMembershipPayment);
     }
     if ($this->_priceSetId) {
         $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config');
         if ($is_quick_config) {
             $this->_useForMember = 0;
             $this->set('useForMember', $this->_useForMember);
         }
     }
     if ($this->_values['is_for_organization']) {
         $this->buildOnBehalfOrganization();
     }
     //we allow premium for pledge during pledge creation only.
     if (!CRM_Utils_Array::value('pledge_id', $this->_values)) {
         CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE);
     }
     if ($this->_values['honor_block_is_active']) {
         $this->buildHonorBlock();
     }
     //don't build pledge block when mid is passed
     if (!$this->_mid) {
         $config = CRM_Core_Config::singleton();
         if (in_array('CiviPledge', $config->enableComponents) && CRM_Utils_Array::value('pledge_block_id', $this->_values)) {
             CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this);
         }
     }
     $this->buildCustom($this->_values['custom_pre_id'], 'customPre');
     $this->buildCustom($this->_values['custom_post_id'], 'customPost');
     if (!empty($this->_fields)) {
         $profileAddressFields = array();
         foreach ($this->_fields as $key => $value) {
             CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields);
         }
         $this->set('profileAddressFields', $profileAddressFields);
     }
     //to create an cms user
     if (!$this->_userID) {
         $createCMSUser = FALSE;
         if ($this->_values['custom_pre_id']) {
             $profileID = $this->_values['custom_pre_id'];
             $createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
         }
         if (!$createCMSUser && $this->_values['custom_post_id']) {
             if (!is_array($this->_values['custom_post_id'])) {
                 $profileIDs = array($this->_values['custom_post_id']);
             } else {
                 $profileIDs = $this->_values['custom_post_id'];
             }
             foreach ($profileIDs as $pid) {
                 if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $pid, 'is_cms_user')) {
                     $profileID = $pid;
                     $createCMSUser = TRUE;
                     break;
                 }
             }
         }
         if ($createCMSUser) {
             CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE);
         }
     }
     if ($this->_pcpId) {
         if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($this->_pcpId)) {
             $this->assign('pcpSupporterText', ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter)));
         }
         $this->assign('pcp', TRUE);
         $this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );"));
         $extraOption = array('onclick' => "return pcpAnonymous( );");
         $elements = array();
         $elements[] =& $this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
         $elements[] =& $this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption);
         $this->addGroup($elements, 'pcp_is_anonymous', NULL, '&nbsp;&nbsp;&nbsp;');
         $this->_defaults['pcp_is_anonymous'] = 0;
         $this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
         $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
     }
     //we have to load confirm contribution button in template
     //when multiple payment processor as the user
     //can toggle with payment processor selection
     $billingModePaymentProcessors = 0;
     if (!empty($this->_paymentProcessors)) {
         foreach ($this->_paymentProcessors as $key => $values) {
             if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) {
                 $billingModePaymentProcessors++;
             }
         }
     }
     if ($billingModePaymentProcessors && count($this->_paymentProcessors) == $billingModePaymentProcessors) {
         $allAreBillingModeProcessors = TRUE;
     } else {
         $allAreBillingModeProcessors = FALSE;
     }
     if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) {
         $this->addButtons(array(array('type' => 'upload', 'name' => ts('Confirm Contribution'), 'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'isDefault' => TRUE)));
     }
     $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Main.php


示例13: setDefaultValues

 /**
  * Function used to set defaults for soft credit block
  */
 static function setDefaultValues(&$defaults, &$form)
 {
     if (!empty($form->_softCreditInfo['soft_credit'])) {
         foreach ($form->_softCreditInfo['soft_credit'] as $key => $value) {
             $defaults["soft_credit_amount[{$key}]"] = CRM_Utils_Money::format($value['amount'], NULL, '%a');
             $defaults["soft_credit_contact_select_id[{$key}]"] = $value['contact_id'];
             $defaults["soft_credit_type[{$key}]"] = $value['soft_credit_type'];
         }
     } elseif (!empty($form->_softCreditInfo['pcp_id'])) {
         $pcpInfo = $form->_softCreditInfo;
         $pcpId = CRM_Utils_Array::value('pcp_id', $pcpInfo);
         $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title');
         $contributionPageTitle = CRM_PCP_BAO_PCP::getPcpPageTitle($pcpId, 'contribute');
         $defaults['pcp_made_through'] = CRM_Utils_Array::value('sort_name', $pcpInfo) . " :: " . $pcpTitle . " :: " . $contributionPageTitle;
         $defaults['pcp_made_through_id'] = CRM_Utils_Array::value('pcp_id', $pcpInfo);
         $defaults['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcpInfo);
         $defaults['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcpInfo);
         $defaults['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcpInfo);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:23,代码来源:SoftCredit.php


示例14: buildUserDashBoard

 /**
  * Function to build user dashboard
  *
  * @return void
  * @access public
  */
 function buildUserDashBoard()
 {
     //build component selectors
     $dashboardElements = array();
     $config = CRM_Core_Config::singleton();
     $this->_userOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'user_dashboard_options');
     $components = CRM_Core_Component::getEnabledComponents();
     $this->assign('contactId', $this->_contactId);
     foreach ($components as $name => $component) {
         $elem = $component->getUserDashboardElement();
         if (!$elem) {
             continue;
         }
         if (!empty($this->_userOptions[$name]) && (CRM_Core_Permission::access($component->name) || CRM_Core_Permission::check($elem['perm'][0]))) {
             $userDashboard = $component->getUserDashboardObject();
             $dashboardElements[] = array('class' => 'crm-dashboard-' . strtolower($component->name), 'sectionTitle' => $elem['title'], 'templatePath' => $userDashboard->getTemplateFileName(), 'weight' => $elem['weight']);
             $userDashboard->run();
         }
     }
     if (!empty($this->_userOptions['Permissioned Orgs'])) {
         $dashboardElements[] = array('class' => 'crm-dashboard-permissionedOrgs', 'templatePath' => 'CRM/Contact/Page/View/RelationshipSelector.tpl', 'sectionTitle' => ts('Your Contacts / Organizations'), 'weight' => 40);
     }
     if (!empty($this->_userOptions['PCP'])) {
         $dashboardElements[] = array('class' => 'crm-dashboard-pcp', 'templatePath' => 'CRM/Contribute/Page/PcpUserDashboard.tpl', 'sectionTitle' => ts('Personal Campaign Pages'), 'weight' => 40);
         list($pcpBlock, $pcpInfo) = CRM_PCP_BAO_PCP::getPcpDashboardInfo($this->_contactId);
         $this->assign('pcpBlock', $pcpBlock);
         $this->assign('pcpInfo', $pcpInfo);
     }
     if (!empty($this->_userOptions['Assigned Activities'])) {
         // Assigned Activities section
         $dashboardElements[] = array('class' => 'crm-dashboard-assignedActivities', 'templatePath' => 'CRM/Activity/Page/UserDashboard.tpl', 'sectionTitle' => ts('Your Assigned Activities'), 'weight' => 5);
         $userDashboard = new CRM_Activity_Page_UserDashboard();
         $userDashboard->run();
     }
     usort($dashboardElements, array('CRM_Utils_Sort', 'cmpFunc'));
     $this->assign('dashboardElements', $dashboardElements);
     if (!empty($this->_userOptions['Groups'])) {
         $this->assign('showGroup', TRUE);
         //build group selector
         $gContact = new CRM_Contact_Page_View_UserDashBoard_GroupContact();
         $gContact->run();
     } else {
         $this->assign('showGroup', FALSE);
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:51,代码来源:UserDashBoard.php


示例15: preProcess


//.........这里部分代码省略.........
                     foreach ($this->_paymentProcessors as $eachPaymentProcessor) {
                         // check selected payment processor is active
                         if (!$eachPaymentProcessor) {
                             CRM_Core_Error::fatal(ts('The site administrator must set a Payment Processor for this event in order to use online registration.'));
                         }
                         // ensure that processor has a valid config
                         $payment = CRM_Core_Payment::singleton($this->_mode, $eachPaymentProcessor, $this);
                         $error = $payment->checkConfig();
                         if (!empty($error)) {
                             CRM_Core_Error::fatal($error);
                         }
                     }
                 }
             }
         }
         //init event fee.
         self::initEventFee($this, $this->_eventId);
         // get the profile ids
         $ufJoinParams = array('entity_table' => 'civicrm_event', 'module' => 'CiviEvent', 'entity_id' => $this->_eventId);
         list($this->_values['custom_pre_id'], $this->_values['custom_post_id']) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
         // set profiles for additional participants
         if ($this->_values['event']['is_multiple_registrations']) {
             // CRM-4377: CiviEvent for the main participant, CiviEvent_Additional for additional participants
             $ufJoinParams['module'] = 'CiviEvent_Additional';
             list($this->_values['additional_custom_pre_id'], $this->_values['additional_custom_post_id'], $preActive, $postActive) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
             // CRM-4377: we need to maintain backward compatibility, hence if there is profile for main contact
             // set same profile for additional contacts.
             if ($this->_values['custom_pre_id'] && !$this->_values['additional_custom_pre_id']) {
                 $this->_values['additional_custom_pre_id'] = $this->_values['custom_pre_id'];
             }
             if ($this->_values['custom_post_id'] && !$this->_values['additional_custom_post_id']) {
                 $this->_values['addi 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Pledge_BAO_Pledge类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Member_PseudoConstant类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap