本文整理汇总了PHP中CRM_Contribute_PseudoConstant::pcpstatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_PseudoConstant::pcpstatus方法的具体用法?PHP CRM_Contribute_PseudoConstant::pcpstatus怎么用?PHP CRM_Contribute_PseudoConstant::pcpstatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Contribute_PseudoConstant::pcpstatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* Browse all custom data groups.
*
*
* @return void
* @access public
* @static
*/
function browse($action = null)
{
require_once 'CRM/Contact/BAO/GroupNesting.php';
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
if ($this->_sortByCharacter == 1 || !empty($_POST)) {
$this->_sortByCharacter = '';
}
require_once 'CRM/Contribute/PseudoConstant.php';
$status = CRM_Contribute_PseudoConstant::pcpstatus();
$contribution_page = CRM_Contribute_PseudoConstant::contributionPage();
$pcpSummary = $params = array();
$whereClause = null;
if (!empty($_POST)) {
if ($_POST['status_id'] != 0) {
$whereClause = ' AND cp.status_id = %1';
$params['1'] = array($_POST['status_id'], 'Integer');
}
if ($_POST['contibution_page_id'] != 0) {
$whereClause .= ' AND cp.contribution_page_id = %2';
$params['2'] = array($_POST['contibution_page_id'], 'Integer');
}
if ($_POST['status_id'] != 0 || $_POST['contibution_page_id'] != 0) {
$this->set('whereClause', $whereClause);
$this->set('params', $params);
} else {
$this->set('whereClause', null);
$this->set('params', null);
}
}
$approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
//check for delete CRM-4418
require_once 'CRM/Core/Permission.php';
$allowToDelete = CRM_Core_Permission::check('delete in CiviContribute');
$params = $this->get('params') ? $this->get('params') : array();
$title = ' AND cp.title LIKE %3';
$params['3'] = array($this->_sortByCharacter . '%', 'String');
$query = "\n SELECT cp.id as id, contact_id , status_id, cp.title as title, contribution_page_id, start_date, end_date, cp.is_active as active\n FROM civicrm_pcp cp, civicrm_contribution_page cpp\n WHERE cp.contribution_page_id = cpp.id {$title}" . $this->get('whereClause') . " ORDER BY status_id";
$dao = CRM_Core_DAO::executeQuery($query, $params, true, 'CRM_Contribute_DAO_PCP');
while ($dao->fetch()) {
$pcpSummary[$dao->id] = array();
$action = array_sum(array_keys($this->links()));
CRM_Core_DAO::storeValues($dao, $pcpSummary[$dao->id]);
require_once 'CRM/Contact/BAO/Contact.php';
$contact = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
$class = '';
if ($dao->status_id != $approvedId || $dao->active != 1) {
$class = 'disabled';
}
switch ($dao->status_id) {
case 2:
$action -= CRM_Core_Action::RENEW;
break;
case 3:
$action -= CRM_Core_Action::REVERT;
break;
}
if (!$allowToDelete) {
$action -= CRM_Core_Action::DELETE;
}
$pcpSummary[$dao->id]['id'] = $dao->id;
$pcpSummary[$dao->id]['start_date'] = $dao->start_date;
$pcpSummary[$dao->id]['end_date'] = $dao->end_date;
$pcpSummary[$dao->id]['supporter'] = $contact['0'];
$pcpSummary[$dao->id]['supporter_id'] = $dao->contact_id;
$pcpSummary[$dao->id]['status_id'] = $status[$dao->status_id];
$pcpSummary[$dao->id]['contribution_page_id'] = $dao->contribution_page_id;
$pcpSummary[$dao->id]['contribution_page_title'] = $contribution_page[$dao->contribution_page_id];
$pcpSummary[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
$pcpSummary[$dao->id]['class'] = $class;
}
$this->search();
$this->pagerAToZ($this->get('whereClause'), $params);
if ($pcpSummary) {
$this->assign('rows', $pcpSummary);
}
// Let template know if user has run a search or not
if ($this->get('whereClause')) {
$this->assign('isSearch', 1);
} else {
$this->assign('isSearch', 0);
}
}
示例2: buildQuickForm
/**
* Function to actually build the form
*
* @param null
*
* @return void
* @access public
*/
public function buildQuickForm()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Campaign'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
} else {
require_once 'CRM/Contribute/PseudoConstant.php';
$status = array_merge(array(ts('- select -')), CRM_Contribute_PseudoConstant::pcpstatus());
$contribution_page = array_merge(array(ts('- select -')), CRM_Contribute_PseudoConstant::contributionPage());
$this->addElement('select', 'status_id', ts('Personal Campaign Pages Status'), $status);
$this->addElement('select', 'contibution_page_id', ts('Contribution Page'), $contribution_page);
$this->addButtons(array(array('type' => 'refresh', 'name' => ts('Show'), 'spacing' => ' ', 'isDefault' => true)));
parent::buildQuickForm();
}
}