本文整理汇总了PHP中CRM_Report_Utils_Report::getInstanceID方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Report_Utils_Report::getInstanceID方法的具体用法?PHP CRM_Report_Utils_Report::getInstanceID怎么用?PHP CRM_Report_Utils_Report::getInstanceID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Report_Utils_Report
的用法示例。
在下文中一共展示了CRM_Report_Utils_Report::getInstanceID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
$instanceId = CRM_Report_Utils_Report::getInstanceID();
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
$optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
$reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
if ($action & CRM_Core_Action::DELETE) {
if (!CRM_Core_Permission::check('administer Reports')) {
$statusMessage = ts('Your do not have permission to Delete Report.');
CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
}
CRM_Report_BAO_Instance::delete($instanceId);
CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.'));
} else {
require_once 'CRM/Core/OptionGroup.php';
$templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
if (strstr($templateInfo['name'], '_Form')) {
$instanceInfo = array();
CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
if (!empty($instanceInfo['title'])) {
CRM_Utils_System::setTitle($instanceInfo['title']);
$this->assign('reportTitle', $instanceInfo['title']);
} else {
CRM_Utils_System::setTitle($templateInfo['label']);
$this->assign('reportTitle', $templateInfo['label']);
}
$wrapper =& new CRM_Utils_Wrapper();
return $wrapper->run($templateInfo['name'], null, null);
}
CRM_Core_Session::setStatus(ts('Could not find template for the instance.'));
}
return CRM_Utils_System::redirect($reportUrl);
}
示例2: run
/**
* Run this page (figure out the action needed and perform it).
*/
public function run()
{
$instanceId = CRM_Report_Utils_Report::getInstanceID();
if (!$instanceId) {
$instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
}
if (is_numeric($instanceId)) {
$instanceURL = CRM_Utils_System::url("civicrm/report/instance/{$instanceId}", 'reset=1');
CRM_Core_Session::singleton()->replaceUserContext($instanceURL);
}
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
$optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
$reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
if ($action & CRM_Core_Action::DELETE) {
if (!CRM_Core_Permission::check('administer Reports')) {
$statusMessage = ts('You do not have permission to Delete Report.');
CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
}
$navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceId, 'navigation_id', 'id');
CRM_Report_BAO_ReportInstance::del($instanceId);
//delete navigation if exists
if ($navId) {
CRM_Core_BAO_Navigation::processDelete($navId);
CRM_Core_BAO_Navigation::resetNavigation();
}
CRM_Core_Session::setStatus(ts('Selected report has been deleted.'), ts('Deleted'), 'success');
} else {
$templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
if (empty($templateInfo)) {
CRM_Core_Error::statusBounce('You have tried to access a report that does not exist.');
}
$extKey = strpos($templateInfo['name'], '.');
$reportClass = NULL;
if ($extKey !== FALSE) {
$ext = CRM_Extension_System::singleton()->getMapper();
$reportClass = $ext->keyToClass($templateInfo['name'], 'report');
$templateInfo['name'] = $reportClass;
}
if (strstr($templateInfo['name'], '_Form') || !is_null($reportClass)) {
$instanceInfo = array();
CRM_Report_BAO_ReportInstance::retrieve(array('id' => $instanceId), $instanceInfo);
if (!empty($instanceInfo['title'])) {
CRM_Utils_System::setTitle($instanceInfo['title']);
$this->assign('reportTitle', $instanceInfo['title']);
} else {
CRM_Utils_System::setTitle($templateInfo['label']);
$this->assign('reportTitle', $templateInfo['label']);
}
$wrapper = new CRM_Utils_Wrapper();
return $wrapper->run($templateInfo['name'], NULL, NULL);
}
CRM_Core_Session::setStatus(ts('Could not find template for the instance.'), ts('Template Not Found'), 'error');
}
return CRM_Utils_System::redirect($reportUrl);
}
示例3: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
$instanceId = CRM_Report_Utils_Report::getInstanceID();
if (!$instanceId) {
$instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
}
$action = CRM_Utils_Request::retrieve('action', 'String', $this);
$optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
$reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
if ($action & CRM_Core_Action::DELETE) {
if (!CRM_Core_Permission::check('administer Reports')) {
$statusMessage = ts('Your do not have permission to Delete Report.');
CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
}
$navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_Instance', $instanceId, 'navigation_id', 'id');
CRM_Report_BAO_Instance::delete($instanceId);
//delete navigation if exists
if ($navId) {
require_once 'CRM/Core/BAO/Navigation.php';
CRM_Core_BAO_Navigation::processDelete($navId);
CRM_Core_BAO_Navigation::resetNavigation();
}
CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.'));
} else {
require_once 'CRM/Core/OptionGroup.php';
$templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
$extKey = strpos($templateInfo['name'], '.');
$reportClass = null;
if ($extKey !== FALSE) {
require_once 'CRM/Core/Extensions.php';
$ext = new CRM_Core_Extensions();
$reportClass = $ext->keyToClass($templateInfo['name'], 'report');
$templateInfo['name'] = $reportClass;
}
if (strstr($templateInfo['name'], '_Form') || !is_null($reportClass)) {
$instanceInfo = array();
CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
if (!empty($instanceInfo['title'])) {
CRM_Utils_System::setTitle($instanceInfo['title']);
$this->assign('reportTitle', $instanceInfo['title']);
} else {
CRM_Utils_System::setTitle($templateInfo['label']);
$this->assign('reportTitle', $templateInfo['label']);
}
$wrapper = new CRM_Utils_Wrapper();
return $wrapper->run($templateInfo['name'], null, null);
}
CRM_Core_Session::setStatus(ts('Could not find template for the instance.'));
}
return CRM_Utils_System::redirect($reportUrl);
}
示例4: preProcessCommon
/**
* Shared pre-process function.
*
* If overriding preProcess function this should still be called.
*
* @throws \Exception
*/
public function preProcessCommon()
{
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', CRM_Core_DAO::$_nullObject);
$this->_dashBoardRowCount = CRM_Utils_Request::retrieve('rowCount', 'Integer', CRM_Core_DAO::$_nullObject);
$this->_section = CRM_Utils_Request::retrieve('section', 'Integer', CRM_Core_DAO::$_nullObject);
$this->assign('section', $this->_section);
CRM_Core_Region::instance('page-header')->add(array('markup' => sprintf('<!-- Report class: [%s] -->', htmlentities(get_class($this)))));
if (!$this->noController) {
$this->setID($this->get('instanceId'));
if (!$this->_id) {
$this->setID(CRM_Report_Utils_Report::getInstanceID());
if (!$this->_id) {
$this->setID(CRM_Report_Utils_Report::getInstanceIDForPath());
}
}
// set qfkey so that pager picks it up and use it in the "Next > Last >>" links.
// FIXME: Note setting it in $_GET doesn't work, since pager generates link based on QUERY_STRING
$_SERVER['QUERY_STRING'] .= "&qfKey={$this->controller->_key}";
}
if ($this->_id) {
$this->assign('instanceId', $this->_id);
$params = array('id' => $this->_id);
$this->_instanceValues = array();
CRM_Core_DAO::commonRetrieve('CRM_Report_DAO_ReportInstance', $params, $this->_instanceValues);
if (empty($this->_instanceValues)) {
CRM_Core_Error::fatal("Report could not be loaded.");
}
$this->_title = $this->_instanceValues['title'];
if (!empty($this->_instanceValues['permission']) && !(CRM_Core_Permission::check($this->_instanceValues['permission']) || CRM_Core_Permission::check('administer Reports'))) {
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
$formValues = CRM_Utils_Array::value('form_values', $this->_instanceValues);
if ($formValues) {
$this->_formValues = unserialize($formValues);
} else {
$this->_formValues = NULL;
}
$this->setOutputMode();
if ($this->_outputMode == 'copy') {
$this->_createNew = TRUE;
$this->_params = $this->_formValues;
$this->_params['view_mode'] = 'criteria';
$this->_params['title'] = ts('(copy)') . $this->getTitle();
// Do not pass go. Do not collect another chance to re-run the same query.
CRM_Report_Form_Instance::postProcess($this);
}
// lets always do a force if reset is found in the url.
// Hey why not? see CRM-17225 for more about this. The use of reset to be force is historical for reasons stated
// in the comment line above these 2.
if (!empty($_REQUEST['reset']) && !in_array(CRM_Utils_Request::retrieve('output', 'String'), array('save', 'criteria'))) {
$this->_force = 1;
}
// set the mode
$this->assign('mode', 'instance');
} elseif (!$this->noController) {
list($optionValueID, $optionValue) = CRM_Report_Utils_Report::getValueIDFromUrl();
$instanceCount = CRM_Report_Utils_Report::getInstanceCount($optionValue);
if ($instanceCount > 0 && $optionValueID) {
$this->assign('instanceUrl', CRM_Utils_System::url('civicrm/report/list', "reset=1&ovid={$optionValueID}"));
}
if ($optionValueID) {
$this->_description = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $optionValueID, 'description');
}
// set the mode
$this->assign('mode', 'template');
}
// lets display the Report Settings section
$this->_instanceForm = $this->_force || $this->_id || !empty($_POST);
// Do not display Report Settings section if administer Reports permission is absent OR
// if report instance is reserved and administer reserved reports absent
if (!CRM_Core_Permission::check('administer Reports') || $this->_instanceValues['is_reserved'] && !CRM_Core_Permission::check('administer reserved reports')) {
$this->_instanceForm = FALSE;
}
$this->assign('criteriaForm', FALSE);
// Display Report Criteria section if user has access Report Criteria OR administer Reports AND report instance is not reserved
if (CRM_Core_Permission::check('administer Reports') || CRM_Core_Permission::check('access Report Criteria')) {
if (!$this->_instanceValues['is_reserved'] || CRM_Core_Permission::check('administer reserved reports')) {
$this->assign('criteriaForm', TRUE);
$this->_criteriaForm = TRUE;
}
}
$this->_instanceButtonName = $this->getButtonName('submit', 'save');
$this->_createNewButtonName = $this->getButtonName('submit', 'next');
$this->_printButtonName = $this->getButtonName('submit', 'print');
$this->_pdfButtonName = $this->getButtonName('submit', 'pdf');
$this->_csvButtonName = $this->getButtonName('submit', 'csv');
$this->_groupButtonName = $this->getButtonName('submit', 'group');
$this->_chartButtonName = $this->getButtonName('submit', 'chart');
}
示例5: preProcessCommon
function preProcessCommon()
{
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', CRM_Core_DAO::$_nullObject);
$this->_section = CRM_Utils_Request::retrieve('section', 'Integer', CRM_Core_DAO::$_nullObject);
$this->assign('section', $this->_section);
$this->_id = $this->get('instanceId');
if (!$this->_id) {
$this->_id = CRM_Report_Utils_Report::getInstanceID();
if (!$this->_id) {
$this->_id = CRM_Report_Utils_Report::getInstanceIDForPath();
}
}
// set qfkey so that pager picks it up and use it in the "Next > Last >>" links,
$_GET['qfKey'] = $this->controller->_key;
if ($this->_id) {
$this->assign('instanceId', $this->_id);
$params = array('id' => $this->_id);
$this->_instanceValues = array();
CRM_Core_DAO::commonRetrieve('CRM_Report_DAO_Instance', $params, $this->_instanceValues);
if (empty($this->_instanceValues)) {
CRM_Core_Error::fatal("Report could not be loaded.");
}
if (!empty($this->_instanceValues['permission']) && !(CRM_Core_Permission::check($this->_instanceValues['permission']) || CRM_Core_Permission::check('administer Reports'))) {
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
$this->_formValues = unserialize($this->_instanceValues['form_values']);
// lets always do a force if reset is found in the url.
if (CRM_Utils_Array::value('reset', $_GET)) {
$this->_force = 1;
}
// set the mode
$this->assign('mode', 'instance');
} else {
list($optionValueID, $optionValue) = CRM_Report_Utils_Report::getValueIDFromUrl();
$instanceCount = CRM_Report_Utils_Report::getInstanceCount($optionValue);
if ($instanceCount > 0 && $optionValueID) {
$this->assign('instanceUrl', CRM_Utils_System::url('civicrm/report/list', "reset=1&ovid={$optionValueID}"));
}
if ($optionValueID) {
$this->_description = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $optionValueID, 'description');
}
// set the mode
$this->assign('mode', 'template');
}
// lets display the
$this->_instanceForm = $this->_force || $this->_id || !empty($_POST);
// do not display instance form if administer Reports permission is absent
if (!CRM_Core_Permission::check('administer Reports')) {
$this->_instanceForm = false;
}
$this->assign('criteriaForm', false);
if (CRM_Core_Permission::check('administer Reports') || CRM_Core_Permission::check('access Report Criteria')) {
$this->assign('criteriaForm', true);
}
$this->_instanceButtonName = $this->getButtonName('submit', 'save');
$this->_printButtonName = $this->getButtonName('submit', 'print');
$this->_pdfButtonName = $this->getButtonName('submit', 'pdf');
$this->_csvButtonName = $this->getButtonName('submit', 'csv');
$this->_groupButtonName = $this->getButtonName('submit', 'group');
$this->_chartButtonName = $this->getButtonName('submit', 'chart');
}