本文整理汇总了PHP中CRM_Core_Action::resolve方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Action::resolve方法的具体用法?PHP CRM_Core_Action::resolve怎么用?PHP CRM_Core_Action::resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Action
的用法示例。
在下文中一共展示了CRM_Core_Action::resolve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieve
/**
* Retrieve a value from the request (GET/POST/REQUEST)
*
* @param string $name name of the variable to be retrieved
* @param string $type type of the variable (see CRM_Utils_Type for details)
* @param stdClass $store session scope where variable is stored
* @param bool $abort is this variable required
* @param mixed $default default value of the variable if not present
* @param string $method where should we look for the variable
*
* @return mixed the value of the variable
* @access public
* @static
*/
static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $default = NULL, $method = 'REQUEST')
{
// hack to detect stuff not yet converted to new style
if (!is_string($type)) {
CRM_Core_Error::backtrace();
CRM_Core_Error::fatal(ts("Please convert retrieve call to use new function signature"));
}
$value = NULL;
switch ($method) {
case 'GET':
$value = CRM_Utils_Array::value($name, $_GET);
break;
case 'POST':
$value = CRM_Utils_Array::value($name, $_POST);
break;
default:
$value = CRM_Utils_Array::value($name, $_REQUEST);
break;
}
if (isset($value) && CRM_Utils_Type::validate($value, $type, $abort, $name) === NULL) {
$value = NULL;
}
if (!isset($value) && $store) {
$value = $store->get($name);
}
if (!isset($value) && $abort) {
CRM_Core_Error::fatal(ts("Could not find valid value for %1", array(1 => $name)));
}
if (!isset($value) && $default) {
$value = $default;
}
// minor hack for action
if ($name == 'action' && is_string($value)) {
$value = CRM_Core_Action::resolve($value);
}
if (isset($value) && $store) {
$store->set($name, $value);
}
return $value;
}
示例2: retrieve
/**
* get the variable information from the request (GET/POST/SESSION
*
* @param $name name of the variable to be retrieved
* @param $store session scope where variable is stored
* @param $abort is this variable required
* @param $default default value of the variable if not present
* @param $method where should we look for the variable
*
* @return string the value of the variable
* @access public
* @static
*
*/
function retrieve($name, &$store, $abort = false, $default = null, $method = 'GET')
{
$value = null;
switch ($method) {
case 'GET':
$value = CRM_Utils_Array::value($name, $_GET);
break;
case 'POST':
$value = CRM_Utils_Array::value($name, $_POST);
break;
default:
$value = CRM_Utils_Array::value($name, $_REQUEST);
break;
}
if (!isset($value) && $store) {
$value = $store->get($name);
}
if (!isset($value) && $abort) {
CRM_Core_Error::fatal("Could not find valid value for {$name}");
}
if (!isset($value) && $default) {
$value = $default;
}
if (isset($value) && $store) {
// minor hack for action
if ($name == 'action' && is_string($value)) {
$value = CRM_Core_Action::resolve($value);
}
$store->set($name, $value);
}
return $value;
}
示例3: __construct
/**
* Class constructor.
*
* @param int $id
* The contact id.
* @param int $gid
* The group id.
*
* @param $restrict
* @param bool $skipPermission
* @param null $profileIds
*
* @return \CRM_Profile_Page_Dynamic
*/
public function __construct($id, $gid, $restrict, $skipPermission = FALSE, $profileIds = NULL)
{
parent::__construct();
$this->_id = $id;
$this->_gid = $gid;
$this->_restrict = $restrict;
$this->_skipPermission = $skipPermission;
if (!array_key_exists('multiRecord', $_GET)) {
$this->set('multiRecord', NULL);
}
if (!array_key_exists('recordId', $_GET)) {
$this->set('recordId', NULL);
}
if (!array_key_exists('allFields', $_GET)) {
$this->set('allFields', NULL);
}
//specifies the action being done on a multi record field
$multiRecordAction = CRM_Utils_Request::retrieve('multiRecord', 'String', $this);
$this->_multiRecord = !is_numeric($multiRecordAction) ? CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction;
if ($this->_multiRecord) {
$this->set('multiRecord', $this->_multiRecord);
}
if ($this->_multiRecord & CRM_Core_Action::VIEW) {
$this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
$this->_allFields = CRM_Utils_Request::retrieve('allFields', 'Integer', $this);
}
if ($profileIds) {
$this->_profileIds = $profileIds;
} else {
$this->_profileIds = array($gid);
}
$this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
if (is_numeric($this->_activityId)) {
$latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
if ($latestRevisionId) {
$this->_activityId = $latestRevisionId;
}
}
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
}
示例4: preProcess
/**
* Pre processing work done here.
*
* gets session variables for table name, id of entity in table, type of entity and stores them.
*
* @param
*
* @return void
*/
public function preProcess()
{
$this->_id = $this->get('id');
$this->_profileIds = $this->get('profileIds');
$this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
//unset from session when $_GET doesn't have it
//except when the form is submitted
if (empty($_POST)) {
if (!array_key_exists('multiRecord', $_GET)) {
$this->set('multiRecord', NULL);
}
if (!array_key_exists('recordId', $_GET)) {
$this->set('recordId', NULL);
}
}
$this->_session = CRM_Core_Session::singleton();
$this->_currentUserID = $this->_session->get('userID');
if ($this->_mode == self::MODE_EDIT) {
//specifies the action being done on a multi record field
$multiRecordAction = CRM_Utils_Request::retrieve('multiRecord', 'String', $this);
$this->_multiRecord = !is_numeric($multiRecordAction) ? CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction;
if ($this->_multiRecord) {
$this->set('multiRecord', $this->_multiRecord);
}
if ($this->_multiRecord && !in_array($this->_multiRecord, array(CRM_Core_Action::UPDATE, CRM_Core_Action::ADD, CRM_Core_Action::DELETE))) {
CRM_Core_Error::fatal(ts('Proper action not specified for this custom value record profile'));
}
}
$this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
$gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0));
if (count($gids) > 1 && !$this->_profileIds && empty($this->_profileIds)) {
if (!empty($gids)) {
foreach ($gids as $pfId) {
$this->_profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
}
}
// check if we are rendering mixed profiles
if (CRM_Core_BAO_UFGroup::checkForMixProfiles($this->_profileIds)) {
CRM_Core_Error::fatal(ts('You cannot combine profiles of multiple types.'));
}
// for now consider 1'st profile as primary profile and validate it
// i.e check for profile type etc.
// FIX ME: validations for other than primary
$this->_gid = $this->_profileIds[0];
$this->set('gid', $this->_gid);
$this->set('profileIds', $this->_profileIds);
}
if (!$this->_gid) {
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
$this->set('gid', $this->_gid);
}
$this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
if (is_numeric($this->_activityId)) {
$latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
if ($latestRevisionId) {
$this->_activityId = $latestRevisionId;
}
}
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
//get values for ufGroupName, captch and dupe update.
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
if ($dao->find(TRUE)) {
$this->_isUpdateDupe = $dao->is_update_dupe;
$this->_isAddCaptcha = $dao->add_captcha;
$this->_ufGroup = (array) $dao;
}
$dao->free();
if (!CRM_Utils_Array::value('is_active', $this->_ufGroup)) {
CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', array(1 => $this->_gid)));
}
}
$this->assign('ufGroupName', $this->_ufGroup['name']);
$gids = empty($this->_profileIds) ? $this->_gid : $this->_profileIds;
// if we dont have a gid use the default, else just use that specific gid
if (($this->_mode == self::MODE_REGISTER || $this->_mode == self::MODE_CREATE) && !$this->_gid) {
$this->_ctype = CRM_Utils_Request::retrieve('ctype', 'String', $this, FALSE, 'Individual', 'REQUEST');
$this->_fields = CRM_Core_BAO_UFGroup::getRegistrationFields($this->_action, $this->_mode, $this->_ctype);
} elseif ($this->_mode == self::MODE_SEARCH) {
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields($this->_action, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $gids, TRUE, NULL, $this->_skipPermission, CRM_Core_Permission::SEARCH);
} else {
$this->_fields = CRM_Core_BAO_UFGroup::getFields($gids, FALSE, NULL, NULL, NULL, FALSE, NULL, $this->_skipPermission, NULL, $this->_action == CRM_Core_Action::ADD ? CRM_Core_Permission::CREATE : CRM_Core_Permission::EDIT);
$multiRecordFieldListing = FALSE;
//using selector for listing of multirecord fields
if ($this->_mode == self::MODE_EDIT && $this->_gid) {
CRM_Core_BAO_UFGroup::shiftMultiRecordFields($this->_fields, $this->_multiRecordFields);
if ($this->_multiRecord) {
if ($this->_multiRecord != CRM_Core_Action::ADD) {
$this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
//.........这里部分代码省略.........