本文整理汇总了PHP中CRM_Price_BAO_PriceField::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_PriceField::getTitle方法的具体用法?PHP CRM_Price_BAO_PriceField::getTitle怎么用?PHP CRM_Price_BAO_PriceField::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_PriceField
的用法示例。
在下文中一共展示了CRM_Price_BAO_PriceField::getTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
*
* @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_PriceSet::checkPermission($this->_sid);
$this->_isSetReserved = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $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_PriceField::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_PriceField', $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();
}
示例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()
{
// 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_PriceSet::getUsedBy($this->_sid);
$this->assign('usedBy', $usedBy);
$this->_isSetReserved = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'is_reserved');
$this->assign('isReserved', $this->_isSetReserved);
CRM_Price_BAO_PriceSet::checkPermission($this->_sid);
$comps = array('Event' => 'civicrm_event', 'Contribution' => 'civicrm_contribution_page', 'EventTemplate' => 'civicrm_event_template');
$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_PriceField::getTitle($fid));
}
}
if ($this->_sid) {
$groupTitle = CRM_Price_BAO_PriceSet::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();
}