Ejemplo n.º 1
0
 function create($contributionPageId)
 {
     $profileParams = array('group_type' => 'Individual,Contact', 'title' => 'Test Supprorter Profile', 'help_pre' => 'Profle to PCP Contribution', 'is_active' => 1, 'is_cms_user' => 2);
     $ufGroup = civicrm_uf_group_create($profileParams);
     $profileId = $ufGroup['id'];
     $fieldsParams = array(array('field_name' => 'first_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 1, 'label' => 'First Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'last_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 2, 'label' => 'Last Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'email', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', 'weight' => 3, 'label' => 'Email', 'is_required' => 1, 'is_active' => 1));
     foreach ($fieldsParams as $value) {
         $ufField = civicrm_uf_field_create($profileId, $value);
     }
     $joinParams = array('module' => 'Profile', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $profileId, 'is_active' => 1);
     require_once 'api/v2/UFJoin.php';
     $ufJoin = civicrm_uf_join_add($joinParams);
     $params = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $contributionPageId, 'supporter_profile_id' => $profileId, 'is_approval_needed' => 0, 'is_tellfriend_enabled' => 0, 'tellfriend_limit' => 0, 'link_text' => 'Create your own Personal Campaign Page!', 'is_active' => 1, 'notify_email' => '*****@*****.**');
     require_once 'CRM/Contribute/BAO/PCP.php';
     $blockPCP = CRM_Contribute_BAO_PCP::add($params);
     return array('blockId' => $blockPCP->id, 'profileId' => $profileId);
 }
Ejemplo n.º 2
0
 /**
  * deleting field
  */
 public function testDeleteUFField()
 {
     $params = array('field_name' => 'country', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', 'weight' => 1, 'location_type_id' => 1, 'label' => 'Test Country', 'is_searchable' => 1, 'is_active' => 1);
     $ufField = civicrm_uf_field_create($this->_ufGroupId, $params);
     $this->_ufFieldId = $ufField['id'];
     foreach ($params as $key => $value) {
         $this->assertEquals($ufField[$key], $params[$key]);
     }
     $result = civicrm_uf_field_delete($ufField['id']);
     $this->assertEquals($result, true);
 }
Ejemplo n.º 3
0
 /**
  * test buildCustomDisplay() method
  */
 function testbuildCustomDisplay()
 {
     $this->markTestSkipped('throws fatals');
     $fieldsParams = array(array('field_name' => 'first_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 1, 'label' => 'First Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'last_name', 'field_type' => 'Individual', 'visibility' => 'Public Pages and Listings', 'weight' => 2, 'label' => 'Last Name', 'is_required' => 1, 'is_active' => 1), array('field_name' => 'email', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', 'weight' => 3, 'label' => 'Email', 'is_required' => 1, 'is_active' => 1));
     foreach ($fieldsParams as $value) {
         $ufField = civicrm_uf_field_create($profileId, $value);
     }
     $joinParams = array('module' => 'Profile', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $profileId, 'is_active' => 1);
     require_once 'api/v2/UFJoin.php';
     $ufJoin = civicrm_uf_join_add($joinParams);
     $params = array('title' => 'Test Cotribution Page', 'contribution_type_id' => $this->_contributionTypeID, 'is_active' => 1, 'custom_post_id' => $profileId);
     require_once 'CRM/Contribute/BAO/ContributionPage.php';
     $contributionpage = CRM_Contribute_BAO_ContributionPage::create($params, $ids);
     $id = $contributionpage->id;
     $values = array();
 }