本文整理汇总了PHP中CRM_Price_BAO_Set::checkPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_Set::checkPermission方法的具体用法?PHP CRM_Price_BAO_Set::checkPermission怎么用?PHP CRM_Price_BAO_Set::checkPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_Set
的用法示例。
在下文中一共展示了CRM_Price_BAO_Set::checkPermission方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.
*
* @param null
*
* @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);
$sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this, false, 0);
if ($sid) {
require_once 'CRM/Price/BAO/Set.php';
CRM_Price_BAO_Set::checkPermission($sid);
}
// what action to take ?
if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) {
$this->edit($sid, $action);
} else {
if ($action & CRM_Core_Action::PREVIEW) {
$this->preview($sid);
} else {
if ($action & CRM_Core_Action::COPY) {
$session = CRM_Core_Session::singleton();
CRM_Core_Session::setStatus("A copy of the price set has been created");
$this->copy();
} else {
require_once 'CRM/Price/BAO/Set.php';
require_once 'CRM/Price/BAO/Field.php';
// if action is delete do the needful.
if ($action & CRM_Core_Action::DELETE) {
$usedBy =& CRM_Price_BAO_Set::getUsedBy($sid);
if (empty($usedBy)) {
// prompt to delete
$session =& CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price', 'action=browse'));
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_DeleteSet', 'Delete Price Set', null);
// $id = CRM_Utils_Request::retrieve('sid', 'Positive', $this, false, 0);
$controller->set('sid', $sid);
$controller->setEmbedded(true);
$controller->process();
$controller->run();
} else {
// add breadcrumb
$url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1');
CRM_Utils_System::appendBreadCrumb(ts('Price Sets'), $url);
$this->assign('usedPriceSetTitle', CRM_Price_BAO_Set::getTitle($sid));
$this->assign('usedBy', $usedBy);
$comps = array("Event" => "civicrm_event", "Contribution" => "civicrm_contribution_page");
$priceSetContexts = array();
foreach ($comps as $name => $table) {
if (array_key_exists($table, $usedBy)) {
$priceSetContexts[] = $name;
}
}
$this->assign('contexts', $priceSetContexts);
}
}
// finally browse the price sets
$this->browse();
}
}
}
// parent run
parent::run();
}
示例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.
*
* @param null
*
* @return void
* @access public
*/
function run()
{
require_once 'CRM/Price/BAO/Set.php';
// get the group id
$this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
$fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, false, 0);
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
// default to 'browse'
if ($this->_sid) {
require_once 'CRM/Price/BAO/Set.php';
CRM_Price_BAO_Set::checkPermission($this->_sid);
}
if ($action & CRM_Core_Action::DELETE) {
require_once 'CRM/Price/BAO/Set.php';
$usedBy =& CRM_Price_BAO_Set::getUsedBy($this->_sid);
if (empty($usedBy)) {
// prompt to delete
$session =& CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&action=browse&sid=' . $this->_sid));
$controller =& new CRM_Core_Controller_Simple('CRM_Price_Form_DeleteField', "Delete Price Field", '');
$controller->set('fid', $fid);
$controller->setEmbedded(true);
$controller->process();
$controller->run();
} else {
// add breadcrumb
require_once 'CRM/Price/BAO/Field.php';
$url = CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1');
CRM_Utils_System::appendBreadCrumb(ts('Price'), $url);
$this->assign('usedPriceSetTitle', CRM_Price_BAO_Field::getTitle($fid));
$this->assign('usedBy', $usedBy);
$comps = array("Event" => "civicrm_event", "Contribution" => "civicrm_contribution_page");
$priceSetContexts = array();
foreach ($comps as $name => $table) {
if (array_key_exists($table, $usedBy)) {
$priceSetContexts[] = $name;
}
}
$this->assign('contexts', $priceSetContexts);
}
}
if ($this->_sid) {
$groupTitle = CRM_Price_BAO_Set::getTitle($this->_sid);
$this->assign('sid', $this->_sid);
$this->assign('groupTitle', $groupTitle);
CRM_Utils_System::setTitle(ts('%1 - Price Fields', array(1 => $groupTitle)));
}
// assign vars to templates
$this->assign('action', $action);
// what action to take ?
if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) {
$this->edit($action);
// no browse for edit/update/view
} else {
if ($action & CRM_Core_Action::PREVIEW) {
$this->preview($fid);
} else {
require_once 'CRM/Price/BAO/Field.php';
$this->browse();
}
}
// Call the parents run method
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.
*
* @param null
*
* @return void
* @access public
*/
function run()
{
// get the field id
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE, 0);
//get the price set id
if (!$this->_sid) {
$this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
}
if ($this->_sid) {
CRM_Price_BAO_Set::checkPermission($this->_sid);
$this->_isSetReserved = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'is_reserved');
$this->assign('isReserved', $this->_isSetReserved);
}
//as url contain $sid so append breadcrumb dynamically.
$breadcrumb = array(array('title' => ts('Price Fields'), 'url' => CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&sid=' . $this->_sid)));
CRM_Utils_System::appendBreadCrumb($breadcrumb);
if ($this->_fid) {
$fieldTitle = CRM_Price_BAO_Field::getTitle($this->_fid);
$this->assign('fid', $this->_fid);
$this->assign('fieldTitle', $fieldTitle);
CRM_Utils_System::setTitle(ts('%1 - Price Options', array(1 => $fieldTitle)));
$htmlType = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Field', $this->_fid, 'html_type');
$this->assign('addMoreFields', TRUE);
//for text price field only single option present
if ($htmlType == 'Text') {
$this->assign('addMoreFields', FALSE);
}
}
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
// assign vars to templates
$this->assign('action', $action);
$oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, FALSE, 0);
// what action to take ?
if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::VIEW | CRM_Core_Action::DELETE) && !$this->_isSetReserved) {
// no browse for edit/update/view
$this->edit($action);
} else {
$this->browse();
}
// Call the parents run method
return parent::run();
}
示例4: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
*
* @param null
*
* @return void
* @access public
*/
function run()
{
// get the group id
$this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
$fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE, 0);
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
if ($this->_sid) {
$usedBy = CRM_Price_BAO_Set::getUsedBy($this->_sid);
$this->assign('usedBy', $usedBy);
$this->_isSetReserved = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'is_reserved');
$this->assign('isReserved', $this->_isSetReserved);
CRM_Price_BAO_Set::checkPermission($this->_sid);
$comps = array('Event' => 'civicrm_event', 'Contribution' => 'civicrm_contribution_page');
$priceSetContexts = array();
foreach ($comps as $name => $table) {
if (array_key_exists($table, $usedBy)) {
$priceSetContexts[] = $name;
}
}
$this->assign('contexts', $priceSetContexts);
}
if ($action & CRM_Core_Action::DELETE && !$this->_isSetReserved) {
if (empty($usedBy)) {
// prompt to delete
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&action=browse&sid=' . $this->_sid));
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_DeleteField', 'Delete Price Field', '');
$controller->set('fid', $fid);
$controller->setEmbedded(TRUE);
$controller->process();
$controller->run();
} else {
// add breadcrumb
$url = CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1');
CRM_Utils_System::appendBreadCrumb(ts('Price'), $url);
$this->assign('usedPriceSetTitle', CRM_Price_BAO_Field::getTitle($fid));
}
}
if ($this->_sid) {
$groupTitle = CRM_Price_BAO_Set::getTitle($this->_sid);
$this->assign('sid', $this->_sid);
$this->assign('groupTitle', $groupTitle);
CRM_Utils_System::setTitle(ts('%1 - Price Fields', array(1 => $groupTitle)));
}
// assign vars to templates
$this->assign('action', $action);
// what action to take ?
if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD) && !$this->_isSetReserved) {
// no browse for edit/update/view
$this->edit($action);
} elseif ($action & CRM_Core_Action::PREVIEW) {
$this->preview($fid);
} else {
$this->browse();
}
// Call the parents run method
return parent::run();
}