本文整理汇总了PHP中CRM_Utils_System::permissionDenied方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::permissionDenied方法的具体用法?PHP CRM_Utils_System::permissionDenied怎么用?PHP CRM_Utils_System::permissionDenied使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::permissionDenied方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
$this->set('searchFormName', 'Custom');
$this->set('context', 'custom');
$csID = CRM_Utils_Request::retrieve('csid', 'Integer', $this);
$ssID = CRM_Utils_Request::retrieve('ssID', 'Integer', $this);
$gID = CRM_Utils_Request::retrieve('gid', 'Integer', $this);
list($this->_customSearchID, $this->_customSearchClass, $formValues) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID);
if (!$this->_customSearchID) {
CRM_Core_Error::fatal('Could not get details for custom search.');
}
// stash this as a hidden element so we can potentially go there if the session
// is reset but this is available in the POST
$this->addElement('hidden', 'csid', $csID);
if (!empty($formValues)) {
$this->_formValues = $formValues;
}
// set breadcrumb to return to Custom Search listings page
$breadCrumb = array(array('title' => ts('Custom Searches'), 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1')));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
// use the custom selector
self::$_selectorName = 'CRM_Contact_Selector_Custom';
$this->set('customSearchID', $this->_customSearchID);
$this->set('customSearchClass', $this->_customSearchClass);
parent::preProcess();
// instantiate the new class
$this->_customClass = new $this->_customSearchClass($this->_formValues);
// CRM-12747
if (isset($this->_customClass->_permissionedComponent) && !self::isPermissioned($this->_customClass->_permissionedComponent)) {
CRM_Utils_System::permissionDenied();
}
}
示例2: preProcess
public function preProcess()
{
if (!CRM_Core_Permission::check('access CiviCRM') || !CRM_Core_Permission::check('administer CiviCRM')) {
CRM_Utils_System::permissionDenied();
exit;
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false);
$this->_object = CRM_Utils_Request::retrieve('object', 'String', $this, true);
$isObjectID = true;
if ($this->_action & CRM_Core_Action::ADD) {
$isObjectID = false;
}
$this->_objectID = CRM_Utils_Request::retrieve('objectID', 'Integer', $this, $isObjectID);
$this->_customFields = array();
$this->assign('object', $this->_object);
if ($this->_object == 'fee') {
$this->_tableName = 'civicrm_value_extended_care_fee_tracker';
CRM_Utils_System::setTitle(ts('Configure Fee Entry'));
$this->_customFields = array('entity_id', 'fee_type', 'category', 'description', 'fee_date', 'total_blocks');
} else {
$this->_tableName = 'civicrm_value_extended_care_signout';
CRM_Utils_System::setTitle(ts('Configure Activity block'));
$this->_customFields = array('entity_id', 'pickup_person_name', 'signin_time', 'signout_time', 'class', 'is_morning', 'at_school_meeting');
}
$this->assign('fields', $this->_customFields);
parent::preProcess();
}
示例3: preProcess
public function preProcess()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($this->_surveyId) {
$this->_single = TRUE;
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo);
$this->_surveyTitle = $surveyInfo['title'];
$this->assign('surveyTitle', $this->_surveyTitle);
CRM_Utils_System::setTitle(ts('Configure Survey - %1', array(1 => $this->_surveyTitle)));
}
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Event');
$this->set('entityId', $this->_surveyId);
CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// CRM-11480, CRM-11682
// Preload libraries required by the "Questions" tab
CRM_UF_Page_ProfileEditor::registerProfileScripts();
CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ActivityModel'));
CRM_Campaign_Form_Survey_TabHeader::build($this);
}
示例4: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
$this->_vid = CRM_Utils_Request::retrieve('vid', 'Positive', $this, TRUE);
if (!CRM_Volunteer_Permission::checkProjectPerms(CRM_Core_Action::UPDATE, $this->_vid)) {
CRM_Utils_System::permissionDenied();
}
$this->_batchInfo['item_count'] = 50;
$params = array('project_id' => $this->_vid);
$this->_volunteerData = CRM_Volunteer_BAO_Assignment::retrieve($params);
$projects = CRM_Volunteer_BAO_Project::retrieve(array('id' => $this->_vid));
$project = $projects[$this->_vid];
$this->_entityID = $project->entity_id;
$this->_entityTable = $project->entity_table;
$this->_title = $project->title;
$this->_title .= ' ( ' . CRM_Utils_Date::customFormat($project->start_date);
$this->_start_date = $project->start_date;
if ($project->end_date) {
$this->_title .= ' - ' . CRM_Utils_Date::customFormat($project->end_date) . ' )';
} else {
$this->_title .= ' )';
}
/*
* Because CiviCRM's asset management framework isn't mature yet (e.g., adding
* assets to forms rendered in pop-ups using CRM_Core_Resources doesn't work),
* we pass a URL fragment to the template and include them via HTML.
*/
$this->assign('extResourceURL', CRM_Core_Resources::singleton()->getUrl('org.civicrm.volunteer'));
$this->assign('vid', $this->_vid);
}
示例5: preProcess
function preProcess()
{
if (!CRM_Core_Permission::check('access custom search form')) {
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
}
示例6: preProcess
/**
* TODO: How many checks do we need to do? Should we check to make sure the
* activity is the right type? That the cid and aid are associated? Seems like
* if you are messing with URL params you are kind of asking for trouble...
*/
function preProcess()
{
$this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE);
$this->_cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$this->_vid = CRM_Utils_Request::retrieve('vid', 'Positive', $this, FALSE);
if (!CRM_Volunteer_Permission::checkProjectPerms(CRM_Core_Action::UPDATE, $this->_vid)) {
CRM_Utils_System::permissionDenied();
}
if (!$this->_aid && !($this->_cid && $this->_vid)) {
CRM_Core_Error::fatal("Form expects an activity ID or both a contact and a volunteer project ID.");
}
$check = array('Activity' => $this->_aid, 'Contact' => $this->_cid, 'VolunteerProject' => $this->_vid);
$errors = array();
foreach ($check as $entityType => $entityID) {
if (!$this->entityExists($entityType, $entityID)) {
$errors[] = "No {$entityType} with ID {$entityID} exists.";
}
}
if (count($errors)) {
CRM_Core_Error::fatal("Invalid parameter(s) passed to commendation form: " . implode(' ', $errors));
}
$contact_display_name = civicrm_api3('Contact', 'getvalue', array('id' => $this->_cid, 'return' => 'display_name'));
CRM_Utils_System::setTitle(ts('Commend %1', array(1 => $contact_display_name, 'domain' => 'org.civicrm.volunteer')));
parent::preProcess();
}
示例7: preProcess
public function preProcess()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE)) {
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_System::setTitle(ts('Edit Survey'));
} else {
CRM_Utils_System::setTitle(ts('Delete Survey'));
}
}
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
return CRM_Custom_Form_CustomData::preProcess($this);
}
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
$session->pushUserContext($url);
$this->_values = $this->get('values');
if (!is_array($this->_values)) {
$this->_values = array();
if ($this->_surveyId) {
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $this->_values);
}
$this->set('values', $this->_values);
}
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
// for custom data
$this->assign('entityID', $this->_surveyId);
if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE)) {
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_System::setTitle(ts('Edit Petition'));
} else {
CRM_Utils_System::setTitle(ts('Delete Petition'));
}
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=petition');
$session->pushUserContext($url);
CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Petition Dashboard'), 'url' => $url)));
}
示例8: run
function run()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
$this->assign('action', $action);
$this->browse();
return parent::run();
}
示例9: run
function run()
{
if (!CRM_Core_Permission::check('administer CiviCampaign')) {
CRM_Utils_System::permissionDenied();
}
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 0);
$this->assign('action', $action);
$this->browse();
parent::run();
}
示例10: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo);
$this->_surveyTitle = $surveyInfo['title'];
$this->assign('surveyTitle', $this->_surveyTitle);
CRM_Utils_System::setTitle(ts('Delete Survey') . ' - ' . $this->_surveyTitle);
}
示例11: preProcess
public function preProcess()
{
if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
CRM_Utils_System::permissionDenied();
}
//check for custom data type.
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
return CRM_Custom_Form_CustomData::preProcess($this);
}
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $this->_context);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
$this->_campaignId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$title = NULL;
if ($this->_action & CRM_Core_Action::UPDATE) {
$title = ts('Edit Campaign');
}
if ($this->_action & CRM_Core_Action::DELETE) {
$title = ts('Delete Campaign');
}
if ($title) {
CRM_Utils_System::setTitle($title);
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=campaign'));
$this->assign('action', $this->_action);
//load the values;
$this->_values = $this->get('values');
if (!is_array($this->_values)) {
$this->_values = array();
// if we are editing
if (isset($this->_campaignId) && $this->_campaignId) {
$params = array('id' => $this->_campaignId);
CRM_Campaign_BAO_Campaign::retrieve($params, $this->_values);
}
//lets use current object session.
$this->set('values', $this->_values);
}
// when custom data is included in form.
if (!empty($_POST['hidden_custom'])) {
$this->set('type', 'Campaign');
$this->set('subType', CRM_Utils_Array::value('campaign_type_id', $_POST));
$this->set('entityId', $this->_campaignId);
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
}
示例12: preProcess
public function preProcess()
{
if (!CRM_Core_Permission::check('access CiviCRM')) {
CRM_Utils_System::permissionDenied();
exit;
}
$this->_indexID = CRM_Utils_Request::retrieve('id', 'Integer', $this, false);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false);
if ($this->_action & (CRM_Core_Action::DISABLE | CRM_Core_Action::ENABLE)) {
return;
}
// table fields, fieldname => type
$this->_customFields = array('term' => 'String', 'session' => 'String', 'name' => 'String', 'day_of_week' => 'String', 'min_grade' => 'Integer', 'max_grade' => 'Integer', 'start_date' => 'Timestamp', 'end_date' => 'Timestamp', 'instructor' => 'String', 'fee_block' => 'Float', 'total_fee_block' => 'Float', 'max_participants' => 'Integer', 'location' => 'String', 'url' => 'String', 'additional_rows' => 'Integer');
if ($this->_action & CRM_Core_Action::ADD) {
$this->_customFields['is_active'] = 'Integer';
}
parent::preProcess();
}
示例13:
/**
* create a Volunteer Need
* takes an associative array and creates a Need object
*
* This function is invoked from within the web form layer and also from the api layer
*
* @param array $params (reference ) an assoc array of name/value pairs
*
* @return CRM_Volunteer_BAO_Need object
* @access public
* @static
*/
static function &create($params)
{
$projectId = CRM_Utils_Array::value('project_id', $params);
$op = CRM_Core_Action::UPDATE;
if (!empty($params['check_permissions']) && !CRM_Volunteer_Permission::checkProjectPerms($op, $projectId)) {
CRM_Utils_System::permissionDenied();
// FIXME: If we don't return here, the script keeps executing. This is not
// what I expect from CRM_Utils_System::permissionDenied().
return FALSE;
}
if (empty($params)) {
return;
}
$need = new CRM_Volunteer_DAO_Need();
$need->copyValues($params);
$need->save();
return $need;
}
示例14: preProcess
/**
* Pre processing.
*
* @return void
*/
public function preProcess()
{
// Ensure user has permission to be here
if (!CRM_Core_Permission::check('administer dedupe rules')) {
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
$this->_options = CRM_Core_SelectValues::getDedupeRuleTypes();
$this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
if ($this->_rgid) {
$rgDao = new CRM_Dedupe_DAO_RuleGroup();
$rgDao->id = $this->_rgid;
$rgDao->find(TRUE);
$this->_defaults['threshold'] = $rgDao->threshold;
$this->_contactType = $rgDao->contact_type;
$this->_defaults['used'] = CRM_Utils_Array::key($rgDao->used, $this->_options);
$this->_defaults['title'] = $rgDao->title;
$this->_defaults['name'] = $rgDao->name;
$this->_defaults['is_reserved'] = $rgDao->is_reserved;
$this->assign('isReserved', $rgDao->is_reserved);
$this->assign('ruleName', $rgDao->name);
$ruleDao = new CRM_Dedupe_DAO_Rule();
$ruleDao->dedupe_rule_group_id = $this->_rgid;
$ruleDao->find();
$count = 0;
while ($ruleDao->fetch()) {
$this->_defaults["where_{$count}"] = "{$ruleDao->rule_table}.{$ruleDao->rule_field}";
$this->_defaults["length_{$count}"] = $ruleDao->rule_length;
$this->_defaults["weight_{$count}"] = $ruleDao->rule_weight;
$count++;
}
}
$supported = CRM_Dedupe_BAO_RuleGroup::supportedFields($this->_contactType);
if (is_array($supported)) {
foreach ($supported as $table => $fields) {
foreach ($fields as $field => $title) {
$this->_fields["{$table}.{$field}"] = $title;
}
}
}
asort($this->_fields);
}
示例15: preProcess
public function preProcess()
{
require_once 'CRM/Campaign/BAO/Campaign.php';
if (!CRM_Campaign_BAO_Campaign::accessCampaignDashboard()) {
CRM_Utils_System::permissionDenied();
}
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
if ($this->_context) {
$this->assign('context', $this->_context);
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE)) {
$this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_System::setTitle(ts('Edit Survey'));
} else {
CRM_Utils_System::setTitle(ts('Delete Survey'));
}
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
$session->pushUserContext($url);
if ($this->_name != 'Petition') {
CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey Dashboard'), 'url' => $url)));
}
$this->_values = array();
if ($this->_surveyId) {
$this->assign('surveyId', $this->_surveyId);
$values = $this->get('values');
// get contact values.
if (!empty($values)) {
$this->_values = $values;
} else {
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $this->_values, true);
$this->set('values', $this->_values);
}
}
$this->assign('action', $this->_action);
}