コード例 #1
0
 function buildQuickForm()
 {
     $eventDetails = CRM_Pcpteams_Utils::getEventDetailsbyEventId($this->controller->get('component_page_id'));
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Yes I do'), 'isDefault' => TRUE)));
     // export form elements
     $this->assign('eventDetails', $eventDetails);
     $this->assign('elementNames', $this->getRenderableElementNames());
     parent::buildQuickForm();
 }
コード例 #2
0
 static function createDefaultPcp($pcpContactId, $componentPageId, $component = 'event')
 {
     if (empty($pcpContactId) || empty($componentPageId)) {
         return FALSE;
     }
     $eventDetails = CRM_Pcpteams_Utils::getEventDetailsbyEventId($componentPageId);
     $contactDisplayName = CRM_Contact_BAO_Contact::displayName($pcpContactId);
     $pcpResult = civicrm_api('Pcpteams', 'create', array('version' => 3, 'title' => $contactDisplayName . ' : ' . $eventDetails['title'], 'intro_text' => "Welcome to " . $contactDisplayName . '\'s PCP', 'contact_id' => $pcpContactId, 'page_id' => $componentPageId, 'page_type' => $component, 'goal_amount' => '0.00'));
     if (!civicrm_error($pcpResult) && $pcpResult['id']) {
         //create activity for pcp created.
         $ids = array('target_contact_id' => $pcpContactId);
         $userId = self::getloggedInUserId();
         $customDigFund = CRM_Core_BAO_CustomField::getCustomFieldID(CRM_Pcpteams_Constant::C_CF_DIGITAL_FUNDRAISING_PCP_ID, CRM_Pcpteams_Constant::C_CG_DIGITAL_FUNDRAISING);
         if ($customDigFund) {
             $ids["custom_{$customDigFund}"] = $pcpResult['id'];
         }
         if ($userId != $pcpContactId) {
             $ids['source_contact_id'] = $userId;
         }
         $activityName = $subject = CRM_Pcpteams_Constant::C_AT_PCP_CREATED;
         $desc = 'New PCP has created';
         self::createPcpActivity($ids, $activityName);
         return $pcpResult['id'];
     }
     return NULL;
 }