当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_Smarty::singleton方法代码示例

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


在下文中一共展示了CRM_Core_Smarty::singleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: run

 function run()
 {
     $upgrade = new CRM_Upgrade_Form();
     $message = ts('CiviCRM upgrade successful');
     if ($upgrade->checkVersion($upgrade->latestVersion)) {
         $message = ts('Your database has already been upgraded to CiviCRM %1', array(1 => $upgrade->latestVersion));
     } elseif ($upgrade->checkVersion('2.1.2') || $upgrade->checkVersion('2.1.3') || $upgrade->checkVersion('2.1.4') || $upgrade->checkVersion('2.1.5')) {
         // do nothing, db version is changed for all upgrades
     } elseif ($upgrade->checkVersion('2.1.0') || $upgrade->checkVersion('2.1') || $upgrade->checkVersion('2.1.1')) {
         // 2.1 to 2.1.2
         $this->runTwoOneTwo();
     } else {
         // 2.0 to 2.1
         for ($i = 1; $i <= 4; $i++) {
             $this->runForm($i);
         }
         // 2.1 to 2.1.2
         $this->runTwoOneTwo();
     }
     // just change the ver in the db, since nothing to upgrade
     $upgrade->setVersion($upgrade->latestVersion);
     // also cleanup the templates_c directory
     $config = CRM_Core_Config::singleton();
     $config->cleanup(1);
     $template = CRM_Core_Smarty::singleton();
     $template->assign('message', $message);
     $template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $upgrade->latestVersion)));
     $template->assign('menuRebuildURL', CRM_Utils_System::url('civicrm/menu/rebuild', 'reset=1'));
     $contents = $template->fetch('CRM/common/success.tpl');
     echo $contents;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:31,代码来源:Upgrade.php

示例3: civicrm_api3_job_rapportagenamailings_mail

/**
 * Send a email to ?? with the mailing report of one mailing
 * 
 * @param type $mailing_id
 */
function civicrm_api3_job_rapportagenamailings_mail($mailing_id)
{
    global $base_root;
    // create a new Cor Page
    $page = new CRM_Core_Page();
    $page->_mailing_id = $mailing_id;
    // create a new template
    $template = CRM_Core_Smarty::singleton();
    // from CRM/Mailing/Page/Report.php
    // check that the user has permission to access mailing id
    CRM_Mailing_BAO_Mailing::checkPermission($mailing_id);
    $report = CRM_Mailing_BAO_Mailing::report($mailing_id);
    //get contents of mailing
    CRM_Mailing_BAO_Mailing::getMailingContent($report, $page);
    $subject = ts('Mailing Gereed: %1', array(1 => $report['mailing']['name']));
    $template->assign('report', $report);
    // inlcude $base_root
    $template->assign('base_root', $base_root);
    $template->assign('subject', $subject);
    // from CRM/Core/page.php
    // only print
    $template->assign('tplFile', 'CRM/Rapportagenamailings/Page/RapportMailing.tpl');
    $content = $template->fetch('CRM/common/print.tpl');
    CRM_Utils_System::appendTPLFile('CRM/Rapportagenamailings/Page/RapportMailing.tpl', $content, $page->overrideExtraTemplateFileName());
    //its time to call the hook.
    CRM_Utils_Hook::alterContent($content, 'page', 'CRM/Rapportagenamailings/Page/RapportMailing.tpl', $page);
    //echo $content;
    // send mail
    $params = array('from' => 'frontoffice@vnv.nl', 'toName' => 'Front Office VnV', 'toEmail' => 'frontoffice@vnv.nl', 'subject' => $subject, 'text' => $subject, 'html' => $content, 'replyTo' => 'frontoffice@vnv.nl');
    CRM_Utils_Mail::send($params);
}
开发者ID:jvos,项目名称:nl.vnv.rapportagenamailings_old,代码行数:36,代码来源:RapportageNaMailings.php

示例4: run

 function run()
 {
     list($ext, $suite) = $this->getRequestExtAndSuite();
     if (empty($ext) || empty($suite)) {
         throw new CRM_Core_Exception("FIXME: Not implemented: QUnit browser");
     }
     if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+$/', $suite) || strpos($suite, '..') !== FALSE) {
         throw new CRM_Core_Exception("Malformed suite name");
     }
     $path = CRM_Extension_System::singleton()->getMapper()->keyToBasePath($ext);
     if (!is_dir("{$path}/tests/qunit/{$suite}")) {
         throw new CRM_Core_Exception("Failed to locate test suite");
     }
     // Load the test suite -- including any PHP, TPL, or JS content
     if (file_exists("{$path}/tests/qunit/{$suite}/test.php")) {
         // e.g. load resources
         require_once "{$path}/tests/qunit/{$suite}/test.php";
     }
     if (file_exists("{$path}/tests/qunit/{$suite}/test.tpl")) {
         // e.g. setup markup and/or load resources
         CRM_Core_Smarty::singleton()->addTemplateDir("{$path}/tests");
         $this->assign('qunitTpl', "qunit/{$suite}/test.tpl");
     }
     if (file_exists("{$path}/tests/qunit/{$suite}/test.js")) {
         CRM_Core_Resources::singleton()->addScriptFile($ext, "tests/qunit/{$suite}/test.js", 1000);
     }
     CRM_Utils_System::setTitle(ts('QUnit: %2 (%1)', array(1 => $ext, 2 => $suite)));
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/qunit/qunit.js')->addStyleFile('civicrm', 'packages/qunit/qunit.css');
     parent::run();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:30,代码来源:QUnit.php

示例5: generatexml

 function generatexml($id)
 {
     $xml = "";
     $template = CRM_Core_Smarty::singleton();
     $this->get((int) $id);
     $template->assign("file", $this->toArray());
     $txgroup = new CRM_Sepa_BAO_SEPATransactionGroup();
     $txgroup->sdd_file_id = $this->id;
     $txgroup->find();
     $total = 0;
     $nbtransactions = 0;
     $fileFormats = array();
     while ($txgroup->fetch()) {
         $xml .= $txgroup->generateXML();
         $total += $txgroup->total;
         $nbtransactions += $txgroup->nbtransactions;
         $fileFormats[] = $txgroup->fileFormat;
     }
     if (count(array_unique($fileFormats)) > 1) {
         throw new Exception('Creditors with mismatching File Formats cannot be mixed in same File');
     } else {
         $fileFormatName = CRM_Utils_SepaOptionGroupTools::sanitizeFileFormat(reset($fileFormats));
     }
     $template->assign("file", $this->toArray());
     $template->assign("total", $total);
     $template->assign("nbtransactions", $nbtransactions);
     $head = $template->fetch('../formats/' . $fileFormatName . '/transaction-header.tpl');
     $footer = $template->fetch('../formats/' . $fileFormatName . '/transaction-footer.tpl');
     return $head . $xml . $footer;
 }
开发者ID:FundingWorks,项目名称:org.project60.sepa,代码行数:30,代码来源:SEPASddFile.php

示例6: upgrade_4_1_alpha1

 /**
  * @param $rev
  */
 public function upgrade_4_1_alpha1($rev)
 {
     $config = CRM_Core_Config::singleton();
     if (in_array('CiviCase', $config->enableComponents)) {
         if (!CRM_Case_BAO_Case::createCaseViews()) {
             $template = CRM_Core_Smarty::singleton();
             $afterUpgradeMessage = '';
             if ($afterUpgradeMessage = $template->get_template_vars('afterUpgradeMessage')) {
                 $afterUpgradeMessage .= "<br/><br/>";
             }
             $afterUpgradeMessage .= '<div class="crm-upgrade-case-views-error" style="background-color: #E43D2B; padding: 10px;">' . ts("There was a problem creating CiviCase database views. Please create the following views manually before using CiviCase:");
             $afterUpgradeMessage .= '<div class="crm-upgrade-case-views-query"><div>' . CRM_Case_BAO_Case::createCaseViewsQuery('upcoming') . '</div><div>' . CRM_Case_BAO_Case::createCaseViewsQuery('recent') . '</div>' . '</div></div>';
             $template->assign('afterUpgradeMessage', $afterUpgradeMessage);
         }
     }
     $upgrade = new CRM_Upgrade_Form();
     $upgrade->processSQL($rev);
     $this->transferPreferencesToSettings();
     $this->createNewSettings();
     // now modify the config so that the directories are now stored in the settings table
     // CRM-8780
     $params = array();
     CRM_Core_BAO_ConfigSetting::add($params);
     // also reset navigation
     CRM_Core_BAO_Navigation::resetNavigation();
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:29,代码来源:FourOne.php

示例7: run

  function run() {
    $smarty= CRM_Core_Smarty::singleton( );

    $dummy = NULL;
    if (array_key_exists('id',$_GET)) {// special treatmenent, because it's often used
      $smarty->assign ('id',(int)$_GET['id']);// an id is always positive
    }
    $pos = strpos (implode (array_keys ($_GET)),'<') ;

    if ($pos !== false) {
      die ("SECURITY FATAL: one of the param names contains &lt;");
    }
    $param = array_map( 'htmlentities' , $_GET);
//TODO: sql escape the params too
    unset($param['q']);
    $smarty->assign_by_ref("request", $param);

   CRM_Core_Resources::singleton()
    ->addScriptFile('eu.tttp.civisualize', 'js/d3.v3.js', 110, 'html-header', FALSE)
    ->addScriptFile('eu.tttp.civisualize', 'js/dc/dc.js', 110, 'html-header', FALSE)
    ->addScriptFile('eu.tttp.civisualize', 'js/dc/crossfilter.js', 110, 'html-header', FALSE)
    ->addStyleFile('eu.tttp.civisualize', 'js/dc/dc.css')
    ->addStyleFile('eu.tttp.civisualize', 'css/style.css');

    require_once 'CRM/Core/Smarty/plugins/function.crmSQL.php';
    $smarty->register_function("crmSQL", "smarty_function_crmSQL");

    require_once 'CRM/Core/Smarty/plugins/function.crmRetrieve.php';
    $smarty->register_function("crmRetrieve", "smarty_function_crmRetrieve");

    require_once 'CRM/Core/Smarty/plugins/function.crmTitle.php';
    $smarty->register_function("crmTitle", "smarty_function_crmTitle");

    return parent::run();
  }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:35,代码来源:Main.php

示例8: add_participant_to_cart

 function add_participant_to_cart()
 {
     require 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $cart_id = $_GET['cart_id'];
     $event_id = $_GET['event_id'];
     $cart = CRM_Event_Cart_BAO_Cart::find_by_id($_GET['cart_id']);
     $params_array = array('cart_id' => $cart->id, 'contact_id' => CRM_Event_Cart_Form_Cart::find_or_create_contact(), 'event_id' => $event_id);
     //XXX security?
     $participant = CRM_Event_Cart_BAO_MerParticipant::create($params_array);
     $participant->save();
     $form = new CRM_Core_Form();
     $pform = new CRM_Event_Cart_Form_MerParticipant($participant);
     $pform->appendQuickForm($form);
     $renderer = $form->getRenderer();
     $config = CRM_Core_Config::singleton();
     $templateDir = $config->templateDir;
     if (is_array($templateDir)) {
         $templateDir = array_pop($templateDir);
     }
     $requiredTemplate = file_get_contents($templateDir . '/CRM/Form/label.tpl');
     $renderer->setRequiredTemplate($requiredTemplate);
     $form->accept($renderer);
     $template = CRM_Core_Smarty::singleton();
     $template->assign('form', $renderer->toArray());
     $template->assign('participant', $participant);
     $output = $template->fetch("CRM/Event/Cart/Form/Checkout/Participant.tpl");
     $transaction->commit();
     echo $output;
     CRM_Utils_System::civiExit();
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:31,代码来源:CheckoutAJAX.php

示例9: addAttachment

 /**
  * Add an ics attachment to the input array.
  *
  * @param array $attachments
  *   Reference to array in same format returned from CRM_Core_BAO_File::getEntityFile().
  * @param array $contacts
  *   Array of contacts (attendees).
  *
  * @return string|null
  *   Array index of the added attachment in the $attachments array, else NULL.
  */
 public function addAttachment(&$attachments, $contacts)
 {
     // Check preferences setting
     if (Civi::settings()->get('activity_assignee_notification_ics')) {
         $config =& CRM_Core_Config::singleton();
         $this->icsfile = tempnam($config->customFileUploadDir, 'ics');
         if ($this->icsfile !== FALSE) {
             rename($this->icsfile, $this->icsfile . '.ics');
             $this->icsfile .= '.ics';
             $icsFileName = basename($this->icsfile);
             // get logged in user's primary email
             // TODO: Is there a better way to do this?
             $organizer = $this->getPrimaryEmail();
             $template = CRM_Core_Smarty::singleton();
             $template->assign('activity', $this->activity);
             $template->assign('organizer', $organizer);
             $template->assign('contacts', $contacts);
             $template->assign('timezone', date_default_timezone_get());
             $calendar = $template->fetch('CRM/Activity/Calendar/ICal.tpl');
             if (file_put_contents($this->icsfile, $calendar) !== FALSE) {
                 if (empty($attachments)) {
                     $attachments = array();
                 }
                 $attachments['activity_ics'] = array('mime_type' => 'text/calendar', 'fileName' => $icsFileName, 'cleanName' => $icsFileName, 'fullPath' => $this->icsfile);
                 return 'activity_ics';
             }
         }
     }
     return NULL;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:41,代码来源:ICalendar.php

示例10: buildChart

 /**
  * colours.
  * @var array
  * @static
  */
 function buildChart(&$params, $chart)
 {
     $openFlashChart = array();
     if ($chart && is_array($params) && !empty($params)) {
         $chartInstance = new $chart($params);
         $chartInstance->buildChart();
         $chartObj = $chartInstance->getChart();
         $openFlashChart = array();
         if ($chartObj) {
             // calculate chart size.
             $xSize = CRM_Utils_Array::value('xSize', $params, 400);
             $ySize = CRM_Utils_Array::value('ySize', $params, 300);
             if ($chart == 'barChart') {
                 $ySize = CRM_Utils_Array::value('ySize', $params, 250);
                 $xSize = 60 * count($params['values']);
                 //hack to show tooltip.
                 if ($xSize < 200) {
                     $xSize = count($params['values']) > 1 ? 100 * count($params['values']) : 170;
                 } elseif ($xSize > 600 && count($params['values']) > 1) {
                     $xSize = (count($params['values']) + 400 / count($params['values'])) * count($params['values']);
                 }
             }
             // generate unique id for this chart instance
             $uniqueId = md5(uniqid(rand(), TRUE));
             $openFlashChart["chart_{$uniqueId}"]['size'] = array('xSize' => $xSize, 'ySize' => $ySize);
             $openFlashChart["chart_{$uniqueId}"]['object'] = $chartObj;
             // assign chart data to template
             $template = CRM_Core_Smarty::singleton();
             $template->assign('uniqueId', $uniqueId);
             $template->assign("openFlashChartData", json_encode($openFlashChart));
         }
     }
     return $openFlashChart;
 }
开发者ID:eileenmcnaughton,项目名称:net.ourpowerbase.report.advancedfundraising,代码行数:39,代码来源:OpenFlashChart.php

示例11: 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

示例12: 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

示例13: run

 function run()
 {
     CRM_Utils_System::setTitle(ts('Public Vacancy List'));
     global $civicrm_root;
     global $base_url;
     //fetch listing
     $row = self::vacancyListDisplay();
     $output = '';
     $output .= '(function() {';
     $output .= file_get_contents("{$civicrm_root}packages/backbone/lodash.compat.min.js");
     //Add js file
     $templateDir = array("{$civicrm_root}packages/jquery/", "{$civicrm_root}packages/jquery/jquery-ui/js/");
     foreach ($templateDir as $templateDir) {
         $files = (array) glob($templateDir . '*.min.js', GLOB_BRACE);
         foreach ($files as $file) {
             $output .= file_get_contents($file);
         }
     }
     //Add css files
     $scan = scandir("{$civicrm_root}packages/jquery/jquery-ui/css/theme/");
     foreach ($scan as $file) {
         if (!is_dir("{$civicrm_root}packages/jquery/jquery-ui/css/theme/{$file}")) {
             $output .= "var link = document.createElement('link');\n        link.rel  = 'stylesheet';\n        link.type = 'text/css';\n        link.href = '{$base_url}/sites/all/modules/civicrm/packages/jquery/jquery-ui/css/theme/{$file}';\n        link.media = 'all';\n        document.getElementsByTagName('head')[0].appendChild(link);";
         }
     }
     //Add template
     $output .= "var \$ = jQuery.noConflict();var c_ = _.noConflict();c_.templateSettings.variable = 'rc';";
     $output .= CRM_Core_Smarty::singleton()->fetch('CRM/HRRecruitment/Page/WidgetJs.tpl');
     $output .= "document.write('<div id=\\'vacancyPublicList\\'></div>');\n      var div = document.getElementById('vacancyPublicList');\n      div.innerHTML = listTemplate({$row});\n      document.write('<div id=\\'vacancyListDialog\\'></div>');";
     //Dialog box to display vacancy information
     $output .= '$(".hr-job-position-link").bind("click",function(e){
   e.preventDefault();
   var infourl = $(this).attr("href") + "&callback=?";
   $.getJSON(infourl).done(function(result) {
     c_.templateSettings.variable = \'rc\';
     $("#vacancyListDialog").html(infoTemplate(result));
     $("#vacancyListDialog").dialog({
       modal: true,
       width: 600,
       title: result.position,
       buttons: [
         {
           text: result.applyButton,
           click: function () { window.location = result.apply; }
         },
         {
           text: result.close,
           click: function () { $(this).dialog("close"); }
         }
       ]
     });
   });
 });';
     $output .= '})();';
     header('Content-type: text/javascript');
     echo $output;
     exit;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:58,代码来源:WidgetJs.php

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

示例15: generateXML

 function generateXML($id = null)
 {
     $template = CRM_Core_Smarty::singleton();
     if ($id) {
         $this->id = $id;
     }
     if (empty($this->id)) {
         CRM_Core_Error::fatal("missing id of the transaction group");
     }
     $r = array();
     $this->total = 0;
     $this->nbtransactions = 0;
     $group = civicrm_api("SepaTransactionGroup", "getsingle", array("sequential" => 1, "version" => 3, "id" => $this->id));
     $creditor_id = $group["sdd_creditor_id"];
     $template->assign("group", $group);
     $creditor = civicrm_api("SepaCreditor", "getsingle", array("sequential" => 1, "version" => 3, "id" => $creditor_id));
     $template->assign("creditor", $creditor);
     $this->fileFormat = CRM_Core_OptionGroup::getValue('sepa_file_format', $creditor['sepa_file_format_id'], 'value', 'Integer', 'name');
     $this->fileFormat = CRM_Utils_SepaOptionGroupTools::sanitizeFileFormat($this->fileFormat);
     $template->assign("fileFormat", $this->fileFormat);
     $queryParams = array(1 => array($this->id, 'Positive'));
     $query = "\n      SELECT\n        c.id,\n        civicrm_contact.display_name,\n        invoice_id,\n        currency,\n        total_amount,\n        receive_date,\n        contribution_recur_id,\n        contribution_status_id,\n        mandate.*\n      FROM civicrm_contribution AS c\n      JOIN civicrm_sdd_contribution_txgroup AS g ON g.contribution_id=c.id\n      JOIN civicrm_sdd_mandate AS mandate ON mandate.id = IF(c.contribution_recur_id IS NOT NULL,\n        (SELECT id FROM civicrm_sdd_mandate WHERE entity_table = 'civicrm_contribution_recur' AND entity_id = c.contribution_recur_id),\n        (SELECT id FROM civicrm_sdd_mandate WHERE entity_table = 'civicrm_contribution' AND entity_id = c.id)\n      )\n      JOIN civicrm_contact ON c.contact_id = civicrm_contact.id\n      WHERE g.txgroup_id = %1\n        AND contribution_status_id != 3\n        AND mandate.is_enabled = true\n    ";
     //and not cancelled
     $contrib = CRM_Core_DAO::executeQuery($query, $queryParams);
     setlocale(LC_CTYPE, 'en_US.utf8');
     //dear dear, it might work, but seems to be highly dependant of the system running it, without any way to know what is available, or if the setting was done properly #phpeature
     while ($contrib->fetch()) {
         $t = $contrib->toArray();
         $t["iban"] = str_replace(array(' ', '-'), '', $t["iban"]);
         // try to convert the name into a more acceptable format
         if (function_exists("iconv")) {
             $t["display_name"] = iconv("UTF-8", "ASCII//TRANSLIT", $t["display_name"]);
             //french banks like utf8 as long as it's ascii7 only
         }
         // ...but to be sure, replace any remainig illegit characters with '?'
         $t["display_name"] = preg_replace("/[^ 0-9a-zA-Z':?,\\-(+.)\\/\"]/", '?', $t["display_name"]);
         // create an individual transaction message
         $t["message"] = CRM_Sepa_Logic_Settings::getTransactionMessage($t, $creditor);
         $r[] = $t;
         if ($creditor_id == null) {
             $creditor_id = $contrib->creditor_id;
         } elseif ($contrib->creditor_id == null) {
             // it shouldn't happen.
             $contrib->creditor_id = $creditor_id;
         } elseif ($creditor_id != $contrib->creditor_id) {
             CRM_Core_Error::fatal("mixed creditors ({$creditor_id} != {$contrib->creditor_id}) in the group - contribution {$contrib->id}");
             //to fix the mandate: update civicrm_sdd_mandate set creditor_id=1;
         }
         $this->total += $contrib->total_amount;
         $this->nbtransactions++;
     }
     $template->assign("total", $this->total);
     $template->assign("nbtransactions", $this->nbtransactions);
     $template->assign("contributions", $r);
     return $template->fetch('../formats/' . $this->fileFormat . '/transaction-details.tpl');
 }
开发者ID:FundingWorks,项目名称:org.project60.sepa,代码行数:56,代码来源:SEPATransactionGroup.php


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