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 * Determine the location of the CMS root.
93 * @return string|NULL local file system path to CMS root, or NULL if it cannot be determined
95 function cmsRootPath() {
100 * Get user login URL for hosting CMS (method declared in each CMS system class)
102 * @param string $destination - if present, add destination to querystring (works for Drupal only)
104 * @return string - loginURL for the current CMS
107 public abstract function getLoginURL($destination = '');
110 * Determine the native ID of the CMS user
115 function getUfId($username) {
116 $className = get_class($this);
117 throw new CRM_Core_Exception("Not implemented: {$className}->getUfId");
121 * Set a init session with user object
123 * @param array $data array with user specific data
127 function setUserSession($data) {
128 list($userID, $ufID) = $data;
129 $session = CRM_Core_Session
::singleton();
130 $session->set('ufID', $ufID);
131 $session->set('userID', $userID);
135 * Reset any system caches that may be required for proper CiviCRM
143 * Return default Site Settings
144 * @return array array
145 * - $url, (Joomla - non admin url)
149 function getDefaultSiteSettings($dir) {
150 $config = CRM_Core_Config
::singleton();
151 $url = $config->userFrameworkBaseURL
;
152 return array($url, NULL, NULL);
156 * Perform any post login activities required by the CMS -
157 * e.g. for drupal: records a watchdog message about the new session, saves the login timestamp,
158 * calls hook_user op 'login' and generates a new session.
160 * @param array params
162 * FIXME: Document values accepted/required by $params
164 function userLoginFinalize($params = array()){