本文整理汇总了PHP中CRM_Core_BAO_UFGroup::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFGroup::getTitle方法的具体用法?PHP CRM_Core_BAO_UFGroup::getTitle怎么用?PHP CRM_Core_BAO_UFGroup::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFGroup::getTitle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_uf_profile_title_get
/**
* Get the form title.
*
* @param int $id id of uf_form
*
* @return string title
*
* @access public
* @static
*
*/
function civicrm_uf_profile_title_get($id)
{
if ((int) $id > 0) {
return CRM_Core_BAO_UFGroup::getTitle($id);
} else {
return civicrm_create_error('Param needs to be a positive integer.');
}
}
示例2: buildQuickForm
/**
* Build the form
*
* @access public
* @return void
*/
function buildQuickForm()
{
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
CRM_Core_Error::fatal('ufGroupId is missing');
}
require_once "CRM/Core/BAO/UFGroup.php";
require_once "CRM/Core/BAO/CustomGroup.php";
$this->_title = ts('Batch Update for Contributions') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->addDefaultButtons(ts('Save'));
$this->_fields = array();
$this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, false, CRM_Core_Action::VIEW);
// remove file type field and then limit fields
$suppressFields = false;
$removehtmlTypes = array('File', 'Autocomplete-Select');
foreach ($this->_fields as $name => $field) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name) && in_array($this->_fields[$name]['html_type'], $removehtmlTypes)) {
$suppressFields = true;
unset($this->_fields[$name]);
}
//fix to reduce size as we are using this field in grid
if (is_array($field['attributes']) && $this->_fields[$name]['attributes']['size'] > 19) {
//shrink class to "form-text-medium"
$this->_fields[$name]['attributes']['size'] = 19;
}
}
$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Update Contribution(s)'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_contributionIds);
$fileFieldExists = false;
//fix for CRM-2752
require_once "CRM/Core/BAO/CustomField.php";
$customFields = CRM_Core_BAO_CustomField::getFields('Contribution');
foreach ($this->_contributionIds as $contributionId) {
$typeId = CRM_Core_DAO::getFieldValue("CRM_Contribute_DAO_Contribution", $contributionId, 'contribution_type_id');
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $customFields);
if ($typeId == $customValue['extends_entity_column_value'] || CRM_Utils_System::isNull($customValue['extends_entity_column_value'])) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, null, $contributionId);
}
} else {
// handle non custom fields
CRM_Core_BAO_UFGroup::buildProfile($this, $field, null, $contributionId);
}
}
}
$this->assign('fields', $this->_fields);
// don't set the status message when form is submitted.
$buttonName = $this->controller->getButtonName('submit');
if ($suppressFields && $buttonName != '_qf_Batch_next') {
CRM_Core_Session::setStatus("FILE or Autocomplete Select type field(s) in the selected profile are not supported for Batch Update and have been excluded.");
}
$this->addDefaultButtons(ts('Update Contributions'));
}
示例3: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
CRM_Core_Error::fatal('ufGroupId is missing');
}
$this->_title = ts('Update multiple contacts') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->addDefaultButtons(ts('Save'));
$this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, FALSE, CRM_Core_Action::VIEW);
// remove file type field and then limit fields
$suppressFields = FALSE;
$removehtmlTypes = array('File', 'Autocomplete-Select');
foreach ($this->_fields as $name => $field) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name) && in_array($this->_fields[$name]['html_type'], $removehtmlTypes)) {
$suppressFields = TRUE;
unset($this->_fields[$name]);
}
}
//FIX ME: phone ext field is added at the end and it gets removed because of below code
//$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Update Contact(s)'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_contactIds);
// if below fields are missing we should not reset sort name / display name
// CRM-6794
$preserveDefaultsArray = array('first_name', 'last_name', 'middle_name', 'organization_name', 'prefix_id', 'suffix_id', 'household_name');
foreach ($this->_contactIds as $contactId) {
$profileFields = $this->_fields;
CRM_Core_BAO_Address::checkContactSharedAddressFields($profileFields, $contactId);
foreach ($profileFields as $name => $field) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $contactId);
if (in_array($field['name'], $preserveDefaultsArray)) {
$this->_preserveDefault = FALSE;
}
}
}
$this->assign('fields', $this->_fields);
// don't set the status message when form is submitted.
$buttonName = $this->controller->getButtonName('submit');
if ($suppressFields && $buttonName != '_qf_BatchUpdateProfile_next') {
CRM_Core_Session::setStatus(ts("File or Autocomplete-Select type field(s) in the selected profile are not supported for Update multiple contacts."), ts('Some Fields Excluded'), 'info');
}
$this->addDefaultButtons(ts('Update Contacts'));
$this->addFormRule(array('CRM_Contact_Form_Task_Batch', 'formRule'));
}
示例4: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
// current form id
$this->_id = $this->get('id');
$this->assign('gid', $this->_id);
$this->_group =& CRM_Core_PseudoConstant::group();
// setting title for html page
if ($this->_action == CRM_CORE_ACTION_UPDATE) {
$title = CRM_Core_BAO_UFGroup::getTitle($this->_id);
CRM_Utils_System::setTitle(ts('Profile Settings - %1', array(1 => $title)));
} else {
if ($this->_action == CRM_CORE_ACTION_DELETE) {
$title = CRM_Core_BAO_UFGroup::getTitle($this->_id);
CRM_Utils_System::setTitle(ts('Delete %1', array(1 => $title)));
$this->_title = $title;
$this->assign('title', $title);
} else {
CRM_Utils_System::setTitle(ts('New CiviCRM Profile Group'));
}
}
}
示例5: buildQuickForm
/**
* Build the form
*
* @access public
*
* @return void
*/
function buildQuickForm()
{
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
CRM_Core_Error::fatal('ufGroupId is missing');
}
$this->_title = ts('Batch Update for Activities') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->addDefaultButtons(ts('Save'));
$this->_fields = array();
$this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, FALSE, CRM_Core_Action::VIEW);
// remove file type field and then limit fields
$suppressFields = FALSE;
$removehtmlTypes = array('File', 'Autocomplete-Select');
foreach ($this->_fields as $name => $field) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name) && in_array($this->_fields[$name]['html_type'], $removehtmlTypes)) {
$suppressFields = TRUE;
unset($this->_fields[$name]);
}
//fix to reduce size as we are using this field in grid
if (is_array($field['attributes']) && $this->_fields[$name]['attributes']['size'] > 19) {
//shrink class to "form-text-medium"
$this->_fields[$name]['attributes']['size'] = 19;
}
}
$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Update Activities'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_activityHolderIds);
$fileFieldExists = FALSE;
//load all campaigns.
if (array_key_exists('activity_campaign_id', $this->_fields)) {
$this->_componentCampaigns = array();
CRM_Core_PseudoConstant::populate($this->_componentCampaigns, 'CRM_Activity_DAO_Activity', TRUE, 'campaign_id', 'id', ' id IN (' . implode(' , ', array_values($this->_activityHolderIds)) . ' ) ');
}
$customFields = CRM_Core_BAO_CustomField::getFields('Activity');
foreach ($this->_activityHolderIds as $activityId) {
$typeId = CRM_Core_DAO::getFieldValue("CRM_Activity_DAO_Activity", $activityId, 'activity_type_id');
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $customFields);
if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value']);
}
if (!empty($entityColumnValue[$typeId]) || CRM_Utils_System::isNull($entityColumnValue[$typeId])) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $activityId);
}
} else {
// handle non custom fields
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $activityId);
}
}
}
$this->assign('fields', $this->_fields);
// don't set the status message when form is submitted.
// $buttonName = $this->controller->getButtonName('submit');
if ($suppressFields) {
CRM_Core_Session::setStatus(ts("FILE or Autocomplete Select type field(s) in the selected profile are not supported for Batch Update."), ts("Some fields have been excluded"), "info");
}
$this->addDefaultButtons(ts('Update Activities'));
}
示例6: buildQuickForm
/**
* Build the form
*
* @access public
*
* @return void
*/
function buildQuickForm()
{
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
CRM_Core_Error::fatal('ufGroupId is missing');
}
$this->_title = ts('Batch Update for Events') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->addDefaultButtons(ts('Save'));
$this->_fields = array();
$this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, FALSE, CRM_Core_Action::VIEW);
// remove file type field and then limit fields
$suppressFields = FALSE;
$removehtmlTypes = array('File', 'Autocomplete-Select');
foreach ($this->_fields as $name => $field) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name) && in_array($this->_fields[$name]['html_type'], $removehtmlTypes)) {
$suppressFields = TRUE;
unset($this->_fields[$name]);
}
//fix to reduce size as we are using this field in grid
if (is_array($field['attributes']) && $this->_fields[$name]['attributes']['size'] > 19) {
//shrink class to "form-text-medium"
$this->_fields[$name]['attributes']['size'] = 19;
}
}
$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Update Participant(s)'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_participantIds);
$fileFieldExists = FALSE;
//load all campaigns.
if (array_key_exists('participant_campaign_id', $this->_fields)) {
$this->_componentCampaigns = array();
CRM_Core_PseudoConstant::populate($this->_componentCampaigns, 'CRM_Event_DAO_Participant', TRUE, 'campaign_id', 'id', ' id IN (' . implode(' , ', array_values($this->_participantIds)) . ' ) ');
}
//fix for CRM-2752
// get the option value for custom data type
$this->_roleCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantRole', 'name');
$this->_eventNameCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventName', 'name');
// build custom data getFields array
$customFieldsRole = CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, $this->_roleCustomDataTypeID);
$customFieldsEvent = CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, $this->_eventNameCustomDataTypeID);
$customFields = CRM_Utils_Array::crmArrayMerge($customFieldsRole, CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, NULL, TRUE));
$this->_customFields = CRM_Utils_Array::crmArrayMerge($customFieldsEvent, $customFields);
foreach ($this->_participantIds as $participantId) {
$roleId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'role_id');
$eventId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'event_id');
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $this->_customFields);
$entityColumnValue = array();
if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value']);
}
$entityColumnValueRole = CRM_Utils_Array::value($roleId, $entityColumnValue);
if ($this->_roleCustomDataTypeID == $customValue['extends_entity_column_id'] && $entityColumnValueRole) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
} elseif ($this->_eventNameCustomDataTypeID == $customValue['extends_entity_column_id'] && $eventId == $entityColumnValueRole) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
} elseif (CRM_Utils_System::isNull($entityColumnValueRole)) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
}
} else {
if ($field['name'] == 'participant_role_id') {
$field['is_multiple'] = TRUE;
}
// handle non custom fields
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
}
}
}
$this->assign('fields', $this->_fields);
// don't set the status message when form is submitted.
$buttonName = $this->controller->getButtonName('submit');
if ($suppressFields && $buttonName != '_qf_Batch_next') {
CRM_Core_Session::setStatus("FILE or Autocomplete Select type field(s) in the selected profile are not supported for Batch Update and have been excluded.");
}
$this->addDefaultButtons(ts('Update Participant(s)'));
}
示例7: profile
/**
* This function is for profile mode (standalone html form ) for uf group
*
* @return void
* @access public
*/
function profile()
{
$config = CRM_Core_Config::singleton();
// reassign resource base to be the full url, CRM-4660
$config->resourceBase = $config->userFrameworkResourceURL;
$config->useFrameworkRelativeBase = $config->userFrameworkBaseURL;
$gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0, 'GET');
$controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create'), CRM_Core_Action::ADD, FALSE, FALSE, TRUE);
$controller->reset();
$controller->process();
$controller->set('gid', $gid);
$controller->setEmbedded(TRUE);
$controller->run();
$template = CRM_Core_Smarty::singleton();
$template->assign('gid', $gid);
$template->assign('tplFile', 'CRM/Profile/Form/Edit.tpl');
$profile = trim($template->fetch('CRM/Form/default.tpl'));
// not sure how to circumvent our own navigation system to generate the right form url
$urlReplaceWith = 'civicrm/profile/create&gid=' . $gid . '&reset=1';
if ($config->userSystem->is_drupal && $config->cleanURL) {
$urlReplaceWith = 'civicrm/profile/create?gid=' . $gid . '&reset=1';
}
$profile = str_replace('civicrm/admin/uf/group', $urlReplaceWith, $profile);
// FIXME: (CRM-3587) hack to make standalone profile work
// in wordpress and joomla without administrator login
if ($config->userFramework == 'Joomla') {
$profile = str_replace('/administrator/', '/index.php', $profile);
} elseif ($config->userFramework == 'WordPress') {
$profile = str_replace('/wp-admin/admin.php', '/index.php', $profile);
}
// add jquery files
$profile = CRM_Utils_String::addJqueryFiles($profile);
$this->assign('profile', htmlentities($profile, ENT_NOQUOTES, 'UTF-8'));
//get the title of uf group
if ($gid) {
$title = CRM_Core_BAO_UFGroup::getTitle($gid);
$this->_title = $title;
} else {
$title = 'Profile Form';
}
$this->assign('title', $title);
$this->assign('action', CRM_Core_Action::PROFILE);
$this->assign('isForm', 0);
}
示例8: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$title = CRM_Core_BAO_UFGroup::getTitle($this->_id);
CRM_Core_BAO_UFGroup::del($this->_id);
CRM_Core_Session::setStatus(ts("Your CiviCRM Profile '%1' has been deleted.", array(1 => $title)), ts('Profile Deleted'), 'success');
} elseif ($this->_action & CRM_Core_Action::DISABLE) {
$ufJoinParams = array('uf_group_id' => $this->_id);
CRM_Core_BAO_UFGroup::delUFJoin($ufJoinParams);
CRM_Core_BAO_UFGroup::setIsActive($this->_id, 0);
} else {
// get the submitted form values.
$params = $ids = array();
$params = $this->controller->exportValues($this->_name);
if (!array_key_exists('is_active', $params)) {
$params['is_active'] = 0;
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['ufgroup'] = $this->_id;
// CRM-5284
// lets skip trying to mess around with profile weights and allow the user to do as needed.
} elseif ($this->_action & CRM_Core_Action::ADD) {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
}
// create uf group
$ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids);
if (!empty($params['is_active'])) {
//make entry in uf join table
CRM_Core_BAO_UFGroup::createUFJoin($params, $ufGroup->id);
} elseif ($this->_id) {
// this profile has been set to inactive, delete all corresponding UF Join's
$ufJoinParams = array('uf_group_id' => $this->_id);
CRM_Core_BAO_UFGroup::delUFJoin($ufJoinParams);
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$url = CRM_Utils_System::url('civicrm/admin/uf/group', 'reset=1&action=browse');
CRM_Core_Session::setStatus(ts("Your CiviCRM Profile '%1' has been saved.", array(1 => $ufGroup->title)), ts('Profile Saved'), 'success');
} else {
// Jump directly to adding a field if popups are disabled
$action = CRM_Core_Resources::singleton()->ajaxPopupsEnabled ? '' : '/add';
$url = CRM_Utils_System::url("civicrm/admin/uf/group/field{$action}", 'reset=1&gid=' . $ufGroup->id . '&action=' . ($action ? 'add' : 'browse'));
CRM_Core_Session::setStatus(ts('Your CiviCRM Profile \'%1\' has been added. You can add fields to this profile now.', array(1 => $ufGroup->title)), ts('Profile Added'), 'success');
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
// update cms integration with registration / my account
CRM_Utils_System::updateCategories();
}
示例9: crm_uf_get_profile_title
/**
* Get the form title.
*
* @param int $id id of uf_form
* @return string title
*
* @access public
* @static
*
*/
function crm_uf_get_profile_title($id)
{
return CRM_Core_BAO_UFGroup::getTitle($id);
}
示例10: profile
/**
* This function is for profile mode (standalone html form ) for uf group
*
* @return void
* @access public
*/
function profile()
{
$config =& CRM_Core_Config::singleton();
// reassign resource base to be the full url, CRM-4660
$config->resourceBase = $config->userFrameworkResourceURL;
$config->useFrameworkRelativeBase = $config->userFrameworkBaseURL;
$gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, false, 0, 'GET');
$controller =& new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create'), CRM_Core_Action::ADD, false, false, true);
$controller->reset();
$controller->process();
$controller->set('gid', $gid);
$controller->setEmbedded(true);
$controller->run();
$template =& CRM_Core_Smarty::singleton();
$template->assign('gid', $gid);
$template->assign('tplFile', 'CRM/Profile/Form/Edit.tpl');
$profile = trim($template->fetch('CRM/Form/default.tpl'));
// not sure how to circumvent our own navigation system to generate the right form url
$profile = str_replace('civicrm/admin/uf/group', 'civicrm/profile/edit&gid=' . $gid . '&reset=1', $profile);
// FIXME: (CRM-3587) hack to make standalone profile in joomla work
// without administrator login
if ($config->userFramework == 'Joomla') {
$profile = str_replace('/administrator/index2.php', '/index.php', $profile);
}
$this->assign('profile', htmlentities($profile));
//get the title of uf group
if ($gid) {
$title = CRM_Core_BAO_UFGroup::getTitle($gid);
$this->_title = $title;
} else {
$title = 'Profile Form';
}
$this->assign('title', $title);
$this->assign('action', CRM_Core_Action::PROFILE);
$this->assign('isForm', 0);
}
示例11: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
*
* @return void
* @access public
*
*/
function run()
{
// get the group id
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, false, 0);
if ($this->_gid) {
require_once 'CRM/Core/BAO/UFGroup.php';
$groupTitle = CRM_Core_BAO_UFGroup::getTitle($this->_gid);
$this->assign('gid', $this->_gid);
$this->assign('groupTitle', $groupTitle);
CRM_Utils_System::setTitle(ts('%1 - CiviCRM Profile Fields', array(1 => $groupTitle)));
}
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
// default to 'browse'
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
// what action to take ?
if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::VIEW | CRM_Core_Action::DELETE)) {
$this->edit($action);
// no browse for edit/update/view/delete
} else {
if ($action & CRM_Core_Action::PREVIEW) {
$this->preview($id, $this->_gid);
} else {
require_once 'CRM/Core/BAO/UFField.php';
$this->browse();
}
}
// Call the parents run method
parent::run();
}
示例12: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$title = CRM_Core_BAO_UFGroup::getTitle($this->_id);
CRM_Core_BAO_UFGroup::del($this->_id);
CRM_Core_Session::setStatus(ts("Your CiviCRM Profile '%1' has been deleted.", array(1 => $title)));
} else {
if ($this->_action & CRM_Core_Action::DISABLE) {
$ufJoinParams = array('uf_group_id' => $this->_id);
CRM_Core_BAO_UFGroup::delUFJoin($ufJoinParams);
require_once "CRM/Core/BAO/UFGroup.php";
CRM_Core_BAO_UFGroup::setIsActive($this->_id, 0);
} else {
// get the submitted form values.
$params = $ids = array();
$params = $this->controller->exportValues($this->_name);
if (!array_key_exists('is_active', $params)) {
$params['is_active'] = 0;
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['ufgroup'] = $this->_id;
// CRM-5284
// lets skip trying to mess around with profile weights and allow the user to do as needed.
} else {
if ($this->_action & CRM_Core_Action::ADD) {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
}
}
// create uf group
$ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids);
if (CRM_Utils_Array::value('is_active', $params)) {
//make entry in uf join table
CRM_Core_BAO_UFGroup::createUFJoin($params, $ufGroup->id);
} else {
if ($this->_id) {
// this profile has been set to inactive, delete all corresponding UF Join's
$ufJoinParams = array('uf_group_id' => $this->_id);
CRM_Core_BAO_UFGroup::delUFJoin($ufJoinParams);
}
}
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Core_Session::setStatus(ts("Your CiviCRM Profile '%1' has been saved.", array(1 => $ufGroup->title)));
} else {
$url = CRM_Utils_System::url('civicrm/admin/uf/group/field/add', 'reset=1&action=add&gid=' . $ufGroup->id);
CRM_Core_Session::setStatus(ts('Your CiviCRM Profile \'%1\' has been added. You can add fields to this profile now.', array(1 => $ufGroup->title)));
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
}
}
// update cms integration with registration / my account
require_once 'CRM/Utils/System.php';
CRM_Utils_System::updateCategories();
}
示例13: profile
/**
* This function is for profile mode (standalone html form ) for uf group
*
* @return void
* @access public
*/
function profile()
{
$gid = CRM_Utils_Request::retrieve('gid', $this, false, 0, 'GET');
$controller =& new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create'), CRM_CORE_ACTION_ADD);
$controller->reset();
$controller->process();
$controller->set('gid', $gid);
$controller->setEmbedded(true);
$controller->run();
$template =& CRM_Core_Smarty::singleton();
$template->assign('tplFile', 'CRM/Profile/Form/Edit.tpl');
$profile = trim($template->fetch('CRM/form.tpl'));
// not sure how to circumvent our own navigation system to generate the right form url
$profile = str_replace('civicrm/admin/uf/group', 'civicrm/profile/edit&gid=' . $gid . '&reset=1', $profile);
$this->assign('profile', htmlentities($profile));
//get the title of uf group
if ($gid) {
$title = CRM_Core_BAO_UFGroup::getTitle($gid);
} else {
$title = 'Profile Form';
}
$this->assign('title', $title);
$this->assign('action', CRM_CORE_ACTION_PROFILE);
$this->assign('isForm', 0);
}
示例14: buildQuickForm
/**
* Build the form
*
* @access public
* @return void
*/
function buildQuickForm()
{
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
CRM_Core_Error::fatal('ufGroupId is missing');
}
require_once "CRM/Core/BAO/UFGroup.php";
$this->_title = ts('Batch Update') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->addDefaultButtons(ts('Save'));
$this->_fields = array();
$this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, false, CRM_Core_Action::VIEW);
// remove file type field and then limit fields
$suppressFields = false;
$removehtmlTypes = array('File', 'Autocomplete-Select');
foreach ($this->_fields as $name => $field) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name) && in_array($this->_fields[$name]['html_type'], $removehtmlTypes)) {
$suppressFields = true;
unset($this->_fields[$name]);
}
}
$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Update Contact(s)'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_contactIds);
foreach ($this->_contactIds as $contactId) {
foreach ($this->_fields as $name => $field) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, null, $contactId);
}
}
$this->assign('fields', $this->_fields);
// don't set the status message when form is submitted.
$buttonName = $this->controller->getButtonName('submit');
if ($suppressFields && $buttonName != '_qf_BatchUpdateProfile_next') {
CRM_Core_Session::setStatus("FILE or Autocomplete Select type field(s) in the selected profile are not supported for Batch Update and have been excluded.");
}
$this->addDefaultButtons(ts('Update Contacts'));
$this->addFormRule(array('CRM_Contact_Form_Task_Batch', 'formRule'));
}