本文整理汇总了PHP中CRM_Utils_System::civiExit方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::civiExit方法的具体用法?PHP CRM_Utils_System::civiExit怎么用?PHP CRM_Utils_System::civiExit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::civiExit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Process a webhook request from Mailchimp.
*
* The only documentation for this *sigh* is (May 2016) at
* https://apidocs.mailchimp.com/webhooks/
*/
public function run()
{
CRM_Mailchimp_Utils::checkDebug("Webhook POST: " . serialize($_POST));
// Empty response object, default response code.
try {
$expected_key = CRM_Core_BAO_Setting::getItem(self::MC_SETTING_GROUP, 'security_key', NULL, FALSE);
$given_key = isset($_GET['key']) ? $_GET['key'] : null;
list($response_code, $response_object) = $this->processRequest($expected_key, $given_key, $_POST);
CRM_Mailchimp_Utils::checkDebug("Webhook response code {$response_code} (200 = ok)");
} catch (RuntimeException $e) {
$response_code = $e->getCode();
$response_object = NULL;
CRM_Mailchimp_Utils::checkDebug("Webhook RuntimeException code {$response_code} (200 means OK): " . $e->getMessage());
} catch (Exception $e) {
// Broad catch.
$response_code = 500;
$response_object = NULL;
CRM_Mailchimp_Utils::checkDebug("Webhook " . get_class($e) . ": " . $e->getMessage());
}
// Serve HTTP response.
if ($response_code != 200) {
// Some fault.
header("HTTP/1.1 {$response_code}");
} else {
// Return the JSON output
header('Content-type: application/json');
print json_encode($response_object);
}
CRM_Utils_System::civiExit();
}
示例2: pledgeName
/**
* Function for building Pledge Name combo box
*/
function pledgeName(&$config)
{
$getRecords = FALSE;
if (isset($_GET['name']) && $_GET['name']) {
$name = CRM_Utils_Type::escape($_GET['name'], 'String');
$name = str_replace('*', '%', $name);
$whereClause = "p.creator_pledge_desc LIKE '%{$name}%' ";
$getRecords = TRUE;
}
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$pledgeId = CRM_Utils_Type::escape($_GET['id'], 'Integer');
$whereClause = "p.id = {$pledgeId} ";
$getRecords = TRUE;
}
if ($getRecords) {
$query = "\nSELECT p.creator_pledge_desc, p.id\nFROM civicrm_pb_pledge p\nWHERE {$whereClause}\n";
$dao = CRM_Core_DAO::executeQuery($query);
$elements = array();
while ($dao->fetch()) {
$elements[] = array('name' => $dao->creator_pledge_desc, 'value' => $dao->id);
}
}
if (empty($elements)) {
$name = $_GET['name'];
if (!$name && isset($_GET['id'])) {
$name = $_GET['id'];
}
$elements[] = array('name' => trim($name, '*'), 'value' => trim($name, '*'));
}
echo CRM_Utils_JSON::encode($elements, 'value');
CRM_Utils_System::civiExit();
}
示例3: getBatchList
/**
* Retrieve records.
*/
public static function getBatchList()
{
$sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
$params = $_REQUEST;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
if ($context != 'financialBatch') {
// data entry status batches
$params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
}
$params['context'] = $context;
// get batch list
$batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
$iFilteredTotal = $iTotal = $params['total'];
if ($context == 'financialBatch') {
$selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
} else {
$selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
}
CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
示例4: getImageProp
static function getImageProp()
{
$img = $_GET['img'];
list($w, $h) = CRM_Badge_BAO_Badge::getImageProperties($img);
echo json_encode(array('width' => $w, 'height' => $h));
CRM_Utils_System::civiExit();
}
示例5: preProcess
function preProcess()
{
if (!CRM_Core_Permission::check('access custom search form')) {
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
}
示例6: run
public function run()
{
/**
* @var \Civi\Angular\Manager $angular
*/
//Use our manager instead of the one provided by core
$angular = new Civi\Angular\VolunteerManager(\CRM_Core_Resources::singleton());
$moduleNames = $this->parseModuleNames(\CRM_Utils_Request::retrieve('modules', 'String'), $angular);
switch (\CRM_Utils_Request::retrieve('format', 'String')) {
case 'json':
case '':
$this->send('application/javascript', json_encode($this->getMetadata($moduleNames, $angular)));
break;
case 'js':
$digest = $this->digestJs($angular->getResources($moduleNames, 'js', 'path'));
//Tell crmResource to use our ajax end-point
$digest = str_replace("ajax/angular-modules", "ajax/volunteer-angular-modules", $digest);
$this->send('application/javascript', $digest);
break;
case 'css':
$this->send('text/css', \CRM_Utils_File::concat($angular->getResources($moduleNames, 'css', 'path'), "\n"));
break;
default:
\CRM_Core_Error::fatal("Unrecognized format");
}
\CRM_Utils_System::civiExit();
}
示例7: getContactMailings
/**
* Function to retrieve contact mailings
*/
public static function getContactMailings()
{
$contactID = CRM_Utils_Type::escape($_GET['contact_id'], 'Integer');
$sortMapper = array(0 => 'subject', 1 => 'creator_name', 2 => '', 3 => 'start_date', 4 => '', 5 => 'links');
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
$params['contact_id'] = $contactID;
$params['context'] = $context;
// get the contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailingSelector($params);
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array('subject', 'mailing_creator', 'recipients', 'start_date', 'openstats', 'links');
header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($mailings, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
示例8: run
function run()
{
$json = array();
// get action
$data = json_decode(file_get_contents("php://input"));
// switch
switch ($data->action) {
case 'views':
// variables
$view_array = views_get_all_views($reset = FALSE);
// build array for each view and their display
foreach ($view_array as $view => $v) {
foreach ($view_array[$view]->display as $display => $d) {
$arr = array('id' => "{$v->name}:{$display}", 'name' => "{$v->human_name} ({$d->display_title})");
$json[] = $arr;
}
}
break;
case 'settings':
// variables
// log
$settings = CRM_Core_BAO_Setting::getItem('windowsill', 'settings');
$json = json_decode(utf8_decode($settings), true);
break;
}
// return JSON
// http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension
// http://civicrm.stackexchange.com/questions/2348/how-to-display-a-drupal-view-in-a-civicrm-tab
print json_encode($json, JSON_PRETTY_PRINT);
// exit
CRM_Utils_System::civiExit();
}
示例9: postProcess
public function postProcess()
{
$params = $this->_submitValues;
$batchDetailsSql = " UPDATE civicrm_batch SET ";
$batchDetailsSql .= " title = %1 ";
$batchDetailsSql .= " , description = %2 ";
$batchDetailsSql .= " , banking_account = %3 ";
$batchDetailsSql .= " , banking_date = %4 ";
$batchDetailsSql .= " , exclude_from_posting = %5 ";
$batchDetailsSql .= " , contribution_type_id = %6 ";
$batchDetailsSql .= " , payment_instrument_id = %7 ";
$batchDetailsSql .= " WHERE id = %8 ";
$bankingDate = CRM_Utils_Date::processDate($params['banking_date']);
$sqlParams = array();
$sqlParams[1] = array((string) $params['batch_title'], 'String');
$sqlParams[2] = array((string) $params['description'], 'String');
$sqlParams[3] = array((string) $params['banking_account'], 'String');
$sqlParams[4] = array((string) $bankingDate, 'String');
$sqlParams[5] = array((string) $params['exclude_from_posting'], 'String');
$sqlParams[6] = array((string) $params['contribution_type_id'], 'String');
$sqlParams[7] = array((string) $params['payment_instrument_id'], 'String');
$sqlParams[8] = array((int) $params['id'], 'Integer');
CRM_Core_DAO::executeQuery($batchDetailsSql, $sqlParams);
drupal_goto('civicrm/batch/process', array('query' => array('bid' => $params['id'], 'reset' => '1')));
CRM_Utils_System::civiExit();
}
示例10: remove_participant_from_cart
public function remove_participant_from_cart()
{
$id = CRM_Utils_Request::retrieve('id', 'Integer');
$participant = CRM_Event_Cart_BAO_MerParticipant::get_by_id($id);
$participant->delete();
CRM_Utils_System::civiExit();
}
示例11: getMemberTypeDefaults
/**
* Function to setDefaults according to membership type
*/
function getMemberTypeDefaults($config)
{
if (!$_POST['mtype']) {
$details['name'] = '';
$details['auto_renew'] = '';
$details['total_amount'] = '';
echo json_encode($details);
CRM_Utils_System::civiExit();
}
$memType = CRM_Utils_Type::escape($_POST['mtype'], 'Integer');
$query = "SELECT name, minimum_fee AS total_amount, financial_type_id, auto_renew\nFROM civicrm_membership_type\nWHERE id = %1";
$dao = CRM_Core_DAO::executeQuery($query, array(1 => array($memType, 'Positive')));
$properties = array('financial_type_id', 'total_amount', 'name', 'auto_renew');
while ($dao->fetch()) {
foreach ($properties as $property) {
$details[$property] = $dao->{$property};
}
}
$details['total_amount_numeric'] = $details['total_amount'];
// fix the display of the monetary value, CRM-4038
$details['total_amount'] = CRM_Utils_Money::format($details['total_amount'], NULL, '%a');
$options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required '));
$details['auto_renew'] = CRM_Utils_Array::value('auto_renew', $options[$details]);
echo json_encode($details);
CRM_Utils_System::civiExit();
}
示例12: checkIsMultiRecord
/**
* Function the check whether the field belongs
* to multi-record custom set
*/
function checkIsMultiRecord()
{
$customId = $_GET['customId'];
$isMultiple = CRM_Core_BAO_CustomField::isMultiRecordField($customId);
$isMultiple = array('is_multi' => $isMultiple);
echo json_encode($isMultiple);
CRM_Utils_System::civiExit();
}
示例13: getTeamList
/**
* Get list of teams.
*
* @return array
*/
public static function getTeamList()
{
$params = $_REQUEST;
if (isset($params['parent_id'])) {
// requesting child groups for a given parent
$params['page'] = 1;
$params['rp'] = 0;
$groups = self::getTeamListSelector($params);
CRM_Utils_JSON::output($groups);
} else {
$sortMapper = array(0 => 'groups.title', 1 => 'count', 2 => 'createdBy.sort_name', 3 => '', 4 => 'groups.group_type', 5 => 'groups.visibility');
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
$params['group_type'] = teamGroupType();
// restrict to teams logged in user may access
$contact = billing_contact_get();
//@todo remove for admin
if (!CRM_Core_Permission::check('edit all contacts')) {
$params['created_by'] = $contact['sort_name'];
}
// get team list
$groups = self::getTeamListSelector($params);
// if no groups found with parent-child hierarchy and logged in user say can view child groups only (an ACL case),
// go ahead with flat hierarchy
if (empty($groups)) {
$groupsAccessible = CRM_Core_PseudoConstant::group();
$parentsOnly = CRM_Utils_Array::value('parentsOnly', $params);
if (!empty($groupsAccessible) && $parentsOnly) {
// recompute group list with flat hierarchy
$params['parentsOnly'] = 0;
$groups = self::getTeamListSelector($params);
}
}
$iFilteredTotal = $iTotal = count($groups);
//$params['total'];
$selectorElements = array('group_name', 'count', 'created_by', 'group_description', 'group_type', 'visibility', 'org_info', 'links', 'class');
if (empty($params['showOrgInfo'])) {
unset($selectorElements[6]);
}
//add setting so this can be tested by unit test
//@todo - ideally the portion of this that retrieves the groups should be extracted into a function separate
// from the one which deals with web inputs & outputs so we have a properly testable & re-usable function
if (!empty($params['is_unit_test'])) {
return array($groups, $iFilteredTotal);
}
header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($groups, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
}
示例14: getNavigationMenu
public static function getNavigationMenu()
{
$contactID = CRM_Core_Session::singleton()->get('userID');
if ($contactID) {
CRM_Core_Page_AJAX::setJsHeaders();
print CRM_Core_Smarty::singleton()->fetchWith('CRM/Menufontawesome/Page/navigation.js.tpl', array('navigation' => CRM_Menufontawesome_BAO_Navigation::createNavigation($contactID)));
}
CRM_Utils_System::civiExit();
}
示例15: deleteQrCode
static function deleteQrCode()
{
$id = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullArray);
if ($id) {
CRM_Core_DAO::executeQuery('DELETE FROM civicrm_qrcode_settings WHERE id = %1', array(1 => array($id, 'Integer')));
echo 'deleted';
}
CRM_Utils_System::civiExit();
}