当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_UFJoin::findUFGroupId方法代码示例

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


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

示例1: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  * @param null
  *
  * @return array    array of default values
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     $ufJoinParams = array('entity_table' => 'civicrm_survey', 'entity_id' => $this->_surveyId, 'weight' => 2);
     if ($ufGroupId = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams)) {
         $defaults['contact_profile_id'] = $ufGroupId;
     }
     return $defaults;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:18,代码来源:Petition.php

示例2: setDefaultValues

 /** 
  * This function sets the default values for the form. Note that in edit/view mode 
  * the default values are retrieved from the database 
  * 
  * @access public 
  * @return void 
  */
 function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     require_once 'CRM/Core/BAO/UFJoin.php';
     $ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id, 'weight' => 1);
     $defaults['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
     $ufJoinParams['weight'] = 2;
     $defaults['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
     return $defaults;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:17,代码来源:Custom.php

示例3: preProcess

 /** 
  * Function to set variables up before form is built 
  *                                                           
  * @return void 
  * @access public 
  */
 function preProcess()
 {
     // current contribution page id
     $this->_id = $this->get('id');
     // get all the values from the dao object
     $params = array('id' => $this->_id);
     $this->_values = array();
     CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $this->_values);
     // get the amounts and the label
     require_once 'CRM/Core/BAO/CustomOption.php';
     CRM_Core_BAO_CustomOption::getAssoc('civicrm_contribution_page', $this->_id, $this->_values);
     // get the profile ids
     require_once 'CRM/Core/BAO/UFJoin.php';
     $ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id, 'weight' => 1);
     $this->_values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
     $ufJoinParams['weight'] = 2;
     $this->_values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:24,代码来源:Preview.php

示例4: preProcess

 public function preProcess()
 {
     $this->bao = new CRM_Campaign_BAO_Petition();
     $this->_mode = self::MODE_CREATE;
     //get the survey id
     $this->_surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
     //some sanity checks
     if (!$this->_surveyId) {
         CRM_Core_Error::fatal('Petition id is not valid. (it needs a "sid" in the url).');
         return;
     }
     //check petition is valid and active
     $params['id'] = $this->_surveyId;
     $this->petition = array();
     CRM_Campaign_BAO_Survey::retrieve($params, $this->petition);
     if (empty($this->petition)) {
         CRM_Core_Error::fatal('Petition doesn\'t exist.');
     }
     if ($this->petition['is_active'] == 0) {
         CRM_Core_Error::fatal('Petition is no longer active.');
     }
     //get userID from session
     $session = CRM_Core_Session::singleton();
     //get the contact id for this user if logged in
     $this->_contactId = $this->getContactId();
     if (isset($this->_contactId)) {
         $this->_loggedIn = TRUE;
     }
     // add the custom contact and activity profile fields to the signature form
     $ufJoinParams = array('entity_id' => $this->_surveyId, 'entity_table' => 'civicrm_survey', 'module' => 'CiviCampaign', 'weight' => 2);
     $this->_contactProfileId = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
     if ($this->_contactProfileId) {
         $this->_contactProfileFields = CRM_Core_BAO_UFGroup::getFields($this->_contactProfileId, FALSE, CRM_Core_Action::ADD);
     }
     if (!isset($this->_contactProfileFields['email-Primary'])) {
         CRM_Core_Error::fatal('The contact profile needs to contain the primary email address field');
     }
     $ufJoinParams['weight'] = 1;
     $this->_activityProfileId = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
     if ($this->_activityProfileId) {
         $this->_activityProfileFields = CRM_Core_BAO_UFGroup::getFields($this->_activityProfileId, FALSE, CRM_Core_Action::ADD);
     }
     $this->setDefaultValues();
     CRM_Utils_System::setTitle($this->petition['title']);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:45,代码来源:Signature.php

示例5: postProcess

 /**
  * Process the form.
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     // we do this in case the user has hit the forward/back button
     if ($this->_id) {
         $params['id'] = $this->_id;
     } else {
         $session = CRM_Core_Session::singleton();
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = date('YmdHis');
         $config = CRM_Core_Config::singleton();
         $params['currency'] = $config->defaultCurrency;
     }
     $params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
     $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
     $params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
     $params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
     $params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
     $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
     $params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
     $params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
     if (!$params['honor_block_is_active']) {
         $params['honor_block_title'] = NULL;
         $params['honor_block_text'] = NULL;
     }
     $dao = CRM_Contribute_BAO_ContributionPage::create($params);
     $ufJoinParams = array('is_organization' => array('module' => 'on_behalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id), 'honor_block_is_active' => array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id));
     foreach ($ufJoinParams as $index => $ufJoinParam) {
         if (!empty($params[$index])) {
             // first delete all past entries
             CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam);
             $ufJoinParam['uf_group_id'] = $params[$index];
             $ufJoinParam['weight'] = 1;
             $ufJoinParam['is_active'] = 1;
             if ($index == 'honor_block_is_active') {
                 $ufJoinParam['uf_group_id'] = $params['honoree_profile'];
                 $ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'soft_credit');
             } else {
                 $ufJoinParam['uf_group_id'] = $params['onbehalf_profile_id'];
                 $ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'on_behalf');
             }
             CRM_Core_BAO_UFJoin::create($ufJoinParam);
         } else {
             if ($index == 'honor_block_is_active') {
                 $params['honor_block_title'] = NULL;
                 $params['honor_block_text'] = NULL;
             } else {
                 $params['for_organization'] = NULL;
             }
             //On subsequent honor_block_is_active uncheck, disable(don't delete)
             //that particular honoree profile entry in UFjoin table, CRM-13981
             $ufId = CRM_Core_BAO_UFJoin::findJoinEntryId($ufJoinParam);
             if ($ufId) {
                 $ufJoinParam['uf_group_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParam);
                 $ufJoinParam['is_active'] = 0;
                 CRM_Core_BAO_UFJoin::create($ufJoinParam);
             }
         }
     }
     $this->set('id', $dao->id);
     if ($this->_action & CRM_Core_Action::ADD) {
         $url = 'civicrm/admin/contribute/amount';
         $urlParams = "action=update&reset=1&id={$dao->id}";
         // special case for 'Save and Done' consistency.
         if ($this->controller->getButtonName('submit') == '_qf_Amount_upload_done') {
             $url = 'civicrm/admin/contribute';
             $urlParams = 'reset=1';
             CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())), ts('Saved'), 'success');
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
     }
     parent::endPostProcess();
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:78,代码来源:Settings.php

示例6: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     //format params
     $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
     $params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], true);
     $params['has_waitlist'] = CRM_Utils_Array::value('has_waitlist', $params, false);
     $params['is_map'] = CRM_Utils_Array::value('is_map', $params, false);
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
     $params['is_public'] = CRM_Utils_Array::value('is_public', $params, false);
     $params['default_role_id'] = CRM_Utils_Array::value('default_role_id', $params, false);
     $params['id'] = $this->_id;
     //new event, so lets set the created_id
     if ($this->_action & CRM_Core_Action::ADD) {
         $session =& CRM_Core_Session::singleton();
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = date('YmdHis');
     }
     $customFields = CRM_Core_BAO_CustomField::getFields('Event', false, false, CRM_Utils_Array::value('event_type_id', $params));
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Event');
     require_once 'CRM/Event/BAO/Event.php';
     // copy all not explicitely set $params keys from the template (if it should be sourced)
     if (CRM_Utils_Array::value('template_id', $params)) {
         $defaults = array();
         $templateParams = array('id' => $params['template_id']);
         CRM_Event_BAO_Event::retrieve($templateParams, $defaults);
         unset($defaults['id']);
         unset($defaults['default_fee_id']);
         unset($defaults['default_discount_fee_id']);
         foreach ($defaults as $key => $value) {
             if (!isset($params[$key])) {
                 $params[$key] = $value;
             }
         }
     }
     $event = CRM_Event_BAO_Event::create($params);
     // now that we have the event’s id, do some more template-based stuff
     if (CRM_Utils_Array::value('template_id', $params)) {
         // copy event fees
         $ogParams = array('name' => "civicrm_event.amount.{$event->id}");
         $defaults = array();
         require_once 'CRM/Core/BAO/OptionGroup.php';
         if (is_null(CRM_Core_BAO_OptionGroup::retrieve($ogParams, $defaults))) {
             // Copy the Main Event Fees
             CRM_Core_BAO_OptionGroup::copyValue('event', $params['template_id'], $event->id);
             // Copy the Discount option Group and Values
             require_once 'CRM/Core/BAO/Discount.php';
             $optionGroupIds = CRM_Core_BAO_Discount::getOptionGroup($params['template_id'], "civicrm_event");
             foreach ($optionGroupIds as $id) {
                 $discountSuffix = '.discount.' . CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $id, 'label');
                 CRM_Core_BAO_OptionGroup::copyValue('event', $params['template_id'], $event->id, false, $discountSuffix);
             }
         }
         // copy price sets if any
         require_once 'CRM/Price/BAO/Set.php';
         $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $params['template_id']);
         if ($priceSetId) {
             CRM_Price_BAO_Set::addTo('civicrm_event', $event->id, $priceSetId);
         }
         // link profiles if none linked
         $ufParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
         require_once 'CRM/Core/BAO/UFJoin.php';
         if (!CRM_Core_BAO_UFJoin::findUFGroupId($ufParams)) {
             CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array('entity_id' => $params['template_id'], 'entity_table' => 'civicrm_event'), array('entity_id' => $event->id));
         }
         // if no Tell-a-Friend defined, check whether there’s one for template and copy if so
         $tafParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
         require_once 'CRM/Friend/BAO/Friend.php';
         if (!CRM_Friend_BAO_Friend::getValues($tafParams)) {
             $tafParams['entity_id'] = $params['template_id'];
             if (CRM_Friend_BAO_Friend::getValues($tafParams)) {
                 $tafParams['entity_id'] = $event->id;
                 CRM_Friend_BAO_Friend::addTellAFriend($tafParams);
             }
         }
     }
     $this->set('id', $event->id);
     if ($this->_action & CRM_Core_Action::ADD) {
         $urlParam = "action=update&reset=1&subPage=Location&id={$event->id}";
         // special case for 'Save and Done' consistency.
         if ($this->controller->getButtonName('submit') == "_qf_EventInfo_upload_done") {
             $urlParam = "action=update&reset=1&id={$event->id}";
             CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())));
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), $urlParam));
     }
     parent::endPostProcess();
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:94,代码来源:EventInfo.php

示例7: sendMail

 function sendMail(&$input, &$ids, &$objects, &$values, $recur = false, $returnMessageText = false)
 {
     $contribution =& $objects['contribution'];
     $membership =& $objects['membership'];
     $participant =& $objects['participant'];
     $event =& $objects['event'];
     if (empty($values)) {
         $values = array();
         if ($input['component'] == 'contribute') {
             require_once 'CRM/Contribute/BAO/ContributionPage.php';
             if (isset($contribution->contribution_page_id)) {
                 CRM_Contribute_BAO_ContributionPage::setValues($contribution->contribution_page_id, $values);
             } else {
                 // Handle re-print receipt for offline contributions (call from PDF.php - no contribution_page_id)
                 $values['is_email_receipt'] = 1;
                 $values['title'] = 'Contribution';
             }
         } else {
             // event
             $eventParams = array('id' => $objects['event']->id);
             $values['event'] = array();
             require_once 'CRM/Event/BAO/Event.php';
             CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
             $eventParams = array('id' => $objects['event']->id);
             $values['event'] = array();
             require_once 'CRM/Event/BAO/Event.php';
             CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
             //get location details
             $locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
             require_once 'CRM/Core/BAO/Location.php';
             require_once 'CRM/Event/Form/ManageEvent/Location.php';
             $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
             require_once 'CRM/Core/BAO/UFJoin.php';
             $ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'weight' => 1);
             $values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
             $ufJoinParams['weight'] = 2;
             $values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
         }
     }
     $template =& CRM_Core_Smarty::singleton();
     // CRM_Core_Error::debug('tpl',$template);
     //assign honor infomation to receiptmessage
     if ($honarID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contribution->id, 'honor_contact_id')) {
         $honorDefault = array();
         $honorIds = array();
         $honorIds['contribution'] = $contribution->id;
         $idParams = array('id' => $honarID, 'contact_id' => $honarID);
         require_once "CRM/Contact/BAO/Contact.php";
         CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $honorIds);
         require_once "CRM/Core/PseudoConstant.php";
         $honorType = CRM_Core_PseudoConstant::honor();
         $prefix = CRM_Core_PseudoConstant::individualPrefix();
         $template->assign('honor_block_is_active', 1);
         $template->assign('honor_prefix', $prefix[$honorDefault["prefix_id"]]);
         $template->assign('honor_first_name', CRM_Utils_Array::value("first_name", $honorDefault));
         $template->assign('honor_last_name', CRM_Utils_Array::value("last_name", $honorDefault));
         $template->assign('honor_email', CRM_Utils_Array::value("email", $honorDefault["email"][1]));
         $template->assign('honor_type', $honorType[$contribution->honor_type_id]);
     }
     require_once 'CRM/Contribute/DAO/ContributionProduct.php';
     $dao =& new CRM_Contribute_DAO_ContributionProduct();
     $dao->contribution_id = $contribution->id;
     if ($dao->find(true)) {
         $premiumId = $dao->product_id;
         $template->assign('option', $dao->product_option);
         require_once 'CRM/Contribute/DAO/Product.php';
         $productDAO =& new CRM_Contribute_DAO_Product();
         $productDAO->id = $premiumId;
         $productDAO->find(true);
         $template->assign('selectPremium', true);
         $template->assign('product_name', $productDAO->name);
         $template->assign('price', $productDAO->price);
         $template->assign('sku', $productDAO->sku);
     }
     // add the new contribution values
     if ($input['component'] == 'contribute') {
         $template->assign('title', $values['title']);
         $template->assign('amount', $input['amount']);
         //PCP Info
         require_once 'CRM/Contribute/DAO/ContributionSoft.php';
         $softDAO =& new CRM_Contribute_DAO_ContributionSoft();
         $softDAO->contribution_id = $contribution->id;
         if ($softDAO->find(true)) {
             $template->assign('pcpBlock', true);
             $template->assign('pcp_display_in_roll', $softDAO->pcp_display_in_roll);
             $template->assign('pcp_roll_nickname', $softDAO->pcp_roll_nickname);
             $template->assign('pcp_personal_note', $softDAO->pcp_personal_note);
             //assign the pcp page title for email subject
             require_once 'CRM/Contribute/DAO/PCP.php';
             $pcpDAO =& new CRM_Contribute_DAO_PCP();
             $pcpDAO->id = $softDAO->pcp_id;
             if ($pcpDAO->find(true)) {
                 $template->assign('title', $pcpDAO->title);
             }
         }
     } else {
         $template->assign('title', $values['event']['title']);
         $template->assign('totalAmount', $input['amount']);
     }
     $template->assign('trxn_id', $contribution->trxn_id);
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:BaseIPN.php

示例8: crm_find_uf_join_UFGroupId

/**
 * Given an assoc list of params, find if there is a record
 * for this set of params and return the group id
 *
 * @param array $params (reference) an assoc array of name/value pairs 
 * 
 * @return int or null
 * @access public
 * 
 */
function crm_find_uf_join_UFGroupId(&$params)
{
    if (!is_array($params) || empty($params)) {
        return _crm_error("{$params} is not valid array");
    }
    if (!isset($params['entity_table']) && !isset($params['entity_id']) && !isset($params['weight'])) {
        return _crm_error("{$param} should have atleast entity_table or entiy_id or weight");
    }
    return CRM_Core_BAO_UFJoin::findUFGroupId($params);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:20,代码来源:UFJoin.php

示例9: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  * 
  * @param null
  * 
  * @return array    array of default values
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = $this->_values;
     if ($this->_surveyId) {
         require_once 'CRM/Core/BAO/UFJoin.php';
         if (CRM_Utils_Array::value('result_id', $defaults) && CRM_Utils_Array::value('recontact_interval', $defaults)) {
             require_once 'CRM/Core/OptionValue.php';
             $resultId = $defaults['result_id'];
             $recontactInterval = unserialize($defaults['recontact_interval']);
             unset($defaults['recontact_interval']);
             $defaults['option_group_id'] = $resultId;
         }
         $ufJoinParams = array('entity_table' => 'civicrm_survey', 'entity_id' => $this->_surveyId, 'weight' => 1);
         if ($ufGroupId = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams)) {
             $defaults['profile_id'] = $ufGroupId;
         }
     }
     if (!isset($defaults['is_active'])) {
         $defaults['is_active'] = 1;
     }
     // set defaults for weight.
     for ($i = 1; $i <= self::NUM_OPTION; $i++) {
         $defaults["option_weight[{$i}]"] = $i;
     }
     $defaultSurveys = CRM_Campaign_BAO_Survey::getSurvey(false, false, true);
     if (!isset($defaults['is_default']) && empty($defaultSurveys)) {
         $defaults['is_default'] = 1;
     }
     return $defaults;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:39,代码来源:Survey.php

示例10: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  * @param null
  *
  * @return array    array of default values
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = $this->_values;
     $ufContactJoinParams = array('entity_table' => 'civicrm_survey', 'entity_id' => $this->_surveyId, 'weight' => 2);
     if ($ufContactGroupId = CRM_Core_BAO_UFJoin::findUFGroupId($ufContactJoinParams)) {
         $defaults['contact_profile_id'] = $ufContactGroupId;
     }
     $ufActivityJoinParams = array('entity_table' => 'civicrm_survey', 'entity_id' => $this->_surveyId, 'weight' => 1);
     if ($ufActivityGroupId = CRM_Core_BAO_UFJoin::findUFGroupId($ufActivityJoinParams)) {
         $defaults['profile_id'] = $ufActivityGroupId;
     }
     if (!isset($defaults['is_active'])) {
         $defaults['is_active'] = 1;
     }
     $defaultSurveys = CRM_Campaign_BAO_Survey::getSurveys(TRUE, TRUE);
     if (!isset($defaults['is_default']) && empty($defaultSurveys)) {
         $defaults['is_default'] = 1;
     }
     return $defaults;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:29,代码来源:Petition.php

示例11: preProcess

 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $this->_votingTab = $this->get('votingTab');
     $this->_reserveToInterview = $this->get('reserveToInterview');
     if ($this->_reserveToInterview || $this->_votingTab) {
         //user came from voting tab / reserve form.
         foreach (array('surveyId', 'contactIds', 'interviewerId') as $fld) {
             $this->{"_{$fld}"} = $this->get($fld);
         }
         //get the target voter ids.
         if ($this->_votingTab) {
             $this->getVoterIds();
         }
     } else {
         parent::preProcess();
         //get the survey id from user submitted values.
         $this->_surveyId = CRM_Utils_Array::value('campaign_survey_id', $this->get('formValues'));
         $this->_interviewerId = CRM_Utils_Array::value('survey_interviewer_id', $this->get('formValues'));
     }
     //get the contact read only fields to display.
     require_once 'CRM/Core/BAO/Preferences.php';
     $readOnlyFields = array_merge(array('contact_type' => '', 'sort_name' => ts('Name')));
     //get the read only field data.
     $returnProperties = array_fill_keys(array_keys($readOnlyFields), 1);
     $returnProperties['contact_sub_type'] = true;
     //get the profile id.
     require_once 'CRM/Core/BAO/UFJoin.php';
     $ufJoinParams = array('entity_id' => $this->_surveyId, 'entity_table' => 'civicrm_survey', 'module' => 'CiviCampaign');
     $this->_ufGroupId = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
     $this->assign('ufGroupId', $this->_ufGroupId);
     //validate all voters for required activity.
     //get the survey activities for given voters.
     require_once 'CRM/Campaign/BAO/Survey.php';
     $this->_surveyActivityIds = CRM_Campaign_BAO_Survey::voterActivityDetails($this->_surveyId, $this->_contactIds, $this->_interviewerId);
     require_once 'CRM/Core/PseudoConstant.php';
     $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
     $scheduledStatusId = array_search('Scheduled', $activityStatus);
     $activityIds = array();
     foreach ($this->_contactIds as $key => $voterId) {
         $actVals = CRM_Utils_Array::value($voterId, $this->_surveyActivityIds);
         $statusId = CRM_Utils_Array::value('status_id', $actVals);
         $activityId = CRM_Utils_Array::value('activity_id', $actVals);
         if ($activityId && $statusId && $scheduledStatusId == $statusId) {
             $activityIds["activity_id_{$voterId}"] = $activityId;
         } else {
             unset($this->_contactIds[$key]);
         }
     }
     //retrieve the contact details.
     $voterDetails = CRM_Campaign_BAO_Survey::voterDetails($this->_contactIds, $returnProperties);
     $this->_allowAjaxReleaseButton = false;
     if ($this->_votingTab && (CRM_Core_Permission::check('manage campaign') || CRM_Core_Permission::check('administer CiviCampaign') || CRM_Core_Permission::check('release campaign contacts'))) {
         $this->_allowAjaxReleaseButton = true;
     }
     $this->assign('votingTab', $this->_votingTab);
     $this->assign('componentIds', $this->_contactIds);
     $this->assign('voterDetails', $voterDetails);
     $this->assign('readOnlyFields', $readOnlyFields);
     $this->assign('interviewerId', $this->_interviewerId);
     $this->assign('surveyActivityIds', json_encode($activityIds));
     $this->assign('allowAjaxReleaseButton', $this->_allowAjaxReleaseButton);
     //get the survey values.
     $this->_surveyValues = $this->get('surveyValues');
     if (!is_array($this->_surveyValues)) {
         $this->_surveyValues = array();
         if ($this->_surveyId) {
             require_once 'CRM/Campaign/BAO/Survey.php';
             $surveyParams = array('id' => $this->_surveyId);
             CRM_Campaign_BAO_Survey::retrieve($surveyParams, $this->_surveyValues);
         }
         $this->set('surveyValues', $this->_surveyValues);
     }
     $this->assign('surveyValues', $this->_surveyValues);
     //get the survey result options.
     $this->_resultOptions = $this->get('resultOptions');
     if (!is_array($this->_resultOptions)) {
         $this->_resultOptions = array();
         if ($resultOptionId = CRM_Utils_Array::value('result_id', $this->_surveyValues)) {
             require_once 'CRM/Core/OptionGroup.php';
             $this->_resultOptions = CRM_Core_OptionGroup::valuesByID($resultOptionId);
         }
         $this->set('resultOptions', $this->_resultOptions);
     }
     //validate the required ids.
     $this->validateIds();
     //append breadcrumb to survey dashboard.
     require_once 'CRM/Campaign/BAO/Campaign.php';
     if (CRM_Campaign_BAO_Campaign::accessCampaignDashboard()) {
         $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
         CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey(s)'), 'url' => $url)));
     }
     //set the title.
     require_once 'CRM/Core/PseudoConstant.php';
     $activityTypes = CRM_Core_PseudoConstant::activityType(false, true, false, 'label', true);
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Interview.php

示例12: postProcess

 /**
  * Function to process the form
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     //format params
     $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
     $params['end_date'] = CRM_Utils_Date::processDate(CRM_Utils_Array::value('end_date', $params), CRM_Utils_Array::value('end_date_time', $params), TRUE);
     $params['has_waitlist'] = CRM_Utils_Array::value('has_waitlist', $params, FALSE);
     $params['is_map'] = CRM_Utils_Array::value('is_map', $params, FALSE);
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
     $params['is_public'] = CRM_Utils_Array::value('is_public', $params, FALSE);
     $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
     $params['default_role_id'] = CRM_Utils_Array::value('default_role_id', $params, FALSE);
     $params['id'] = $this->_id;
     $customFields = CRM_Core_BAO_CustomField::getFields('Event', FALSE, FALSE, CRM_Utils_Array::value('event_type_id', $params));
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Event');
     //merge params with defaults from templates
     if (CRM_Utils_Array::value('template_id', $params)) {
         $params = array_merge(CRM_Event_BAO_Event::getTemplateDefaultValues($params['template_id']), $params);
     }
     $event = CRM_Event_BAO_Event::create($params);
     // now that we have the event’s id, do some more template-based stuff
     if (CRM_Utils_Array::value('template_id', $params)) {
         // copy price sets if any
         $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $params['template_id']);
         if ($priceSetId) {
             $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config');
             if ($isQuickConfig) {
                 $copyPriceSet =& CRM_Price_BAO_Set::copy($priceSetId);
                 $priceSetId = $copyPriceSet->id;
             }
             CRM_Price_BAO_Set::addTo('civicrm_event', $event->id, $priceSetId);
         }
         // link profiles if none linked
         $ufParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
         if (!CRM_Core_BAO_UFJoin::findUFGroupId($ufParams)) {
             CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array('entity_id' => $params['template_id'], 'entity_table' => 'civicrm_event'), array('entity_id' => $event->id));
         }
         // if no Tell-a-Friend defined, check whether there’s one for template and copy if so
         $tafParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
         if (!CRM_Friend_BAO_Friend::getValues($tafParams)) {
             $tafParams['entity_id'] = $params['template_id'];
             if (CRM_Friend_BAO_Friend::getValues($tafParams)) {
                 $tafParams['entity_id'] = $event->id;
                 if (isset($tafParams['id'])) {
                     unset($tafParams['id']);
                 }
                 CRM_Friend_BAO_Friend::addTellAFriend($tafParams);
             }
         }
         //copy pcp settings
         CRM_Core_DAO::copyGeneric('CRM_PCP_DAO_PCPBlock', array('entity_id' => $params['template_id'], 'entity_table' => 'civicrm_event'), array('entity_id' => $event->id), array('replace' => array('target_entity_id' => $event->id)));
         //copy event schedule remainder
         CRM_Core_DAO::copyGeneric('CRM_Core_DAO_ActionSchedule', array('entity_value' => $params['template_id']), array('entity_value' => $event->id));
     }
     $this->set('id', $event->id);
     if ($this->_action & CRM_Core_Action::ADD) {
         $url = 'civicrm/event/manage/location';
         $urlParams = "action=update&reset=1&id={$event->id}";
         // special case for 'Save and Done' consistency.
         if ($this->controller->getButtonName('submit') == '_qf_EventInfo_upload_done') {
             $url = 'civicrm/event/manage';
             $urlParams = 'reset=1';
             CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())));
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
     }
     parent::endPostProcess();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:75,代码来源:EventInfo.php

示例13: getSurveyProfileId

 /**
  * Function to retrieve survey associated profile id.
  *
  */
 public static function getSurveyProfileId($surveyId)
 {
     if (!$surveyId) {
         return NULL;
     }
     static $ufIds = array();
     if (!array_key_exists($surveyId, $ufIds)) {
         //get the profile id.
         $ufJoinParams = array('entity_id' => $surveyId, 'entity_table' => 'civicrm_survey', 'module' => 'CiviCampaign');
         $ufIds[$surveyId] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
     }
     return $ufIds[$surveyId];
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:17,代码来源:Survey.php

示例14: preProcess

 /** 
  * Function to set variables up before form is built 
  *                                                           
  * @return void 
  * @access public 
  */
 function preProcess()
 {
     $config =& CRM_Core_Config::singleton();
     $session =& CRM_Core_Session::singleton();
     // make sure we have a valid payment class, else abort
     if (!$config->paymentClass) {
         CRM_Utils_System::setUFMessage(ts('%1 is not set in the config file.', array(1 => 'CIVICRM_CONTRIBUTE_PAYMENT_PROCESSOR')));
         CRM_Utils_System::redirect($config->userFrameworkBaseURL);
     }
     // current contribution page id
     $this->_id = CRM_Utils_Request::retrieve('id', $this);
     if (!$this->_id) {
         $pastContributionId = $session->get('pastContributionId');
         if (!$pastContributionId) {
             CRM_Core_Error::fatal(ts('We could not find contribution details for your request. Please try your request again.'));
         } else {
             CRM_Core_Error::fatal(ts('This contribution has already been submitted. Click <a href="%1">here</a> if you want to make another contribution.', array(1 => CRM_Utils_System::url('civicrm/contribute/transact', 'reset=1&id=' . $pastContributionId))));
         }
     } else {
         $session->set('pastContributionId', $this->_id);
     }
     // we do not want to display recently viewed items, so turn off
     $this->assign('displayRecent', false);
     // action
     $this->_action = CRM_Utils_Request::retrieve('action', $this, false, 'add');
     $this->assign('action', $this->_action);
     // current mode
     $this->_mode = $this->_action == 1024 ? 'test' : 'live';
     $this->_values = $this->get('values');
     $this->_fields = $this->get('fields');
     if (!$this->_values) {
         // get all the values from the dao object
         $params = array('id' => $this->_id);
         $this->_values = array();
         $this->_fields = array();
         CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $this->_values);
         // check if form is active
         if (!$this->_values['is_active']) {
             // form is inactive, bounce user back to front page of CMS
             CRM_Utils_System::setUFMessage(ts('The page you requested is currently unavailable.'));
             CRM_Utils_System::redirect($config->userFrameworkBaseURL);
         }
         // get the amounts and the label
         require_once 'CRM/Core/BAO/CustomOption.php';
         CRM_Core_BAO_CustomOption::getAssoc('civicrm_contribution_page', $this->_id, $this->_values);
         // get the profile ids
         require_once 'CRM/Core/BAO/UFJoin.php';
         $ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id, 'weight' => 1);
         $this->_values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
         $ufJoinParams['weight'] = 2;
         $this->_values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
         if ($config->paymentBillingMode & CRM_CONTRIBUTE_PAYMENT_BILLING_MODE_FORM) {
             $this->setCreditCardFields();
         }
         $this->set('values', $this->_values);
         $this->set('fields', $this->_fields);
     }
     $this->_contributeMode = $this->get('contributeMode');
     $this->assign('contributeMode', $this->_contributeMode);
     // assigning title to template in case someone wants to use it, also setting CMS page title
     $this->assign('title', $this->_values['title']);
     CRM_Utils_System::setTitle($this->_values['title']);
     $this->_defaults = array();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:70,代码来源:ContributionBase.php


注:本文中的CRM_Core_BAO_UFJoin::findUFGroupId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。