• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_Page_AJAX类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CRM_Core_Page_AJAX的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Page_AJAX类的具体用法?PHP CRM_Core_Page_AJAX怎么用?PHP CRM_Core_Page_AJAX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CRM_Core_Page_AJAX类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getGroupList

 /**
  * Get list of groups.
  */
 public static function getGroupList()
 {
     $params = $_GET;
     if (isset($params['parent_id'])) {
         // requesting child groups for a given parent
         $params['page'] = 1;
         $params['rp'] = 0;
         $groups = CRM_Contact_BAO_Group::getGroupListSelector($params);
         CRM_Utils_JSON::output($groups);
     } else {
         $params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
         $optionalParameters = array('parentsOnly' => 'Integer', 'showOrgInfo' => 'Boolean');
         $params += CRM_Core_Page_AJAX::validateParams(array(), $optionalParameters);
         // get group list
         $groups = CRM_Contact_BAO_Group::getGroupListSelector($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, CRM-12225
         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 = CRM_Contact_BAO_Group::getGroupListSelector($params);
             }
         }
         CRM_Utils_JSON::output($groups);
     }
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:32,代码来源:AJAX.php


示例2: getContactList

 /**
  * @deprecated
  */
 static function getContactList()
 {
     // if context is 'customfield'
     if (CRM_Utils_Array::value('context', $_GET) == 'customfield') {
         return self::contactReference();
     }
     $params = array('version' => 3, 'check_permissions' => TRUE);
     // String params
     // FIXME: param keys don't match input keys, using this array to translate
     $whitelist = array('s' => 'name', 'fieldName' => 'field_name', 'tableName' => 'table_name', 'context' => 'context', 'rel' => 'rel', 'contact_sub_type' => 'contact_sub_type', 'contact_type' => 'contact_type');
     foreach ($whitelist as $key => $param) {
         if (!empty($_GET[$key])) {
             $params[$param] = $_GET[$key];
         }
     }
     //CRM-10687: Allow quicksearch by multiple fields
     if (!empty($params['field_name'])) {
         if ($params['field_name'] == 'phone_numeric') {
             $params['name'] = preg_replace('/[^\\d]/', '', $params['name']);
         }
         if (!$params['name']) {
             CRM_Utils_System::civiExit();
         }
     }
     // Numeric params
     $whitelist = array('limit', 'org', 'employee_id', 'cid', 'id', 'cmsuser');
     foreach ($whitelist as $key) {
         if (!empty($_GET[$key]) && is_numeric($_GET[$key])) {
             $params[$key] = $_GET[$key];
         }
     }
     $result = civicrm_api('Contact', 'getquick', $params);
     CRM_Core_Page_AJAX::autocompleteResults(CRM_Utils_Array::value('values', $result), 'data');
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:37,代码来源:AJAX.php


示例3: getContactMailings

 /**
  * Retrieve contact mailings.
  */
 public static function getContactMailings()
 {
     $params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
     $params += CRM_Core_Page_AJAX::validateParams(array('contact_id' => 'Integer'));
     // get the contact mailings
     $mailings = CRM_Mailing_BAO_Mailing::getContactMailingSelector($params);
     CRM_Utils_JSON::output($mailings);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:11,代码来源:AJAX.php


示例4: 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();
 }
开发者ID:omarabuhussein,项目名称:com.opetmar.menufontawesome,代码行数:9,代码来源:AJAX.php


示例5: getSoftContributionRows

 /**
  * Get Soft credit to list in DT
  */
 public static function getSoftContributionRows()
 {
     $requiredParameters = array('cid' => 'Integer', 'context' => 'String');
     $optionalParameters = array('entityID' => 'Integer', 'isTest' => 'Integer');
     $params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
     $params += CRM_Core_Page_AJAX::validateParams($requiredParameters, $optionalParameters);
     $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionSelector($params);
     if (!empty($_GET['is_unit_test'])) {
         return $softCreditList;
     }
     CRM_Utils_JSON::output($softCreditList);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:15,代码来源:AJAX.php


示例6: testCheckAuthz

 public function testCheckAuthz()
 {
     $cases = array();
     $cases[] = array('method', 'CRM_Foo', FALSE, 'method');
     $cases[] = array('method', 'CRM_Foo_Page_AJAX_Bar', FALSE, 'method');
     $cases[] = array('method', 'CRM_Contact_Page_AJAX', TRUE, 'getAddressDisplay');
     $cases[] = array('method', 'CRM_Foo_Page_AJAX', FALSE, 'method(');
     $cases[] = array('method', 'CRM_Foo_Page_AJAX', FALSE, 'method()');
     $cases[] = array('method', 'othermethod;CRM_Foo_Page_AJAX', FALSE, 'method');
     $cases[] = array('method', 'CRM_Foo_Page_AJAX;othermethod', FALSE, 'method');
     $cases[] = array('method', 'CRM_Foo_Page_Inline_Bar', FALSE, '');
     $cases[] = array('method', 'CRM_Foo_Page_Inline_Bar', FALSE, 'method');
     $cases[] = array('method', 'CRM_Foo->method', FALSE);
     $cases[] = array('page', 'CRM_Foo', FALSE);
     $cases[] = array('page', 'CRM_Foo_Bar', FALSE);
     $cases[] = array('page', 'CRM_Foo_Page', FALSE);
     $cases[] = array('page', 'CRM_Foo_Page_Bar', FALSE);
     $cases[] = array('page', 'CRM_Foo_Page_Inline', FALSE);
     $cases[] = array('page', 'CRM_Contact_Page_Inline_CommunicationPreferences', TRUE);
     $cases[] = array('page', 'CRM_Foo_Page_Inline_Bar_Bang', FALSE);
     $cases[] = array('page', 'othermethod;CRM_Foo_Page_Inline_Bar', FALSE);
     $cases[] = array('page', 'CRM_Foo_Page_Inline_Bar;othermethod', FALSE);
     $cases[] = array('page', 'CRM_Foo_Form', FALSE);
     $cases[] = array('page', 'CRM_Foo_Form_Bar', FALSE);
     $cases[] = array('page', 'CRM_Foo_Form_Inline', FALSE);
     $cases[] = array('page', 'CRM_Contact_Form_Inline_Email', TRUE);
     $cases[] = array('page', 'CRM_Foo_Form_Inline_Bar_Bang', FALSE);
     $cases[] = array('page', 'othermethod;CRM_Foo_Form_Inline_Bar', FALSE);
     $cases[] = array('page', 'CRM_Foo_Form_Inline_Bar;othermethod', FALSE);
     // aliases for 'page'
     $cases[] = array('class', 'CRM_Foo_Bar', FALSE);
     $cases[] = array('class', 'CRM_Contact_Page_Inline_Phone', TRUE);
     $cases[] = array('', 'CRM_Foo_Bar', FALSE);
     $cases[] = array('', 'CRM_Contact_Page_Inline_Demographics', TRUE);
     // invalid type
     $cases[] = array('invalidtype', 'CRM_Foo_Page_Inline_Bar', FALSE);
     $cases[] = array('invalidtype', 'CRM_Foo_Page_AJAX::method', FALSE);
     foreach ($cases as $case) {
         list($type, $className, $expectedResult) = $case;
         $methodName = CRM_Utils_Array::value(3, $case);
         $actualResult = CRM_Core_Page_AJAX::checkAuthz($type, $className, $methodName);
         if ($methodName) {
             $this->assertEquals($expectedResult, $actualResult, sprintf('Check type=[%s] value=[%s] method=[%s]', $type, $className, $methodName));
         } else {
             $this->assertEquals($expectedResult, $actualResult, sprintf('Check type=[%s] value=[%s]', $type, $className));
         }
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:48,代码来源:AJAXTest.php


示例7: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     parent::preProcess();
     if ($this->_id) {
         $params = array('id' => $this->_id);
         $financialAccount = CRM_Financial_BAO_FinancialAccount::retrieve($params, CRM_Core_DAO::$_nullArray);
         $financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type');
         if ($financialAccount->financial_account_type_id == array_search('Asset', $financialAccountType) && strtolower($financialAccount->account_type_code) == 'ar' && !CRM_Financial_BAO_FinancialAccount::getARAccounts($this->_id, array_search('Asset', $financialAccountType))) {
             $this->_isARFlag = TRUE;
             if ($this->_action & CRM_Core_Action::DELETE) {
                 $msg = ts("The selected financial account cannot be deleted because at least one Accounts Receivable type account is required (to ensure that accounting transactions are in balance).");
                 if (CRM_Utils_Array::value('snippet', $_REQUEST) == 'json') {
                     CRM_Core_Page_AJAX::returnJsonResponse($msg);
                 }
                 CRM_Core_Session::setStatus($msg, '', 'error');
                 CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialAccount', "reset=1&action=browse"));
             }
         }
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:26,代码来源:FinancialAccount.php


示例8: redirect

 /**
  * Redirect to another URL.
  *
  * @param string $url
  *   The URL to provide to the browser via the Location header.
  */
 public static function redirect($url = NULL)
 {
     if (!$url) {
         $url = self::url('civicrm/dashboard', 'reset=1');
     }
     // replace the & characters with &
     // this is kinda hackish but not sure how to do it right
     $url = str_replace('&', '&', $url);
     // If we are in a json context, respond appropriately
     if (CRM_Utils_Array::value('snippet', $_GET) === 'json') {
         CRM_Core_Page_AJAX::returnJsonResponse(array('status' => 'redirect', 'userContext' => $url));
     }
     self::setHttpHeader('Location', $url);
     self::civiExit();
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:21,代码来源:System.php


示例9: renderForm

 /**
  * Render the page using a custom templating system.
  *
  * @param CRM_Core_Form $page
  *   The CRM_Core_Form page.
  */
 public function renderForm(&$page)
 {
     $this->_setRenderTemplates($page);
     $template = CRM_Core_Smarty::singleton();
     $form = $page->toSmarty();
     // Deprecated - use snippet=6 instead of json=1
     $json = CRM_Utils_Request::retrieve('json', 'Boolean', CRM_Core_DAO::$_nullObject);
     if ($json) {
         CRM_Utils_JSON::output($form);
     }
     $template->assign('form', $form);
     $template->assign('isForm', 1);
     $controller =& $page->controller;
     // Stop here if we are in embedded mode. Exception: displaying form errors via ajax
     if ($controller->getEmbedded() && !(!empty($form['errors']) && $controller->_QFResponseType == 'json')) {
         return;
     }
     $template->assign('action', $page->getAction());
     $pageTemplateFile = $page->getHookedTemplateFileName();
     $template->assign('tplFile', $pageTemplateFile);
     $content = $template->fetch($controller->getTemplateFile());
     if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $page->overrideExtraTemplateFileName());
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'form', $pageTemplateFile, $page);
     $print = $controller->getPrint();
     if ($print) {
         $html =& $content;
     } else {
         $html = CRM_Utils_System::theme($content, $print);
     }
     if ($controller->_QFResponseType == 'json') {
         $response = array('content' => $html);
         if (!empty($page->ajaxResponse)) {
             $response += $page->ajaxResponse;
         }
         if (!empty($form['errors'])) {
             $response['status'] = 'form_error';
             $response['errors'] = $form['errors'];
         }
         CRM_Core_Page_AJAX::returnJsonResponse($response);
     }
     if ($print) {
         if ($print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$page->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } else {
             echo $html;
         }
         CRM_Utils_System::civiExit();
     }
     print $html;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:60,代码来源:Display.php


示例10: caseDetails

 /**
  * @throws \CiviCRM_API3_Exception
  */
 public function caseDetails()
 {
     $caseId = CRM_Utils_Type::escape($_GET['caseId'], 'Positive');
     $case = civicrm_api3('Case', 'getsingle', array('id' => $caseId, 'check_permissions' => TRUE, 'return' => array('subject', 'case_type_id', 'status_id', 'start_date', 'end_date')));
     $caseStatuses = CRM_Case_PseudoConstant::caseStatus();
     $caseTypes = CRM_Case_PseudoConstant::caseType('title', FALSE);
     $caseDetails = "<table><tr><td>" . ts('Case Subject') . "</td><td>{$case['subject']}</td></tr>\n                                  <tr><td>" . ts('Case Type') . "</td><td>{$caseTypes[$case['case_type_id']]}</td></tr>\n                                  <tr><td>" . ts('Case Status') . "</td><td>{$caseStatuses[$case['status_id']]}</td></tr>\n                                  <tr><td>" . ts('Case Start Date') . "</td><td>" . CRM_Utils_Date::customFormat($case['start_date']) . "</td></tr>\n                                  <tr><td>" . ts('Case End Date') . "</td><td></td></tr>" . CRM_Utils_Date::customFormat($case['end_date']) . "</table>";
     if (CRM_Utils_Array::value('snippet', $_GET) == 'json') {
         CRM_Core_Page_AJAX::returnJsonResponse($caseDetails);
     }
     echo $caseDetails;
     CRM_Utils_System::civiExit();
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:16,代码来源:AJAX.php


示例11: statusBounce

 /**
  * Set a status message in the session, then bounce back to the referrer.
  *
  * @param string $status
  *   The status message to set.
  *
  * @param null $redirect
  * @param string $title
  * @return void
  */
 public static function statusBounce($status, $redirect = NULL, $title = NULL)
 {
     $session = CRM_Core_Session::singleton();
     if (!$redirect) {
         $redirect = $session->readUserContext();
     }
     if ($title === NULL) {
         $title = ts('Error');
     }
     $session->setStatus($status, $title, 'alert', array('expires' => 0));
     if (CRM_Utils_Array::value('snippet', $_REQUEST) === CRM_Core_Smarty::PRINT_JSON) {
         CRM_Core_Page_AJAX::returnJsonResponse(array('status' => 'error'));
     }
     CRM_Utils_System::redirect($redirect);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:25,代码来源:Error.php


示例12: outputLocalizationJS

 /**
  * Create dynamic script for localizing js widgets.
  */
 public static function outputLocalizationJS()
 {
     CRM_Core_Page_AJAX::setJsHeaders();
     $config = CRM_Core_Config::singleton();
     $vars = array('moneyFormat' => json_encode(CRM_Utils_Money::format(1234.56)), 'contactSearch' => json_encode($config->includeEmailInName ? ts('Start typing a name or email...') : ts('Start typing a name...')), 'otherSearch' => json_encode(ts('Enter search term...')), 'entityRef' => array('contactCreate' => CRM_Core_BAO_UFGroup::getCreateLinks(), 'filters' => self::getEntityRefFilters()), 'ajaxPopupsEnabled' => self::singleton()->ajaxPopupsEnabled);
     print CRM_Core_Smarty::singleton()->fetchWith('CRM/common/l10n.js.tpl', $vars);
     CRM_Utils_System::civiExit();
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:11,代码来源:Resources.php


示例13: getPermissionedEmployer

 /**
  * Function to obtain list of permissioned employer for the given contact-id.
  */
 static function getPermissionedEmployer()
 {
     $cid = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
     $name = trim(CRM_Utils_Type::escape($_GET['s'], 'String'));
     $name = str_replace('*', '%', $name);
     $elements = CRM_Contact_BAO_Relationship::getPermissionedEmployer($cid, $name);
     $results = array();
     if (!empty($elements)) {
         foreach ($elements as $cid => $name) {
             $results[$cid] = $name['name'];
         }
     }
     CRM_Core_Page_AJAX::autocompleteResults($results);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:17,代码来源:AJAX.php


示例14: mainProcess

 /**
  * just a wrapper, so that we can call all the hook functions
  * @param bool $allowAjax
  *   FIXME: This feels kind of hackish, ideally we would take the json-related code from this function.
  *                          and bury it deeper down in the controller
  */
 public function mainProcess($allowAjax = TRUE)
 {
     $this->postProcess();
     $this->postProcessHook();
     // Respond with JSON if in AJAX context (also support legacy value '6')
     if ($allowAjax && !empty($_REQUEST['snippet']) && in_array($_REQUEST['snippet'], array(CRM_Core_Smarty::PRINT_JSON, 6))) {
         $this->ajaxResponse['buttonName'] = str_replace('_qf_' . $this->getAttribute('id') . '_', '', $this->controller->getButtonName());
         $this->ajaxResponse['action'] = $this->_action;
         if (isset($this->_id) || isset($this->id)) {
             $this->ajaxResponse['id'] = isset($this->id) ? $this->id : $this->_id;
         }
         CRM_Core_Page_AJAX::returnJsonResponse($this->ajaxResponse);
     }
 }
开发者ID:hoegrammer,项目名称:civicrm-core,代码行数:20,代码来源:Form.php


示例15: json_encode

| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
/**
 *
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2015
 * $Id$
 */
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
$template = CRM_Core_Smarty::singleton();
require_once 'CRM/Utils/Request.php';
$cpageId = CRM_Utils_Request::retrieve('cpageId', 'Positive', CRM_Core_DAO::$_nullObject);
$widgetId = CRM_Utils_Request::retrieve('widgetId', 'Positive', CRM_Core_DAO::$_nullObject);
$format = CRM_Utils_Request::retrieve('format', 'Positive', CRM_Core_DAO::$_nullObject);
$includePending = CRM_Utils_Request::retrieve('includePending', 'Boolean', CRM_Core_DAO::$_nullObject);
require_once 'CRM/Contribute/BAO/Widget.php';
$jsonvar = 'jsondata';
if (isset($format)) {
    $jsonvar .= $cpageId;
}
$data = CRM_Contribute_BAO_Widget::getContributionPageData($cpageId, $widgetId, $includePending);
$output = '
    var ' . $jsonvar . ' = ' . json_encode($data) . ';
';
CRM_Core_Page_AJAX::setJsHeaders(60);
echo $output;
CRM_Utils_System::civiExit();
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:31,代码来源:widget.php


示例16: caseDetails

 public function caseDetails()
 {
     $caseId = CRM_Utils_Type::escape($_GET['caseId'], 'Positive');
     if (!CRM_Case_BAO_Case::accessCase($caseId, FALSE)) {
         CRM_Utils_System::permissionDenied();
     }
     $sql = "SELECT civicrm_case.*, civicrm_case_type.title as case_type\n        FROM civicrm_case\n        INNER JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id\n        WHERE civicrm_case.id = %1";
     $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($caseId, 'Integer')));
     if ($dao->fetch()) {
         $caseStatuses = CRM_Case_PseudoConstant::caseStatus();
         $cs = $caseStatuses[$dao->status_id];
         $caseDetails = "<table><tr><td>" . ts('Case Subject') . "</td><td>{$dao->subject}</td></tr>\n                                    <tr><td>" . ts('Case Type') . "</td><td>{$dao->case_type}</td></tr>\n                                    <tr><td>" . ts('Case Status') . "</td><td>{$cs}</td></tr>\n                                    <tr><td>" . ts('Case Start Date') . "</td><td>" . CRM_Utils_Date::customFormat($dao->start_date) . "</td></tr>\n                                    <tr><td>" . ts('Case End Date') . "</td><td></td></tr>" . CRM_Utils_Date::customFormat($dao->end_date) . "</table>";
         if (CRM_Utils_Array::value('snippet', $_GET) == 'json') {
             CRM_Core_Page_AJAX::returnJsonResponse($caseDetails);
         } else {
             echo $caseDetails;
         }
     } else {
         CRM_Core_Error::fatal('Could not find valid Case.');
     }
     CRM_Utils_System::civiExit();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:22,代码来源:AJAX.php


示例17: fixOrderOutput

 /**
  * @param $url
  */
 public static function fixOrderOutput($url)
 {
     if (empty($_GET['snippet']) || $_GET['snippet'] !== 'json') {
         CRM_Utils_System::redirect($url);
     }
     CRM_Core_Page_AJAX::returnJsonResponse(array('userContext' => $url));
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:10,代码来源:Weight.php


示例18: getStatusMsg


//.........这里部分代码省略.........
                 } else {
                     $ret['content'] = ts('Are you sure you want to disable \'%1\' Price Set?', array(1 => $priceSet));
                 }
                 break;
             case 'CRM_Event_BAO_Event':
                 $ret['content'] = ts('Are you sure you want to disable this Event?');
                 break;
             case 'CRM_Core_BAO_UFField':
                 $ret['content'] = ts('Are you sure you want to disable this CiviCRM Profile field?');
                 break;
             case 'CRM_Contribute_BAO_ManagePremiums':
                 $ret['content'] = ts('Are you sure you want to disable this premium? This action will remove the premium from any contribution pages that currently offer it. However it will not delete the premium record - so you can re-enable it and add it back to your contribution page(s) at a later time.');
                 break;
             case 'CRM_Contact_BAO_Relationship':
                 $ret['content'] = ts('Are you sure you want to disable this relationship?');
                 break;
             case 'CRM_Contact_BAO_RelationshipType':
                 $ret['content'] = ts('Are you sure you want to disable this relationship type?') . '<br/><br/>' . ts('Users will no longer be able to select this value when adding or editing relationships between contacts.');
                 break;
             case 'CRM_Financial_BAO_FinancialType':
                 $ret['content'] = ts('Are you sure you want to disable this financial type?');
                 break;
             case 'CRM_Financial_BAO_FinancialAccount':
                 if (!CRM_Financial_BAO_FinancialAccount::getARAccounts($recordID)) {
                     $ret['illegal'] = TRUE;
                     $ret['content'] = ts('The selected financial account cannot be disabled because at least one Accounts Receivable type account is required (to ensure that accounting transactions are in balance).');
                 } else {
                     $ret['content'] = ts('Are you sure you want to disable this financial account?');
                 }
                 break;
             case 'CRM_Financial_BAO_PaymentProcessor':
                 $ret['content'] = ts('Are you sure you want to disable this payment processor?') . ' <br/><br/>' . ts('Users will no longer be able to select this value when adding or editing transaction pages.');
                 break;
             case 'CRM_Financial_BAO_PaymentProcessorType':
                 $ret['content'] = ts('Are you sure you want to disable this payment processor type?');
                 break;
             case 'CRM_Core_BAO_LocationType':
                 $ret['content'] = ts('Are you sure you want to disable this location type?') . ' <br/><br/>' . ts('Users will no longer be able to select this value when adding or editing contact locations.');
                 break;
             case 'CRM_Event_BAO_ParticipantStatusType':
                 $ret['content'] = ts('Are you sure you want to disable this Participant Status?') . '<br/><br/> ' . ts('Users will no longer be able to select this value when adding or editing Participant Status.');
                 break;
             case 'CRM_Mailing_BAO_Component':
                 $ret['content'] = ts('Are you sure you want to disable this component?');
                 break;
             case 'CRM_Core_BAO_CustomField':
                 $ret['content'] = ts('Are you sure you want to disable this custom data field?');
                 break;
             case 'CRM_Core_BAO_CustomGroup':
                 $ret['content'] = ts('Are you sure you want to disable this custom data group? Any profile fields that are linked to custom fields of this group will be disabled.');
                 break;
             case 'CRM_Core_BAO_MessageTemplate':
                 $ret['content'] = ts('Are you sure you want to disable this message tempate?');
                 break;
             case 'CRM_ACL_BAO_ACL':
                 $ret['content'] = ts('Are you sure you want to disable this ACL?');
                 break;
             case 'CRM_ACL_BAO_EntityRole':
                 $ret['content'] = ts('Are you sure you want to disable this ACL Role Assignment?');
                 break;
             case 'CRM_Member_BAO_MembershipType':
                 $ret['content'] = ts('Are you sure you want to disable this membership type?');
                 break;
             case 'CRM_Member_BAO_MembershipStatus':
                 $ret['content'] = ts('Are you sure you want to disable this membership status rule?');
                 break;
             case 'CRM_Price_BAO_PriceField':
                 $ret['content'] = ts('Are you sure you want to disable this price field?');
                 break;
             case 'CRM_Contact_BAO_Group':
                 $ret['content'] = ts('Are you sure you want to disable this Group?');
                 break;
             case 'CRM_Core_BAO_OptionGroup':
                 $ret['content'] = ts('Are you sure you want to disable this Option?');
                 break;
             case 'CRM_Contact_BAO_ContactType':
                 $ret['content'] = ts('Are you sure you want to disable this Contact Type?');
                 break;
             case 'CRM_Core_BAO_OptionValue':
                 $label = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $recordID, 'label');
                 $ret['content'] = ts('Are you sure you want to disable the \'%1\' option ?', array(1 => $label));
                 $ret['content'] .= '<br /><br />' . ts('WARNING - Disabling an option which has been assigned to existing records will result in that option being cleared when the record is edited.');
                 break;
             case 'CRM_Contribute_BAO_ContributionRecur':
                 $recurDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recordID);
                 $ret['content'] = ts('Are you sure you want to mark this recurring contribution as cancelled?');
                 $ret['content'] .= '<br /><br /><strong>' . ts('WARNING - This action sets the CiviCRM recurring contribution status to Cancelled, but does NOT send a cancellation request to the payment processor. You will need to ensure that this recurring payment (subscription) is cancelled by the payment processor.') . '</strong>';
                 if ($recurDetails->membership_id) {
                     $ret['content'] .= '<br /><br /><strong>' . ts('This recurring contribution is linked to an auto-renew membership. If you cancel it, the associated membership will no longer renew automatically. However, the current membership status will not be affected.') . '</strong>';
                 }
                 break;
             default:
                 $ret['content'] = ts('Are you sure you want to disable this record?');
                 break;
         }
     } else {
         $ret = array('status' => 'error', 'content' => 'Error: Unknown entity type.', 'illegal' => TRUE);
     }
     CRM_Core_Page_AJAX::returnJsonResponse($ret);
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:AJAX.php


示例19: run

 /**
  * Run this page (figure out the action needed and perform it).
  *
  * @param int $id
  * @param int $contactID
  * @param bool $print
  * @param bool $allowID
  */
 public function run($id = NULL, $contactID = NULL, $print = TRUE, $allowID = FALSE)
 {
     if (is_numeric($id)) {
         $this->_mailingID = $id;
     } else {
         $print = TRUE;
         $this->_mailingID = CRM_Utils_Request::retrieve('id', 'String', CRM_Core_DAO::$_nullObject, TRUE);
     }
     // # CRM-7651
     // override contactID from the function level if passed in
     if (isset($contactID) && is_numeric($contactID)) {
         $this->_contactID = $contactID;
     } else {
         $session = CRM_Core_Session::singleton();
         $this->_contactID = $session->get('userID');
     }
     // mailing key check
     if (Civi::settings()->get('hash_mailing_url')) {
         $this->_mailing = new CRM_Mailing_BAO_Mailing();
         if (!is_numeric($this->_mailingID)) {
             $this->_mailing->hash = $this->_mailingID;
         } elseif (is_numeric($this->_mailingID)) {
             $this->_mailing->id = $this->_mailingID;
             // if mailing is present and associated hash is present
             // while 'hash' is not been used for mailing view : throw 'permissionDenied'
             if ($this->_mailing->find() && CRM_Core_DAO::getFieldValue('CRM_Mailing_BAO_Mailing', $this->_mailingID, 'hash', 'id') && !$allowID) {
                 CRM_Utils_System::permissionDenied();
                 return;
             }
         }
     } else {
         $this->_mailing = new CRM_Mailing_BAO_Mailing();
         $this->_mailing->id = $this->_mailingID;
     }
     if (!$this->_mailing->find(TRUE) || !$this->checkPermission()) {
         CRM_Utils_System::permissionDenied();
         return;
     }
     CRM_Mailing_BAO_Mailing::tokenReplace($this->_mailing);
     // get and format attachments
     $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $this->_mailing->id);
     // get contact detail and compose if contact id exists
     $returnProperties = $this->_mailing->getReturnProperties();
     if (isset($this->_contactID)) {
         // get details of contact with token value including Custom Field Token Values.CRM-3734
         $params = array('contact_id' => $this->_contactID);
         $details = CRM_Utils_Token::getTokenDetails($params, $returnProperties, FALSE, TRUE, NULL, $this->_mailing->getFlattenedTokens(), get_class($this));
         $details = $details[0][$this->_contactID];
         $contactId = $this->_contactID;
     } else {
         // get tokens that are not contact specific resolved
         $params = array('contact_id' => 0);
         $details = CRM_Utils_Token::getAnonymousTokenDetails($params, $returnProperties, TRUE, TRUE, NULL, $this->_mailing->getFlattenedTokens(), get_class($this));
         $details = CRM_Utils_Array::value(0, $details[0]);
         $contactId = 0;
     }
     $mime =& $this->_mailing->compose(NULL, NULL, NULL, $contactId, $this->_mailing->from_email, $this->_mailing->from_email, TRUE, $details, $attachments);
     $title = NULL;
     if (isset($this->_mailing->body_html) && empty($_GET['text'])) {
         $header = 'text/html; charset=utf-8';
         $content = $mime->getHTMLBody();
         if (strpos($content, '<head>') === FALSE && strpos($content, '<title>') === FALSE) {
             $title = '<head><title>' . $this->_mailing->subject . '</title></head>';
         }
     } else {
         $header = 'text/plain; charset=utf-8';
         $content = $mime->getTXTBody();
     }
     CRM_Utils_System::setTitle($this->_mailing->subject);
     if (CRM_Utils_Array::value('snippet', $_GET) === 'json') {
         CRM_Core_Page_AJAX::returnJsonResponse($content);
     }
     if ($print) {
         CRM_Utils_System::setHttpHeader('Content-Type', $header);
         print $title;
         print $content;
         CRM_Utils_System::civiExit();
     } else {
         return $content;
     }
 }
开发者ID:scardinius,项目名称:civicrm-core,代码行数:89,代码来源:View.php


示例20: run

 /**
  * This function takes care of all the things common to all
  * pages. This typically involves assigning the appropriate
  * smarty variable :)
  *
  * @return string The content generated by running this page
  */
 function run()
 {
     if ($this->_embedded) {
         return;
     }
     self::$_template->assign('mode', $this->_mode);
     $pageTemplateFile = $this->getHookedTemplateFileName();
     self::$_template->assign('tplFile', $pageTemplateFile);
     // invoke the pagRun hook, CRM-3906
     CRM_Utils_Hook::pageRun($this);
     if ($this->_print) {
         if (in_array($this->_print, array(CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON))) {
             $content = self::$_template->fetch('CRM/common/snippet.tpl');
         } else {
             $content = self::$_template->fetch('CRM/common/print.tpl');
         }
         CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $this->overrideExtraTemplateFileName());
         //its time to call the hook.
         CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
         if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$this->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } elseif ($this->_print == CRM_Core_Smarty::PRINT_JSON) {
             $this->ajaxResponse['content'] = $content;
             CRM_Core_Page_AJAX::returnJsonResponse($this->ajaxResponse);
         } else {
             echo $content;
         }
         CRM_Utils_System::civiExit();
     }
     $config = CRM_Core_Config::singleton();
     // TODO: Is there a better way to ensure these actions don't happen during AJAX requests?
     if (empty($_GET['snippet'])) {
         // Version check and intermittent alert to admins
         CRM_Utils_VersionCheck::singleton()->versionAlert();
         CRM_Utils_Check_Security::singleton()->showPeriodicAlerts();
         // Debug msg once per hour
         if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) {
             $msg = ts('Warning: Debug is enabled in <a href="%1">system settings</a>. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1')));
             CRM_Core_Session::setStatus($msg, ts('Debug Mode'));
         }
     }
     $content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
     // Render page header
     if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content);
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
     echo CRM_Utils_System::theme($content, $this->_print);
     return;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:59,代码来源:Page.php



注:本文中的CRM_Core_Page_AJAX类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_Page_Basic类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_Page类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap