本文整理汇总了PHP中CRM_Utils_System::currentPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::currentPath方法的具体用法?PHP CRM_Utils_System::currentPath怎么用?PHP CRM_Utils_System::currentPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::currentPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBackendURI
function getBackendURI()
{
$backendURI = NULL;
$path = CRM_Utils_System::currentPath();
if (false !== strpos($path, '..')) {
die("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
}
$path = split('/', $path);
if (!CRM_Utils_Array::value(3, $path)) {
die("BACKEND ERROR: No backend found in request");
} else {
$backend = CRM_Utils_Array::value(3, $path);
if ("facebook" == $backend) {
$enabled = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'enable_facebook'));
if ($enabled) {
$facebook_client_id = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'facebook_app_id'));
$backendURI = "https://www.facebook.com/dialog/oauth?";
$backendURI .= "client_id=" . $facebook_client_id;
$backendURI .= "&redirect_uri=" . $this->getRedirectURI("facebook");
}
} else {
if ("googleplus" == $backend) {
$enabled = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'enable_googleplus'));
if ($enabled) {
$googleplus_client_id = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'google_plus_key'));
$backendURI = "https://accounts.google.com/o/oauth2/auth?scope=email%20profile&response_type=code&";
$backendURI .= "client_id=" . $googleplus_client_id;
$backendURI .= "&redirect_uri=" . $this->getRedirectURI("googleplus");
}
}
}
}
return $backendURI;
}
示例2: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
* @access public
*
*/
function run()
{
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
// set breadcrumb to append to 2nd layer pages
$breadCrumb = array(array('title' => ts('Manage Items'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')));
// what action to take ?
if ($action & CRM_Core_Action::ADD) {
$session = CRM_Core_Session::singleton();
if ($session->get('userID')) {
// For logged in user directly go to add/update item page.
$controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item', 'New Item', $action);
$controller->set('donorID', $session->get('userID'));
} else {
// For anonymous user go via account creation wizard.
require_once 'CRM/Auction/Controller/Item.php';
$controller = new CRM_Auction_Controller_Item('New Item', $action);
}
return $controller->run();
} elseif ($action & CRM_Core_Action::UPDATE) {
$session = CRM_Core_Session::singleton();
if ($session->get('userID')) {
$controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item', 'Update Item', $action);
$controller->set('donorID', $session->get('userID'));
return $controller->run();
}
}
// parent run
parent::run();
}
示例3: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
* @access public
*
*/
function run()
{
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
// set breadcrumb to append to 2nd layer pages
$breadCrumb = array(array('title' => ts('Manage Items'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')));
// what action to take ?
if ($action & CRM_Core_Action::DISABLE) {
require_once 'CRM/Auction/BAO/Auction.php';
CRM_Auction_BAO_Auction::setIsActive($id, 0);
} elseif ($action & CRM_Core_Action::ENABLE) {
require_once 'CRM/Auction/BAO/Auction.php';
CRM_Auction_BAO_Auction::setIsActive($id, 1);
} elseif ($action & CRM_Core_Action::DELETE) {
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
$controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Auction_Delete', 'Delete Auction', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$controller->set('id', $id);
$controller->process();
return $controller->run();
}
// finally browse the auctions
$this->browse();
// parent run
parent::run();
}
示例4: getTemplateFileName
function getTemplateFileName () {
$request = CRM_Utils_System::currentPath();
if (false !== strpos($request, '..')) {
die ("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
}
$request = split ('/',$request);
$tplfile = NULL;
$smarty= CRM_Core_Smarty::singleton( );
$smarty->assign("options",array());
if (CRM_Utils_Array::value(2, $request)) {
$tplfile = _civicrm_api_get_camel_name($request[2]);
$tplfile = explode('?', $tplfile);
$tpl = 'dataviz/'.$tplfile[0].'.tpl';
}
if (CRM_Utils_Array::value(3, $request)) {
$r3 = _civicrm_api_get_camel_name($request[3]);
$smarty->assign("id",$r3);
}
if (!$tplfile) {
$tpl = "CRM/Civizualise/Page/Main.tpl";
}
if( !$smarty->template_exists($tpl) ){
header("Status: 404 Not Found");
die ("Can't find the requested template file templates/$tpl");
}
return $tpl;
}
示例5: __construct
/**
* The pager constructor. Takes a few values, and then assigns a lot of defaults
* to the PEAR pager class
* We have embedded some html in this class. Need to figure out how to export this
* to the top level at some point in time
*
* @param int total the total count of items to be displayed
* @param int currentPage the page currently being displayed
* @param string status the status message to be displayed. It embeds a token
* %%statusMessage%% that will be replaced with which items
* are currently being displayed
* @param string csvString the title of the link to be displayed for the export
* @param int perPage the number of items displayed per page
*
* @return object the newly created and initialized pager object
*
* @access public
*
*/
function __construct($params)
{
if ($params['status'] === null) {
$params['status'] = ts('Contacts %%StatusMessage%%');
}
$params['path'] = CRM_Utils_System::makeURL(CRM_Utils_System::currentPath());
$this->initialize($params);
$this->Pager_Sliding($params);
list($offset, $limit) = $this->getOffsetAndRowCount();
$start = $offset + 1;
$end = $offset + $limit;
if ($end > $params['total']) {
$end = $params['total'];
}
if ($params['total'] == 0) {
$statusMessage = '';
} else {
$statusMessage = ts('%1 - %2 of %3', array(1 => $start, 2 => $end, 3 => $params['total']));
}
$params['status'] = str_replace('%%StatusMessage%%', $statusMessage, $params['status']);
$this->_response = array('first' => $this->_printFirstPage(), 'back' => str_replace(' ', '', $this->_getBackLink()), 'next' => str_replace(' ', '', $this->_getNextLink()), 'last' => $this->_printLastPage(), 'currentPage' => $this->getCurrentPageID(), 'numPages' => $this->numPages(), 'csvString' => CRM_Utils_Array::value('csvString', $params), 'status' => CRM_Utils_Array::value('status', $params), 'buttonTop' => CRM_Utils_Array::value('buttonTop', $params), 'buttonBottom' => CRM_Utils_Array::value('buttonBottom', $params), 'twentyfive' => $this->getPerPageLink(25), 'fifty' => $this->getPerPageLink(50), 'onehundred' => $this->getPerPageLink(100));
/**
* A page cannot have two variables with the same form name. Hence in the
* pager display, we have a form submission at the top with the normal
* page variable, but a different form element for one at the bottom
*
*/
$this->_response['titleTop'] = ts('Page %1 of %2', array(1 => '<input size="2" maxlength="3" name="' . self::PAGE_ID . '" type="text" value="' . $this->_response['currentPage'] . '" />', 2 => $this->_response['numPages']));
$this->_response['titleBottom'] = ts('Page %1 of %2', array(1 => '<input size="2" maxlength="3" name="' . self::PAGE_ID_BOTTOM . '" type="text" value="' . $this->_response['currentPage'] . '" />', 2 => $this->_response['numPages']));
}
示例6: ts
function &actionLinks()
{
// check if variable _actionsLinks is populated
if (!isset(self::$_actionLinks)) {
// helper variable for nicer formatting
$deleteExtra = ts('Are you sure you want to delete this Widget?');
self::$_actionLinks = array(CRM_Core_Action::UPDATE => array('name' => ts('View and Edit'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=update&reset=1&id=%%id%%', 'title' => ts('Update')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=delete&reset=1&id=%%id%%', 'title' => ts('Delete Custom Field'), 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"'));
}
return self::$_actionLinks;
}
示例7: ts
/**
* Get the action links for this page.
*
* @param null
*
* @return array array of action links that we need to display for the browse screen
* @access public
*/
static function &actionLinks()
{
// check if variable _actionsLinks is populated
if (!isset(self::$_actionLinks)) {
// helper variable for nicer formatting
$deleteExtra = ts('Are you sure you want to delete this workflow?');
$copyExtra = ts('Are you sure you want to make a copy of this workflow?');
self::$_actionLinks = array(CRM_Core_Action::BROWSE => array('name' => ts('View and Edit Steps'), 'url' => 'civicrm/workflows/profiles', 'qs' => 'reset=1&action=browse&wid=%%wid%%', 'title' => ts('View and Edit Steps')), CRM_Core_Action::UPDATE => array('name' => ts('Settings'), 'url' => 'civicrm/workflows/update', 'qs' => 'action=update&reset=1&wid=%%wid%%', 'title' => ts('Edit Workflow Settings')), CRM_Core_Action::VIEW => array('name' => ts('Workflow Link'), 'url' => 'civicrm/workflow', 'qs' => 'wid=%%wid%%&reset=1', 'title' => ts('Link to the Workflow page')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=disable&wid=%%wid%%&reset=1', 'title' => ts('Disable Workflow')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=enable&wid=%%wid%%&reset=1', 'title' => ts('Enable Workflow')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=delete&reset=1&wid=%%wid%%', 'title' => ts('Delete Workflow'), 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"'), CRM_Core_Action::COPY => array('name' => ts('Clone Workflow'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=copy&reset=1&wid=%%wid%%', 'title' => ts('Make a Copy of this workflow'), 'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"'));
}
return self::$_actionLinks;
}
示例8: 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);
}
示例9: run
function run()
{
$session = CRM_Core_Session::singleton();
if (!CRM_Core_Permission::check(array(array('view Applicants', 'manage Applicants', 'evaluate Applicants', 'administer Vacancy', 'administer CiviCRM')))) {
$session->pushUserContext(CRM_Utils_System::url('civicrm'));
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to perform this action.'));
}
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$searchParams = array();
foreach (array('position', 'status_id', 'location') as $searchField) {
$searchValue = $this->get($searchField);
if (!empty($searchValue)) {
$searchParams[$searchField] = $searchValue;
}
}
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0, 'REQUEST');
$this->_isTemplate = (bool) CRM_Utils_Request::retrieve('template', 'Integer', $this);
if (isset($this->_isTemplate)) {
$this->assign('isTemplate', $this->_isTemplate);
}
// what action to take ?
if ($action & CRM_Core_Action::DELETE) {
$session = CRM_Core_Session::singleton();
$pathCancel = $this->_isTemplate ? "reset=1&action=browse&template={$this->_isTemplate}" : "reset=1&action=browse";
$session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), $pathCancel));
$controller = new CRM_Core_Controller_Simple('CRM_HRRecruitment_Form_Search_Delete', 'Delete Vacancy', $action);
$controller->set('id', $id);
$controller->process();
return $controller->run();
}
if ($action & CRM_Core_Action::UPDATE) {
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/vacancy', 'reset=1&action=browse'));
$controller = new CRM_Core_Controller_Simple('CRM_HRRecruitment_Form_HRVacancy', 'Edit Vacancy', $action);
$controller->set('id', $id);
$controller->process();
return $controller->run();
} elseif ($action & CRM_Core_Action::COPY) {
$this->copy();
}
// finally browse the custom groups
$this->browse($action, $searchParams);
// parent run
return parent::run();
}
示例10: save
/**
* Generate the config js file based on posted data.
*
* @param array $params
*/
public function save($params)
{
$config = "/**\n" . " * CKEditor config file auto-generated by CiviCRM.\n" . " *\n" . " * Note: This file will be overwritten if settings are modified at:\n" . " * @link " . CRM_Utils_System::url(CRM_Utils_System::currentPath(), NULL, TRUE, NULL, FALSE) . "\n" . " */\n\n" . preg_replace('~\\R~u', "\n", $params['config']);
// Use defaultSettings as a whitelist so we don't just insert any old junk into the file
foreach ($this->defaultSettings as $key => $default) {
if (isset($params[$key]) && strlen($params[$key])) {
$pos = strrpos($config, '};');
$setting = "\n\tconfig.{$key} = '{$params[$key]}';\n";
$config = substr_replace($config, $setting, $pos, 0);
}
}
self::saveConfigFile($config);
if (!empty($params['save'])) {
CRM_Core_Session::setStatus(ts("You may need to clear your browser's cache to see the changes in CiviCRM."), ts('CKEditor Saved'), 'success');
}
}
示例11: alterStateProvinceID
function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName)
{
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
$row[$selectedfield . '_hover'] = ts("%1 for this state.", array(1 => $value));
$states = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
if (!is_array($states)) {
return $states;
}
}
示例12: copy
/**
* This function is to make a copy of a price set, including
* all the fields in the page
*
* @return void
* @access public
*/
function copy()
{
$id = CRM_Utils_Request::retrieve('sid', 'Positive', $this, true, 0, 'GET');
require_once 'CRM/Price/BAO/Set.php';
CRM_Price_BAO_Set::copy($id);
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
}
示例13: browse
/**
* Browse all event templates.
*/
public function browse()
{
//get all event templates.
$allEventTemplates = array();
$eventTemplate = new CRM_Event_DAO_Event();
$eventTypes = CRM_Event_PseudoConstant::eventType();
$participantRoles = CRM_Event_PseudoConstant::participantRole();
$participantListings = CRM_Event_PseudoConstant::participantListing();
//find all event templates.
$eventTemplate->is_template = TRUE;
$eventTemplate->find();
while ($eventTemplate->fetch()) {
CRM_Core_DAO::storeValues($eventTemplate, $allEventTemplates[$eventTemplate->id]);
//get listing types.
if ($eventTemplate->participant_listing_id) {
$allEventTemplates[$eventTemplate->id]['participant_listing'] = $participantListings[$eventTemplate->participant_listing_id];
}
//get participant role
if ($eventTemplate->default_role_id) {
$allEventTemplates[$eventTemplate->id]['participant_role'] = $participantRoles[$eventTemplate->default_role_id];
}
//get event type.
if (isset($eventTypes[$eventTemplate->event_type_id])) {
$allEventTemplates[$eventTemplate->id]['event_type'] = $eventTypes[$eventTemplate->event_type_id];
}
//form all action links
$action = array_sum(array_keys($this->links()));
//add action links.
$allEventTemplates[$eventTemplate->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $eventTemplate->id), ts('more'), FALSE, 'eventTemplate.manage.action', 'Event', $eventTemplate->id);
}
$this->assign('rows', $allEventTemplates);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
}
示例14: copy
/**
* Make a copy of a contribution page, including all the fields in the page.
*/
public function copy()
{
$gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, TRUE, 0, 'GET');
CRM_Contribute_BAO_ContributionPage::copy($gid);
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
}
示例15: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
* @access public
*
*/
function run()
{
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
// default to 'browse'
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
// figure out whether we’re handling an event or an event template
if ($id) {
$this->_isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'is_template');
} elseif ($action & CRM_Core_Action::ADD) {
$this->_isTemplate = CRM_Utils_Request::retrieve('is_template', 'Boolean', $this);
}
if (!$this->_isTemplate && $id) {
$breadCrumb = array(array('title' => ts('Manage Events'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
// what action to take ?
if ($action & CRM_Core_Action::ADD || $action & CRM_Core_Action::UPDATE) {
require_once 'CRM/Event/Page/ManageEventEdit.php';
$page = new CRM_Event_Page_ManageEventEdit();
return $page->run();
} else {
if ($action & CRM_Core_Action::DELETE) {
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
$controller = new CRM_Core_Controller_Simple('CRM_Event_Form_ManageEvent_Delete', 'Delete Event', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
$controller->set('id', $id);
$controller->process();
return $controller->run();
} else {
if ($action & CRM_Core_Action::COPY) {
$this->copy();
}
}
}
// finally browse the custom groups
$this->browse();
// parent run
parent::run();
}