本文整理汇总了PHP中CRM_Utils_Rule类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Rule类的具体用法?PHP CRM_Utils_Rule怎么用?PHP CRM_Utils_Rule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Utils_Rule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
require_once 'CRM/Utils/Rule.php';
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= '&qfKey=' . $qfKey;
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/contact/search/custom', $urlParams);
$session->replaceUserContext($url);
//get the survey id from user submitted values.
$this->_surveyId = CRM_Utils_Array::value('survey_id', $this->get('formValues'));
$isHeld = CRM_Utils_Array::value('status_id', $this->get('formValues'));
if (!$this->_surveyId || !$isHeld) {
CRM_Core_Error::statusBounce(ts("Please search with 'Is Held' and 'Survey Id' filters to apply this action."));
}
$session = CRM_Core_Session::singleton();
if (empty($this->_contactIds) || !$session->get('userID')) {
CRM_Core_Error::statusBounce(ts("Could not find contacts for release voters resevation Or Missing Interviewer contact."));
}
$this->_interviewerId = $session->get('userID');
$surveyDetails = array();
$params = array('id' => $this->_surveyId);
$this->_surveyDetails = CRM_Campaign_BAO_Survey::retrieve($params, $surveyDetails);
$numVoters = CRM_Core_DAO::singleValueQuery("SELECT COUNT(*) FROM " . self::ACTIVITY_SURVEY_DETAIL_TABLE . " WHERE status_id = 'H' AND survey_id = %1 AND interviewer_id = %2", array(1 => array($this->_surveyId, 'Integer'), 2 => array($this->_interviewerId, 'Integer')));
if (!isset($numVoters) || $numVoters < 1) {
CRM_Core_Error::statusBounce(ts("All voters held by you are already released for this survey."));
}
$this->assign('surveyTitle', $surveyDetails['title']);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:38,代码来源:ReleaseVoters.php
示例2: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_caseId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
//get current client name.
require_once 'CRM/Contact/BAO/Contact.php';
$this->assign('currentClientName', CRM_Contact_BAO_Contact::displayName($this->_contactId));
//set the context.
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactId}&selectedChild=case");
if ($context == 'search') {
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
require_once 'CRM/Utils/Rule.php';
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/case/search', $urlParams);
} else {
if ($context == 'dashboard') {
$url = CRM_Utils_System::url('civicrm/case', 'reset=1');
}
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:33,代码来源:EditClient.php
示例3: _encodeHeaders
function _encodeHeaders($input, $params = array())
{
require_once 'CRM/Utils/Rule.php';
$emailValues = array();
foreach ($input as $fieldName => $fieldValue) {
$fieldNames = $emails = array();
$hasValue = false;
//multiple email w/ comma separate.
$fieldValues = explode(',', $fieldValue);
foreach ($fieldValues as $index => $value) {
$value = trim($value);
//might be case we have only email address.
if (CRM_Utils_Rule::email($value)) {
$hasValue = true;
$emails[$index] = $value;
$fieldNames[$index] = 'FIXME_HACK_FOR_NO_NAME';
} else {
$matches = array();
if (preg_match('/^(.*)<([^<]*)>$/', $value, $matches)) {
$hasValue = true;
$emails[$index] = $matches[2];
$fieldNames[$index] = trim($matches[1]);
}
}
}
//get formatted values back in input
if ($hasValue) {
$input[$fieldName] = implode(',', $fieldNames);
$emailValues[$fieldName] = implode(',', $emails);
}
}
// encode the email-less headers
$input = parent::_encodeHeaders($input, $params);
// add emails back to headers, quoting these headers along the way
foreach ($emailValues as $fieldName => $value) {
$emails = explode(',', $value);
$fieldNames = explode(',', $input[$fieldName]);
foreach ($fieldNames as $index => &$name) {
$name = str_replace('\\', '\\\\', $name);
$name = str_replace('"', '\\"', $name);
// CRM-5640 -if the name was actually doubly-quoted,
// strip these(the next line will add them back);
if (substr($name, 0, 2) == '\\"' && substr($name, -2) == '\\"') {
$name = substr($name, 2, -2);
}
}
//combine fieldNames and emails.
$mergeValues = array();
foreach ($emails as $index => $email) {
if ($fieldNames[$index] == 'FIXME_HACK_FOR_NO_NAME') {
$mergeValues[] = $email;
} else {
$mergeValues[] = "\"{$fieldNames[$index]}\" <{$email}>";
}
}
//finally get values in.
$input[$fieldName] = implode(',', $mergeValues);
}
return $input;
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:60,代码来源:FixedMailMIME.php
示例4: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
//get current client name.
$this->assign('currentClientName', CRM_Contact_BAO_Contact::displayName($cid));
//set the context.
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$cid}&selectedChild=case");
if ($context == 'search') {
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/case/search', $urlParams);
} elseif ($context == 'dashboard') {
$url = CRM_Utils_System::url('civicrm/case', 'reset=1');
} elseif (in_array($context, array('dashlet', 'dashletFullscreen'))) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:28,代码来源:EditClient.php
示例5: preProcess
function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, FALSE);
if ($oid) {
$this->_id = CRM_Utils_Request::retrieve('oid', 'Positive', $this, FALSE);
} else {
$this->assign('hide_contact', TRUE);
$this->_id = $cid;
}
if (!CRM_Utils_Rule::positiveInteger($this->_id)) {
CRM_Core_Error::fatal('We need a valid discount ID for view');
}
$this->assign('id', $this->_id);
$defaults = array();
$params = array('id' => $this->_id);
require_once 'CRM/CiviDiscount/BAO/Item.php';
CRM_CiviDiscount_BAO_Item::retrieve($params, $defaults);
require_once 'CRM/CiviDiscount/BAO/Track.php';
if ($cid) {
$rows = CRM_CiviDiscount_BAO_Track::getUsageByContact($this->_id);
} else {
$rows = CRM_CiviDiscount_BAO_Track::getUsageByOrg($this->_id);
}
$this->assign('rows', $rows);
$this->assign('code_details', $defaults);
$this->ajaxResponse['tabCount'] = count($rows);
if (!empty($defaults['code'])) {
CRM_Utils_System::setTitle($defaults['code']);
}
}
开发者ID:mathavanveda,项目名称:org.civicrm.module.cividiscount,代码行数:31,代码来源:Usage.php
示例6: create
/**
* takes an associative array and creates a financial transaction object
*
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return object CRM_Core_BAO_FinancialTrxn object
* @access public
* @static
*/
static function create(&$params)
{
$trxn = new CRM_Core_DAO_FinancialTrxn();
$trxn->copyValues($params);
require_once 'CRM/Utils/Rule.php';
if (!CRM_Utils_Rule::currencyCode($trxn->currency)) {
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
$trxn->currency = $config->defaultCurrency;
}
// if a transaction already exists for a contribution id, lets get the finTrxnId and entityFinTrxId
$fids = self::getFinancialTrxnIds($params['contribution_id'], 'civicrm_contribution');
if ($fids['financialTrxnId']) {
$trxn->id = $fids['financialTrxnId'];
}
$trxn->save();
$contributionAmount = CRM_Utils_Array::value('net_amount', $params);
if (!$contributionAmount && isset($params['total_amount'])) {
$contributionAmount = $params['total_amount'];
}
// save to entity_financial_trxn table
$entity_financial_trxn_params = array('entity_table' => "civicrm_contribution", 'entity_id' => $params['contribution_id'], 'financial_trxn_id' => $trxn->id, 'amount' => $contributionAmount, 'currency' => $trxn->currency);
$entity_trxn =& new CRM_Core_DAO_EntityFinancialTrxn();
$entity_trxn->copyValues($entity_financial_trxn_params);
if ($fids['entityFinancialTrxnId']) {
$entity_trxn->id = $fids['entityFinancialTrxnId'];
}
$entity_trxn->save();
return $trxn;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:39,代码来源:FinancialTrxn.php
示例7: 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'));
}
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:35,代码来源:PDF.php
示例8: civicrm_api3_generic_setValue
/**
* params must contain at least id=xx & {one of the fields from getfields}=value
*/
function civicrm_api3_generic_setValue($apiRequest)
{
$entity = $apiRequest['entity'];
$params = $apiRequest['params'];
// we can't use _spec, doesn't work with generic
civicrm_api3_verify_mandatory($params, NULL, array('id', 'field', 'value'));
$id = $params['id'];
if (!is_numeric($id)) {
return civicrm_api3_create_error(ts('Please enter a number'), array('error_code' => 'NaN', 'field' => "id"));
}
$field = CRM_Utils_String::munge($params['field']);
$value = $params['value'];
$fields = civicrm_api($entity, 'getFields', array("version" => 3, "sequential"));
// getfields error, shouldn't happen.
if ($fields['is_error']) {
return $fields;
}
$fields = $fields['values'];
if (!array_key_exists($field, $fields)) {
return civicrm_api3_create_error("Param 'field' ({$field}) is invalid. must be an existing field", array("error_code" => "invalid_field", "fields" => array_keys($fields)));
}
$def = $fields[$field];
if (array_key_exists('required', $def) && empty($value)) {
return civicrm_api3_create_error(ts("This can't be empty, please provide a value"), array("error_code" => "required", "field" => $field));
}
switch ($def['type']) {
case 1:
//int
if (!is_numeric($value)) {
return civicrm_api3_create_error("Param '{$field}' must be a number", array('error_code' => 'NaN'));
}
case 2:
//string
require_once "CRM/Utils/Rule.php";
if (!CRM_Utils_Rule::xssString($value)) {
return civicrm_api3_create_error(ts('Illegal characters in input (potential scripting attack)'), array('error_code' => 'XSS'));
}
if (array_key_exists('maxlength', $def)) {
$value = substr($value, 0, $def['maxlength']);
}
break;
case 16:
//boolean
$value = (bool) $value;
break;
case 4:
//date
//date
default:
return civicrm_api3_create_error("Param '{$field}' is of a type not managed yet. Join the API team and help us implement it", array('error_code' => 'NOT_IMPLEMENTED'));
}
if (CRM_Core_DAO::setFieldValue(_civicrm_api3_get_DAO($entity), $id, $field, $value)) {
$entity = array('id' => $id, $field => $value);
CRM_Utils_Hook::post('edit', $entity, $id, $entity);
return civicrm_api3_create_success($entity);
} else {
return civicrm_api3_create_error("error assigning {$field}={$value} for {$entity} (id={$id})");
}
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:62,代码来源:Setvalue.php
示例9: titleToVar
/**
* Convert a display name into a potential variable
* name that we could use in forms/code
*
* @param name Name of the string
* @return string An equivalent variable name
*
* @access public
* @return string (or null)
* @static
*/
static function titleToVar($title, $maxLength = 31)
{
$variable = self::munge($title);
require_once "CRM/Utils/Rule.php";
if (CRM_Utils_Rule::title($variable, $maxLength)) {
return $variable;
}
return null;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:20,代码来源:String.php
示例10: titleToVar
/**
* Convert a display name into a potential variable
* name that we could use in forms/code
*
* @param name Name of the string
*
* @param int $maxLength
*
* @return string An equivalent variable name
*
* @access public
*
* @return string (or null)
* @static
*/
static function titleToVar($title, $maxLength = 31)
{
$variable = self::munge($title, '_', $maxLength);
if (CRM_Utils_Rule::title($variable, $maxLength)) {
return $variable;
}
// if longer than the maxLength lets just return a substr of the
// md5 to prevent errors downstream
return substr(md5($title), 0, $maxLength);
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:25,代码来源:String.php
示例11: titleToVar
/**
* Convert a display name into a potential variable
* name that we could use in forms/code
*
* @param name Name of the string
* @return string An equivalent variable name
*
* @access public
* @return string (or null)
* @static
*/
function titleToVar($title)
{
if (!CRM_Utils_Rule::title($title)) {
return null;
}
$variable = CRM_Utils_String::munge($title);
if (CRM_Utils_Rule::variable($variable)) {
return $variable;
}
return null;
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:22,代码来源:String.php
示例12: __construct
/**
* @param string $name
* Symbolic name for the check.
* @param string $message
* Printable message (short or long).
* @param string $title
* Printable message (short).
* @param string $level
* The severity of the message. Use PSR-3 log levels.
*
* @see Psr\Log\LogLevel
*/
public function __construct($name, $message, $title, $level = \Psr\Log\LogLevel::WARNING)
{
$this->name = $name;
$this->message = $message;
$this->title = $title;
// Handle non-integer severity levels.
if (!CRM_Utils_Rule::integer($level)) {
$level = CRM_Utils_Check::severityMap($level);
}
$this->level = $level;
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:23,代码来源:Message.php
示例13: isContactInGroup
/**
* Checks wether a contact is a member of a group
*
* This function is a copy of CRM_Contact_BAO_GroupContact::isContactInGroup but with
* a change so that the group contact cache won't be rebuild. Which somehow resulted
* in a deadlock
*
* @param $contact_id
* @param $group_id
* @return bool
*/
public static function isContactInGroup($contact_id, $group_id)
{
if (!CRM_Utils_Rule::positiveInteger($contact_id) || !CRM_Utils_Rule::positiveInteger($group_id)) {
return FALSE;
}
$params = array(array('group', 'IN', array($group_id => 1), 0, 0), array('contact_id', '=', $contact_id, 0, 0));
list($contacts, $_) = CRM_Contact_BAO_Query::apiQuery($params, array('contact_id'), null, null, 0, 1, false, false, true);
if (!empty($contacts)) {
return TRUE;
}
return FALSE;
}
开发者ID:alejandro-ixiam,项目名称:org.civicoop.civirules,代码行数:23,代码来源:GroupContact.php
示例14: array
/**
* Form rule to validate the date selector and/or if we should deliver
* immediately.
*
* Warning: if you make changes here, be sure to also make them in
* Retry.php
*
* @param array $params The form values
* @return boolean True if either we deliver immediately, or the
* date is properly set.
* @static
*/
function &formRule(&$params)
{
if ($params['now']) {
return true;
}
if (!CRM_Utils_Rule::qfDate($params['start_date'])) {
return array('start_date' => ts('Start date is not valid.'));
}
if (CRM_Utils_Date::format($params['start_date']) < date('YmdHi00')) {
return array('start_date' => ts('Start date cannot be earlier than the current time.'));
}
return true;
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:25,代码来源:Schedule.php
示例15: create
/**
* takes an associative array and creates a financial transaction object
*
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return object CRM_Contribute_BAO_FinancialTrxn object
* @access public
* @static
*/
function create(&$params)
{
$trxn =& new CRM_Contribute_DAO_FinancialTrxn();
$trxn->copyValues($params);
$trxn->domain_id = CRM_Core_Config::domainID();
require_once 'CRM/Utils/Rule.php';
if (!CRM_Utils_Rule::currencyCode($contribution->currency)) {
require_once 'CRM/Core/Config.php';
$config =& CRM_Core_Config::singleton();
$contribution->currency = $config->defaultCurrency;
}
return $trxn->save();
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:22,代码来源:FinancialTrxn.php
示例16: civicrm_api3_relationship_delete
/**
* Delete a relationship.
*
* @param array $params
*
* @return array
* API Result Array
*/
function civicrm_api3_relationship_delete($params)
{
if (!CRM_Utils_Rule::integer($params['id'])) {
return civicrm_api3_create_error('Invalid value for relationship ID');
}
$relationBAO = new CRM_Contact_BAO_Relationship();
$relationBAO->id = $params['id'];
if (!$relationBAO->find(TRUE)) {
return civicrm_api3_create_error('Relationship id is not valid');
} else {
$relationBAO->del($params['id']);
return civicrm_api3_create_success('Deleted relationship successfully');
}
}
开发者ID:konadave,项目名称:civicrm-core,代码行数:22,代码来源:Relationship.php
示例17: retrieveAssigneeIdsByActivityId
/**
* Retrieve assignee_id by activity_id
*
* @param int $id ID of the activity
*
* @return void
*
* @access public
*
*/
static function retrieveAssigneeIdsByActivityId($activity_id)
{
$assigneeArray = array();
if (!CRM_Utils_Rule::positiveInteger($activity_id)) {
return $assigneeArray;
}
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$sql = "\nSELECT contact_id\nFROM civicrm_activity_contact\nINNER JOIN civicrm_contact ON contact_id = civicrm_contact.id\nWHERE activity_id = %1\nAND record_type_id = {$assigneeID}\nAND civicrm_contact.is_deleted = 0\n";
$assignment = CRM_Core_DAO::executeQuery($sql, array(1 => array($activity_id, 'Integer')));
while ($assignment->fetch()) {
$assigneeArray[] = $assignment->contact_id;
}
return $assigneeArray;
}
开发者ID:hguru,项目名称:224Civi,代码行数:25,代码来源:ActivityAssignment.php
示例18: postProcess
/**
* Process the uploaded file.
*
* @return void
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
$exportParams = $this->controller->exportValues('Select');
$currentPath = CRM_Utils_System::currentPath();
$urlParams = NULL;
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams = "&qfKey={$qfKey}";
}
//get the button name
$buttonName = $this->controller->getButtonName('done');
$buttonName1 = $this->controller->getButtonName('next');
if ($buttonName == '_qf_Map_done') {
$this->set('exportColumnCount', NULL);
$this->controller->resetPage($this->_name);
return CRM_Utils_System::redirect(CRM_Utils_System::url($currentPath, 'force=1' . $urlParams));
}
if ($this->controller->exportValue($this->_name, 'addMore')) {
$this->set('exportColumnCount', $this->_exportColumnCount);
return;
}
$mapperKeys = $params['mapper'][1];
$checkEmpty = 0;
foreach ($mapperKeys as $value) {
if ($value[0]) {
$checkEmpty++;
}
}
if (!$checkEmpty) {
$this->set('mappingId', NULL);
CRM_Utils_System::redirect(CRM_Utils_System::url($currentPath, '_qf_Map_display=true' . $urlParams));
}
if ($buttonName1 == '_qf_Map_next') {
if (!empty($params['updateMapping'])) {
//save mapping fields
CRM_Core_BAO_Mapping::saveMappingFields($params, $params['mappingId']);
}
if (!empty($params['saveMapping'])) {
$mappingParams = array('name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], 'mapping_type_id' => $this->get('mappingTypeId'));
$saveMapping = CRM_Core_BAO_Mapping::add($mappingParams);
//save mapping fields
CRM_Core_BAO_Mapping::saveMappingFields($params, $saveMapping->id);
}
}
//get the csv file
CRM_Export_BAO_Export_Relationship::exportComponents($this->get('selectAll'), $this->get('componentIds'), $this->get('queryParams'), $this->get(CRM_Utils_Sort::SORT_ORDER), $mapperKeys, $this->get('returnProperties'), $this->get('exportMode'), $this->get('componentClause'), $this->get('componentTable'), $this->get('mergeSameAddress'), $this->get('mergeSameHousehold'), $exportParams);
}
开发者ID:Chirojeugd-Vlaanderen,项目名称:civicrm-relationship-entity,代码行数:53,代码来源:Map.php
示例19: preProcess
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess()
{
$session = CRM_Core_Session::singleton();
$this->set('searchRows', '');
$ssID = $this->get('ssID');
if (isset($ssID)) {
$urlParams = 'reset=1&force=1&ssID=' . $ssID;
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/grant/search', $urlParams);
$session->replaceUserContext($url);
return;
}
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:21,代码来源:Result.php
示例20: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$lid = CRM_Utils_Request::retrieve('lid', 'Positive', $this, FALSE);
$eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, FALSE);
$profileGID = CRM_Utils_Request::retrieve('profileGID', 'Integer', $this, FALSE);
$this->assign('profileGID', $profileGID);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$type = 'Contact';
if ($cid) {
$ids = array($cid);
$this->_single = TRUE;
if ($profileGID) {
// this does a check and ensures that the user has permission on this profile
// CRM-11766
$profileIDs = CRM_Profile_Page_Listings::getProfileContact($profileGID);
if (!in_array($cid, $profileIDs)) {
CRM_Core_Error::fatal();
}
} elseif ($context) {
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$session = CRM_Core_Session::singleton();
$urlString = "civicrm/contact/search/{$context}";
if ($context == 'search') {
$urlString = 'civicrm/contact/search';
}
$url = CRM_Utils_System::url($urlString, $urlParams);
$session->replaceUserContext($url);
}
} elseif ($eid) {
$ids = $eid;
$type = 'Event';
} else {
if ($profileGID) {
$ids = CRM_Profile_Page_Listings::getProfileContact($profileGID);
} else {
parent::preProcess();
$ids = $this->_contactIds;
}
}
self::createMapXML($ids, $lid, $this, TRUE, $type);
$this->assign('single', $this->_single);
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:50,代码来源:Map.php
注:本文中的CRM_Utils_Rule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论