本文整理汇总了PHP中CRM_Core_Session::storeSessionObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Session::storeSessionObjects方法的具体用法?PHP CRM_Core_Session::storeSessionObjects怎么用?PHP CRM_Core_Session::storeSessionObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Session
的用法示例。
在下文中一共展示了CRM_Core_Session::storeSessionObjects方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runItem
/**
* Given a menu item, call the appropriate controller and return the response
*
* @param array $item see CRM_Core_Menu
* @return string, HTML
*/
public static function runItem($item)
{
$config = CRM_Core_Config::singleton();
if ($config->userFramework == 'Joomla' && $item) {
$config->userFrameworkURLVar = 'task';
// joomla 1.5RC1 seems to push this in the POST variable, which messes
// QF and checkboxes
unset($_POST['option']);
CRM_Core_Joomla::sidebarLeft();
}
// set active Component
$template = CRM_Core_Smarty::singleton();
$template->assign('activeComponent', 'CiviCRM');
$template->assign('formTpl', 'default');
if ($item) {
// CRM-7656 - make sure we send a clean sanitized path to create printer friendly url
$printerFriendly = CRM_Utils_System::makeURL('snippet', FALSE, FALSE, CRM_Utils_Array::value('path', $item)) . '2';
$template->assign('printerFriendly', $printerFriendly);
if (!array_key_exists('page_callback', $item)) {
CRM_Core_Error::debug('Bad item', $item);
CRM_Core_Error::fatal(ts('Bad menu record in database'));
}
// check that we are permissioned to access this page
if (!CRM_Core_Permission::checkMenuItem($item)) {
CRM_Utils_System::permissionDenied();
return;
}
// check if ssl is set
if (CRM_Utils_Array::value('is_ssl', $item)) {
CRM_Utils_System::redirectToSSL();
}
if (isset($item['title'])) {
CRM_Utils_System::setTitle($item['title']);
}
if (isset($item['breadcrumb']) && !isset($item['is_public'])) {
CRM_Utils_System::appendBreadCrumb($item['breadcrumb']);
}
$pageArgs = NULL;
if (CRM_Utils_Array::value('page_arguments', $item)) {
$pageArgs = CRM_Core_Menu::getArrayForPathArgs($item['page_arguments']);
}
$template = CRM_Core_Smarty::singleton();
if (!empty($item['is_public'])) {
$template->assign('urlIsPublic', TRUE);
} else {
$template->assign('urlIsPublic', FALSE);
self::versionCheck($template);
}
if (isset($item['return_url'])) {
$session = CRM_Core_Session::singleton();
$args = CRM_Utils_Array::value('return_url_args', $item, 'reset=1');
$session->pushUserContext(CRM_Utils_System::url($item['return_url'], $args));
}
$result = NULL;
if (is_array($item['page_callback'])) {
$newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback'][0]) . '.php';
$result = call_user_func($item['page_callback'], $newArgs);
} elseif (strstr($item['page_callback'], '_Form')) {
$wrapper = new CRM_Utils_Wrapper();
$result = $wrapper->run(CRM_Utils_Array::value('page_callback', $item), CRM_Utils_Array::value('title', $item), isset($pageArgs) ? $pageArgs : NULL);
} else {
$newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback']) . '.php';
$mode = 'null';
if (isset($pageArgs['mode'])) {
$mode = $pageArgs['mode'];
unset($pageArgs['mode']);
}
$title = CRM_Utils_Array::value('title', $item);
if (strstr($item['page_callback'], '_Page')) {
$object = new $item['page_callback']($title, $mode);
} elseif (strstr($item['page_callback'], '_Controller')) {
$addSequence = 'false';
if (isset($pageArgs['addSequence'])) {
$addSequence = $pageArgs['addSequence'];
$addSequence = $addSequence ? 'true' : 'false';
unset($pageArgs['addSequence']);
}
$object = new $item['page_callback']($title, true, $mode, null, $addSequence);
} else {
CRM_Core_Error::fatal();
}
$result = $object->run($newArgs, $pageArgs);
}
CRM_Core_Session::storeSessionObjects();
return $result;
}
CRM_Core_Menu::store();
CRM_Core_Session::setStatus(ts('Menu has been rebuilt'), ts('Complete'), 'success');
return CRM_Utils_System::redirect();
}
示例2: civiExit
/**
* Exit with provided exit code.
*
* @param int $status
* (optional) Code with which to exit.
*/
public static function civiExit($status = 0)
{
// move things to CiviCRM cache as needed
CRM_Core_Session::storeSessionObjects();
exit($status);
}
示例3: doDirectPayment
/**
* Process payment with external gateway.
*
* @param array $params assoc array of input parameters for this transaction
*
* @param string $component
*
* @throws CRM_Core_Exception
* @return array
* The result in an nice formatted array (or an error object)
*/
public function doDirectPayment(&$params, $component = 'contribute')
{
$this->_component = strtolower($component);
$this->gateway = Omnipay::create(str_replace('omnipay_', '', $this->_paymentProcessor['payment_processor_type']));
$this->setProcessorFields();
$this->setTransactionID(CRM_Utils_Array::value('contributionID', $params));
$this->storeReturnUrls($params['qfKey'], CRM_Utils_Array::value('participantID', $params), CRM_Utils_Array::value('eventID', $params));
$this->saveBillingAddressIfRequired($params);
try {
if (!empty($params['is_recur'])) {
$response = $this->gateway->createCard($this->getCreditCardOptions($params, $component))->send();
} else {
$response = $this->gateway->purchase($this->getCreditCardOptions($params, $component))->send();
}
if ($response->isSuccessful()) {
// mark order as complete
$params['trxn_id'] = $response->getTransactionReference();
//gross_amount ? fee_amount?
return $params;
} elseif ($response->isRedirect()) {
CRM_Core_Session::storeSessionObjects();
if ($response->isTransparentRedirect() || !empty($this->gateway->transparentRedirect)) {
$this->storeTransparentRedirectFormData($params['qfKey'], $response->getRedirectData() + array('payment_processor_id' => $this->_paymentProcessor['id'], 'post_submit_url' => $response->getRedirectURL()));
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/payment/details', array('key' => $params['qfKey'])));
}
$response->redirect();
} else {
//@todo - is $response->getCode supported by some / many processors?
return $this->handleError('alert', 'failed processor transaction ' . $this->_paymentProcessor['payment_processor_type'], (array) $response, 9001, $response->getMessage());
}
} catch (\Exception $e) {
// internal error, log exception and display a generic message to the customer
//@todo - looks like invalid credit card numbers are winding up here too - we could handle separately by capturing that exception type - what is good fraud practice?
return $this->handleError('error', 'unknown processor error ' . $this->_paymentProcessor['payment_processor_type'], array($e->getCode() => $e->getMessage()), $e->getCode(), 'Sorry, there was an error processing your payment. Please try again later.');
}
}
示例4: civiExit
static function civiExit($status = 0)
{
// move things to CiviCRM cache as needed
require_once 'CRM/Core/Session.php';
CRM_Core_Session::storeSessionObjects();
exit($status);
}
示例5: _invoke
//.........这里部分代码省略.........
}
}
// get the menu items
$path = implode('/', $args);
$item = CRM_Core_Menu::get($path);
// we should try to compute menus, if item is empty and stay on the same page,
// rather than compute and redirect to dashboard.
if (!$item) {
CRM_Core_Menu::store(FALSE);
$item = CRM_Core_Menu::get($path);
}
if ($config->userFramework == 'Joomla' && $item) {
$config->userFrameworkURLVar = 'task';
// joomla 1.5RC1 seems to push this in the POST variable, which messes
// QF and checkboxes
unset($_POST['option']);
CRM_Core_Joomla::sidebarLeft();
}
// set active Component
$template = CRM_Core_Smarty::singleton();
$template->assign('activeComponent', 'CiviCRM');
$template->assign('formTpl', 'default');
if ($item) {
// CRM-7656 - make sure we send a clean sanitized path to create printer friendly url
$printerFriendly = CRM_Utils_System::makeURL('snippet', FALSE, FALSE, CRM_Utils_Array::value('path', $item)) . '2';
$template->assign('printerFriendly', $printerFriendly);
if (!array_key_exists('page_callback', $item)) {
CRM_Core_Error::debug('Bad item', $item);
CRM_Core_Error::fatal(ts('Bad menu record in database'));
}
// check that we are permissioned to access this page
if (!CRM_Core_Permission::checkMenuItem($item)) {
CRM_Utils_System::permissionDenied();
return;
}
// check if ssl is set
if (CRM_Utils_Array::value('is_ssl', $item)) {
CRM_Utils_System::redirectToSSL();
}
if (isset($item['title'])) {
CRM_Utils_System::setTitle($item['title']);
}
if (isset($item['breadcrumb']) && !isset($item['is_public'])) {
CRM_Utils_System::appendBreadCrumb($item['breadcrumb']);
}
$pageArgs = NULL;
if (CRM_Utils_Array::value('page_arguments', $item)) {
$pageArgs = CRM_Core_Menu::getArrayForPathArgs($item['page_arguments']);
}
$template = CRM_Core_Smarty::singleton();
if (isset($item['is_public']) && $item['is_public']) {
$template->assign('urlIsPublic', TRUE);
} else {
$template->assign('urlIsPublic', FALSE);
}
if (isset($item['return_url'])) {
$session = CRM_Core_Session::singleton();
$args = CRM_Utils_Array::value('return_url_args', $item, 'reset=1');
$session->pushUserContext(CRM_Utils_System::url($item['return_url'], $args));
}
// CRM_Core_Error::debug( $item ); exit( );
$result = NULL;
if (is_array($item['page_callback'])) {
$newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback'][0]) . '.php';
$result = call_user_func($item['page_callback'], $newArgs);
} elseif (strstr($item['page_callback'], '_Form')) {
$wrapper = new CRM_Utils_Wrapper();
$result = $wrapper->run(CRM_Utils_Array::value('page_callback', $item), CRM_Utils_Array::value('title', $item), isset($pageArgs) ? $pageArgs : NULL);
} else {
$newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback']) . '.php';
$mode = 'null';
if (isset($pageArgs['mode'])) {
$mode = $pageArgs['mode'];
unset($pageArgs['mode']);
}
$title = CRM_Utils_Array::value('title', $item);
if (strstr($item['page_callback'], '_Page')) {
eval("\$object = new {$item['page_callback']}( \$title, \$mode );");
} elseif (strstr($item['page_callback'], '_Controller')) {
$addSequence = 'false';
if (isset($pageArgs['addSequence'])) {
$addSequence = $pageArgs['addSequence'];
$addSequence = $addSequence ? 'true' : 'false';
unset($pageArgs['addSequence']);
}
eval("\$object = new {$item['page_callback']}( \$title, true, \$mode, null, \$addSequence );");
} else {
CRM_Core_Error::fatal();
}
$result = $object->run($newArgs, $pageArgs);
}
CRM_Core_Session::storeSessionObjects();
return $result;
}
CRM_Core_Menu::store();
CRM_Core_Session::setStatus(ts('Menu has been rebuilt'));
return CRM_Utils_System::redirect();
}