本文整理汇总了PHP中CRM_Utils_System::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::redirect方法的具体用法?PHP CRM_Utils_System::redirect怎么用?PHP CRM_Utils_System::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
function postProcess()
{
$values = $this->exportValues();
$pcp_type_contact = $values['pcp_contact_id'];
$pcp_type = $values['pcp_type'];
$custom_group_name = CRM_Pcpteams_Constant::C_PCP_CUSTOM_GROUP_NAME;
$customGroupParams = array('version' => 3, 'sequential' => 1, 'name' => $custom_group_name);
$custom_group_ret = civicrm_api('CustomGroup', 'GET', $customGroupParams);
$customGroupID = $custom_group_ret['id'];
$customGroupTableName = $custom_group_ret['values'][0]['table_name'];
$query = "SELECT ct.pcp_type_contact as contactID FROM {$customGroupTableName} ct WHERE ct.pcp_type = '{$pcp_type}'";
$dao = CRM_Core_DAO::executeQuery($query);
$pcpFound = FALSE;
while ($dao->fetch()) {
if ($dao->contactID == $pcp_type_contact) {
CRM_Core_Session::setStatus(ts('PCP Found. Redirecting to dashboard'));
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/dashboard', 'reset=1'));
$pcpFound = TRUE;
break;
}
}
if (!$pcpFound) {
CRM_Core_Session::setStatus(ts('PCP Not Found. Creating New PCP Record'));
$PcpID = $this->_pcpId;
$insertQuery = "\n INSERT INTO `civicrm_value_pcp_custom_set` (`id`, `entity_id`, `team_pcp_id`, `pcp_type`, `pcp_type_contact`) VALUES (NULL, {$PcpID}, NULL, '{$pcp_type}', {$pcp_type_contact})";
$dao = CRM_Core_DAO::executeQuery($insertQuery);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/pcp/dashboard', 'reset=1'));
}
//Fixme:
parent::postProcess();
}
示例2: postProcess
function postProcess()
{
$values = $this->exportValues();
// find/determine household name
if ($values['hh_option'] == 'new') {
// extract the name:
if ($values['household_name_pattern'] == 'custom') {
$household_name = $values['household_name'];
} else {
$household_name = $values['household_name_pattern'];
}
$household = civicrm_api3('Contact', 'create', array('contact_type' => 'Household', 'household_name' => $household_name));
$household_id = $household['id'];
} elseif ($values['hh_option'] == 'existing') {
$household_id = (int) $values['existing_household'];
} else {
// has to be the selected_XXX preselected household change
$household_id = (int) substr($values['hh_option'], 9);
}
// find contact_ids
$contact_ids = $values['hh_contacts'];
// ...and pass the ball to the merge view
$mergeview_url = CRM_Utils_System::url('civicrm/household/mergeview', "hid={$household_id}&oids={$contact_ids}");
CRM_Utils_System::redirect($mergeview_url);
parent::postProcess();
}
示例3: preProcess
/**
* @param CRM_Core_Form $form
* @param null $type
* @param null $mode
*
* @throws Exception
*/
public static function preProcess(&$form, $type = NULL, $mode = NULL)
{
if ($type) {
$form->_type = $type;
} else {
$form->_type = CRM_Utils_Request::retrieve('type', 'String', $form);
}
if ($form->_type) {
$form->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($form->_type, $form->_mode);
}
$form->set('paymentProcessor', $form->_paymentProcessor);
// also set cancel subscription url
if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) {
$form->_paymentObject = CRM_Core_Payment::singleton($mode, $form->_paymentProcessor, $form);
$form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL();
}
//checks after setting $form->_paymentProcessor
// we do this outside of the above conditional to avoid
// saving the country/state list in the session (which could be huge)
CRM_Core_Payment_Form::setPaymentFieldsByProcessor($form, $form->_paymentProcessor);
$form->assign_by_ref('paymentProcessor', $form->_paymentProcessor);
// check if this is a paypal auto return and redirect accordingly
//@todo - determine if this is legacy and remove
if (CRM_Core_Payment::paypalRedirect($form->_paymentProcessor)) {
$url = CRM_Utils_System::url('civicrm/contribute/transact', "_qf_ThankYou_display=1&qfKey={$form->controller->_key}");
CRM_Utils_System::redirect($url);
}
// make sure we have a valid payment class, else abort
if (!empty($form->_values['is_monetary']) && !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])) {
CRM_Core_Error::fatal(ts('Payment processor is not set for this page'));
}
if (!empty($form->_membershipBlock) && !empty($form->_membershipBlock['is_separate_payment']) && (!empty($form->_paymentProcessor['class_name']) && !(CRM_Utils_Array::value('billing_mode', $form->_paymentProcessor) & CRM_Core_Payment::BILLING_MODE_FORM))) {
CRM_Core_Error::fatal(ts('This contribution page is configured to support separate contribution and membership payments. This %1 plugin does not currently support multiple simultaneous payments, or the option to "Execute real-time monetary transactions" is disabled. Please contact the site administrator and notify them of this error', array(1 => $form->_paymentProcessor['payment_processor_type'])));
}
}
示例4: buildForm
function buildForm(&$form)
{
$groups =& CRM_Core_PseudoConstant::group();
$tags =& CRM_Core_PseudoConstant::tag();
if (count($groups) == 0 || count($tags) == 0) {
CRM_Core_Session::setStatus(ts("Atleast one Group and Tag must be present, for Custom Group / Tag search."));
$url = CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1');
CRM_Utils_System::redirect($url);
}
$inG =& $form->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outG =& $form->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$andOr =& $form->addElement('checkbox', 'andOr', 'Combine With (AND, Uncheck For OR)', null, array('checked' => 'checked'));
$int =& $form->addElement('advmultiselect', 'includeTags', ts('Include Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outt =& $form->addElement('advmultiselect', 'excludeTags', ts('Exclude Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
//add/remove buttons for groups
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$outG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
//add/remove buttons for tags
$int->setButtonAttributes('add', array('value' => ts('Add >>')));
$outt->setButtonAttributes('add', array('value' => ts('Add >>')));
$int->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outt->setButtonAttributes('remove', array('value' => ts('<< Remove')));
/**
* if you are using the standard template, this array tells the template what elements
* are part of the search criteria
*/
$form->assign('elements', array('includeGroups', 'excludeGroups', 'andOr', 'includeTags', 'excludeTags'));
}
示例5: 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);
}
}
示例6: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
if ($this->_action == CRM_Core_Action::DELETE) {
if ($this->_id && ($tag = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $this->_id, 'name', 'parent_id'))) {
CRM_Core_Session::setStatus(ts("This tag cannot be deleted! You must Delete all its child tags ('%1', etc) prior to deleting this tag.", array(1 => $tag)));
$url = CRM_Utils_System::url('civicrm/admin/tag', "reset=1");
CRM_Utils_System::redirect($url);
return true;
} else {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
} else {
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'name'), true);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Tag', $this->_id));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'description'));
//@lobo haven't a clue why the checkbox isn't displayed (it should be checked by default
$this->add('checkbox', 'is_selectable', ts("If it's a tag or a category"));
$allTag = array('' => '- ' . ts('select') . ' -') + CRM_Core_PseudoConstant::tag();
if ($this->_id) {
unset($allTag[$this->_id]);
}
$this->add('select', 'parent_id', ts('Parent Tag'), $allTag);
parent::buildQuickForm();
}
}
示例7: run
function run()
{
$this->setActivityStatusIds();
$this->setValues();
$contactParams = array('is_opt_out' => 1);
$groupId = CRM_Core_BAO_Setting::getItem('Speakcivi API Preferences', 'group_id');
$location = '';
if ($this->isGroupContactAdded($this->contactId, $groupId)) {
$this->setGroupContactRemoved($this->contactId, $groupId);
$location = 'removed from Members after optout link';
if (CRM_Speakcivi_Cleanup_Leave::hasJoins($this->contactId)) {
CRM_Speakcivi_Logic_Activity::leave($this->contactId, 'confirmation_link', $this->campaignId, $this->activityId, '', 'Added by SpeakCivi Optout');
}
}
if ($this->campaignId) {
$campaign = new CRM_Speakcivi_Logic_Campaign($this->campaignId);
$locale = $campaign->getLanguage();
$language = substr($locale, 0, 2);
$this->setLanguageTag($this->contactId, $language);
}
CRM_Speakcivi_Logic_Contact::set($this->contactId, $contactParams);
$aids = $this->findActivitiesIds($this->activityId, $this->campaignId, $this->contactId);
$this->setActivitiesStatuses($this->activityId, $aids, 'optout', $location);
$country = $this->getCountry($this->campaignId);
$url = "{$country}/post_optout";
CRM_Utils_System::redirect($url);
}
示例8: __construct
function __construct()
{
// don’t display the ‘Add these Contacts to Group’ button
$this->_add2groupSupported = FALSE;
$dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
$this->db = $dsn['database'];
$this->log_conn_id = CRM_Utils_Request::retrieve('log_conn_id', 'Integer', CRM_Core_DAO::$_nullObject);
$this->log_date = CRM_Utils_Request::retrieve('log_date', 'String', CRM_Core_DAO::$_nullObject);
$this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$this->raw = CRM_Utils_Request::retrieve('raw', 'Boolean', CRM_Core_DAO::$_nullObject);
parent::__construct();
CRM_Utils_System::resetBreadCrumb();
$breadcrumb = array(array('title' => ts('Home'), 'url' => CRM_Utils_System::url()), array('title' => ts('CiviCRM'), 'url' => CRM_Utils_System::url('civicrm', 'reset=1')), array('title' => ts('View Contact'), 'url' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")), array('title' => ts('Search Results'), 'url' => CRM_Utils_System::url('civicrm/contact/search', "force=1")));
CRM_Utils_System::appendBreadCrumb($breadcrumb);
if (CRM_Utils_Request::retrieve('revert', 'Boolean', CRM_Core_DAO::$_nullObject)) {
$reverter = new CRM_Logging_Reverter($this->log_conn_id, $this->log_date);
$reverter->revert($this->tables);
CRM_Core_Session::setStatus(ts('The changes have been reverted.'));
if ($this->cid) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
} else {
CRM_Utils_System::redirect(CRM_Report_Utils_Report::getNextUrl($this->summary, 'reset=1', FALSE, TRUE));
}
}
// make sure the report works even without the params
if (!$this->log_conn_id or !$this->log_date) {
$dao = new CRM_Core_DAO();
$dao->query("SELECT log_conn_id, log_date FROM `{$this->db}`.log_{$this->tables[0]} WHERE log_action = 'Update' ORDER BY log_date DESC LIMIT 1");
$dao->fetch();
$this->log_conn_id = $dao->log_conn_id;
$this->log_date = $dao->log_date;
}
$this->_columnHeaders = array('field' => array('title' => ts('Field')), 'from' => array('title' => ts('Changed From')), 'to' => array('title' => ts('Changed To')));
}
示例9: preProcess
/**
* Function to set variables up before form is built
*
* @param null
*
* @return void
* @access public
*/
public function preProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
//check permission for action.
if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'title');
$this->assign('title', $this->_title);
parent::preProcess();
}
if (!$this->_action) {
$action = CRM_Utils_Array::value('action', $_GET);
$id = CRM_Utils_Array::value('id', $_GET);
switch ($action) {
case 'delete':
require_once 'CRM/Contribute/BAO/PCP.php';
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $id, 'title');
CRM_Contribute_BAO_PCP::delete($id);
CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $title)));
break;
case 'disable':
require_once 'CRM/Contribute/BAO/PCP.php';
CRM_Contribute_BAO_PCP::setDisable($id, '0');
break;
case 'enable':
require_once 'CRM/Contribute/BAO/PCP.php';
CRM_Contribute_BAO_PCP::setDisable($id, '1');
break;
}
$session =& CRM_Core_Session::singleton();
CRM_Utils_System::redirect($session->popUserContext());
}
}
示例10: pre
/**
* Method to process civicrm pre hook:
* If objectName = GroupContact and Group is a protected group, check if user has permission.
* When user does not have permission, redirect to user context with status message
*
*/
public static function pre($op, $objectName, $objectId, $params)
{
if ($objectName == 'GroupContact' && self::groupIsProtected($objectId) == TRUE) {
// check if request is from webform, and allow groupcontact action if from webform
$webFormRequest = FALSE;
$request = CRM_Utils_Request::exportValues();
if (isset($request['form_id'])) {
$requestParts = explode('_', $request['form_id']);
if (isset($requestParts[2])) {
if ($requestParts[0] == 'webform' && $requestParts[1] == 'client' && ($requestParts[2] = 'form')) {
$webFormRequest = TRUE;
}
}
}
if (!$webFormRequest) {
if (!CRM_Core_Permission::check('manage protected groups')) {
CRM_Core_Session::setStatus(ts("You are not allowed to add or remove contacts to this group"), ts("Not allowed"), "error");
// if from report, redirect to report instance
if (isset($request['q']) && substr($request['q'], 0, 15) == "civicrm/report/") {
CRM_Utils_System::redirect(CRM_Utils_System::url($request['q'], 'reset=1', true));
} else {
$session = CRM_Core_Session::singleton();
CRM_Utils_System::redirect($session->readUserContext());
}
}
}
}
}
示例11: __construct
/**
* Class constructor.
*
* @param null $title
* @param bool|int $action
* @param bool $modal
*
* @throws \Exception
*/
public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
{
parent::__construct($title, $modal, NULL, FALSE, TRUE);
// New: civicrm/mailing/send?reset=1
// Re-use: civicrm/mailing/send?reset=1&mid=%%mid%%
// Continue: civicrm/mailing/send?reset=1&mid=%%mid%%&continue=true
$mid = CRM_Utils_Request::retrieve('mid', 'Positive');
$continue = CRM_Utils_Request::retrieve('continue', 'String');
if (!$mid) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/new'));
}
if ($mid && $continue) {
//CRM-15979 - check if abtest exist for mailing then redirect accordingly
$abtest = CRM_Mailing_BAO_MailingAB::getABTest($mid);
if (!empty($abtest) && !empty($abtest->id)) {
$redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id);
} else {
$redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mid);
}
CRM_Utils_System::redirect($redirect);
}
if ($mid && !$continue) {
$clone = civicrm_api3('Mailing', 'clone', array('id' => $mid));
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $clone['id']));
}
}
示例12: __construct
function __construct()
{
parent::__construct();
$check = CRM_Core_Permission::check('access Contact Dashboard');
if (!$check) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
break;
}
$this->_contactId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$session =& CRM_Core_Session::singleton();
$userID = $session->get('userID');
if (!$this->_contactId) {
$this->_contactId = $userID;
} else {
if ($this->_contactId != $userID) {
require_once 'CRM/Contact/BAO/Contact/Permission.php';
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::VIEW)) {
CRM_Core_Error::fatal(ts('You do not have permission to view this contact'));
}
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
$this->_edit = false;
}
}
}
}
示例13: 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);
}
}
示例14: edit
/**
* called when action is update.
*
* @param int $groupId
*
* @return null
*/
public function edit($groupId = NULL)
{
$this->assign('edit', $this->_edit);
if (!$this->_edit) {
return NULL;
}
$action = CRM_Utils_Request::retrieve('action', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'browse');
if ($action == CRM_Core_Action::DELETE) {
$groupContactId = CRM_Utils_Request::retrieve('gcid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
$status = CRM_Utils_Request::retrieve('st', 'String', CRM_Core_DAO::$_nullObject, TRUE);
if (is_numeric($groupContactId) && $status) {
CRM_Contact_Page_View_GroupContact::del($groupContactId, $status, $this->_contactId);
}
$url = CRM_Utils_System::url('civicrm/user', "reset=1&id={$this->_contactId}");
CRM_Utils_System::redirect($url);
}
$controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_GroupContact', ts("Contact's Groups"), CRM_Core_Action::ADD, FALSE, FALSE, TRUE, FALSE);
$controller->setEmbedded(TRUE);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1&id={$this->_contactId}"), FALSE);
$controller->reset();
$controller->set('contactId', $this->_contactId);
$controller->set('groupId', $groupId);
$controller->set('context', 'user');
$controller->set('onlyPublicGroups', $this->_onlyPublicGroups);
$controller->process();
$controller->run();
}
示例15: postProcess
public function postProcess()
{
$session = CRM_Core_Session::singleton();
$session->setStatus('Rule ' . $this->rule->label . ' parameters updated', 'Rule parameters updated', 'success');
$redirectUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id=' . $this->rule->id, TRUE);
CRM_Utils_System::redirect($redirectUrl);
}