*/
var $supports_form_extensions = FALSE;
+ /**
+ * Append an additional breadcrumb tag to the existing breadcrumb
+ *
+ * @param array $breadCrumbs
+ */
+ public function appendBreadCrumb($breadCrumbs) {
+ }
+
+ /**
+ * Reset an additional breadcrumb tag to the existing breadcrumb
+ */
+ public function resetBreadCrumb() {
+ }
+
+ /**
+ * Append a string to the head of the html file
+ *
+ * @param string $head
+ * The new string to be appended.
+ */
+ public function addHTMLHead($head) {
+ }
+
+ /**
+ * Rewrite various system urls to https
+ */
+ public function mapConfigToSSL() {
+ // dont need to do anything, let CMS handle their own switch to SSL
+ }
+
+ /**
+ * Figure out the post url for QuickForm
+ *
+ * @param string $action
+ * The default url if one is pre-specified.
+ *
+ * @return string
+ * The url to post the form.
+ */
+ public function postURL($action) {
+ $config = CRM_Core_Config::singleton();
+ if (!empty($action)) {
+ return $action;
+ }
+
+ return $this->url(CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET),
+ NULL, TRUE, NULL, FALSE
+ );
+ }
+
+ /**
+ * Generate the url string to a CiviCRM path.
+ *
+ * @param string $path
+ * The path being linked to, such as "civicrm/add".
+ * @param string $query
+ * A query string to append to the link.
+ * @param bool $absolute
+ * Whether to force the output to be an absolute link (beginning with http).
+ * Useful for links that will be displayed outside the site, such as in an RSS feed.
+ * @param string $fragment
+ * A fragment identifier (named anchor) to append to the link.
+ * @param bool $htmlize
+ * Whether to encode special html characters such as &.
+ * @param bool $frontend
+ * This link should be to the CMS front end (applies to WP & Joomla).
+ * @param bool $forceBackend
+ * This link should be to the CMS back end (applies to WP & Joomla).
+ *
+ * @return string
+ */
+ public function url(
+ $path = NULL,
+ $query = NULL,
+ $absolute = FALSE,
+ $fragment = NULL,
+ $htmlize = TRUE,
+ $frontend = FALSE,
+ $forceBackend = FALSE
+ ) {
+ return NULL;
+ }
+
+ /**
+ * Authenticate the user against the CMS db
+ *
+ * @param string $name
+ * The user name.
+ * @param string $password
+ * The password for the above user.
+ * @param bool $loadCMSBootstrap
+ * Load cms bootstrap?.
+ * @param string $realPath
+ * Filename of script
+ *
+ * @return array|bool
+ * [contactID, ufID, unique string] else false if no auth
+ */
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ return FALSE;
+ }
+
+ /**
+ * Set a message in the CMS to display to a user
+ *
+ * @param string $message
+ * The message to set.
+ */
+ public function setMessage($message) {
+ }
+
+ /**
+ * Load user into session
+ *
+ * @param $user
+ *
+ * @return bool
+ */
+ public function loadUser($user) {
+ return TRUE;
+ }
+
+ /**
+ * Immediately stop script execution and display a 401 "Access Denied" page
+ */
+ public function permissionDenied() {
+ CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ }
+
+ /**
+ * Immediately stop script execution, log out the user and redirect to the home page
+ *
+ * @deprecated
+ * This function should be removed in favor of linking to the CMS's logout page
+ */
+ public function logout() {
+ }
+
+ /**
+ * Clear CMS caches related to the user registration/profile forms.
+ * Used when updating/embedding profiles on CMS user forms.
+ * @see CRM-3600
+ */
+ public function updateCategories() {
+ }
+
+ /**
+ * Get the locale set in the CMS
+ *
+ * @return string|null
+ * Locale or null for none
+ */
+ public function getUFLocale() {
+ return NULL;
+ }
+
/**
* If we are using a theming system, invoke theme, else just print the
* content
}
/**
+ * Get CMS Version
+ *
* @return string
*/
public function getVersion() {
return NULL;
}
+ /**
+ * Create a user in the CMS.
+ *
+ * @param array $params
+ * @param string $mail
+ * Email id for cms user.
+ *
+ * @return int|bool
+ * uid if user exists, false otherwise
+ */
+ public function createUser(&$params, $mail) {
+ return FALSE;
+ }
+
+ /**
+ * Update a user's email address in the CMS.
+ *
+ * @param int $ufID
+ * User ID in CMS.
+ * @param string $email
+ * Primary contact email address.
+ */
+ public function updateCMSName($ufID, $email) {
+ }
+
+ /**
+ * Check if user is logged in to the CMS.
+ *
+ * @return bool
+ */
+ public function isUserLoggedIn() {
+ return FALSE;
+ }
+
/**
* Get user login URL for hosting CMS (method declared in each CMS system class)
*
*/
public abstract function getLoginURL($destination = '');
+ /**
+ * Get the login destination string. When this is passed in the
+ * URL the user will be directed to it after filling in the CMS form
+ *
+ * @param CRM_Core_Form $form
+ * Form object representing the 'current' form - to which the user will be returned.
+ * @return string|NULL
+ * destination value for URL
+ */
+ public function getLoginDestination(&$form) {
+ return NULL;
+ }
+
/**
* Determine the native ID of the CMS user
*
* @param string $username
*
* @throws CRM_Core_Exception
- * @return;
*/
public function getUfId($username) {
$className = get_class($this);
// nullop by default
}
+ /**
+ * Add a script file
+ *
+ * Note: This function is not to be called directly
+ * @see CRM_Core_Region::render()
+ *
+ * @param $url : string, absolute path to file
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
+ *
+ * @return bool
+ * TRUE if we support this operation in this CMS, FALSE otherwise
+ */
+ public function addScriptUrl($url, $region) {
+ return FALSE;
+ }
+
+ /**
+ * Add an inline script
+ *
+ * Note: This function is not to be called directly
+ * @see CRM_Core_Region::render()
+ *
+ * @param $code : string, javascript code
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
+ *
+ * @return bool
+ * TRUE if we support this operation in this CMS, FALSE otherwise
+ */
+ public function addScript($code, $region) {
+ return FALSE;
+ }
+
+ /**
+ * Add a css file
+ *
+ * Note: This function is not to be called directly
+ * @see CRM_Core_Region::render()
+ *
+ * @param $url : string, absolute path to file
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
+ *
+ * @return bool
+ * TRUE if we support this operation in this CMS, FALSE otherwise
+ */
+ public function addStyleUrl($url, $region) {
+ return FALSE;
+ }
+
+ /**
+ * Add an inline style
+ *
+ * Note: This function is not to be called directly
+ * @see CRM_Core_Region::render()
+ *
+ * @param $code : string, css code
+ * @param string $region
+ * location within the document: 'html-header', 'page-header', 'page-footer'.
+ *
+ * @return bool
+ * TRUE if we support this operation in this CMS, FALSE otherwise
+ */
+ public function addStyle($code, $region) {
+ return FALSE;
+ }
+
+ /**
+ * Sets the title of the page
+ *
+ * @param string $title
+ * Title to set in html header
+ * @param string|null $pageTitle
+ * Title to set in html body (if different)
+ */
+ public function setTitle($title, $pageTitle = NULL) {
+ }
+
/**
* Return default Site Settings
*
}
/**
- * Over-ridable function to get timezone as a string eg.
- *
+ * Get timezone as a string
* @return string
- * Time zone, e.g. 'America/Los_Angeles'
+ * Timezone string e.g. 'America/Los_Angeles'
*/
public function getTimeZoneString() {
return date_default_timezone_get();
* $uniqueIdentifer Unique identifier from the user Framework system
*/
public function getUniqueIdentifierFromUserObject($user) {
+ return NULL;
}
/**
* Get User ID from UserFramework system (CMS)
* @param object $user
* Object as described by the User Framework.
- * @return mixed
- * <NULL, number>
+ * @return null|int
*/
public function getUserIDFromUserObject($user) {
+ return NULL;
}
/**
* Get currently logged in user uf id.
*
- * @return;
- * $userID logged in user uf id.
+ * @return int|null
+ * logged in user uf id.
*/
public function getLoggedInUfID() {
+ return NULL;
}
/**
* Get currently logged in user unique identifier - this tends to be the email address or user name.
*
- * @return;
+ * @return string|null
* logged in user unique identifier
*/
public function getLoggedInUniqueIdentifier() {
+ return NULL;
}
/**
* @param int $contactID
* Contact ID.
*
- * @return string
+ * @return string|null
*/
public function getUserRecordUrl($contactID) {
return NULL;
/**
* Log error to CMS
+ *
+ * $param string $message
*/
public function logger($message) {
-
}
/**
* Append to coreResourcesList
+ *
+ * @param array $list
*/
public function appendCoreResources(&$list) {
}
class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase {
/**
- * Create a user in Drupal.
- *
- * @param array $params
- * @param string $mail
- * Email id for cms user.
- *
- * @return int|bool
- * uid if user exists, false otherwise
+ * @inheritDoc
*/
public function createUser(&$params, $mail) {
$form_state = form_state_defaults();
}
/**
- * Change user name in host CMS
- *
- * @param int $ufID
- * User ID in CMS
- * @param string $ufName
- * User name
+ * @inheritDoc
*/
public function updateCMSName($ufID, $ufName) {
// CRM-5555
}
/**
- * Get the drupal destination string. When this is passed in the
- * URL the user will be directed to it after filling in the drupal form
- *
- * @param CRM_Core_Form $form
- * Form object representing the 'current' form - to which the user will be returned.
- * @return null|string
- * destination value for URL
- */
- public function getLoginDestination(&$form) {
- $args = NULL;
-
- $id = $form->get('id');
- if ($id) {
- $args .= "&id=$id";
- }
- else {
- $gid = $form->get('gid');
- if ($gid) {
- $args .= "&gid=$gid";
- }
- else {
- // Setup Personal Campaign Page link uses pageId
- $pageId = $form->get('pageId');
- if ($pageId) {
- $component = $form->get('component');
- $args .= "&pageId=$pageId&component=$component&action=add";
- }
- }
- }
-
- $destination = NULL;
- if ($args) {
- // append destination so user is returned to form they came from after login
- $destination = CRM_Utils_System::currentPath() . '?reset=1' . $args;
- }
- return $destination;
- }
-
- /**
- * Get user login URL for hosting CMS (method declared in each CMS system class)
- *
- * @param string $destination
- * If present, add destination to querystring (works for Drupal only).
- *
- * @return string
- * loginURL for the current CMS
+ * @inheritDoc
*/
public function getLoginURL($destination = '') {
$query = $destination ? array('destination' => $destination) : array();
return url('user', array('query' => $query));
}
-
/**
- * Sets the title of the page
- *
- * @param string $title
- * @param null $pageTitle
- *
- * @paqram string $pageTitle
- *
- * @return void
+ * @inheritDoc
*/
public function setTitle($title, $pageTitle = NULL) {
if (arg(0) == 'civicrm') {
}
/**
- * Append an additional breadcrumb tag to the existing breadcrumb
- *
- * @param array $breadCrumbs
- * @internal param string $title
- * @internal param string $url
- *
- * @return void
+ * @inheritDoc
*/
public function appendBreadCrumb($breadCrumbs) {
$breadCrumb = drupal_get_breadcrumb();
}
/**
- * Reset an additional breadcrumb tag to the existing breadcrumb
- *
- * @return void
+ * @inheritDoc
*/
public function resetBreadCrumb() {
$bc = array();
}
/**
- * Append a string to the head of the html file
- *
- * @param string $header
- * The new string to be appended.
- *
- * @return void
+ * @inheritDoc
*/
public function addHTMLHead($header) {
static $count = 0;
}
/**
- * Add a script file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addScriptUrl($url, $region) {
$params = array('group' => JS_LIBRARY, 'weight' => 10);
}
/**
- * Add an inline script
- *
- * @param $code : string, javascript code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addScript($code, $region) {
$params = array('type' => 'inline', 'group' => JS_LIBRARY, 'weight' => 10);
}
/**
- * Add a css file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addStyleUrl($url, $region) {
if ($region != 'html-header') {
}
/**
- * Add an inline style
- *
- * @param $code : string, css code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addStyle($code, $region) {
if ($region != 'html-header') {
}
/**
- * Rewrite various system urls to https
- *
- * @return void
+ * @inheritDoc
*/
public function mapConfigToSSL() {
global $base_url;
}
/**
- * Figure out the post url for the form
- *
- * @param mix $action
- * The default action if one is pre-specified.
- *
- * @return string
- * the url to post the form
- */
- public function postURL($action) {
- if (!empty($action)) {
- return $action;
- }
-
- return $this->url($_GET['q']);
- }
-
-
- /**
- * Authenticate the user against the drupal db
- *
- * @param string $name
- * The user name.
- * @param string $password
- * The password for the above user name.
- * @param bool $loadCMSBootstrap
- * Load cms bootstrap?.
- * @param NULL|string $realPath filename of script
- *
- * @return mixed false if no auth array(contactID, ufID, unique string ) if success
+ * @inheritDoc
*/
- public static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
require_once 'DB.php';
$config = CRM_Core_Config::singleton();
}
/**
- * Load user into session
- *
- * @param string $username
- *
- * @return bool
+ * @inheritDoc
*/
public function loadUser($username) {
global $user;
}
/**
- * Set a message in the UF to display to a user
- *
- * @param string $message
- * The message to set.
- */
- public function setMessage($message) {
- drupal_set_message($message);
- }
-
- /**
- * @return mixed
+ * @inheritDoc
*/
public function logout() {
module_load_include('inc', 'user', 'user.pages');
return user_logout();
}
- public function updateCategories() {
- // copied this from profile.module. Seems a bit inefficient, but i dont know a better way
- // CRM-3600
- cache_clear_all();
- menu_rebuild();
- }
-
/**
* Get the default location for CiviCRM blocks
*
return 'sidebar_first';
}
- /**
- * Get the locale set in the hosting CMS
- *
- * @return string
- * with the locale or null for none
- */
- public function getUFLocale() {
- // return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
- // (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
- // sometimes for CLI based on order called, this might not be set and/or empty
- global $language;
-
- if (empty($language)) {
- return NULL;
- }
-
- if ($language->language == 'zh-hans') {
- return 'zh_CN';
- }
-
- if ($language->language == 'zh-hant') {
- return 'zh_TW';
- }
-
- if (preg_match('/^.._..$/', $language->language)) {
- return $language->language;
- }
-
- return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2));
- }
-
- /**
- * @return string
- */
- public function getVersion() {
- return defined('VERSION') ? VERSION : 'Unknown';
- }
-
/**
* Load drupal bootstrap
*
}
/**
- * Check is user logged in.
- *
- * @return bool
+ * @inheritDoc
*/
public function isUserLoggedIn() {
$isloggedIn = FALSE;
}
/**
- * Get currently logged in user uf id.
- *
- * @return int
- * $userID logged in user uf id.
+ * @inheritDoc
*/
public function getLoggedInUfID() {
$ufID = NULL;
}
/**
- * Format the url as per language Negotiation.
- *
- * @param string $url
- *
- * @param bool $addLanguagePart
- * @param bool $removeLanguagePart
- *
- * @return string
- * , formatted url.
+ * @inheritDoc
*/
public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
}
/**
- * Over-ridable function to get timezone as a string eg.
- * @return string
- * Timezone e.g. 'America/Los_Angeles'
+ * @inheritDoc
*/
public function getTimeZoneString() {
global $user;
return $timezone;
}
- /**
- * Reset any system caches that may be required for proper CiviCRM
- * integration.
- */
- public function flush() {
- drupal_flush_all_caches();
- }
-
}
}
/**
- * Create a user in Drupal.
- *
- * @param array $params
- * @param string $mail
- * Email id for cms user.
- *
- * @return int|bool
- * uid if user exists, false otherwise
+ * @inheritDoc
*/
public function createUser(&$params, $mail) {
$form_state = array();
}
/**
- * Change user name in host CMS
- *
- * @param int $ufID User ID in CMS
- * @param string $ufName User name
+ * @inheritDoc
*/
public function updateCMSName($ufID, $ufName) {
// CRM-5555
}
/**
- * Get the drupal destination string. When this is passed in the
- * URL the user will be directed to it after filling in the drupal form
- *
- * @param CRM_Core_Form $form
- * Form object representing the 'current' form - to which the user will be returned.
- * @return string
- * destination value for URL
- */
- public function getLoginDestination(&$form) {
- $args = NULL;
-
- $id = $form->get('id');
- if ($id) {
- $args .= "&id=$id";
- }
- else {
- $gid = $form->get('gid');
- if ($gid) {
- $args .= "&gid=$gid";
- }
- else {
- // Setup Personal Campaign Page link uses pageId
- $pageId = $form->get('pageId');
- if ($pageId) {
- $component = $form->get('component');
- $args .= "&pageId=$pageId&component=$component&action=add";
- }
- }
- }
-
- $destination = NULL;
- if ($args) {
- // append destination so user is returned to form they came from after login
- $destination = CRM_Utils_System::currentPath() . '?reset=1' . $args;
- }
- return $destination;
- }
-
- /**
- * Sets the title of the page
- *
- * @param string $title
- * @param null $pageTitle
- *
- * @paqram string $pageTitle
- *
- * @return void
+ * @inheritDoc
*/
public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
}
/**
- * Append an additional breadcrumb tag to the existing breadcrumb
- *
- * @param $breadCrumbs
- *
- * @internal param string $title
- * @internal param string $url
- *
- * @return void
+ * @inheritDoc
*/
public function appendBreadCrumb($breadCrumbs) {
$breadCrumb = drupal_get_breadcrumb();
}
/**
- * Reset an additional breadcrumb tag to the existing breadcrumb
- *
- * @return void
+ * @inheritDoc
*/
public function resetBreadCrumb() {
$bc = array();
drupal_set_html_head($head);
}
- /**
- * Add a script file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addScriptUrl($url, $region) {
- // CRM-15450 - D6 doesn't order internal/external links correctly so we can't use drupal_add_js
- return FALSE;
- }
-
- /**
- * Add an inline script
- *
- * @param $code : string, javascript code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addScript($code, $region) {
- // CRM-15450 - ensure scripts are in correct order
- return FALSE;
- }
-
/**
* Add a css file
*
}
/**
- * Add an inline style
- *
- * @param $code : string, css code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addStyle($code, $region) {
- return FALSE;
- }
-
- /**
- * Rewrite various system urls to https
+ * @inheritDoc
*/
public function mapConfigToSSL() {
global $base_url;
}
/**
- * Figure out the post url for the form
- *
- * @param mix $action
- * The default action if one is pre-specified.
- *
- * @return string
- * the url to post the form
- */
- public function postURL($action) {
- if (!empty($action)) {
- return $action;
- }
-
- return $this->url($_GET['q']);
- }
-
- /**
- * Authenticate the user against the drupal db
- *
- * @param string $name
- * The user name.
- * @param string $password
- * The password for the above user name.
- * @param bool $loadCMSBootstrap
- * Load cms bootstrap?.
- * @param NULL|string $realPath filename of script
- *
- * @return array|bool
- * [contactID, ufID, uniqueString] if success else false if no auth
+ * @inheritDoc
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
//@todo this 'PEAR-y' stuff is only required when bookstrap is not being loaded which is rare
}
/**
- * Load user into session
+ * @inheritDoc
*/
public function loadUser($username) {
global $user;
}
/**
- * Set a message in the UF to display to a user
- *
- * @param string $message
- * The message to set.
- */
- public function setMessage($message) {
- drupal_set_message($message);
- }
-
- /**
- * @return mixed
+ * @inheritDoc
*/
public function logout() {
module_load_include('inc', 'user', 'user.pages');
return user_logout();
}
- public function updateCategories() {
- // copied this from profile.module. Seems a bit inefficient, but i dont know a better way
- // CRM-3600
- cache_clear_all();
- menu_rebuild();
- }
-
- /**
- * Get the locale set in the hosting CMS
- *
- * @return string
- * with the locale or null for none
- */
- public function getUFLocale() {
- // return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
- // (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
- // sometimes for CLI based on order called, this might not be set and/or empty
- global $language;
-
- if (empty($language)) {
- return NULL;
- }
-
- if ($language->language == 'zh-hans') {
- return 'zh_CN';
- }
-
- if ($language->language == 'zh-hant') {
- return 'zh_TW';
- }
-
- if (preg_match('/^.._..$/', $language->language)) {
- return $language->language;
- }
-
- return CRM_Core_I18n_PseudoConstant::longForShort(substr($language->language, 0, 2));
- }
-
- /**
- * @return string
- */
- public function getVersion() {
- return defined('VERSION') ? VERSION : 'Unknown';
- }
-
/**
* Load drupal bootstrap
*
}
/**
- * Check is user logged in.
- *
- * @return bool
+ * @inheritDoc
*/
public function isUserLoggedIn() {
$isloggedIn = FALSE;
}
/**
- * Get currently logged in user uf id.
- *
- * @return int
- * $userID logged in user uf id.
+ * @inheritDoc
*/
public function getLoggedInUfID() {
$ufID = NULL;
}
/**
- * Format the url as per language Negotiation.
- *
- * @param string $url
- *
- * @param bool $addLanguagePart
- * @param bool $removeLanguagePart
- *
- * @return string
- * , formatted url.
+ * @inheritDoc
*/
public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
}
/**
- * Get user login URL for hosting CMS (method declared in each CMS system class)
- *
- * @param string $destination
- * If present, add destination to querystring (works for Drupal only).
- *
- * @return string
- * loginURL for the current CMS
+ * @inheritDoc
*/
public function getLoginURL($destination = '') {
$config = CRM_Core_Config::singleton();
}
/**
- * Over-ridable function to get timezone as a string eg.
- * @return string
- * Timezone e.g. 'America/Los_Angeles'
+ * @inheritDoc
*/
public function getTimeZoneString() {
global $user;
return $timezone;
}
-
- /**
- * Reset any system caches that may be required for proper CiviCRM
- * integration.
- */
- public function flush() {
- drupal_flush_all_caches();
- }
-
}
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
/**
- * Create a user in Drupal.
- *
- * @param array $params
- * @param string $mail
- * Email id for cms user.
- *
- * @return int|bool
- * uid if user exists, false otherwise
+ * @inheritDoc
*/
public function createUser(&$params, $mail) {
$user = \Drupal::currentUser();
}
/**
- * Update the Drupal user's email address.
- *
- * @param int $ufID
- * User ID in CMS.
- * @param string $email
- * Primary contact email address.
+ * @inheritDoc
*/
public function updateCMSName($ufID, $email) {
$user = user_load($ufID);
}
/**
- * Get the drupal destination string. When this is passed in the
- * URL the user will be directed to it after filling in the drupal form
- *
- * @param CRM_Core_Form $form
- * Form object representing the 'current' form - to which the user will be returned.
- * @return string
- * destination value for URL
- */
- public function getLoginDestination(&$form) {
- $args = NULL;
-
- $id = $form->get('id');
- if ($id) {
- $args .= "&id=$id";
- }
- else {
- $gid = $form->get('gid');
- if ($gid) {
- $args .= "&gid=$gid";
- }
- else {
- // Setup Personal Campaign Page link uses pageId
- $pageId = $form->get('pageId');
- if ($pageId) {
- $component = $form->get('component');
- $args .= "&pageId=$pageId&component=$component&action=add";
- }
- }
- }
-
- $destination = NULL;
- if ($args) {
- // append destination so user is returned to form they came from after login
- $destination = CRM_Utils_System::currentPath() . '?reset=1' . $args;
- }
- return $destination;
- }
-
- /**
- * Get user login URL for hosting CMS (method declared in each CMS system class)
- *
- * @param string $destination
- * If present, add destination to querystring (works for Drupal only).
- *
- * @return string
- * loginURL for the current CMS
+ * @inheritDoc
*/
public function getLoginURL($destination = '') {
$query = $destination ? array('destination' => $destination) : array();
return \Drupal::url('user.page', array(), array('query' => $query));
}
-
/**
- * Sets the title of the page
- *
- * @param string $title
- * @param string $pageTitle
- *
- * @return void
+ * @inheritDoc
*/
public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
}
/**
- * Append an additional breadcrumb tag to the existing breadcrumb
- *
- * @param $breadcrumbs
- *
- * @internal param string $title
- * @internal param string $url
- *
- * @return void
+ * @inheritDoc
*/
public function appendBreadCrumb($breadcrumbs) {
$civicrmPageState = \Drupal::service('civicrm.page_state');
}
/**
- * Reset an additional breadcrumb tag to the existing breadcrumb
- *
- * @return void
+ * @inheritDoc
*/
public function resetBreadCrumb() {
\Drupal::service('civicrm.page_state')->resetBreadcrumbs();
}
/**
- * Append a string to the head of the html file
- *
- * @param string $header
- * The new string to be appended.
- *
- * @return void
+ * @inheritDoc
*/
public function addHTMLHead($header) {
\Drupal::service('civicrm.page_state')->addHtmlHeader($header);
}
/**
- * Add a script file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addScriptUrl($url, $region) {
$options = array('group' => JS_LIBRARY, 'weight' => 10);
}
/**
- * Add an inline script
- *
- * @param $code : string, javascript code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addScript($code, $region) {
$options = array('type' => 'inline', 'group' => JS_LIBRARY, 'weight' => 10);
}
/**
- * Add a css file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addStyleUrl($url, $region) {
if ($region != 'html-header') {
}
/**
- * Add an inline style
- *
- * @param $code : string, css code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addStyle($code, $region) {
if ($region != 'html-header') {
* This seems to be a legacy function. We assume all resources are within the drupal
* directory and always return TRUE. As well, we clean up the $url.
*
+ * FIXME: This is not a legacy function and the above is not a safe assumption.
+ * External urls are allowed by CRM_Core_Resources and this needs to return the correct value.
+ *
* @param $url
*
* @return bool
if (($pos = strpos($url, '?')) !== FALSE) {
$url = substr($url, 0, $pos);
}
-
+ // FIXME: Should not unconditionally return true
return TRUE;
}
/**
- * Rewrite various system urls to https
- *
* This function does nothing in Drupal 8. Changes to the base_url should be made
* in settings.php directly.
- *
- * @return void
*/
public function mapConfigToSSL() {
}
/**
- * @param string $path
- * The base path (eg. civicrm/search/contact).
- * @param string $query
- * The query string (eg. reset=1&cid=66) but html encoded(?) (optional).
- * @param bool $absolute
- * Produce an absolute including domain and protocol (optional).
- * @param string $fragment
- * A named anchor (optional).
- * @param bool $htmlize
- * Produce a html encoded url (optional).
- * @param bool $frontend
- * A joomla hack (unused).
- * @param bool $forceBackend
- * A joomla jack (unused).
- * @return string
+ * @inheritDoc
*/
- public function url($path = '', $query = '', $absolute = FALSE, $fragment = '', $htmlize = FALSE, $frontend = FALSE, $forceBackend = FALSE) {
+ public function url(
+ $path = '',
+ $query = '',
+ $absolute = FALSE,
+ $fragment = NULL,
+ $htmlize = TRUE,
+ $frontend = FALSE,
+ $forceBackend = FALSE
+ ) {
$query = html_entity_decode($query);
$url = \Drupal\civicrm\CivicrmHelper::parseURL("{$path}?{$query}");
return $url;
}
-
/**
- * Authenticate the user against the drupal db
- *
- * @param string $name
- * The user name.
- * @param string $password
- * The password for the above user name.
- * @param bool $loadCMSBootstrap
- * Load cms bootstrap?.
- * @param NULL|string $realPath filename of script
- *
- * @return array|bool
- * [contactID, ufID, uniqueString] if success else false if no auth
- *
- * This always bootstraps Drupal
+ * @inheritDoc
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
(new CRM_Utils_System_Drupal8())->loadBootStrap(array(), FALSE);
}
/**
- * Load user into session
+ * @inheritDoc
*/
public function loadUser($username) {
$user = user_load_by_name($username);
}
/**
- * Set a message in the UF to display to a user
- *
- * @param string $message
- * The message to set.
+ * @inheritDoc
*/
- public function setMessage($message) {
- drupal_set_message($message);
- }
-
public function permissionDenied() {
\Drupal::service('civicrm.page_state')->setAccessDenied();
}
}
/**
- * Check if user is logged in.
- *
- * @return bool
+ * @inheritDoc
*/
public function isUserLoggedIn() {
return \Drupal::currentUser()->isAuthenticated();
}
/**
- * Get currently logged in user uf id.
- *
- * @return int
- * $userID logged in user uf id.
+ * @inheritDoc
*/
public function getLoggedInUfID() {
if ($id = \Drupal::currentUser()->id()) {
}
/**
- * Get the default location for CiviCRM blocks
- *
- * @return string
+ * @inheritDoc
*/
public function getDefaultBlockLocation() {
return 'sidebar_first';
}
/**
- * @param string $dir base civicrm directory
- * Return default Site Settings
- * @return array
- * array
- * - $url, (Joomla - non admin url)
- * - $siteName,
- * - $siteRoot
+ * @inheritDoc
*/
public function getDefaultSiteSettings($dir) {
$config = CRM_Core_Config::singleton();
/**
* Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url)
*
- * @param string $path
- * The path being linked to, such as "civicrm/add".
- * @param string $query
- * A query string to append to the link.
- * @param bool $absolute
- * Whether to force the output to be an absolute link (beginning with http:).
- * Useful for links that will be displayed outside the site, such as in an
- * RSS feed.
- * @param string $fragment
- * A fragment identifier (named anchor) to append to the link.
- * @param bool $htmlize
- * whether to convert to html eqivalant.
- * @param bool $frontend
- * a gross joomla hack.
- * @param bool $forceBackend
- * a gross joomla hack.
- *
- * @return string
- * an HTML string containing a link to the given path.
+ * @inheritDoc
*/
public function url(
- $path = NULL, $query = NULL, $absolute = FALSE,
- $fragment = NULL, $htmlize = TRUE,
- $frontend = FALSE, $forceBackend = FALSE
+ $path = NULL,
+ $query = NULL,
+ $absolute = FALSE,
+ $fragment = NULL,
+ $htmlize = TRUE,
+ $frontend = FALSE,
+ $forceBackend = FALSE
) {
$config = CRM_Core_Config::singleton();
$script = 'index.php';
}
/**
- * Get User ID from UserFramework system (Drupal)
- * @param object $user
- * Object as described by the CMS.
- * @return mixed
- * <NULL, number>
+ * @inheritDoc
*/
public function getUserIDFromUserObject($user) {
return !empty($user->uid) ? $user->uid : NULL;
}
/**
- * Get Unique Identifier from UserFramework system (CMS)
- * @param object $user
- * Object as described by the User Framework.
- * @return mixed
- * $uniqueIdentifer Unique identifier from the user Framework system
+ * @inheritDoc
+ */
+ public function setMessage($message) {
+ drupal_set_message($message);
+ }
+
+ /**
+ * @inheritDoc
*/
public function getUniqueIdentifierFromUserObject($user) {
return empty($user->mail) ? NULL : $user->mail;
}
/**
- * Get currently logged in user unique identifier - this tends to be the email address or user name.
- *
- * @return string
- * logged in user unique identifier
+ * @inheritDoc
*/
public function getLoggedInUniqueIdentifier() {
global $user;
}
/**
- * Action to take when access is not permitted
+ * @inheritDoc
*/
public function permissionDenied() {
drupal_access_denied();
}
/**
- * Get Url to view user record
- * @param int $contactID
- * Contact ID.
- *
- * @return string
+ * @inheritDoc
*/
public function getUserRecordUrl($contactID) {
$uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
}
/**
- * Is the current user permitted to add a user
- * @return bool
+ * @inheritDoc
*/
public function checkPermissionAddUser() {
- if (CRM_Core_Permission::check('administer users')) {
- return TRUE;
- }
+ return CRM_Core_Permission::check('administer users');
}
-
/**
- * Log error to CMS
+ * @inheritDoc
*/
public function logger($message) {
if (CRM_Core_Config::singleton()->userFrameworkLogging) {
}
/**
- * Flush css/js caches
+ * @inheritDoc
*/
public function clearResourceCache() {
_drupal_flush_css_js();
}
/**
- * Append to coreResourcesList
+ * Append Drupal js to coreResourcesList
*/
public function appendCoreResources(&$list) {
$list[] = 'js/crm.drupal.js';
}
/**
- * Reset any system caches that may be required for proper CiviCRM
- * integration.
+ * @inheritDoc
*/
public function flush() {
drupal_flush_all_caches();
}
/**
- * Format the url as per language Negotiation.
- *
- * @param string $url
- *
- * @return string
- * , formatted url.
+ * @inheritDoc
*/
public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
if (empty($url)) {
}
/**
- * GET CMS Version
- * @return string
+ * @inheritDoc
*/
public function getVersion() {
return defined('VERSION') ? VERSION : 'Unknown';
}
/**
+ * @inheritDoc
*/
public function updateCategories() {
- // copied this from profile.module. Seems a bit inefficient, but i dont know a better way
- // CRM-3600
+ // copied this from profile.module. Seems a bit inefficient, but i don't know a better way
cache_clear_all();
menu_rebuild();
}
/**
- * Get the locale set in the hosting CMS
- *
- * @return string
- * with the locale or null for none
+ * @inheritDoc
*/
public function getUFLocale() {
// return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
}
/**
- * Figure out the post url for the form
- *
- * @param mix $action
- * The default action if one is pre-specified.
- *
- * @return string
- * the url to post the form
+ * @inheritDoc
+ */
+ public function getLoginDestination(&$form) {
+ $args = NULL;
+
+ $id = $form->get('id');
+ if ($id) {
+ $args .= "&id=$id";
+ }
+ else {
+ $gid = $form->get('gid');
+ if ($gid) {
+ $args .= "&gid=$gid";
+ }
+ else {
+ // Setup Personal Campaign Page link uses pageId
+ $pageId = $form->get('pageId');
+ if ($pageId) {
+ $component = $form->get('component');
+ $args .= "&pageId=$pageId&component=$component&action=add";
+ }
+ }
+ }
+
+ $destination = NULL;
+ if ($args) {
+ // append destination so user is returned to form they came from after login
+ $destination = CRM_Utils_System::currentPath() . '?reset=1' . $args;
+ }
+ return $destination;
+ }
+
+ /**
+ * Fixme: Why are we overriding the parent function? Seems inconsistent.
+ * This version supplies slightly different params to $this->url (not absolute and html encoded) but why?
*/
public function postURL($action) {
if (!empty($action)) {
}
/**
- * Create a user of Joomla.
- *
- * @param array $params
- * @param string $mail
- * Email id for cms user.
- *
- * @return int|bool
- * uid if user exists, false otherwise
+ * @inheritDoc
*/
public function createUser(&$params, $mail) {
$baseDir = JPATH_SITE;
}
/**
- * Change user name in host CMS
- *
- * @param int $ufID
- * @param string $ufName User name
+ * @inheritDoc
*/
public function updateCMSName($ufID, $ufName) {
$ufID = CRM_Utils_Type::escape($ufID, 'Integer');
}
/**
- * Sets the title of the page
- *
- * @param string $title
- * Title to set.
- * @param string $pageTitle
- *
- * @return void
+ * @inheritDoc
*/
public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
}
/**
- * Append an additional breadcrumb tag to the existing breadcrumb
- *
- * @param $breadCrumbs
- *
- * @internal param string $title
- * @internal param string $url
- *
- * @return void
+ * @inheritDoc
*/
public function appendBreadCrumb($breadCrumbs) {
$template = CRM_Core_Smarty::singleton();
}
/**
- * Reset an additional breadcrumb tag to the existing breadcrumb
- *
- * @internal param string $bc the new breadcrumb to be appended
- *
- * @return void
+ * @inheritDoc
*/
public function resetBreadCrumb() {
}
/**
- * Append a string to the head of the html file
- *
- * @param null $string
- *
- * @internal param string $head the new string to be appended
- *
- * @return void
+ * @inheritDoc
*/
- public static function addHTMLHead($string = NULL) {
+ public function addHTMLHead($string = NULL) {
if ($string) {
$document = JFactory::getDocument();
$document->addCustomTag($string);
}
/**
- * Add a script file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addScriptUrl($url, $region) {
- return FALSE;
- }
-
- /**
- * Add an inline script
- *
- * @param $code : string, javascript code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addScript($code, $region) {
- return FALSE;
- }
-
- /**
- * Add a css file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addStyleUrl($url, $region) {
if ($region == 'html-header') {
}
/**
- * Add an inline style
- *
- * @param $code : string, css code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
+ * @inheritDoc
*/
public function addStyle($code, $region) {
if ($region == 'html-header') {
}
/**
- * Generate an internal CiviCRM URL
- *
- * @param string $path
- * The path being linked to, such as "civicrm/add".
- * @param string $query
- * A query string to append to the link.
- * @param bool $absolute
- * Whether to force the output to be an absolute link (beginning with http:).
- * Useful for links that will be displayed outside the site, such as in an
- * RSS feed.
- * @param string $fragment
- * A fragment identifier (named anchor) to append to the link.
- * @param bool $htmlize
- * whether to convert to html eqivalant.
- * @param bool $frontend
- * a gross joomla hack.
- *
- * @param bool $forceBackend
- *
- * @return string
- * an HTML string containing a link to the given path.
+ * @inheritDoc
*/
public function url(
- $path = NULL, $query = NULL, $absolute = TRUE,
- $fragment = NULL, $htmlize = TRUE,
- $frontend = FALSE, $forceBackend = FALSE
+ $path = NULL,
+ $query = NULL,
+ $absolute = FALSE,
+ $fragment = NULL,
+ $htmlize = TRUE,
+ $frontend = FALSE,
+ $forceBackend = FALSE
) {
$config = CRM_Core_Config::singleton();
$separator = $htmlize ? '&' : '&';
return $url;
}
- /**
- * Rewrite various system urls to https
- *
- * @return void
- * access public
- */
- public function mapConfigToSSL() {
- // dont need to do anything, let CMS handle their own switch to SSL
- }
-
- /**
- * Figure out the post url for the form
- *
- * @param $action
- * The default action if one is pre-specified.
- *
- * @return string
- * the url to post the form
- */
- public function postURL($action) {
- if (!empty($action)) {
- return $action;
- }
-
- return $this->url(CRM_Utils_Array::value('task', $_GET),
- NULL, TRUE, NULL, FALSE
- );
- }
-
/**
* Set the email address of the user
*
}
/**
- * Authenticate the user against the joomla db
- *
- * @param string $name
- * The user name.
- * @param string $password
- * The password for the above user name.
- * @param bool $loadCMSBootstrap
- * load cms bootstrap?.
- *
- * @return array|bool
- * [contactID, ufID, uniqueString] if success else false if no auth
+ * @inheritDoc
*/
- public function authenticate($name, $password, $loadCMSBootstrap = FALSE) {
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
require_once 'DB.php';
$config = CRM_Core_Config::singleton();
}
/**
- * Set a message in the UF to display to a user
- *
- * @param string $message
- * The message to set.
+ * FIXME: Do something
*/
public function setMessage($message) {
}
/**
- * @param $user
- *
- * @return bool
+ * FIXME: Do something
*/
public function loadUser($user) {
return TRUE;
}
+ /**
+ * FIXME: Use CMS-native approach
+ */
public function permissionDenied() {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
+ /**
+ * @inheritDoc
+ */
public function logout() {
session_destroy();
header("Location:index.php");
}
/**
- * Get the locale set in the hosting CMS
- *
- * @return string
- * the used locale or null for none
+ * @inheritDoc
*/
public function getUFLocale() {
if (defined('_JEXEC')) {
}
/**
- * @return string
+ * @inheritDoc
*/
public function getVersion() {
if (class_exists('JVersion')) {
}
/**
- * Check is user logged in.
- *
- * @return bool
+ * @inheritDoc
*/
public function isUserLoggedIn() {
$user = JFactory::getUser();
}
/**
- * Get currently logged in user uf id.
- *
- * @return int
- * logged in user uf id.
+ * @inheritDoc
*/
public function getLoggedInUfID() {
$user = JFactory::getUser();
}
/**
- * Get currently logged in user unique identifier - this tends to be the email address or user name.
- *
- * @return string
- * logged in user unique identifier
+ * @inheritDoc
*/
public function getLoggedInUniqueIdentifier() {
$user = JFactory::getUser();
}
/**
- * Get User ID from UserFramework system (Joomla)
- * @param object $user
- * Object as described by the CMS.
- * @return mixed
- * <NULL, number>
+ * @inheritDoc
*/
public function getUserIDFromUserObject($user) {
return !empty($user->id) ? $user->id : NULL;
}
/**
- * Get Unique Identifier from UserFramework system (CMS)
- * @param object $user
- * Object as described by the User Framework.
- * @return mixed
- * $uniqueIdentifer Unique identifier from the user Framework system
+ * @inheritDoc
*/
public function getUniqueIdentifierFromUserObject($user) {
return ($user->guest) ? NULL : $user->email;
}
/**
- * Get user login URL for hosting CMS (method declared in each CMS system class)
- *
- * @param string $destination
- * If present, add destination to querystring (works for Drupal only).
- *
- * @return string
- * loginURL for the current CMS
+ * @inheritDoc
*/
public function getLoginURL($destination = '') {
$config = CRM_Core_Config::singleton();
}
/**
- * @param CRM_Core_Form $form
+ * @inheritDoc
*/
public function getLoginDestination(&$form) {
$args = NULL;
}
/**
- * Return default Site Settings
- *
- * @param $dir
- *
- * @return array
- * array
- * - $url, (Joomla - non admin url)
- * - $siteName,
- * - $siteRoot
+ * @inheritDoc
*/
public function getDefaultSiteSettings($dir) {
$config = CRM_Core_Config::singleton();
}
/**
- * Get Url to view user record
- * @param int $contactID
- * Contact ID.
- *
- * @return string
+ * @inheritDoc
*/
public function getUserRecordUrl($contactID) {
$uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
}
/**
- * Is the current user permitted to add a user
- * @return bool
+ * @inheritDoc
*/
public function checkPermissionAddUser() {
if (JFactory::getUser()->authorise('core.create', 'com_users')) {
}
/**
- * Append to coreResourcesList
+ * Append Joomla js to coreResourcesList
*/
public function appendCoreResources(&$list) {
$list[] = 'js/crm.joomla.js';
static $uf = NULL;
static $ufClass = NULL;
- /**
- * Sets the title of the page
- *
- * @param string $title
- * Title for page.
- * @param $pageTitle
- *
- * @paqram string $pageTitle
- *
- * @return void
- */
- public function setTitle($title, $pageTitle) {
- return NULL;
- }
-
/**
* Given a permission string, check for access requirements
*
}
/**
- * Append an additional breadcrumb tag to the existing breadcrumb
- *
- * @param string $title
- * @param string $url
- *
- * @return void
- */
- public function appendBreadCrumb($title, $url) {
- return NULL;
- }
-
- /**
- * Append a string to the head of the html file
- *
- * @param string $head
- * The new string to be appended.
- *
- * @return void
- */
- public function addHTMLHead($head) {
- return NULL;
- }
-
- /**
- * Generate an internal CiviCRM URL
- *
- * @param string $path
- * The path being linked to, such as "civicrm/add".
- * @param string $query
- * A query string to append to the link.
- * @param bool $absolute
- * Whether to force the output to be an absolute link (beginning with http:).
- * Useful for links that will be displayed outside the site, such as in an
- * RSS feed.
- * @param string $fragment
- * A fragment identifier (named anchor) to append to the link.
- *
- * @return string
- * an HTML string containing a link to the given path.
+ * @inheritDoc
*/
public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
if (isset(self::$ufClass)) {
}
/**
- * Figure out the post url for the form
- *
- * @return string
- * the url to post the form
+ * FIXME: Can this override be removed in favor of the parent?
+ * @inheritDoc
*/
public function postURL($action) {
return NULL;
}
/**
- * Authenticate a user against the real UF
- *
- * @param string $name
- * Login name.
- * @param string $pass
- * Login password.
- *
- * @return array
- * Result array
+ * @inheritDoc
*/
- public function &authenticate($name, $pass) {
+ public function authenticate($name, $pass) {
if (isset(self::$ufClass)) {
$className = self::$ufClass;
$result =& $className::authenticate($name, $pass);
$config->userFrameworkClass = 'CRM_Utils_System_Soap';
}
- /**
- * Get the locale set in the hosting CMS
- *
- * @return null
- * as the language is set elsewhere
- */
- public function getUFLocale() {
- return NULL;
- }
-
/**
* Get user login URL for hosting CMS (method declared in each CMS system class)
*
* @param string $destination
- * If present, add destination to querystring (works for Drupal only).
*
* @throws Exception
- * @return;
- * loginURL for the current CMS
*/
public function getLoginURL($destination = '') {
throw new Exception("Method not implemented: getLoginURL");
*
* @return mixed
*/
- public static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$retVal = array(1, 1, 12345);
return $retVal;
}
}
/**
- * Sets the title of the page
- *
- * @param string $title
- * @param null $pageTitle
- *
- * @return void
+ * @inheritDoc
*/
public function setTitle($title, $pageTitle = NULL) {
if (!$pageTitle) {
$pageTitle = $title;
}
- // get civi-wordpress instance
- $civi = civi_wp();
-
- // do we have functionality provided by plugin version 4.6+ present?
- if (method_exists($civi, 'civicrm_context_get')) {
-
- // FIXME: Why is this global?
- global $civicrm_wp_title;
- $civicrm_wp_title = $title;
-
- // yes, set page title, depending on context
- $context = civi_wp()->civicrm_context_get();
- switch ($context) {
- case 'admin':
- case 'shortcode':
- $template = CRM_Core_Smarty::singleton();
- $template->assign('pageTitle', $pageTitle);
- }
-
- }
- elseif (civicrm_wp_in_civicrm()) {
-
- // legacy pre-4.6 behaviour
- global $civicrm_wp_title;
- $civicrm_wp_title = $title;
- $template = CRM_Core_Smarty::singleton();
- $template->assign('pageTitle', $pageTitle);
+ // FIXME: Why is this global?
+ global $civicrm_wp_title;
+ $civicrm_wp_title = $title;
+ // yes, set page title, depending on context
+ $context = civi_wp()->civicrm_context_get();
+ switch ($context) {
+ case 'admin':
+ case 'shortcode':
+ $template = CRM_Core_Smarty::singleton();
+ $template->assign('pageTitle', $pageTitle);
}
}
/**
- * Append an additional breadcrumb tag to the existing breadcrumb
- *
- * @param $breadCrumbs
- *
- * @internal param string $title
- * @internal param string $url
- *
- * @return void
+ * @inheritDoc
*/
public function appendBreadCrumb($breadCrumbs) {
$breadCrumb = wp_get_breadcrumb();
}
/**
- * Reset an additional breadcrumb tag to the existing breadcrumb
- *
- * @return void
+ * @inheritDoc
*/
public function resetBreadCrumb() {
$bc = array();
}
/**
- * Append a string to the head of the html file
- *
- * @param string $head
- * The new string to be appended.
- *
- * @return void
+ * @inheritDoc
*/
public function addHTMLHead($head) {
static $registered = FALSE;
));
}
+ /**
+ * WP action callback
+ */
public static function _showHTMLHead() {
$region = CRM_Core_Region::instance('wp_head', FALSE);
if ($region) {
}
/**
- * Add a script file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addScriptUrl($url, $region) {
- return FALSE;
- }
-
- /**
- * Add an inline script
- *
- * @param $code : string, javascript code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addScript($code, $region) {
- return FALSE;
- }
-
- /**
- * Add a css file
- *
- * @param $url : string, absolute path to file
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addStyleUrl($url, $region) {
- return FALSE;
- }
-
- /**
- * Add an inline style
- *
- * @param $code : string, css code
- * @param string $region
- * location within the document: 'html-header', 'page-header', 'page-footer'.
- *
- * Note: This function is not to be called directly
- * @see CRM_Core_Region::render()
- *
- * @return bool
- * TRUE if we support this operation in this CMS, FALSE otherwise
- */
- public function addStyle($code, $region) {
- return FALSE;
- }
-
- /**
- * Rewrite various system urls to https
- *
- * @return void
+ * @inheritDoc
*/
public function mapConfigToSSL() {
global $base_url;
}
/**
- * Figure out the post url for the form
- *
- * @param mix $action
- * The default action if one is pre-specified.
- *
- * @return string
- * the url to post the form
- */
- public function postURL($action) {
- if (!empty($action)) {
- return $action;
- }
-
- return $this->url($_GET['q'], NULL, TRUE, NULL, FALSE);
- }
-
- /**
- * Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url)
- *
- * @param string $path
- * The path being linked to, such as "civicrm/add".
- * @param string $query
- * A query string to append to the link.
- * @param bool $absolute
- * Whether to force the output to be an absolute link (beginning with http:).
- * Useful for links that will be displayed outside the site, such as in an
- * RSS feed.
- * @param string $fragment
- * A fragment identifier (named anchor) to append to the link.
- * @param bool $htmlize
- * whether to convert to html eqivalant.
- * @param bool $frontend
- * a gross joomla hack.
- *
- * @param bool $forceBackend
- *
- * @return string
- * an HTML string containing a link to the given path.
+ * @inheritDoc
*/
public function url(
$path = NULL,
}
/**
- * Authenticate the user against the wordpress db
- *
- * @param string $name
- * The user name.
- * @param string $password
- * The password for the above user name.
- *
- * @param bool $loadCMSBootstrap
- * @param null $realPath
- *
- * @return array|bool
- * [contactID, ufID, uniqueString] if success else false if no auth
+ * @inheritDoc
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$config = CRM_Core_Config::singleton();
return FALSE;
}
- // need to change this to make sure we matched only one row
+ // TODO: need to change this to make sure we matched only one row
CRM_Core_BAO_UFMatch::synchronizeUFMatch($user->data, $user->data->ID, $user->data->user_email, 'WordPress');
$contactID = CRM_Core_BAO_UFMatch::getContactId($user->data->ID);
}
/**
- * Set a message in the UF to display to a user
- *
- * @param string $message
- * The message to set.
- *
+ * FIXME: Do something
*/
public function setMessage($message) {
}
/**
- * @param $user
- *
- * @return bool
+ * FIXME: Do something
*/
public function loadUser($user) {
return TRUE;
}
+ /**
+ * FIXME: Use CMS-native approach
+ */
public function permissionDenied() {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
+ /**
+ * @inheritDoc
+ */
public function logout() {
// destroy session
if (session_id()) {
wp_redirect(wp_login_url());
}
- public function updateCategories() {
- }
-
/**
- * Get the locale set in the hosting CMS
- *
- * @return string
- * with the locale or null for none
+ * @inheritDoc
*/
public function getUFLocale() {
// WPML plugin
}
/**
- * @param array $params
- * @param $mail
- *
- * @return mixed
+ * @inheritDoc
*/
public function createUser(&$params, $mail) {
$user_data = array(
}
/**
- * Change user name in host CMS
- *
- * @param int $ufID
- * User ID in CMS.
- * @param string $ufName
- * User name.
+ * @inheritDoc
*/
public function updateCMSName($ufID, $ufName) {
// CRM-10620
}
/**
- * Check is user logged in.
- *
- * @return bool
+ * @inheritDoc
*/
public function isUserLoggedIn() {
$isloggedIn = FALSE;
}
/**
- * Get currently logged in user uf id.
- *
- * @return int
- * $userID logged in user uf id.
+ * @inheritDoc
*/
public function getLoggedInUfID() {
$ufID = NULL;
}
/**
- * Get currently logged in user unique identifier - this tends to be the email address or user name.
- *
- * @return string
- * logged in user unique identifier
+ * @inheritDoc
*/
public function getLoggedInUniqueIdentifier() {
$user = $this->getLoggedInUserObject();
}
/**
- * Get Unique Identifier from UserFramework system (CMS)
- * @param object $user
- * Object as described by the User Framework.
- * @return int|null
- * Unique identifier from the user Framework system
+ * @inheritDoc
*/
public function getUniqueIdentifierFromUserObject($user) {
return empty($user->user_email) ? NULL : $user->user_email;
}
/**
- * Get user login URL for hosting CMS (method declared in each CMS system class)
- *
- * @param string $destination
- * If present, add destination to querystring (works for Drupal only).
- *
- * @return string
- * loginURL for the current CMS
+ * @inheritDoc
*/
public function getLoginURL($destination = '') {
$config = CRM_Core_Config::singleton();
}
/**
- * @param CRM_Core_Form $form
+ * FIXME: Do something
*/
public function getLoginDestination(&$form) {
return NULL;
}
/**
- * Return the current WordPress version if relevant function exists
- *
- * @return string
- * version number
+ * @inheritDoc
*/
public function getVersion() {
if (function_exists('get_bloginfo')) {
}
/**
- * Get timezone as a string
- * @return string
- * Timezone e.g. 'America/Los_Angeles'
+ * @inheritDoc
*/
public function getTimeZoneString() {
return get_option('timezone_string');
}
/**
- * Get Url to view user record
- * @param int $contactID
- * Contact ID.
- *
- * @return string
+ * @inheritDoc
*/
public function getUserRecordUrl($contactID) {
$uid = CRM_Core_BAO_UFMatch::getUFId($contactID);