本文整理汇总了PHP中CRM_Core_BAO_ActionSchedule::isConfigured方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_ActionSchedule::isConfigured方法的具体用法?PHP CRM_Core_BAO_ActionSchedule::isConfigured怎么用?PHP CRM_Core_BAO_ActionSchedule::isConfigured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_ActionSchedule
的用法示例。
在下文中一共展示了CRM_Core_BAO_ActionSchedule::isConfigured方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventSummary
//.........这里部分代码省略.........
case 'is_public':
if ($dao->{$name}) {
$set = 'Yes';
} else {
$set = 'No';
}
$eventSummary['events'][$dao->id][$property] = $set;
break;
case 'is_map':
if ($dao->{$name} && $config->mapAPIKey) {
$values = array();
$ids = array();
$params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event');
$values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
if (is_numeric(CRM_Utils_Array::value('geo_code_1', $values['location']['address'][1])) || $config->mapGeoCoding && !empty($values['location']['address'][1]['city']) && !empty($values['location']['address'][1]['state_province_id'])) {
$set = CRM_Utils_System::url('civicrm/contact/map/event', "reset=1&eid={$dao->id}");
}
}
$eventSummary['events'][$dao->id][$property] = $set;
if (in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
$eventSummary['events'][$dao->id]['configure'] = CRM_Utils_System::url('civicrm/admin/event', "action=update&id={$dao->id}&reset=1");
}
break;
case 'end_date':
case 'start_date':
$eventSummary['events'][$dao->id][$property] = CRM_Utils_Date::customFormat($dao->{$name}, NULL, array('d'));
break;
case 'participants':
case 'notCountedDueToRole':
case 'notCountedDueToStatus':
case 'notCountedParticipants':
$set = NULL;
$propertyCnt = 0;
if ($name == 'participants') {
$propertyCnt = self::getParticipantCount($dao->id);
if ($propertyCnt) {
$set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=true&role=true");
}
} elseif ($name == 'notCountedParticipants') {
$propertyCnt = self::getParticipantCount($dao->id, TRUE, FALSE, TRUE, FALSE);
if ($propertyCnt) {
// FIXME : selector fail to search w/ OR operator.
// $set = CRM_Utils_System::url( 'civicrm/event/search',
// "reset=1&force=1&event=$dao->id&status=false&role=false" );
}
} elseif ($name == 'notCountedDueToStatus') {
$propertyCnt = self::getParticipantCount($dao->id, TRUE, FALSE, FALSE, FALSE);
if ($propertyCnt) {
$set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=false");
}
} else {
$propertyCnt = self::getParticipantCount($dao->id, FALSE, FALSE, TRUE, FALSE);
if ($propertyCnt) {
$set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&role=false");
}
}
$eventSummary['events'][$dao->id][$property] = $propertyCnt;
$eventSummary['events'][$dao->id][$name . '_url'] = $set;
break;
default:
$eventSummary['events'][$dao->id][$property] = $dao->{$name};
break;
}
}
// prepare the area for per-status participant counts
$statusClasses = array('Positive', 'Pending', 'Waiting', 'Negative');
$eventSummary['events'][$dao->id]['statuses'] = array_fill_keys($statusClasses, array());
$eventSummary['events'][$dao->id]['friend'] = $dao->is_friend_active;
$eventSummary['events'][$dao->id]['is_monetary'] = $dao->is_monetary;
$eventSummary['events'][$dao->id]['is_online_registration'] = $dao->is_online_registration;
$eventSummary['events'][$dao->id]['is_show_location'] = $dao->is_show_location;
$eventSummary['events'][$dao->id]['is_subevent'] = $dao->slot_label_id;
$eventSummary['events'][$dao->id]['is_pcp_enabled'] = $dao->is_pcp_enabled;
$eventSummary['events'][$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mappingID);
$statusTypes = CRM_Event_PseudoConstant::participantStatus();
foreach ($statusValues as $statusId => $statusValue) {
if (!array_key_exists($statusId, $statusTypes)) {
continue;
}
$class = $statusValue['class'];
$statusCount = self::eventTotalSeats($dao->id, "( participant.status_id = {$statusId} )");
if ($statusCount) {
$urlString = "reset=1&force=1&event={$dao->id}&status={$statusId}";
$statusInfo = array('url' => CRM_Utils_System::url('civicrm/event/search', $urlString), 'name' => $statusValue['name'], 'label' => $statusValue['label'], 'count' => $statusCount);
$eventSummary['events'][$dao->id]['statuses'][$class][] = $statusInfo;
}
}
}
$countedRoles = CRM_Event_PseudoConstant::participantRole(NULL, 'filter = 1');
$nonCountedRoles = CRM_Event_PseudoConstant::participantRole(NULL, '( filter = 0 OR filter IS NULL )');
$countedStatus = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$nonCountedStatus = CRM_Event_PseudoConstant::participantStatus(NULL, '( is_counted = 0 OR is_counted IS NULL )');
$countedStatusANDRoles = array_merge($countedStatus, $countedRoles);
$nonCountedStatusANDRoles = array_merge($nonCountedStatus, $nonCountedRoles);
$eventSummary['nonCountedRoles'] = implode('/', array_values($nonCountedRoles));
$eventSummary['nonCountedStatus'] = implode('/', array_values($nonCountedStatus));
$eventSummary['countedStatusANDRoles'] = implode('/', array_values($countedStatusANDRoles));
$eventSummary['nonCountedStatusANDRoles'] = implode('/', array_values($nonCountedStatusANDRoles));
return $eventSummary;
}
示例2: browse
/**
* Browse all events.
*
* @return void
*/
public function browse()
{
Civi::resources()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
$createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
if (strtolower($this->_sortByCharacter) == 'all' || !empty($_POST)) {
$this->_sortByCharacter = '';
$this->set('sortByCharacter', '');
}
$this->_force = $this->_searchResult = NULL;
$this->search();
$params = array();
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
$whereClause = $this->whereClause($params, FALSE, $this->_force);
$this->pagerAToZ($whereClause, $params);
$params = array();
$whereClause = $this->whereClause($params, TRUE, $this->_force);
// because is_template != 1 would be to simple
$whereClause .= ' AND (is_template = 0 OR is_template IS NULL)';
$this->pager($whereClause, $params);
list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
// get all custom groups sorted by weight
$manageEvent = array();
$query = "\n SELECT *\n FROM civicrm_event\n WHERE {$whereClause}\nORDER BY start_date desc\n LIMIT {$offset}, {$rowCount}";
$dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
$permissions = CRM_Event_BAO_Event::checkPermission();
//get all campaigns.
$allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
// get the list of active event pcps
$eventPCPS = array();
$pcpDao = new CRM_PCP_DAO_PCPBlock();
$pcpDao->entity_table = 'civicrm_event';
$pcpDao->find();
while ($pcpDao->fetch()) {
$eventPCPS[$pcpDao->entity_id] = $pcpDao->entity_id;
}
// check if we're in shopping cart mode for events
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
$this->assign('eventCartEnabled', $enableCart);
$mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
$eventType = CRM_Core_OptionGroup::values('event_type');
while ($dao->fetch()) {
if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
$manageEvent[$dao->id] = array();
$repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($dao->id, 'civicrm_event');
$manageEvent[$dao->id]['repeat'] = '';
if ($repeat) {
$manageEvent[$dao->id]['repeat'] = ts('Repeating (%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
}
CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->links()));
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
if (!in_array($dao->id, $permissions[CRM_Core_Permission::DELETE])) {
$action -= CRM_Core_Action::DELETE;
}
if (!in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
$action -= CRM_Core_Action::UPDATE;
}
$manageEvent[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), TRUE, 'event.manage.list', 'Event', $dao->id);
$params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event', 'is_active' => 1);
$defaults['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
$manageEvent[$dao->id]['friend'] = CRM_Friend_BAO_Friend::getValues($params);
if (isset($defaults['location']['address'][1]['city'])) {
$manageEvent[$dao->id]['city'] = $defaults['location']['address'][1]['city'];
}
if (isset($defaults['location']['address'][1]['state_province_id'])) {
$manageEvent[$dao->id]['state_province'] = CRM_Core_PseudoConstant::stateProvince($defaults['location']['address'][1]['state_province_id']);
}
//show campaigns on selector.
$manageEvent[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
$manageEvent[$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mapping->getId());
$manageEvent[$dao->id]['is_pcp_enabled'] = CRM_Utils_Array::value($dao->id, $eventPCPS);
$manageEvent[$dao->id]['event_type'] = CRM_Utils_Array::value($manageEvent[$dao->id]['event_type_id'], $eventType);
$manageEvent[$dao->id]['is_repeating_event'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_RecurringEntity', $dao->id, 'parent_id', 'entity_id');
// allow hooks to set 'field' value which allows configuration pop-up to show a tab as enabled/disabled
CRM_Utils_Hook::tabset('civicrm/event/manage/rows', $manageEvent, array('event_id' => $dao->id));
}
}
$manageEvent['tab'] = self::tabs($enableCart);
$this->assign('rows', $manageEvent);
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0');
$findParticipants['statusCounted'] = implode(', ', array_values($statusTypes));
$findParticipants['statusNotCounted'] = implode(', ', array_values($statusTypesPending));
$this->assign('findParticipants', $findParticipants);
}