本文整理汇总了PHP中CRM_Core_Error::statusBounce方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Error::statusBounce方法的具体用法?PHP CRM_Core_Error::statusBounce怎么用?PHP CRM_Core_Error::statusBounce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Error
的用法示例。
在下文中一共展示了CRM_Core_Error::statusBounce方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
$session =& CRM_Core_Session::singleton();
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false);
$this->_pageId = CRM_Utils_Request::retrieve('pageId', 'Positive', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($this->_id) {
$contactID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'contact_id');
}
$this->_contactID = isset($contactID) ? $contactID : $session->get('userID');
if (!$this->_pageId) {
$this->_pageId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'contribution_page_id');
}
$config =& CRM_Core_Config::singleton();
//redirect back to online Contribution page, we allow only logged in
//user to configure the PCP account and Page in standalone installation.
if ($config->userFramework == 'Standalone' && !$this->_contactID) {
CRM_Core_Error::statusBounce(ts("You must login with your OpenID provider before you can create a Personal Campaign Page."), CRM_Utils_System::url('civicrm/contribute/transact', "reset=1&id={$this->_pageId}", false, null, false, true));
}
$this->_single = $this->get('single');
if (!$this->_single) {
$this->_single = $session->get('singleForm');
}
$this->set('action', $this->_action);
$this->set('page_id', $this->_id);
$this->set('contribution_page_id', $this->_pageId);
// we do not want to display recently viewed items, so turn off
$this->assign('displayRecent', false);
if ($this->_single) {
CRM_Utils_System::setTitle(ts('Update Contact Information'));
}
}
示例2: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
if ($id) {
$this->_contributionIds = array($id);
$this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
$this->_single = true;
$this->assign('totalSelectedContributions', 1);
} else {
parent::preProcess();
}
// check that all the contribution ids have pending status
$query = "\nSELECT count(*)\nFROM civicrm_contribution\nWHERE contribution_status_id != 2\nAND {$this->_componentClause}";
$count = CRM_Core_DAO::singleValueQuery($query, CRM_Core_DAO::$_nullArray);
if ($count != 0) {
CRM_Core_Error::statusBounce(ts('Please select only online contributions with Pending status.'));
}
// ensure that all contributions are generated online by pay later
$query = "\nSELECT DISTINCT( source ) as source\nFROM civicrm_contribution\nWHERE {$this->_componentClause}";
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
while ($dao->fetch()) {
if (strpos($dao->source, ts('Online Contribution')) === false && strpos($dao->source, ts('Online Event Registration')) === false) {
CRM_Core_Error::statusBounce("<strong>Update Pending Contribution Status</strong> can only be used for pending online contributions (made using the 'Pay Later' option). The Source for these contributions starts with 'Online ...'. Please de-select any offline contributions and try again.");
}
}
// we have all the contribution ids, so now we get the contact ids
parent::setContactIDs();
$this->assign('single', $this->_single);
}
示例3: run
function run()
{
require_once 'CRM/Utils/Request.php';
require_once 'CRM/Core/DAO.php';
$eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, true);
$fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, false);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
$quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
require_once 'CRM/Core/BAO/File.php';
list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, null, $quest);
if (!$path) {
CRM_Core_Error::statusBounce('Could not retrieve the file');
}
$buffer = file_get_contents($path);
if (!$buffer) {
CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
}
if ($action & CRM_Core_Action::DELETE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
CRM_Core_BAO_File::delete($id, $eid, $fid);
CRM_Core_Session::setStatus(ts('The attached file has been deleted.'));
$session = CRM_Core_Session::singleton();
$toUrl = $session->popUserContext();
CRM_Utils_System::redirect($toUrl);
} else {
$wrapper = new CRM_Utils_Wrapper();
return $wrapper->run('CRM_Custom_Form_DeleteFile', ts('Domain Information Page'), null);
}
} else {
require_once 'CRM/Utils/File.php';
CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
}
}
示例4: run
function run()
{
$contactID = CRM_Utils_Request::retrieve('cid', 'Integer');
if (!empty($contactID)) {
if (!self::checkPermissions($contactID, 'viewWidget')) {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm'));
CRM_Core_Error::statusBounce(ts('You do not have permission to access this page'));
}
CRM_Utils_System::setTitle(ts('Absences for %1', array(1 => CRM_Contact_BAO_Contact::displayName($contactID))));
self::registerResources($contactID);
} else {
$session = CRM_Core_Session::singleton();
if (is_numeric($session->get('userID'))) {
if (!self::checkPermissions($session->get('userID'), 'viewWidget')) {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm'));
CRM_Core_Error::statusBounce(ts('You do not have permission to access this page'));
}
CRM_Utils_System::setTitle(ts('My Absences'));
self::registerResources($session->get('userID'));
} else {
throw new CRM_Core_Exception("Failed to determine contact ID");
}
}
parent::run();
}
示例5: preProcess
/**
* Pre-processing for the form.
*
* @throws \Exception
*/
public function preProcess()
{
$this->setAction(CRM_Core_Action::UPDATE);
$this->contributionRecurID = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
if ($this->contributionRecurID) {
$this->_paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($this->contributionRecurID);
if (!$this->_paymentProcessor) {
CRM_Core_Error::statusBounce(ts('There is no valid processor for this subscription so it cannot be edited.'));
}
$this->_paymentProcessorObj = $this->_paymentProcessor['object'];
$this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->contributionRecurID);
}
$this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE);
if ($this->_coid) {
$this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'info');
$this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
$this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
$this->contributionRecurID = $this->_subscriptionDetails->recur_id;
} elseif ($this->contributionRecurID) {
$this->_coid = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->contributionRecurID, 'id', 'contribution_recur_id');
}
if (!$this->contributionRecurID || $this->_subscriptionDetails == CRM_Core_DAO::$_nullObject) {
CRM_Core_Error::fatal('Required information missing.');
}
if ($this->_subscriptionDetails->membership_id && $this->_subscriptionDetails->auto_renew) {
CRM_Core_Error::fatal(ts('You cannot update the subscription.'));
}
if (!CRM_Core_Permission::check('edit contributions')) {
$userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE);
if (!CRM_Contact_BAO_Contact_Utils::validChecksum($this->_subscriptionDetails->contact_id, $userChecksum)) {
CRM_Core_Error::fatal(ts('You do not have permission to update subscription.'));
}
$this->_selfService = TRUE;
}
$this->assign('self_service', $this->_selfService);
$this->editableScheduleFields = $this->_paymentProcessorObj->getEditableRecurringScheduleFields();
$changeHelpText = $this->_paymentProcessorObj->getRecurringScheduleUpdateHelpText();
if (!in_array('amount', $this->editableScheduleFields)) {
// Not sure if this is good behaviour - maintaining this existing behaviour for now.
CRM_Core_Session::setStatus($changeHelpText, ts('Warning'), 'alert');
} else {
$this->assign('changeHelpText', $changeHelpText);
}
$alreadyHardCodedFields = array('amount', 'installments');
foreach ($this->editableScheduleFields as $editableScheduleField) {
if (!in_array($editableScheduleField, $alreadyHardCodedFields)) {
$this->addField($editableScheduleField, array('entity' => 'ContributionRecur'));
}
}
$this->assign('editableScheduleFields', array_diff($this->editableScheduleFields, $alreadyHardCodedFields));
$this->assign('paymentProcessor', $this->_paymentProcessor);
$this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
$this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
if ($this->_subscriptionDetails->contact_id) {
list($this->_donorDisplayName, $this->_donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
}
CRM_Utils_System::setTitle(ts('Update Recurring Contribution'));
// Handle context redirection.
CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
}
示例6: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
$this->_isTemplate = (bool) CRM_Utils_Request::retrieve('template', 'Integer', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
if ($this->_isTemplate) {
CRM_Utils_System::setTitle(ts('New Vacancy Template'));
}
if ($this->_id) {
if ($this->_isTemplate = CRM_Core_DAO::getFieldValue('CRM_HRRecruitment_DAO_HRVacancy', $this->_id, 'is_template')) {
CRM_Utils_System::setTitle(ts('Edit Vacancy Template'));
} else {
CRM_Utils_System::setTitle(ts('Edit Vacancy'));
}
}
$this->assign('isTemplate', $this->_isTemplate);
$session = CRM_Core_Session::singleton();
if ($this->_id) {
$permission = CRM_HRRecruitment_BAO_HRVacancyPermission::checkVacancyPermission($this->_id, array("administer Vacancy", "administer CiviCRM"));
} else {
$permission = CRM_Core_Permission::checkAnyPerm(array("administer Vacancy", "administer CiviCRM"));
}
if (!$permission) {
$session->pushUserContext(CRM_Utils_System::url('civicrm'));
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to perform this action.'));
}
CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrrecruitment', 'templates/CRM/HRRecruitment/Form/HRVacancy.js');
}
示例7: run
public function run()
{
$eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, TRUE);
$fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, NULL, $quest);
if (!$path) {
CRM_Core_Error::statusBounce('Could not retrieve the file');
}
$buffer = file_get_contents($path);
if (!$buffer) {
CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
}
if ($action & CRM_Core_Action::DELETE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
CRM_Core_BAO_File::deleteFileReferences($id, $eid, $fid);
CRM_Core_Session::setStatus(ts('The attached file has been deleted.'), ts('Complete'), 'success');
$session = CRM_Core_Session::singleton();
$toUrl = $session->popUserContext();
CRM_Utils_System::redirect($toUrl);
}
} else {
CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
}
}
示例8: preProcess
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess()
{
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($id) {
$this->_contributionIds = array($id);
$this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
$this->_single = TRUE;
$this->assign('totalSelectedContributions', 1);
} else {
parent::preProcess();
}
// check that all the contribution ids have pending status
$query = "\nSELECT count(*)\nFROM civicrm_contribution\nWHERE contribution_status_id != 1\nAND {$this->_componentClause}";
$count = CRM_Core_DAO::singleValueQuery($query);
if ($count != 0) {
CRM_Core_Error::statusBounce("Please select only online contributions with Completed status.");
}
// we have all the contribution ids, so now we get the contact ids
parent::setContactIDs();
$this->assign('single', $this->_single);
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
$breadCrumb = array(array('url' => $url, 'title' => ts('Search Results')));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
}
示例9: preProcess
public function preProcess()
{
parent::preProcess();
$this->_groupID = CRM_Utils_Request::retrieve('gid', 'Integer', $this, FALSE, NULL, 'REQUEST');
// ensure that there is a destination, if not set the destination to the
// referrer string
if (!$this->controller->getDestination()) {
$this->controller->setDestination(NULL, TRUE);
}
if ($this->_groupID) {
$groupTypeCondition = CRM_Contact_BAO_Group::groupTypeCondition('Mailing');
// make sure requested qroup is accessible and exists
$query = "\nSELECT title, description\n FROM civicrm_group\n WHERE id={$this->_groupID}\n AND visibility != 'User and User Admin Only'\n AND {$groupTypeCondition}";
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
if ($dao->fetch()) {
$this->assign('groupName', $dao->title);
CRM_Utils_System::setTitle(ts('Subscribe to Mailing List - %1', array(1 => $dao->title)));
} else {
CRM_Core_Error::statusBounce("The specified group is not configured for this action OR The group doesn't exist.");
}
$this->assign('single', TRUE);
} else {
$this->assign('single', FALSE);
CRM_Utils_System::setTitle(ts('Mailing List Subscription'));
}
}
示例10: preProcess
/**
* This function is called prior to building and submitting the form
*/
function preProcess()
{
// check contact_id
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if (empty($this->_contactId)) {
CRM_Core_Error::statusBounce(ts('Could not get a contact id.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// check for permissions
$session = CRM_Core_Session::singleton();
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// get session
$session = CRM_Core_Session::singleton();
// get values
$this->_configGroup = CRM_Lidmaatschapwijziging_ConfigGroup::singleton($this->_contactId);
$this->_values = $this->_configGroup->getContact();
// set display name
$this->_display_name = $this->_values['display_name'];
// set title
CRM_Utils_System::setTitle('LidmaatschapWijziging - Group - ' . $this->_values['display_name']);
// set contact id
$this->_values['contact_id'] = $this->_contactId;
}
示例11: postProcess
/**
* Process the form submission.
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$errors = CRM_Financial_BAO_FinancialType::del($this->_id);
if (!empty($errors)) {
CRM_Core_Error::statusBounce($errors['error_message'], CRM_Utils_System::url('civicrm/admin/financial/financialType', "reset=1&action=browse"), ts('Cannot Delete'));
}
CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'), ts('Record Deleted'), 'success');
} else {
$params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['financialType'] = $this->_id;
}
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
if ($this->_action & CRM_Core_Action::UPDATE) {
$url = CRM_Utils_System::url('civicrm/admin/financial/financialType', 'reset=1&action=browse');
CRM_Core_Session::setStatus(ts('The financial type "%1" has been updated.', array(1 => $financialType->name)), ts('Saved'), 'success');
} else {
$url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', 'reset=1&action=browse&aid=' . $financialType->id);
$statusArray = array(1 => $financialType->name, 2 => $financialType->name, 3 => CRM_Utils_Array::value(0, $financialType->titles), 4 => CRM_Utils_Array::value(1, $financialType->titles), 5 => CRM_Utils_Array::value(2, $financialType->titles));
if (empty($financialType->titles)) {
$text = ts('Your Financial "%1" Type has been created and assigned to an existing financial account with the same title. You should review the assigned account and determine whether additional account relationships are needed.', $statusArray);
} else {
$text = ts('Your Financial "%1" Type has been created, along with a corresponding income account "%2". That income account, along with standard financial accounts "%3", "%4" and "%5" have been linked to the financial type. You may edit or replace those relationships here.', $statusArray);
}
CRM_Core_Session::setStatus($text, ts('Saved'), 'success', array('expires' => 0));
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
}
示例12: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
$instanceId = CRM_Report_Utils_Report::getInstanceID();
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
$optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
$reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
if ($action & CRM_Core_Action::DELETE) {
if (!CRM_Core_Permission::check('administer Reports')) {
$statusMessage = ts('Your do not have permission to Delete Report.');
CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
}
CRM_Report_BAO_Instance::delete($instanceId);
CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.'));
} else {
require_once 'CRM/Core/OptionGroup.php';
$templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
if (strstr($templateInfo['name'], '_Form')) {
$instanceInfo = array();
CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
if (!empty($instanceInfo['title'])) {
CRM_Utils_System::setTitle($instanceInfo['title']);
$this->assign('reportTitle', $instanceInfo['title']);
} else {
CRM_Utils_System::setTitle($templateInfo['label']);
$this->assign('reportTitle', $templateInfo['label']);
}
$wrapper =& new CRM_Utils_Wrapper();
return $wrapper->run($templateInfo['name'], null, null);
}
CRM_Core_Session::setStatus(ts('Could not find template for the instance.'));
}
return CRM_Utils_System::redirect($reportUrl);
}
示例13: preProcess
/**
* This function is called prior to building and submitting the form
*/
function preProcess()
{
// check contact_id
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if (empty($this->_contactId)) {
CRM_Core_Error::statusBounce(ts('Could not get a contact id.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// check for permissions
$session = CRM_Core_Session::singleton();
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// get request
$this->_request = CRM_Utils_Request::retrieve('request', 'String', $this, FALSE, 'choose');
// get session
$session = CRM_Core_Session::singleton();
// get values
$this->_configRelationship = CRM_Lidmaatschapwijziging_ConfigRelationship::singleton($this->_contactId);
$this->_values = $this->_configRelationship->getContact();
// set contact id
$this->_values['contact_id'] = $this->_contactId;
// set display name
$this->_display_name = $this->_values['display_name'];
// set request
$this->_values['request'] = $this->_request;
// set title
CRM_Utils_System::setTitle('LidmaatschapWijziging - Relatie - ' . $this->_values['display_name']);
// request
if ('empty' == $this->_request) {
}
if ('choose' == $this->_request) {
// if there is no relatiosnhips then the options are empty, we
// show a message that there are no memebrships and a submit butten to
// go to the relationship, first we redirect them to request empty
$relationships = $this->_configRelationship->getRelationships();
if (empty($relationships)) {
// redirect user
$url = CRM_Utils_System::url('civicrm/lidmaatschapwijziging/relationship', 'reset=1&request=empty&cid=' . $this->_contactId);
CRM_Utils_System::redirect($url);
}
}
if ('update' == $this->_request) {
// get relationship id
$this->_relationshipId = CRM_Utils_Request::retrieve('relationship_id', 'Positive', $this);
$this->_values['relationship_id'] = $this->_relationshipId;
// get relationship
$this->_values = array_merge($this->_values, $this->_configRelationship->getRelationship($this->_relationshipId));
if (!empty($this->_values['contact_a']['display_name'])) {
$this->assign('sort_name_a', $this->_values['contact_a']['display_name']);
}
if (!empty($this->_values['contact_b']['display_name'])) {
$this->assign('sort_name_b', $this->_values['contact_b']['display_name']);
}
// note
$this->_values['note_id'] = $this->_values['notes']['id'];
$this->_values['note'] = $this->_values['notes']['note'];
}
}
示例14: preProcess
/**
* Pre processing work done here.
*
* gets session variables for group or field id
*
* @return void
*/
public function preProcess()
{
// get the controller vars
$this->_groupId = $this->get('groupId');
$this->_fieldId = $this->get('fieldId');
if ($this->_fieldId) {
// field preview
$defaults = array();
$params = array('id' => $this->_fieldId);
$fieldDAO = new CRM_Core_DAO_CustomField();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
if (!empty($defaults['is_view'])) {
CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.'));
} elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) {
CRM_Core_Error::statusBounce(ts('This field is inactive so it will not display on edit form.'));
}
$groupTree = array();
$groupTree[$this->_groupId]['id'] = 0;
$groupTree[$this->_groupId]['fields'] = array();
$groupTree[$this->_groupId]['fields'][$this->_fieldId] = $defaults;
$this->_groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1, $this);
$this->assign('preview_type', 'field');
} else {
$groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail($this->_groupId);
$this->_groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, TRUE, $this);
$this->assign('preview_type', 'group');
}
}
示例15: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
// reset action from the session
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'update');
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$rcid = CRM_Utils_Request::retrieve('rcid', 'Positive', $this);
$rcid = $rcid ? "&id={$rcid}" : '';
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1{$rcid}"));
if ($this->_contactId) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $this->_contactId;
if (!$contact->find(TRUE)) {
CRM_Core_Error::statusBounce(ts('contact does not exist: %1', array(1 => $this->_contactId)));
}
$this->_contactType = $contact->contact_type;
// check for permissions
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'));
}
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
} else {
CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
}
}