本文整理汇总了PHP中CRM_Core_DAO_UFJoin类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_UFJoin类的具体用法?PHP CRM_Core_DAO_UFJoin怎么用?PHP CRM_Core_DAO_UFJoin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_DAO_UFJoin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
// process url params
if ($this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive')) {
$this->assign('contactID', $this->_contactID);
}
if ($this->_caseID = CRM_Utils_Request::retrieve('case_id', 'Positive')) {
$this->assign('case_id', $this->_caseID);
// get Vacancy ID
$vacancyID = CRM_HRRecruitment_BAO_HRVacancy::getVacancyIDByCase($this->_caseID);
//Get application and evaluaiton profile IDs
foreach (array('application_profile', 'evaluation_profile') as $profileName) {
$dao = new CRM_Core_DAO_UFJoin();
$dao->module = 'Vacancy';
$dao->entity_id = $vacancyID;
$dao->module_data = $profileName;
$dao->find(TRUE);
$profile[$profileName] = $dao->uf_group_id;
}
//Check for existing Evaluation activity type and assign variables to tpl
$this->assign('actions', 'add');
$params = array('activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Evaluation'));
$caseActivity = CRM_Case_BAO_Case::getCaseActivity($this->_caseID, $params, $this->_contactID);
foreach ($caseActivity as $caseActivity) {
$evalID = $caseActivity['id'];
$this->assign('id', $evalID);
$this->assign('actions', 'update');
}
$this->_profileID = $profile['application_profile'];
$this->_evalProfileID = $profile['evaluation_profile'];
}
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:38,代码来源:CaseProfile.php
示例2: buildQuickForm
/**
* Function used to build form element for soft credit block.
*
* @param CRM_Core_Form $form
*
* @return \CRM_Core_Form
*/
public static function buildQuickForm(&$form)
{
if (!empty($form->_honor_block_is_active)) {
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $form->_id;
if ($ufJoinDAO->find(TRUE)) {
$jsonData = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoinDAO->module_data, TRUE, 'soft_credit');
if ($jsonData) {
foreach (array('honor_block_title', 'honor_block_text') as $name) {
$form->assign($name, $jsonData[$name]);
}
$softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
// radio button for Honor Type
foreach ($jsonData['soft_credit_types'] as $value) {
$honorTypes[$value] = $form->createElement('radio', NULL, NULL, $softCreditTypes[$value], $value);
}
$form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE);
}
}
return $form;
}
// by default generate 10 blocks
$item_count = 11;
$showSoftCreditRow = 2;
if ($form->getAction() & CRM_Core_Action::UPDATE) {
$form->_softCreditInfo = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($form->_id, TRUE);
} elseif (!empty($form->_pledgeID)) {
//Check and select most recent completed contrubtion and use it to retrieve
//soft-credit information to use as default for current pledge payment, CRM-13981
$pledgePayments = CRM_Pledge_BAO_PledgePayment::getPledgePayments($form->_pledgeID);
foreach ($pledgePayments as $id => $record) {
if ($record['contribution_id']) {
$softCredits = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($record['contribution_id'], TRUE);
if ($record['status'] == 'Completed' && count($softCredits) > 0) {
$form->_softCreditInfo = $softCredits;
}
}
}
}
if (property_exists($form, "_softCreditInfo")) {
if (!empty($form->_softCreditInfo['soft_credit'])) {
$showSoftCreditRow = count($form->_softCreditInfo['soft_credit']);
$showSoftCreditRow++;
}
}
for ($rowNumber = 1; $rowNumber <= $item_count; $rowNumber++) {
$form->addEntityRef("soft_credit_contact_id[{$rowNumber}]", ts('Contact'), array('create' => TRUE));
$form->addMoney("soft_credit_amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE);
$form->addSelect("soft_credit_type[{$rowNumber}]", array('entity' => 'contribution_soft', 'field' => 'soft_credit_type_id', 'label' => ts('Type')));
if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) {
$form->add('hidden', "soft_credit_id[{$rowNumber}]", $form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id']);
}
}
self::addPCPFields($form);
$form->assign('showSoftCreditRow', $showSoftCreditRow);
$form->assign('rowCount', $item_count);
$form->addElement('hidden', 'sct_default_id', CRM_Core_OptionGroup::getDefaultValue("soft_credit_type"), array('id' => 'sct_default_id'));
}
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:66,代码来源:SoftCredit.php
示例3: setDefaultValues
/**
* Set default values for the form.
*/
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Title and Settings') . " ({$title})");
foreach (array('on_behalf', 'soft_credit') as $module) {
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = $module;
$ufJoinDAO->entity_id = $this->_id;
$ufJoinDAO->entity_table = 'civicrm_contribution_page';
if ($ufJoinDAO->find(TRUE)) {
$jsonData = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoinDAO->module_data, TRUE, $module);
if ($module == 'soft_credit') {
$defaults['honoree_profile'] = $ufJoinDAO->uf_group_id;
$defaults = array_merge($defaults, $jsonData);
$defaults['honor_block_is_active'] = $ufJoinDAO->is_active;
} else {
$defaults['onbehalf_profile_id'] = $ufJoinDAO->uf_group_id;
$defaults = array_merge($defaults, $jsonData);
$defaults['is_organization'] = $ufJoinDAO->is_active;
}
} else {
if ($module == 'soft_credit') {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'on_behalf_organization';
if ($ufGroupDAO->find(TRUE)) {
$defaults['onbehalf_profile_id'] = $ufGroupDAO->id;
}
$defaults['for_organization'] = ts('I am contributing on behalf of an organization.');
$defaults['is_for_organization'] = 1;
}
}
}
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
return $defaults;
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:55,代码来源:Settings.php
示例4: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this);
if (!isset($this->_contactID)) {
$this->_contactID = 0;
}
if (!$this->_id) {
CRM_Core_Error::fatal(ts('There is no related Vacancy to apply'));
}
$ufJoinParams = array('module' => 'Vacancy', 'entity_id' => $this->_id, 'module_data' => 'application_profile');
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($ufJoinParams);
$ufJoin->find(TRUE);
$this->_profileID = $ufJoin->uf_group_id;
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:22,代码来源:Application.php
示例5: 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();
$soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
CRM_Utils_System::setTitle(ts('Title and Settings (%1)', array(1 => $title)));
$ufJoinParams = array('module' => 'OnBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$onBehalfIDs = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
if ($onBehalfIDs) {
// get the first one only
$defaults['onbehalf_profile_id'] = $onBehalfIDs[0];
}
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $this->_id;
if ($ufJoinDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufJoinDAO->uf_group_id;
$jsonData = json_decode($ufJoinDAO->module_data);
if ($jsonData) {
foreach ($jsonData->soft_credit as $index => $value) {
$defaults[$index] = $value;
}
}
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
} else {
CRM_Utils_System::setTitle(ts('Title and Settings'));
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
return $defaults;
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:51,代码来源:Settings.php
示例6: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
$eventId = $this->_id;
$defaults = parent::setDefaultValues();
$this->setShowHide($defaults);
if (isset($eventId)) {
$params = array('id' => $eventId);
CRM_Event_BAO_Event::retrieve($params, $defaults);
require_once 'CRM/Core/BAO/UFJoin.php';
$ufJoinParams = array('entity_table' => 'civicrm_event', 'module' => 'CiviEvent', 'entity_id' => $eventId);
list($defaults['custom_pre_id'], $defaults['custom_post_id']) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
if ($defaults['is_multiple_registrations']) {
// CRM-4377: set additional participants’ profiles – set to ‘none’ if explicitly unset (non-active)
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->module = 'CiviEvent_Additional';
$ufJoin->entity_table = 'civicrm_event';
$ufJoin->entity_id = $eventId;
$ufJoin->orderBy('weight');
$ufJoin->find();
$custom = array(1 => 'additional_custom_pre_id', 2 => 'additional_custom_post_id');
while ($ufJoin->fetch()) {
$defaults[$custom[$ufJoin->weight]] = $ufJoin->is_active ? $ufJoin->uf_group_id : 'none';
}
}
} else {
$defaults['is_email_confirm'] = 0;
}
// provide defaults for required fields if empty (and as a 'hint' for approval message field)
$defaults['registration_link_text'] = CRM_Utils_Array::value('registration_link_text', $defaults, ts('Register Now'));
$defaults['confirm_title'] = CRM_Utils_Array::value('confirm_title', $defaults, ts('Confirm Your Registration Information'));
$defaults['thankyou_title'] = CRM_Utils_Array::value('thankyou_title', $defaults, ts('Thank You for Registering'));
$defaults['approval_req_text'] = CRM_Utils_Array::value('approval_req_text', $defaults, ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.'));
if (CRM_Utils_Array::value('registration_start_date', $defaults)) {
list($defaults['registration_start_date'], $defaults['registration_start_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['registration_start_date'], 'activityDateTime');
}
if (CRM_Utils_Array::value('registration_end_date', $defaults)) {
list($defaults['registration_end_date'], $defaults['registration_end_date_time']) = CRM_Utils_Date::setDateDefaults($defaults['registration_end_date'], 'activityDateTime');
}
return $defaults;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:47,代码来源:Registration.php
示例7: setDefaultValues
/**
* Set default values for the form.
*/
public function setDefaultValues()
{
$defaults = parent::setDefaultValues();
$soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($this->_id) {
$ufJoinParams = array('module' => 'OnBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$onBehalfIDs = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
if ($onBehalfIDs) {
// get the first one only
$defaults['onbehalf_profile_id'] = $onBehalfIDs[0];
}
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $this->_id;
if ($ufJoinDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufJoinDAO->uf_group_id;
$jsonData = CRM_Contribute_BAO_ContributionPage::formatMultilingualHonorParams($ufJoinDAO->module_data, TRUE);
$defaults = array_merge($defaults, $jsonData);
$defaults['honor_block_is_active'] = $ufJoinDAO->is_active;
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
} else {
$ufGroupDAO = new CRM_Core_DAO_UFGroup();
$ufGroupDAO->name = 'honoree_individual';
if ($ufGroupDAO->find(TRUE)) {
$defaults['honoree_profile'] = $ufGroupDAO->id;
}
$defaults['soft_credit_types'] = array(CRM_Utils_Array::value('in_honor_of', $soft_credit_types), CRM_Utils_Array::value('in_memory_of', $soft_credit_types));
}
return $defaults;
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:40,代码来源:Settings.php
示例8: formatMultilingualHonorParams
/**
* Get or Set multilingually affected honor params for processing module_data or setting default values.
*
* @param string $params :
* @param bool $setDefault : If yes then returns array to used for setting default value afterward
*
* @return array|string
*/
public static function formatMultilingualHonorParams($params, $setDefault = FALSE)
{
$config = CRM_Core_Config::singleton();
$sctJson = $sctJsonDecode = NULL;
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
//When we are fetching the honor params respecting both multi and mono lingual state
//and setting it to default param of Contribution Page's Main and Setting form
if ($setDefault) {
$sctJsonDecode = json_decode($params);
$sctJsonDecode = (array) $sctJsonDecode->soft_credit;
if (!$domain->locales && !empty($sctJsonDecode['default'])) {
//monolingual state
$sctJsonDecode += (array) $sctJsonDecode['default'];
} elseif (!empty($sctJsonDecode[$config->lcMessages])) {
//multilingual state
foreach ($sctJsonDecode[$config->lcMessages] as $column => $value) {
$sctJsonDecode[$column] = $value;
}
unset($sctJsonDecode[$config->lcMessages]);
}
return $sctJsonDecode;
}
//check and handle multilingual honoree params
if (!$domain->locales) {
//if in singlelingual state simply return the array format
$sctJson = json_encode(array('soft_credit' => array('soft_credit_types' => $params['soft_credit_types'], 'default' => array('honor_block_title' => $params['honor_block_title'], 'honor_block_text' => $params['honor_block_text']))));
} else {
//if in multilingual state then retrieve the module_data against this contribution and
//merge with earlier module_data json data to current so not to lose earlier multilingual module_data information
$sctJson = array('soft_credit' => array('soft_credit_types' => $params['soft_credit_types'], $config->lcMessages => array('honor_block_title' => $params['honor_block_title'], 'honor_block_text' => $params['honor_block_text'])));
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $params['id'];
$ufJoinDAO->find(TRUE);
$jsonData = json_decode($ufJoinDAO->module_data);
if ($jsonData) {
$sctJson['soft_credit'] = array_merge((array) $jsonData->soft_credit, $sctJson['soft_credit']);
}
$sctJson = json_encode($sctJson);
}
return $sctJson;
}
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:51,代码来源:ContributionPage.php
示例9: getUFGroupIds
public static function getUFGroupIds(&$params)
{
$dao = new CRM_Core_DAO_UFJoin();
// CRM-4377 (ab)uses the module column
if (isset($params['module'])) {
$dao->module = CRM_Utils_Array::value('module', $params);
}
$dao->entity_table = CRM_Utils_Array::value('entity_table', $params);
$dao->entity_id = CRM_Utils_Array::value('entity_id', $params);
$dao->orderBy('weight asc');
$first = $second = $firstActive = $secondActive = null;
$firstWeight = null;
$dao->find();
if ($dao->fetch()) {
$first = $dao->uf_group_id;
$firstWeight = $dao->weight;
$firstActive = $dao->is_active;
}
while ($dao->fetch()) {
if ($first != $dao->uf_group_id) {
$second = $dao->uf_group_id;
$secondActive = $dao->is_active;
break;
}
}
// if there is only one profile check to see the weight, if > 1 then let it be second
// this is an approx rule, but should work in most cases.
if ($second == null && $firstWeight > 1) {
$second = $first;
$first = null;
}
return array($first, $second, $firstActive, $secondActive);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:33,代码来源:UFJoin.php
示例10: buildQuickForm
/**
* Function used to build form element for soft credit block.
*
* @param CRM_Core_Form $form
*
* @return void
*/
public static function buildQuickForm(&$form)
{
if (!empty($form->_honor_block_is_active)) {
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = 'soft_credit';
$ufJoinDAO->entity_id = $form->_id;
if ($ufJoinDAO->find(TRUE)) {
$jsonData = CRM_Contribute_BAO_ContributionPage::formatMultilingualHonorParams($ufJoinDAO->module_data, TRUE);
if ($jsonData) {
foreach (array('honor_block_title', 'honor_block_text') as $name) {
$form->assign($name, $jsonData[$name]);
}
$softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
// radio button for Honor Type
foreach ($jsonData['soft_credit_types'] as $value) {
$honorTypes[$value] = $form->createElement('radio', NULL, NULL, $softCreditTypes[$value], $value);
}
$form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE);
}
}
return $form;
}
// by default generate 10 blocks
$item_count = 11;
$showSoftCreditRow = 2;
if ($form->getAction() & CRM_Core_Action::UPDATE) {
$form->_softCreditInfo = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($form->_id, TRUE);
} elseif (!empty($form->_pledgeID)) {
//Check and select most recent completed contrubtion and use it to retrieve
//soft-credit information to use as default for current pledge payment, CRM-13981
$pledgePayments = CRM_Pledge_BAO_PledgePayment::getPledgePayments($form->_pledgeID);
foreach ($pledgePayments as $id => $record) {
if ($record['contribution_id']) {
$softCredits = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($record['contribution_id'], TRUE);
if ($record['status'] == 'Completed' && count($softCredits) > 0) {
$form->_softCreditInfo = $softCredits;
}
}
}
}
if (property_exists($form, "_softCreditInfo")) {
if (!empty($form->_softCreditInfo['soft_credit'])) {
$showSoftCreditRow = count($form->_softCreditInfo['soft_credit']);
$showSoftCreditRow++;
}
}
for ($rowNumber = 1; $rowNumber <= $item_count; $rowNumber++) {
$form->addEntityRef("soft_credit_contact_id[{$rowNumber}]", ts('Contact'), array('create' => TRUE));
$form->addMoney("soft_credit_amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE);
$form->addSelect("soft_credit_type[{$rowNumber}]", array('entity' => 'contribution_soft', 'field' => 'soft_credit_type_id', 'label' => ts('Type')));
if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) {
$form->add('hidden', "soft_credit_id[{$rowNumber}]", $form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id']);
}
}
// CRM-7368 allow user to set or edit PCP link for contributions
$siteHasPCPs = CRM_Contribute_PseudoConstant::pcPage();
if (!CRM_Utils_Array::crmIsEmptyArray($siteHasPCPs)) {
$form->assign('siteHasPCPs', 1);
// Fixme: Not a true entityRef field. Relies on PCP.js.tpl
$form->add('text', 'pcp_made_through_id', ts('Credit to a Personal Campaign Page'), array('class' => 'twenty', 'placeholder' => ts('- select -')));
// stores the label
$form->add('hidden', 'pcp_made_through');
$form->addElement('checkbox', 'pcp_display_in_roll', ts('Display in Honor Roll?'), NULL);
$form->addElement('text', 'pcp_roll_nickname', ts('Name (for Honor Roll)'));
$form->addElement('textarea', 'pcp_personal_note', ts('Personal Note (for Honor Roll)'));
}
$form->assign('showSoftCreditRow', $showSoftCreditRow);
$form->assign('rowCount', $item_count);
$form->addElement('hidden', 'sct_default_id', CRM_Core_OptionGroup::getDefaultValue("soft_credit_type"), array('id' => 'sct_default_id'));
}
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:77,代码来源:SoftCredit.php
示例11: hrrecruitment_civicrm_buildForm
/**
* Implementation of hook_civicrm_buildForm
*
* @params string $formName - the name of the form
* object $form - reference to the form object
* @return void
*/
function hrrecruitment_civicrm_buildForm($formName, &$form)
{
$caseTypes = CRM_Case_PseudoConstant::caseType('name');
$appValue = array_search('Application', $caseTypes);
//To hide application case type from add assignment form
if ($formName == 'CRM_Case_Form_Case') {
if ($form->_action & CRM_Core_Action::DELETE || $form->_action & CRM_Core_Action::RENEW) {
return;
}
$form->_caseType = CRM_Case_PseudoConstant::caseType();
unset($form->_caseType[$appValue]);
$form->add('select', 'case_type_id', ts('Assignment Type'), $form->_caseType, TRUE);
}
//report change
if ($formName == 'CRM_Report_Form_Case_Summary' || $formName == 'CRM_Report_Form_Case_Detail') {
$statuses = CRM_Case_PseudoConstant::caseStatus('label', FALSE, 'AND filter = 1', TRUE);
$form->case_statuses = $form->case_statuses + $statuses;
}
if ($formName == 'CRM_Activity_Form_Search') {
$actId = CRM_Utils_Request::retrieve('type', 'Positive', $form);
$form->_formValues['activity_type_id'][$actId] = $defaults['activity_type_id'][$actId] = 1;
$form->setDefaults($defaults);
$form->set('formValues', $form->_formValues);
$form->preProcess();
}
if ($formName == 'CRM_Case_Form_CaseView') {
$params = array('id' => $form->_caseID);
CRM_Core_DAO::commonRetrieve('CRM_Case_BAO_Case', $params, $values, array('status_id'));
$statuses = CRM_Case_PseudoConstant::caseStatus('label', FALSE, 'AND (filter IN (0,1) OR filter IS NULL)', TRUE);
$form->_caseDetails['case_status'] = $statuses[$values['case_status_id']];
$form->assign('caseDetails', $form->_caseDetails);
}
if ($formName == 'CRM_Case_Form_Activity' || $formName == 'CRM_Contact_Form_Task_Email') {
$caseId = CRM_Utils_Request::retrieve('caseid', 'String', $form);
$vacancyID = CRM_HRRecruitment_BAO_HRVacancy::getVacancyIDByCase($caseId);
$caseId = explode(',', $caseId);
$aType = CRM_Utils_Request::retrieve('atype', 'Positive') ? CRM_Utils_Request::retrieve('atype', 'Positive') : CRM_Utils_Array::value('activity_type_id', $form->_defaultValues);
$evalID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Evaluation');
/* Check for proper permissions */
if ($vacancyID && $aType) {
$administerper = CRM_HRRecruitment_BAO_HRVacancyPermission::checkVacancyPermission($vacancyID, array("administer Vacancy", "administer CiviCRM", "manage Applicants"));
$evaluateper = CRM_HRRecruitment_BAO_HRVacancyPermission::checkVacancyPermission($vacancyID, array("administer Vacancy", "administer CiviCRM", "evaluate Applicants"));
if ($aType != $evalID && !$administerper || $aType == $evalID && !$evaluateper) {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm'));
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to perform this action.'));
return;
}
}
/* TO set vacancy stages as case status for 'Change Case Status' activity */
if ($aType == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Change Case Status')) {
$allcase = TRUE;
foreach ($caseId as $key => $val) {
$caseType = CRM_Case_BAO_Case::getCaseType($val, 'id');
if ($caseType != $appValue) {
$allcase = FALSE;
}
}
if ($allcase) {
$form->removeElement('case_status_id');
$form->_caseStatus = CRM_Case_PseudoConstant::caseStatus('label', TRUE, 'AND filter = 1', TRUE);
$form->add('select', 'case_status_id', ts('Case Status'), $form->_caseStatus, TRUE);
if ($caseStatusId = CRM_Utils_Request::retrieve('case_status_id', 'Positive', $form)) {
$form->freeze('case_status_id');
$form->setDefaults(array('case_status_id' => $caseStatusId));
}
}
}
/* build the evaluation profile on the evaluation activity */
//check for evaluation activity type
if ($aType == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Evaluation')) {
//rename label and status name for Activity Status
$activityStatus = $form->getElement('status_id');
$activityStatus->_options = array();
$scheduleStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled');
$completeStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Completed');
$activityStatus->addOption('Scheduled', $scheduleStatus);
$activityStatus->addOption('Complete Evaluation', $completeStatus);
$activityStatus->_label = 'Evaluation Status';
//retriev Case ID, Activity ID, Contact ID
$caseID = CRM_Utils_Request::retrieve('caseid', 'Positive', $form);
$activityID = CRM_Utils_Request::retrieve('id', 'Positive', $form);
$contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $form);
//get Evaluation profile ID
$dao = new CRM_Core_DAO_UFJoin();
$dao->module = 'Vacancy';
$dao->entity_id = CRM_HRRecruitment_BAO_HRVacancy::getVacancyIDByCase($caseID);
$dao->module_data = 'evaluation_profile';
$dao->find(TRUE);
$profileID = $dao->uf_group_id;
$profileFields = CRM_Core_BAO_UFGroup::getFields($profileID);
$form->assign('fields', $profileFields);
CRM_Core_BAO_UFGroup::setProfileDefaults($contactID, $profileFields, $def);
$form->setDefaults($def);
//.........这里部分代码省略.........
开发者ID:JoeMurray,项目名称:civihr,代码行数:101,代码来源:hrrecruitment.php
示例12: retrieve
/**
* Given the list of params in the params array, fetch the object
* and store the values in the values array
*
* @param array $params input parameters to find object
* @param array $values output values of the object
*
* @return CRM_HRRecruitment_DAO_HRVacancy|null the found object or null
* @access public
* @static
*/
static function retrieve(&$params, &$defaults)
{
$vacancy = new self();
$vacancy->copyValues($params);
if ($vacancy->find(TRUE)) {
CRM_Core_DAO::storeValues($vacancy, $defaults);
$stage = new CRM_HRRecruitment_DAO_HRVacancyStage();
$stage->vacancy_id = $vacancy->id;
$stage->find();
while ($stage->fetch()) {
$defaults['stages'][$stage->weight] = $stage->case_status_id;
}
$permission = new CRM_HRRecruitment_DAO_HRVacancyPermission();
$permission->vacancy_id = $vacancy->id;
$permission->find();
$count = 1;
while ($permission->fetch()) {
$defaults['permission'][$count] = $permission->permission;
$defaults['permission_contact_id'][$count] = $permission->contact_id;
$count++;
}
foreach (array('application_profile', 'evaluation_profile') as $profileName) {
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->module = 'Vacancy';
$ufJoin->entity_id = $vacancy->id;
$ufJoin->module_data = $profileName;
$ufJoin->find(TRUE);
$defaults[$profileName] = $ufJoin->uf_group_id;
}
}
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:42,代码来源:HRVacancy.php
示例13: formatModuleData
/**
* Get or Set honor/on_behalf params for processing module_data or setting default values.
*
* @param array $params :
* @param bool $setDefault : If yes then returns array to used for setting default value afterward
* @param string $module : processing module_data for which module? e.g. soft_credit, on_behalf
*
* @return array|string
*/
public static function formatModuleData($params, $setDefault = FALSE, $module)
{
$tsLocale = CRM_Core_I18n::getLocale();
$config = CRM_Core_Config::singleton();
$json = $jsonDecode = NULL;
$domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
$moduleDataFormat = array('soft_credit' => array(1 => 'soft_credit_types', 'multilingual' => array('honor_block_title', 'honor_block_text')), 'on_behalf' => array(1 => 'is_for_organization', 'multilingual' => array('for_organization')));
//When we are fetching the honor params respecting both multi and mono lingual state
//and setting it to default param of Contribution Page's Main and Setting form
if ($setDefault) {
$jsonDecode = json_decode($params);
$jsonDecode = (array) $jsonDecode->{$module};
if (!$domain->locales && !empty($jsonDecode['default'])) {
//monolingual state
$jsonDecode += (array) $jsonDecode['default'];
unset($jsonDecode['default']);
} elseif (!empty($jsonDecode[$tsLocale])) {
//multilingual state
foreach ($jsonDecode[$tsLocale] as $column => $value) {
$jsonDecode[$column] = $value;
}
unset($jsonDecode[$tsLocale]);
}
return $jsonDecode;
}
//check and handle multilingual honoree params
if (!$domain->locales) {
//if in singlelingual state simply return the array format
$json = array($module => NULL);
foreach ($moduleDataFormat[$module] as $key => $attribute) {
if ($key === 'multilingual') {
$json[$module]['default'] = array();
foreach ($attribute as $attr) {
$json[$module]['default'][$attr] = $params[$attr];
}
} else {
$json[$module][$attribute] = $params[$attribute];
}
}
$json = json_encode($json);
} else {
//if in multilingual state then retrieve the module_data against this contribution and
//merge with earlier module_data json data to current so not to lose earlier multilingual module_data information
$json = array($module => NULL);
foreach ($moduleDataFormat[$module] as $key => $attribute) {
if ($key === 'multilingual') {
$json[$module][$config->lcMessages] = array();
foreach ($attribute as $attr) {
$json[$module][$config->lcMessages][$attr] = $params[$attr];
}
} else {
$json[$module][$attribute] = $params[$attribute];
}
}
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = $module;
$ufJoinDAO->entity_id = $params['id'];
$ufJoinDAO->find(TRUE);
$jsonData = json_decode($ufJoinDAO->module_data);
if ($jsonData) {
$json[$module] = array_merge((array) $jsonData->{$module}, $json[$module]);
}
$json = json_encode($json);
}
return $json;
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:76,代码来源:ContributionPage.php
示例14: getUFGroupIds
/**
* @param array $params
*
* @return array
*/
public static function getUFGroupIds(&$params)
{
$dao = new CRM_Core_DAO_UFJoin();
// CRM-4377 (ab)uses the module column
if (isset($params['module'])) {
$dao->module = CRM_Utils_Array::value('module', $params);
}
$dao->entity_table = CRM_Utils_Array::value('entity_table', $params);
$dao->entity_id = CRM_Utils_Array::value('entity_id', $params);
$dao->orderBy('weight asc');
$dao->find();
$first = $firstActive = NULL;
$second = $secondActive = array();
while ($dao->fetch()) {
if ($dao->weight == 1) {
$first = $dao->uf_group_id;
$firstActive = $dao->is_active;
} else {
$second[] = $dao->uf_group_id;
$secondActive[] = $dao->is_active;
}
}
return array($first, $second, $firstActive, $secondActive);
}
开发者ID:kidaa30,项目名称:yes,代码行数:29,代码来源:UFJoin.php
示例15: delUFJoin
/**
* Function to delete the uf join record for an uf group
*
* @param array $params (reference) an assoc array of name/value pairs
*
* @return void
* @access public
* @static
*/
static function delUFJoin(&$params)
{
require_once 'CRM/Core/DAO/UFJoin.php';
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($params);
$ufJoin->delete();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:16,代码来源:UFGroup.php
示例16: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
// current contribution page id
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if (!$this->_id) {
// seems like the session is corrupted and/or we lost the id trail
// lets just bump this to a regular session error and redirect user to main page
$this->controller->invalidKeyRedirect();
}
// this was used prior to the cleverer this_>getContactID - unsure now
$this->_userID = $session->get('userID');
//Check if honor block is enabled for current contribution
$ufJoinParams = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($ufJoinParams);
$ufJoin->find(TRUE);
$this->_honor_block_is_active = $ufJoin->is_active;
$this->_contactID = $this->_membershipContactID = $this->getContactID();
$this->_mid = NULL;
if ($this->_contactID) {
$this->_mid = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
if ($this->_mid) {
$membership = new CRM_Member_DAO_Membership();
$membership->id = $this->_mid;
if ($membership->find(TRUE)) {
$this->_defaultMemTypeId = $membership->membership_type_id;
if ($membership->contact_id != $this->_contactID) {
$validMembership = FALSE;
$employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID);
if (!empty($employers) && array_key_exists($membership->contact_id, $employers)) {
$this->_membershipContactID = $membership->contact_id;
$this->assign('membershipContactID', $this->_membershipContactID);
$this->assign('membershipContactName', $employers[$this->_membershipContactID]['name']);
$validMembership = TRUE;
} else {
$membershipType = new CRM_Member_BAO_MembershipType();
$membershipType->id = $membership->membership_type_id;
if ($membershipType->find(TRUE)) {
// CRM-14051 - membership_type.relationship_type_id is a CTRL-A padded string w one or more ID values.
// Convert to commma separated list.
$inheritedRelTypes = implode(CRM_Utils_Array::explodePadded($membershipType->relationship_type_id), ',');
$permContacts = CRM_Contact_BAO_Relationship::getPermissionedContacts($this->_userID, $membershipType->relationship_type_id);
if (array_key_exists($membership->contact_id, $permContacts)) {
$this->_membershipContactID = $membership->contact_id;
$validMembership = TRUE;
}
}
}
if (!$validMembership) {
CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert');
}
}
} else {
CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert');
}
unset($membership);
}
}
// we do not want to display recently viewed items, so turn off
$this->assign
|
请发表评论