本文整理汇总了PHP中CRM_PCP_BAO_PCP::buildOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_PCP_BAO_PCP::buildOptions方法的具体用法?PHP CRM_PCP_BAO_PCP::buildOptions怎么用?PHP CRM_PCP_BAO_PCP::buildOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_PCP_BAO_PCP
的用法示例。
在下文中一共展示了CRM_PCP_BAO_PCP::buildOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* Browse all custom data groups.
*
*
* @param null $action
*
* @return void
* @access public
* @static
*/
function browse($action = NULL)
{
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
if ($this->_sortByCharacter == 1 || !empty($_POST)) {
$this->_sortByCharacter = '';
}
$status = CRM_PCP_BAO_PCP::buildOptions('status_id', 'create');
$pcpSummary = $params = array();
$whereClause = NULL;
if (!empty($_POST) || !empty($_GET['page_type'])) {
if (!empty($_POST['status_id'])) {
$whereClause = ' AND cp.status_id = %1';
$params['1'] = array($_POST['status_id'], 'Integer');
}
if (!empty($_POST['page_type'])) {
$whereClause .= ' AND cp.page_type = %2';
$params['2'] = array($_POST['page_type'], 'String');
} elseif (!empty($_GET['page_type'])) {
$whereClause .= ' AND cp.page_type = %2';
$params['2'] = array($_GET['page_type'], 'String');
}
if (!empty($_POST['page_id'])) {
$whereClause .= ' AND cp.page_id = %4 AND cp.page_type = "contribute"';
$params['4'] = array($_POST['page_id'], 'Integer');
}
if (!empty($_POST['event_id'])) {
$whereClause .= ' AND cp.page_id = %5 AND cp.page_type = "event"';
$params['5'] = array($_POST['event_id'], 'Integer');
}
if ($whereClause) {
$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
$allowToDelete = CRM_Core_Permission::check('delete in CiviContribute');
// get all contribution pages
$query = "SELECT id, title, start_date, end_date FROM civicrm_contribution_page WHERE (1)";
$cpages = CRM_Core_DAO::executeQuery($query);
while ($cpages->fetch()) {
$pages['contribute'][$cpages->id]['id'] = $cpages->id;
$pages['contribute'][$cpages->id]['title'] = $cpages->title;
$pages['contribute'][$cpages->id]['start_date'] = $cpages->start_date;
$pages['contribute'][$cpages->id]['end_date'] = $cpages->end_date;
}
// get all event pages. pcp campaign start and end dates for event related pcp's use the online registration start and end dates,
// altho if target is contribution page this might not be correct. fixme? dgg
$query = "SELECT id, title, start_date, end_date, registration_start_date, registration_end_date\n FROM civicrm_event\n WHERE is_template IS NULL OR is_template != 1";
$epages = CRM_Core_DAO::executeQuery($query);
while ($epages->fetch()) {
$pages['event'][$epages->id]['id'] = $epages->id;
$pages['event'][$epages->id]['title'] = $epages->title;
$pages['event'][$epages->id]['start_date'] = $epages->registration_start_date;
$pages['event'][$epages->id]['end_date'] = $epages->registration_end_date;
}
$params = $this->get('params') ? $this->get('params') : array();
$title = '1';
if ($this->_sortByCharacter !== NULL) {
$clauses[] = "cp.title LIKE '" . strtolower(CRM_Core_DAO::escapeWildCardString($this->_sortByCharacter)) . "%'";
}
$query = "\n SELECT cp.id, cp.contact_id , cp.status_id, cp.title, cp.is_active, cp.page_type, cp.page_id\n FROM civicrm_pcp cp\n WHERE {$title}" . $this->get('whereClause') . " ORDER BY cp.status_id";
$pcp = CRM_Core_DAO::executeQuery($query, $params);
while ($pcp->fetch()) {
$action = array_sum(array_keys($this->links()));
$contact = CRM_Contact_BAO_Contact::getDisplayAndImage($pcp->contact_id);
$class = '';
if ($pcp->status_id != $approvedId || $pcp->is_active != 1) {
$class = 'disabled';
}
switch ($pcp->status_id) {
case 2:
$action -= CRM_Core_Action::RENEW;
break;
case 3:
$action -= CRM_Core_Action::REVERT;
break;
}
switch ($pcp->is_active) {
case 1:
$action -= CRM_Core_Action::ENABLE;
break;
case 0:
$action -= CRM_Core_Action::DISABLE;
break;
}
if (!$allowToDelete) {
//.........这里部分代码省略.........