当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_Permission::checkActionPermission方法代码示例

本文整理汇总了PHP中CRM_Core_Permission::checkActionPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Permission::checkActionPermission方法的具体用法?PHP CRM_Core_Permission::checkActionPermission怎么用?PHP CRM_Core_Permission::checkActionPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_Permission的用法示例。


在下文中一共展示了CRM_Core_Permission::checkActionPermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 /** 
  * Function to set variables up before form is built 
  *                                                           
  * @return void 
  * @access public
  */
 public function preProcess()
 {
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('action', $this->_action);
     $this->assign('context', $this->_context);
     //check permission for action.
     if (!CRM_Core_Permission::checkActionPermission('CiviGrant', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->_noteId = null;
     if ($this->_id) {
         require_once 'CRM/Core/BAO/Note.php';
         $noteDAO = new CRM_Core_BAO_Note();
         $noteDAO->entity_table = 'civicrm_grant';
         $noteDAO->entity_id = $this->_id;
         if ($noteDAO->find(true)) {
             $this->_noteId = $noteDAO->id;
         }
     }
     //build custom data
     CRM_Custom_Form_Customdata::preProcess($this, null, null, 1, 'Grant', $this->_id);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:33,代码来源:Grant.php

示例2: preProcess

 /**
  * Build all the data structures needed to build the form.
  */
 public function preProcess()
 {
     if (!CRM_Core_Permission::checkActionPermission('CiviCase', CRM_Core_Action::DELETE)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
     parent::preProcess();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:10,代码来源:Delete.php

示例3: preProcess

 /**
  * Function to set variables up before form is built
  * 
  * @param null
  * 
  * @return void
  * @access public
  */
 public function preProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         //check permission for action.
         if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
         }
         $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'title');
         $this->assign('title', $this->_title);
         parent::preProcess();
     }
     if (!$this->_action) {
         $action = CRM_Utils_Array::value('action', $_GET);
         $id = CRM_Utils_Array::value('id', $_GET);
         switch ($action) {
             case 'delete':
                 require_once 'CRM/Contribute/BAO/PCP.php';
                 $title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $id, 'title');
                 CRM_Contribute_BAO_PCP::delete($id);
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $title)));
                 break;
             case 'disable':
                 require_once 'CRM/Contribute/BAO/PCP.php';
                 CRM_Contribute_BAO_PCP::setDisable($id, '0');
                 break;
             case 'enable':
                 require_once 'CRM/Contribute/BAO/PCP.php';
                 CRM_Contribute_BAO_PCP::setDisable($id, '1');
                 break;
         }
         $session =& CRM_Core_Session::singleton();
         CRM_Utils_System::redirect($session->popUserContext());
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:43,代码来源:PCP.php

示例4: preProcess

 /**
  * This function is called prior to building and submitting the form
  */
 function preProcess()
 {
     // check contact_id
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     if (empty($this->_contactId)) {
         CRM_Core_Error::statusBounce(ts('Could not get a contact id.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
         // this also redirects to the default civicrm page
     }
     // check for edit permission
     if (!CRM_Core_Permission::checkActionPermission('CiviMember', 'update')) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     // get request
     $this->_request = CRM_Utils_Request::retrieve('request', 'String', $this, FALSE, 'choose');
     // get session
     $session = CRM_Core_Session::singleton();
     // get values
     $this->_configMembership = CRM_Lidmaatschapwijziging_ConfigMembership::singleton($this->_contactId);
     $this->_values = $this->_configMembership->getContact();
     // set display name
     $this->_display_name = $this->_values['display_name'];
     // set contact id
     $this->_values['contact_id'] = $this->_contactId;
     // set request
     $this->_values['request'] = $this->_request;
     // set title
     CRM_Utils_System::setTitle('LidmaatschapWijziging - Lidmaatschap - ' . $this->_values['display_name']);
     // request
     if ('empty' == $this->_request) {
     }
     if ('choose' == $this->_request) {
         // if there is no memberships then the options are empty, we
         // show a message that there are no memebrships and a submit butten to
         // go to the relationship, first we redirect them to request empty
         $memberships = $this->_configMembership->getMemberships();
         if (empty($memberships)) {
             // redirect user
             $url = CRM_Utils_System::url('civicrm/lidmaatschapwijziging/membership', 'reset=1&request=empty&cid=' . $this->_contactId);
             CRM_Utils_System::redirect($url);
         }
     }
     if ('update' == $this->_request) {
         // get membership id
         $this->_membershipId = CRM_Utils_Request::retrieve('membership_id', 'Positive', $this);
         $this->_values['membership_id'] = $this->_membershipId;
         // get membership
         $membership = $this->_configMembership->getMembership($this->_membershipId);
         $this->_values = array_merge($this->_values, $membership);
         // get source, source is overritten by the contact source and not the membership source, i
         // override it here
         $this->_values['source'] = $membership['source'];
         // This is diffrent from the LidmaatschapWijzigingContact because the custom field values are already send with the membership
         // We have to set the _values of the custom field like huppeldepup and not custom_35, so we
         // loop through the custom field and change the custom_35 values to huppeldepup
         foreach ($this->_configMembership->getMembershipCustomFields() as $key => $field) {
             $this->_values[$field['name']] = $this->_values['custom_' . $field['id']];
         }
     }
 }
开发者ID:jvos,项目名称:nl.vnv.lidmaatschapwijziging_old,代码行数:62,代码来源:LidmaatschapwijzigingMembership.php

示例5: preProcess

 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     //check permission for delete.
     if (!CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::DELETE)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:13,代码来源:Delete.php

示例6: preProcess

 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     //check for delete
     if (!CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     parent::preProcess();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:14,代码来源:Delete.php

示例7: array

 /**
  * These tasks are the core set of tasks that the user can perform
  * on a contact / group of contacts
  *
  * @return array the set of tasks for a group of contacts
  * @static
  * @access public
  */
 static function &tasks()
 {
     if (!self::$_tasks) {
         if (CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::DELETE)) {
             self::$_tasks = array(1 => ts('Delete Grants'));
         }
     }
     return self::$_tasks;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:17,代码来源:Task.php

示例8: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @param null
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         //check permission for action.
         if (!CRM_Core_Permission::checkActionPermission('CiviEvent', $this->_action)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
         }
         $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $this->_id, 'title');
         $this->assign('title', $this->_title);
         parent::preProcess();
     }
     if (!$this->_action) {
         $this->_action = CRM_Utils_Array::value('action', $_GET);
         $this->_id = CRM_Utils_Array::value('id', $_GET);
     } else {
         $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     }
     //give the context.
     if (!isset($this->_context)) {
         $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     }
     $this->assign('context', $this->_context);
     $session = CRM_Core_Session::singleton();
     $context = $session->popUserContext();
     $userID = $session->get('userID');
     //do not allow destructive actions without permissions
     $permission = FALSE;
     if (CRM_Core_Permission::check('administer CiviCRM') || $userID && CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $this->_id, 'contact_id') == $userID) {
         $permission = TRUE;
     }
     if ($permission && $this->_id) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $this->_id, 'title');
         switch ($this->_action) {
             case CRM_Core_Action::DELETE:
             case 'delete':
                 CRM_PCP_BAO_PCP::deleteById($this->_id);
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $this->_title)), ts('Page Deleted'), 'success');
                 break;
             case CRM_Core_Action::DISABLE:
             case 'disable':
                 CRM_PCP_BAO_PCP::setDisable($this->_id, '0');
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been disabled.", array(1 => $this->_title)), ts('Page Disabled'), 'success');
                 break;
             case CRM_Core_Action::ENABLE:
             case 'enable':
                 CRM_PCP_BAO_PCP::setDisable($this->_id, '1');
                 CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been enabled.", array(1 => $this->_title)), ts('Page Enabled'), 'success');
                 break;
         }
         if ($context) {
             CRM_Utils_System::redirect($context);
         }
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:63,代码来源:PCP.php

示例9: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     // check for action permissions.
     if (!CRM_Core_Permission::checkActionPermission('CiviPledge', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $this->assign('action', $this->_action);
     $this->assign('context', $this->_context);
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->userDisplayName = $this->userEmail = NULL;
     if ($this->_contactID) {
         list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
         $this->assign('displayName', $this->userDisplayName);
         // set title to "Pledge - "+Contact Name
         $displayName = $this->userDisplayName;
         $pageTitle = ts('Pledge by') . ' ' . $displayName;
         $this->assign('pageTitle', $pageTitle);
         CRM_Utils_System::setTitle($pageTitle);
     }
     //build custom data
     CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Pledge', $this->_id);
     $this->_values = array();
     // current pledge id
     if ($this->_id) {
         //get the contribution id
         $this->_contributionID = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $this->_id, 'contribution_id', 'pledge_id');
         $params = array('id' => $this->_id);
         CRM_Pledge_BAO_Pledge::getValues($params, $this->_values);
         $paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
         //check for pending pledge.
         if (CRM_Utils_Array::value('status_id', $this->_values) == array_search('Pending', $paymentStatusTypes)) {
             $this->_isPending = TRUE;
         } elseif (CRM_Utils_Array::value('status_id', $this->_values) == array_search('Overdue', $paymentStatusTypes)) {
             $allPledgePayments = array();
             CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'pledge_id', $this->_id, $allPledgePayments, array('status_id'));
             foreach ($allPledgePayments as $key => $value) {
                 $allStatus[$value['id']] = $paymentStatusTypes[$value['status_id']];
             }
             if (count(array_count_values($allStatus)) <= 2) {
                 if (CRM_Utils_Array::value('Pending', array_count_values($allStatus))) {
                     $this->_isPending = TRUE;
                 }
             }
         }
     }
     //get the pledge frequency units.
     $this->_freqUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:61,代码来源:Pledge.php

示例10: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if (!CRM_Core_Permission::checkActionPermission('CiviAuction', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     if (($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::UPDATE || $this->_action & CRM_Core_Action::DELETE) && !$this->_id) {
         CRM_Core_Error::fatal();
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:17,代码来源:Auction.php

示例11: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     $values = $ids = array();
     $params = array('id' => $this->get('id'));
     CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
     $values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
     if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
         $sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
         $dao = new CRM_Core_DAO();
         $dao->query($sql);
         if ($dao->fetch()) {
             $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
             $values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
         }
         $honor = CRM_Core_PseudoConstant::get('CRM_Pledge_DAO_Pledge', 'honor_type_id');
         $values['honor_type'] = $honor[$values['honor_type_id']];
     }
     //handle custom data.
     $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     if (!empty($values['contribution_page_id'])) {
         $values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
     }
     $values['financial_type'] = CRM_Utils_Array::value($values['financial_type_id'], CRM_Contribute_PseudoConstant::financialType());
     if ($values['status_id']) {
         $values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
     }
     $url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     $recentOther = array();
     if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
         $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     }
     if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
         $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     }
     $displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
     $this->assign('displayName', $displayName);
     $title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['financial_type'] . ')';
     // add Pledge to Recent Items
     CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], NULL, $recentOther);
     // Check if this is default domain contact CRM-10482
     if (CRM_Contact_BAO_Contact::checkDomainContact($values['contact_id'])) {
         $displayName .= ' (' . ts('default organization') . ')';
     }
     // omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
     CRM_Utils_System::setTitle(ts('View Pledge by') . ' ' . $displayName);
     //do check for campaigns
     if ($campaignId = CRM_Utils_Array::value('campaign_id', $values)) {
         $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
         $values['campaign'] = $campaigns[$campaignId];
     }
     $this->assign($values);
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:59,代码来源:PledgeView.php

示例12: preProcess

 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     //check for delete
     if (!CRM_Core_Permission::checkActionPermission('CiviEvent', CRM_Core_Action::DELETE)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     parent::preProcess();
     foreach ($this->_participantIds as $participantId) {
         if (CRM_Event_BAO_Participant::isPrimaryParticipant($participantId)) {
             $this->assign('additionalParticipants', TRUE);
         }
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:19,代码来源:Delete.php

示例13: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     parent::preProcess();
     //check for delete
     if (!CRM_Core_Permission::checkActionPermission('CiviEvent', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     if ($this->_isTemplate) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'template_title');
     } else {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title');
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:19,代码来源:Delete.php

示例14: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     //Check if there are contributions related to Contribution Page
     parent::preProcess();
     //check for delete
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $dao = new CRM_Contribute_DAO_Contribution();
     $dao->contribution_page_id = $this->_id;
     if ($dao->find(TRUE)) {
         $this->_relatedContributions = TRUE;
         $this->assign('relatedContributions', TRUE);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:21,代码来源:Delete.php

示例15: preProcess

 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  *
  * @return void
  * @access public
  *
  */
 function preProcess()
 {
     $this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
     // check for action permissions.
     if (!CRM_Core_Permission::checkActionPermission('CiviMail', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     require_once 'CRM/Mailing/BAO/Mailing.php';
     $mailing = new CRM_Mailing_BAO_Mailing();
     $mailing->id = $this->_mailingId;
     if ($mailing->find(true)) {
         $this->assign('subject', $mailing->subject);
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:23,代码来源:Browse.php


注:本文中的CRM_Core_Permission::checkActionPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。