本文整理汇总了PHP中CRM_Core_Region类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Region类的具体用法?PHP CRM_Core_Region怎么用?PHP CRM_Core_Region使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Region类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
// Add our template
CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
parent::run();
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:7,代码来源:Backbone.php
示例2: theme
/**
* if we are using a theming system, invoke theme, else just print the
* content
*
* @param string $content the content that will be themed
* @param boolean $print are we displaying to the screen or bypassing theming?
* @param boolean $maintenance for maintenance mode
*
* @return void prints content on stdout
* @access public
*/
function theme(&$content, $print = FALSE, $maintenance = FALSE)
{
$ret = FALSE;
// TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
// but the parts should be copied into cleaner subclass implementations
$config = CRM_Core_Config::singleton();
if ($config->userSystem->is_drupal && function_exists('theme') && !$print) {
if ($maintenance) {
drupal_set_breadcrumb('');
drupal_maintenance_theme();
if ($region = CRM_Core_Region::instance('html-header', FALSE)) {
CRM_Utils_System::addHTMLHead($region->render(''));
}
print theme('maintenance_page', array('content' => $content));
exit;
}
$ret = TRUE;
// TODO: Figure out why D7 returns but everyone else prints
}
$out = $content;
$config =& CRM_Core_Config::singleton();
if (!$print && $config->userFramework == 'WordPress') {
if (is_admin()) {
require_once ABSPATH . 'wp-admin/admin-header.php';
} else {
// FIX ME: we need to figure out to replace civicrm content on the frontend pages
}
}
if ($ret) {
return $out;
} else {
print $out;
}
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:45,代码来源:Base.php
示例3: buildForm
function buildForm(&$form)
{
// check if we're in test mode
if ($this->_mode == 'test') {
$test = ' Test';
} else {
$test = '';
}
// we don't need the default stuff:
$form->_paymentFields = array();
$form->add('text', 'bank_account_number', ts('IBAN'), array('size' => 34, 'maxlength' => 34), TRUE);
$form->add('text', 'bank_identification_number', ts('BIC'), array('size' => 11, 'maxlength' => 11), TRUE);
$form->add('text', 'bank_name', ts('Bank Name'), array('size' => 20, 'maxlength' => 64), FALSE);
$form->add('text', 'account_holder', ts('Account Holder'), array('size' => 20, 'maxlength' => 64), FALSE);
$form->add('select', 'cycle_day', ts('Collection Day'), CRM_Sepa_Logic_Settings::getListSetting("cycledays", range(1, 28), $this->_creditorId), FALSE);
$form->addDate('start_date', ts('start date'), TRUE, array());
$form->registerRule('sepa_iban_valid', 'callback', 'rule_valid_IBAN', 'CRM_Sepa_Logic_Verification');
$form->registerRule('sepa_bic_valid', 'callback', 'rule_valid_BIC', 'CRM_Sepa_Logic_Verification');
$form->addRule('bank_account_number', ts('This is not a correct IBAN.'), 'sepa_iban_valid');
$form->addRule('bank_identification_number', ts('This is not a correct BIC.'), 'sepa_bic_valid');
$rcur_notice_days = (int) CRM_Sepa_Logic_Settings::getSetting("batching.RCUR.notice", $this->_creditorId);
$ooff_notice_days = (int) CRM_Sepa_Logic_Settings::getSetting("batching.OOFF.notice", $this->_creditorId);
$timestamp_rcur = strtotime("now + {$rcur_notice_days} days");
$timestamp_ooff = strtotime("now + {$ooff_notice_days} days");
$earliest_rcur_date = array(date('Y', $timestamp_rcur), date('m', $timestamp_rcur), date('d', $timestamp_rcur));
$earliest_ooff_date = array(date('Y', $timestamp_ooff), date('m', $timestamp_ooff), date('d', $timestamp_ooff));
$form->assign('earliest_rcur_date', $earliest_rcur_date);
$form->assign('earliest_ooff_date', $earliest_ooff_date);
CRM_Core_Region::instance('billing-block')->add(array('template' => 'CRM/Core/Payment/SEPA/SDD.tpl', 'weight' => -1));
}
开发者ID:scardinius,项目名称:org.project60.sepa,代码行数:30,代码来源:SDD.php
示例4: addResources
/**
* Load needed JS, CSS and settings for the backend Volunteer Management UI
*/
public static function addResources($entity_id, $entity_table)
{
static $loaded = FALSE;
$ccr = CRM_Core_Resources::singleton();
if ($loaded || $ccr->isAjaxMode()) {
return;
}
$loaded = TRUE;
$config = CRM_Core_Config::singleton();
// Vendor libraries
$ccr->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE);
$ccr->addScriptFile('civicrm', 'packages/backbone/backbone-min.js', 120, 'html-header', FALSE);
$ccr->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.min.js', 125, 'html-header', FALSE);
// Our stylesheet
$ccr->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css');
// Add all scripts for our js app
$weight = 0;
$baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
// This glob pattern will recurse the js directory up to 4 levels deep
foreach (glob($baseDir . 'js/backbone/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
$fileName = substr($file, strlen($baseDir));
$ccr->addScriptFile('org.civicrm.volunteer', $fileName, $weight++);
}
// Add our template
CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
// Fetch event so we can set the default start time for needs
// FIXME: Not the greatest for supporting non-events
$entity = civicrm_api3(str_replace('civicrm_', '', $entity_table), 'getsingle', array('id' => $entity_id));
// Static variables
$ccr->addSetting(array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => CRM_Utils_Array::value('start_date', $entity)), 'config' => array('timeInputFormat' => $config->timeInputFormat), 'constants' => array('CRM_Core_Action' => array('NONE' => 0, 'ADD' => 1, 'UPDATE' => 2, 'VIEW' => 4, 'DELETE' => 8, 'BROWSE' => 16, 'ENABLE' => 32, 'DISABLE' => 64, 'EXPORT' => 128, 'BASIC' => 256, 'ADVANCED' => 512, 'PREVIEW' => 1024, 'FOLLOWUP' => 2048, 'MAP' => 4096, 'PROFILE' => 8192, 'COPY' => 16384, 'RENEW' => 32768, 'DETACH' => 65536, 'REVERT' => 131072, 'CLOSE' => 262144, 'REOPEN' => 524288, 'MAX_ACTION' => 1048575))));
// Check for problems
_volunteer_checkResourceUrl();
}
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:37,代码来源:Manage.php
示例5: buildForm
function buildForm(&$form)
{
// Change the label on the "name" fields, and make mandatory
// (they are mandatory for CC transactions, but not shown as such in the form by default
// because of the 'pay later' option)
$fields = array('billing_first_name' => ts('First Name'), 'billing_last_name' => ts('Last Name'), 'billing_individual_prefix' => ts('Title'));
foreach ($fields as $field => $title) {
if ($form->elementExists($field)) {
$e =& $form->getElement($field);
$e->setLabel($title);
$form->addRule($field, ts('%1 is a required field.', array(1 => $title)), 'required');
}
}
$fields = array('billing_street_address-5', 'billing_city-5', 'billing_country_id-5', 'billing_state_province_id-5', 'billing_postal_code-5');
foreach ($fields as $field) {
if ($form->elementExists($field)) {
$e =& $form->getElement($field);
$title = $e->getLabel();
$form->addRule($field, ts('%1 is a required field.', array(1 => $title)), 'required');
}
}
CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Symbioticux/Contribute/Form/Contribution/Main.validate.tpl'));
// Preview & demo sites should encourage to use a test CC number
// otherwise users do not know what CC to use, and sometimes use their own.
if (CRM_Utils_Array::value('action', $_REQUEST) == 'preview' || !empty($GLOBALS['symbioticux_demo']) || CRM_Utils_Array::value('name', $form->_paymentProcessors[1]) == 'Dummy') {
CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Symbioticux/Contribute/Form/Contribution/Main.billing-explain.tpl'));
$js = "cj('#credit_card_number').click(function(event) {\n if (! cj(this).val()) {\n cj(this).val('4111111111111111').trigger('change');\n cj('#cvv2').val('123').trigger('change');\n cj('#credit_card_exp_date_m').val('5').trigger('change');\n cj('#credit_card_exp_date_Y').val('2018').trigger('change');\n\n cj('.symbioticux-billing-explain-cc').prependTo('.credit_card_info-section').slideDown();\n }\n });";
CRM_Core_Resources::singleton()->addScript($js);
}
CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Symbioticux/Contribute/Form/Contribution/Main.hide-other-amount.tpl'));
// Remove some CSS classes on the 'submit' button.
$js = "cj('.crm-submit-buttons .crm-form-submit').addClass('btn btn-primary').removeClass('crm-form-submit').parent().removeClass('crm-button');";
CRM_Core_Resources::singleton()->addScript($js);
}
开发者ID:coopsymbiotic,项目名称:coop.symbiotic.symbioticux,代码行数:34,代码来源:Main.php
示例6: mailjet_civicrm_pageRun
/**
* Implementation of hook_civicrm_pageRun
*
* Handler for pageRun hook.
*/
function mailjet_civicrm_pageRun(&$page)
{
if (get_class($page) == 'CRM_Mailing_Page_Report') {
$mailingId = $page->_mailing_id;
$mailingJobs = civicrm_api3('MailingJob', 'get', $params = array('mailing_id' => $mailingId));
$stats = array('BlockedCount' => 0, 'BouncedCount' => 0, 'ClickedCount' => 0, 'DeliveredCount' => 0, 'OpenedCount' => 0, 'ProcessedCount' => 0, 'QueuedCount' => 0, 'SpamComplaintCount' => 0, 'UnsubscribedCount' => 0);
foreach ($mailingJobs['values'] as $key => $job) {
if ($job['job_type'] == 'child') {
$jobId = $key;
require_once 'packages/mailjet-0.3/php-mailjet-v3-simple.class.php';
// Create a new Mailjet Object
$mj = new Mailjet(MAILJET_API_KEY, MAILJET_SECRET_KEY);
$mj->debug = 0;
$mailJetParams = array('method' => 'VIEW', 'unique' => CRM_Mailjet_BAO_Event::getMailjetCustomCampaignId($jobId));
$response = $mj->campaign($mailJetParams);
$page->assign('mailjet_params', $mailJetParams);
if (!empty($response)) {
if ($response->Count == 1) {
$campaign = $response->Data[0];
$mailJetParams = array('method' => 'VIEW', 'unique' => $campaign->ID);
$response = $mj->campaignstatistics($mailJetParams);
if ($response->Count == 1) {
$stats = sumUpStats($stats, get_object_vars($response->Data[0]));
}
}
}
}
}
$page->assign('mailjet_stats', $stats);
CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Mailjet/Page/Report.tpl'));
}
}
开发者ID:WeMoveEU,项目名称:uk.co.compucorp.civicrm.mailjet,代码行数:37,代码来源:mailjet.php
示例7: addResources
/**
* Load needed JS, CSS and settings for the backend Volunteer Management UI
*/
public static function addResources($entity_id, $entity_table)
{
static $loaded = FALSE;
if ($loaded) {
return;
}
$loaded = TRUE;
$config = CRM_Core_Config::singleton();
$ccr = CRM_Core_Resources::singleton();
// Vendor libraries
$ccr->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE);
$ccr->addScriptFile('civicrm', 'packages/backbone/backbone-min.js', 120, 'html-header');
$ccr->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.min.js', 125, 'html-header', FALSE);
// Our stylesheet
$ccr->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css');
// Add all scripts for our js app
$weight = 0;
$baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
// This glob pattern will recurse the js directory up to 4 levels deep
foreach (glob($baseDir . 'js/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
$fileName = substr($file, strlen($baseDir));
$ccr->addScriptFile('org.civicrm.volunteer', $fileName, $weight++);
}
// Add our template
CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
// Fetch event so we can set the default start time for needs
// FIXME: Not the greatest for supporting non-events
$entity = civicrm_api3(str_replace('civicrm_', '', $entity_table), 'getsingle', array('id' => $entity_id));
// Static variables
$ccr->addSetting(array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => CRM_Utils_Array::value('start_date', $entity)), 'config' => array('timeInputFormat' => $config->timeInputFormat)));
// Check for problems
_volunteer_civicrm_check_resource_url();
}
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:37,代码来源:Manage.php
示例8: buildForm
public function buildForm($formName, &$form)
{
if ($formName != 'CRM_Contribute_Form_Contribution') {
return;
}
if (!CRM_Core_Permission::check('edit memberships')) {
return;
}
$contact_id = $form->getVar('_contactID');
if (!$contact_id) {
return;
}
$current_membership_id = false;
$contribution_id = $form->getVar('_id');
if ($contribution_id) {
$current_membership_id = CRM_Core_DAO::singleValueQuery("SELECT membership_id FROM civicrm_membership_payment where contribution_id = %1", array(1 => array($contribution_id, 'Integer')));
}
$memberships = array('' => ts('-- None --')) + $this->getMembershipsForContact($contact_id);
$snippet['template'] = 'CRM/Membershippayment/Contribution/Form.tpl';
$snippet['contact_id'] = $contact_id;
$form->add('select', 'membership_id', ts('Membership'), $memberships);
if ($current_membership_id) {
$defaults['membership_id'] = $current_membership_id;
$form->setDefaults($defaults);
}
CRM_Core_Region::instance('page-body')->add($snippet);
}
开发者ID:dragonjon,项目名称:org.civicoop.membershippayment,代码行数:27,代码来源:Form.php
示例9: buildForm
/**
* Method to process civicrm buildForm hook
*
* User can only manage group settings for non-protected groups or if user has permissions
*/
public static function buildForm($formName, $form)
{
if ($formName == 'CRM_Group_Form_Edit') {
$protectGroupAllowed = CRM_Core_Permission::check('manage protected groups');
if (!$protectGroupAllowed) {
CRM_Core_Region::instance('page-body')->add(array('template' => 'GroupProtect.tpl'));
}
}
}
开发者ID:CiviCooP,项目名称:org.civicoop.groupprotect,代码行数:14,代码来源:GroupProtect.php
示例10: html2pdf
/**
* @param $text
* @param string $fileName
* @param bool $output
* @param null $pdfFormat
*
* @return string|void
*/
public static function html2pdf(&$text, $fileName = 'civicrm.pdf', $output = FALSE, $pdfFormat = NULL)
{
if (is_array($text)) {
$pages =& $text;
} else {
$pages = array($text);
}
// Get PDF Page Format
$format = CRM_Core_BAO_PdfFormat::getDefaultValues();
if (is_array($pdfFormat)) {
// PDF Page Format parameters passed in
$format = array_merge($format, $pdfFormat);
} else {
// PDF Page Format ID passed in
$format = CRM_Core_BAO_PdfFormat::getById($pdfFormat);
}
$paperSize = CRM_Core_BAO_PaperSize::getByName($format['paper_size']);
$paper_width = self::convertMetric($paperSize['width'], $paperSize['metric'], 'pt');
$paper_height = self::convertMetric($paperSize['height'], $paperSize['metric'], 'pt');
// dompdf requires dimensions in points
$paper_size = array(0, 0, $paper_width, $paper_height);
$orientation = CRM_Core_BAO_PdfFormat::getValue('orientation', $format);
$metric = CRM_Core_BAO_PdfFormat::getValue('metric', $format);
$t = CRM_Core_BAO_PdfFormat::getValue('margin_top', $format);
$r = CRM_Core_BAO_PdfFormat::getValue('margin_right', $format);
$b = CRM_Core_BAO_PdfFormat::getValue('margin_bottom', $format);
$l = CRM_Core_BAO_PdfFormat::getValue('margin_left', $format);
$stationery_path_partial = CRM_Core_BAO_PdfFormat::getValue('stationery', $format);
$stationery_path = NULL;
if (strlen($stationery_path_partial)) {
$doc_root = $_SERVER['DOCUMENT_ROOT'];
$stationery_path = $doc_root . "/" . $stationery_path_partial;
}
$margins = array($metric, $t, $r, $b, $l);
$config = CRM_Core_Config::singleton();
// Add a special region for the HTML header of PDF files:
$pdfHeaderRegion = CRM_Core_Region::instance('export-document-header', FALSE);
$htmlHeader = $pdfHeaderRegion ? $pdfHeaderRegion->render('', FALSE) : '';
$html = "\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n <style>@page { margin: {$t}{$metric} {$r}{$metric} {$b}{$metric} {$l}{$metric}; }</style>\n <style type=\"text/css\">@import url({$config->userFrameworkResourceURL}css/print.css);</style>\n {$htmlHeader}\n </head>\n <body>\n <div id=\"crm-container\">\n";
// Strip <html>, <header>, and <body> tags from each page
$htmlElementstoStrip = array('@<head[^>]*?>.*?</head>@siu', '@<script[^>]*?>.*?</script>@siu', '@<body>@siu', '@</body>@siu', '@<html[^>]*?>@siu', '@</html>@siu', '@<!DOCTYPE[^>]*?>@siu');
$htmlElementsInstead = array('', '', '', '', '', '');
foreach ($pages as &$page) {
$page = preg_replace($htmlElementstoStrip, $htmlElementsInstead, $page);
}
// Glue the pages together
$html .= implode("\n<div style=\"page-break-after: always\"></div>\n", $pages);
$html .= "\n </div>\n </body>\n</html>";
if ($config->wkhtmltopdfPath) {
return self::_html2pdf_wkhtmltopdf($paper_size, $orientation, $margins, $html, $output, $fileName);
} else {
return self::_html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName);
//return self::_html2pdf_tcpdf($paper_size, $orientation, $margins, $html, $output, $fileName, $stationery_path);
}
}
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:63,代码来源:Utils.php
示例11: registerProfileScripts
public static function registerProfileScripts()
{
static $loaded = FALSE;
if ($loaded || CRM_Core_Resources::isAjaxMode()) {
return;
}
$loaded = TRUE;
CRM_Core_Resources::singleton()->addSettingsFactory(function () {
return array('PseudoConstant' => array('locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), 'websiteType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'), 'phoneType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id')), 'initialProfileList' => civicrm_api('UFGroup', 'get', array('version' => 3, 'sequential' => 1, 'is_active' => 1, 'rowCount' => 1000)), 'contactSubTypes' => CRM_Contact_BAO_ContactType::subTypes(), 'profilePreviewKey' => CRM_Core_Key::get('CRM_UF_Form_Inline_Preview', TRUE));
})->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.js', 120, 'html-header')->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.collectionsubset.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/backbone-forms.js', 130, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/adapters/backbone.bootstrap-modal.min.js', 140, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone-forms/distribution/editors/list.min.js', 140, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/backbone-forms/distribution/templates/default.css', 140, 'html-header')->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header')->addStyleFile('civicrm', 'css/crm.designer.css', 140, 'html-header')->addScriptFile('civicrm', 'js/crm.backbone.js', 150)->addScriptFile('civicrm', 'js/model/crm.schema-mapped.js', 200)->addScriptFile('civicrm', 'js/model/crm.uf.js', 200)->addScriptFile('civicrm', 'js/model/crm.designer.js', 200)->addScriptFile('civicrm', 'js/model/crm.profile-selector.js', 200)->addScriptFile('civicrm', 'js/view/crm.designer.js', 200)->addScriptFile('civicrm', 'js/view/crm.profile-selector.js', 200)->addScriptFile('civicrm', 'js/jquery/jquery.crmProfileSelector.js', 250)->addScriptFile('civicrm', 'js/crm.designerapp.js', 250);
CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/UF/Page/ProfileTemplates.tpl'));
}
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:12,代码来源:ProfileEditor.php
示例12: _volunteer_civicrm_buildForm_CRM_Custom_Form_Field
/**
* Delegated implementation of hook_civicrm_buildForm
*
* Customizes the UI for adding custom fields to allow the user to specify whether
* a multi-select field should use the slider widget or not
*/
function _volunteer_civicrm_buildForm_CRM_Custom_Form_Field($formName, CRM_Core_Form &$form)
{
// set default value for the checkbox
$field_id = $form->getVar('_id');
$widgetized_fields = _volunteer_get_slider_fields();
$form->_defaultValues['is_slider_widget'] = in_array($field_id, $widgetized_fields);
// add checkbox to the form object
$form->add('checkbox', 'is_slider_widget', ts('Use Slider Selector?'));
// add checkbox to the display
CRM_Core_Region::instance('page-body')->add(array('template' => 'Slider/CRM/Custom/Form/Field.tpl'));
// reposition and show/hide checkbox
CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.volunteer', 'js/CRM_Custom_Form_Field.js');
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:19,代码来源:volunteer.slider.php
示例13: hrvisa_civicrm_buildProfile
/**
* Implementation of hook_civicrm_buildProfile
*/
function hrvisa_civicrm_buildProfile($name)
{
if ($name == 'hrvisa_tab') {
// To fix validation alert issue
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('urlIsPublic', FALSE);
$contactID = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$config = CRM_Core_Config::singleton();
if ($config->logging && 'multiProfileDialog' !== CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject)) {
CRM_Core_Region::instance('profile-form-hrvisa_tab')->add(array('template' => 'CRM/common/logButton.tpl', 'instance_id' => CRM_Report_Utils_Report::getInstanceIDForValue('logging/contact/summary'), 'css_class' => 'hrvisa-revision-link', 'table_name' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', 'Immigration', 'table_name', 'name'), 'contact_id' => $contactID, 'weight' => -2));
}
}
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:16,代码来源:hrvisa.php
示例14: smarty_block_crmRegion
/**
* Smarty block function for defining content-regions which can be dynamically-altered
*
* @see CRM_Core_Regions
*
* @param array $params must define 'name'
* @param string $content Default content
* @param object $smarty the Smarty object
*
* @return string
*/
function smarty_block_crmRegion($params, $content, &$smarty, &$repeat)
{
if ($repeat) {
return;
}
require_once 'CRM/Core/Region.php';
$region = CRM_Core_Region::instance($params['name'], FALSE);
if ($region) {
$result = $region->render($content);
return $result;
} else {
return $content;
}
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:25,代码来源:block.crmRegion.php
示例15: smarty_block_crmRegion
/**
* Smarty block function for defining content-regions which can be dynamically-altered
*
* @see CRM_Core_Regions
*
* @param array $params
* Must define 'name'.
* @param string $content
* Default content.
* @param CRM_Core_Smarty $smarty
* The Smarty object.
*
* @param $repeat
*
* @return string
*/
function smarty_block_crmRegion($params, $content, &$smarty, &$repeat)
{
if ($repeat) {
return NULL;
}
require_once 'CRM/Core/Region.php';
$region = CRM_Core_Region::instance($params['name'], FALSE);
if ($region) {
$result = $region->render($content, CRM_Utils_Array::value('allowCmsOverride', $params, TRUE));
return $result;
} else {
return $content;
}
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:30,代码来源:block.crmRegion.php
示例16: hrqual_civicrm_buildProfile
/**
* Implementation of hook_civicrm_buildProfile
*/
function hrqual_civicrm_buildProfile($name)
{
if ($name == 'hrqual_tab') {
// To fix validation alert issue
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('urlIsPublic', FALSE);
$action = CRM_Utils_Request::retrieve('multiRecord', 'String', $this);
// display the select box only in add and update mode
if (in_array($action, array("add", "update"))) {
$regionParams = array('markup' => "<select id='category_name' name='category_name' style='display:none' class='form-select required'></select>");
CRM_Core_Region::instance('profile-form-hrqual_tab')->add($regionParams);
}
$config = CRM_Core_Config::singleton();
if ($config->logging && 'multiProfileDialog' !== CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject)) {
$contactID = CRM_Utils_Request::retrieve('id', 'Positive', $this);
CRM_Core_Region::instance('profile-form-hrqual_tab')->add(array('template' => 'CRM/common/logButton.tpl', 'instance_id' => CRM_Report_Utils_Report::getInstanceIDForValue('logging/contact/summary'), 'css_class' => 'hrqual-revision-link', 'table_name' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', 'Qualifications', 'table_name', 'name'), 'contact_id' => $contactID, 'weight' => -2));
}
}
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:22,代码来源:hrqual.php
示例17: civiexportexcel_civicrm_buildForm
/**
* Implementation of hook_civicrm_buildForm().
*
* Used to add a 'Export to Excel' button in the Report forms.
*/
function civiexportexcel_civicrm_buildForm($formName, &$form)
{
// Reports extend the CRM_Report_Form class.
// We use that to check whether we should inject the Excel export buttons.
if (is_subclass_of($form, 'CRM_Report_Form')) {
$smarty = CRM_Core_Smarty::singleton();
$vars = $smarty->get_template_vars();
$form->_excelButtonName = $form->getButtonName('submit', 'excel');
$label = !empty($vars['instanceId']) ? ts('Export to Excel') : ts('Preview Excel');
$form->addElement('submit', $form->_excelButtonName, $label);
CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Report/Form/Actions-civiexportexcel.tpl'));
// This hook also gets called when we click on a submit button,
// so we can handle that part here too.
$buttonName = $form->controller->getButtonName();
$output = CRM_Utils_Request::retrieve('output', 'String', CRM_Core_DAO::$_nullObject);
if ($form->_excelButtonName == $buttonName || $output == 'excel2007') {
$form->assign('printOnly', TRUE);
$printOnly = TRUE;
$form->assign('outputMode', 'excel2007');
// FIXME: this duplicates part of CRM_Report_Form::postProcess()
// since we do not have a place to hook into, we hi-jack the form process
// before it gets into postProcess.
// get ready with post process params
$form->beginPostProcess();
// build query
$sql = $form->buildQuery(FALSE);
// build array of result based on column headers. This method also allows
// modifying column headers before using it to build result set i.e $rows.
$rows = array();
$form->buildRows($sql, $rows);
// format result set.
// This seems to cause more problems than it fixes.
// $form->formatDisplay($rows);
// Show stats on a second Excel page.
$stats = $form->statistics($rows);
// assign variables to templates
$form->doTemplateAssignment($rows);
// FIXME: END.
CRM_CiviExportExcel_Utils_Report::export2excel2007($form, $rows, $stats);
}
}
}
开发者ID:mollux,项目名称:ca.bidon.civiexportexcel,代码行数:47,代码来源:civiexportexcel.php
示例18: run
/**
*
* POST Param 'qrid': string, usually the name of the queue
*/
public function run()
{
$qrid = CRM_Utils_Request::retrieve('qrid', 'String', $this, TRUE);
$runner = CRM_Queue_Runner::instance($qrid);
if (!is_object($runner)) {
CRM_Core_Error::fatal('Queue runner must be configured before execution.');
}
CRM_Utils_System::setTitle($runner->title);
$this->assign('queueRunnerData', array('qrid' => $runner->qrid, 'runNextAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/runNext', NULL, FALSE, NULL, FALSE), 'skipNextAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/skipNext', NULL, FALSE, NULL, FALSE), 'onEndAjax' => CRM_Utils_System::url($runner->pathPrefix . '/ajax/onEnd', NULL, FALSE, NULL, FALSE), 'completed' => 0, 'numberOfItems' => $runner->queue->numberOfItems(), 'buttons' => $runner->buttons));
if ($runner->isMinimal) {
// Render page header
if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
CRM_Utils_System::addHTMLHead($region->render(''));
}
$smarty = CRM_Core_Smarty::singleton();
$content = $smarty->fetch('CRM/Queue/Page/Runner.tpl');
echo CRM_Utils_System::theme($content, $this->_print, TRUE);
} else {
parent::run();
}
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:25,代码来源:Runner.php
示例19: _securefiles_civicrm_buildForm_CRM_Custom_Form_Field
/**
* Delegated implementation of hook_civicrm_buildForm
*
* Customizes the UI for adding custom fields to allow the user to specify whether
* this field should be handled by the secure file extension
*/
function _securefiles_civicrm_buildForm_CRM_Custom_Form_Field($formName, CRM_Core_Form &$form)
{
// set default value for the checkbox
$field_id = $form->getVar('_id');
$enabled_fields = _securefiles_get_secure_enabled_fields();
$form->_defaultValues['use_securefiles'] = in_array($field_id, $enabled_fields);
// add checkbox to the form object
$form->add('checkbox', 'use_securefiles', ts('Store using SecureFiles'));
// add checkbox/settings form to the display
CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Securefiles/Form/CustomField.tpl'));
$secureFileElements = array();
//Let the Backend service add fields if it wants/needs to
$backendService = CRM_Securefiles_Backend::getBackendService();
if ($backendService) {
$backendService->buildFieldSettingsForm($form, $secureFileElements);
}
//Assign our custom field names to the form so the template can render them.
$form->assign("secureFileElements", $secureFileElements);
// reposition and show/hide checkbox
CRM_Core_Resources::singleton()->addScriptFile('com.ginkgostreet.securefiles', 'js/CRM_Custom_Form_Field.js');
}
开发者ID:ginkgostreet,项目名称:com.ginkgostreet.securefiles,代码行数:27,代码来源:securefiles.widget.php
示例20: hrui_civicrm_buildForm
function hrui_civicrm_buildForm($formName, &$form)
{
CRM_Core_Resources::singleton()->addStyleFile('org.civicrm.hrui', 'css/hrui.css')->addScriptFile('org.civicrm.hrui', 'js/hrui.js');
if ($form instanceof CRM_Contact_Form_Contact) {
CRM_Core_Resources::singleton()->addSetting(array('formName' => 'contactForm'));
//HR-358 - Set default values
//set default value to phone location and type
$locationId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', 'Main', 'id', 'name');
$result = civicrm_api3('LocationType', 'create', array('id' => $locationId, 'is_default' => 1, 'is_active' => 1));
if ($form->elementExists('phone[2][phone_type_id]') && $form->elementExists('phone[2][phone_type_id]')) {
$phoneType = $form->getElement('phone[2][phone_type_id]');
$phoneValue = CRM_Core_OptionGroup::values('phone_type');
$phoneKey = CRM_Utils_Array::key('Mobile', $phoneValue);
$phoneType->setSelected($phoneKey);
$phoneLocation = $form->getElement('phone[2][location_type_id]');
$phoneLocation->setSelected($locationId);
}
}
$ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'type_20130502144049', 'id', 'name');
//HR-355 -- Add Government ID
if ($formName == 'CRM_Contact_Form_Contact' && $ogID && $form->_contactType == 'Individual') {
//add government fields
$contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $form);
$templatePath = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.hrui') . '/templates';
$form->add('text', 'GovernmentId', ts('Government ID'));
$form->addElement('select', "govTypeOptions", '', CRM_Core_BAO_OptionValue::getOptionValuesAssocArray($ogID));
CRM_Core_Region::instance('page-body')->add(array('template' => "{$templatePath}/CRM/HRUI/Form/contactField.tpl"));
$action = CRM_Utils_Request::retrieve('action', 'String', $form);
$govVal = CRM_HRIdent_Page_HRIdent::retreiveContactFieldValue($contactID);
//set default to government type option
$default = array();
$default['govTypeOptions'] = CRM_Core_BAO_CustomField::getOptionGroupDefault($ogID, 'select');
if ($action == CRM_Core_Action::UPDATE && !empty($govVal)) {
//set key for updating specific record of contact id in custom value table
$default['govTypeOptions'] = CRM_Utils_Array::value('type', $govVal);
$default['GovernmentId'] = CRM_Utils_Array::value('typeNumber', $govVal);
}
$form->setDefaults($default);
}
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:40,代码来源:hrui.php
注:本文中的CRM_Core_Region类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论