本文整理汇总了PHP中CRM_PCP_BAO_PCP::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_PCP_BAO_PCP::getStatus方法的具体用法?PHP CRM_PCP_BAO_PCP::getStatus怎么用?PHP CRM_PCP_BAO_PCP::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_PCP_BAO_PCP
的用法示例。
在下文中一共展示了CRM_PCP_BAO_PCP::getStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
*
* @return void
*/
public function run()
{
$session = CRM_Core_Session::singleton();
$config = CRM_Core_Config::singleton();
$permissionCheck = FALSE;
$statusMessage = '';
if ($config->userFramework != 'Joomla') {
$permissionCheck = CRM_Core_Permission::check('administer CiviCRM');
}
//get the pcp id.
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
$prms = array('id' => $this->_id);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
$this->_component = $pcpInfo['page_type'];
if (empty($pcpInfo)) {
$statusMessage = ts('The personal campaign page you requested is currently unavailable.');
CRM_Core_Error::statusBounce($statusMessage, $config->userFrameworkBaseURL);
}
CRM_Utils_System::setTitle($pcpInfo['title']);
$this->assign('pcp', $pcpInfo);
$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
$approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
// check if PCP is created by anonymous user
$anonymousPCP = CRM_Utils_Request::retrieve('ap', 'Boolean', $this);
if ($anonymousPCP) {
$loginURL = $config->userSystem->getLoginURL();
$anonMessage = ts('Once you\'ve received your new account welcome email, you can <a href=%1>click here</a> to login and promote your campaign page.', array(1 => $loginURL));
CRM_Core_Session::setStatus($anonMessage, ts('Success'), 'success');
} else {
$statusMessage = ts('The personal campaign page you requested is currently unavailable. However you can still support the campaign by making a contribution here.');
}
$pcpBlock = new CRM_PCP_DAO_PCPBlock();
$pcpBlock->entity_table = CRM_PCP_BAO_PCP::getPcpEntityTable($pcpInfo['page_type']);
$pcpBlock->entity_id = $pcpInfo['page_id'];
$pcpBlock->find(TRUE);
// Redirect back to source page in case of error.
if ($pcpInfo['page_type'] == 'contribute') {
$urlBase = 'civicrm/contribute/transact';
} elseif ($pcpInfo['page_type'] == 'event') {
$urlBase = 'civicrm/event/register';
}
if ($pcpInfo['status_id'] != $approvedId || !$pcpInfo['is_active']) {
if ($pcpInfo['contact_id'] != $session->get('userID') && !$permissionCheck) {
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url($urlBase, "reset=1&id=" . $pcpInfo['page_id'], FALSE, NULL, FALSE, TRUE));
}
} else {
$getStatus = CRM_PCP_BAO_PCP::getStatus($this->_id, $this->_component);
if (!$getStatus) {
// PCP not enabled for this contribution page. Forward everyone to source page
CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url($urlBase, "reset=1&id=" . $pcpInfo['page_id'], FALSE, NULL, FALSE, TRUE));
}
}
$default = array();
if ($pcpBlock->target_entity_type == 'contribute') {
$urlBase = 'civicrm/contribute/transact';
} elseif ($pcpBlock->target_entity_type == 'event') {
$urlBase = 'civicrm/event/register';
}
if ($pcpBlock->entity_table == 'civicrm_event') {
$page_class = 'CRM_Event_DAO_Event';
$this->assign('pageName', CRM_Event_PseudoConstant::event($pcpInfo['page_id']));
CRM_Core_DAO::commonRetrieveAll($page_class, 'id', $pcpInfo['page_id'], $default, array('start_date', 'end_date', 'registration_start_date', 'registration_end_date'));
} elseif ($pcpBlock->entity_table == 'civicrm_contribution_page') {
$page_class = 'CRM_Contribute_DAO_ContributionPage';
$this->assign('pageName', CRM_Contribute_PseudoConstant::contributionPage($pcpInfo['page_id'], TRUE));
CRM_Core_DAO::commonRetrieveAll($page_class, 'id', $pcpInfo['page_id'], $default, array('start_date', 'end_date'));
}
$pageInfo = $default[$pcpInfo['page_id']];
if ($pcpInfo['contact_id'] == $session->get('userID')) {
$owner = $pageInfo;
$owner['status'] = CRM_Utils_Array::value($pcpInfo['status_id'], $pcpStatus);
$this->assign('owner', $owner);
$link = CRM_PCP_BAO_PCP::pcpLinks();
$hints = array(CRM_Core_Action::UPDATE => ts('Change the content and appearance of your page'), CRM_Core_Action::DETACH => ts('Send emails inviting your friends to support your campaign!'), CRM_Core_Action::VIEW => ts('Copy this link to share directly with your network!'), CRM_Core_Action::BROWSE => ts('Update your personal contact information'), CRM_Core_Action::DISABLE => ts('De-activate the page (you can re-activate it later)'), CRM_Core_Action::ENABLE => ts('Activate the page (you can de-activate it later)'), CRM_Core_Action::DELETE => ts('Remove the page (this cannot be undone!)'));
$replace = array('id' => $this->_id, 'block' => $pcpBlock->id, 'pageComponent' => $this->_component);
if (!$pcpBlock->is_tellfriend_enabled || CRM_Utils_Array::value('status_id', $pcpInfo) != $approvedId) {
unset($link['all'][CRM_Core_Action::DETACH]);
}
switch ($pcpInfo['is_active']) {
case 1:
unset($link['all'][CRM_Core_Action::ENABLE]);
break;
case 0:
unset($link['all'][CRM_Core_Action::DISABLE]);
break;
}
$this->assign('links', $link['all']);
$this->assign('hints', $hints);
$this->assign('replace', $replace);
}
//.........这里部分代码省略.........