4 * Base class for UF system integrations
6 abstract class CRM_Utils_System_Base
{
7 var $is_drupal = FALSE;
8 var $is_joomla = FALSE;
9 var $is_wordpress = FALSE;
12 * Does the CMS allow CMS forms to be extended by hooks
14 var $supports_form_extensions = FALSE;
17 * if we are using a theming system, invoke theme, else just print the
20 * @param string $content the content that will be themed
21 * @param boolean $print are we displaying to the screen or bypassing theming?
22 * @param boolean $maintenance for maintenance mode
24 * @return void prints content on stdout
27 function theme(&$content, $print = FALSE, $maintenance = FALSE) {
30 // TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
31 // but the parts should be copied into cleaner subclass implementations
32 if (function_exists('theme') && !$print) {
34 drupal_set_breadcrumb('');
35 drupal_maintenance_theme();
36 if ($region = CRM_Core_Region
::instance('html-header', FALSE)) {
37 CRM_Utils_System
::addHTMLHead($region->render(''));
39 print theme('maintenance_page', array('content' => $content));
42 $ret = TRUE; // TODO: Figure out why D7 returns but everyone else prints
46 $config = &CRM_Core_Config
::singleton();
48 $config->userFramework
== 'WordPress'
51 require_once (ABSPATH
. 'wp-admin/admin-header.php');
54 // FIX ME: we need to figure out to replace civicrm content on the frontend pages
66 function getDefaultBlockLocation() {
70 function getVersion() {
75 * Format the url as per language Negotiation.
79 * @return string $url, formatted url.
82 function languageNegotiationURL(
84 $addLanguagePart = TRUE,
85 $removeLanguagePart = FALSE
91 * Currently this is just helping out the test class as defaults is calling it - maybe move fix to defaults
93 function cmsRootPath() {
97 * Get user login URL for hosting CMS (method declared in each CMS system class)
99 * @param string $destination - if present, add destination to querystring (works for Drupal only)
101 * @return string - loginURL for the current CMS
104 public abstract function getLoginURL($destination = '');
107 * Set a init session with user object
109 * @param array $data array with user specific data
113 function setUserSession($data) {
114 list($userID, $ufID) = $data;
115 $session = CRM_Core_Session
::singleton();
116 $session->set('ufID', $ufID);
117 $session->set('userID', $userID);
121 * Reset any system caches that may be required for proper CiviCRM
129 * Perform any post login activities required by the CMS -
130 * e.g. for drupal: records a watchdog message about the new session, saves the login timestamp,
131 * calls hook_user op 'login' and generates a new session.
133 * @param array params
135 * FIXME: Document values accepted/required by $params
137 function userLoginFinalize($params = array()){