X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem%2FDrupalBase.php;h=a881144a69ec84bb3233467d7f92b759a8d1338e;hb=53cc5b88dfc2d12f529cdbd0be88511b90507047;hp=b0cff3e7c64c46b89dbdc0ba75cc327ef3073c00;hpb=7071b668e87e3eeda9ad5d6cf2fb71df35115806;p=civicrm-core.git diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index b0cff3e7c6..a881144a69 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -37,10 +37,23 @@ * Drupal specific stuff goes here */ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { + + /** + * Does this CMS / UF support a CMS specific logging mechanism? + * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions + * @var bool + */ + var $supports_UF_Logging = TRUE; /** * */ function __construct() { + /** + * deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific + * functions and leave the codebase oblivious to the type of CMS + * @deprecated + * @var bool + */ $this->is_drupal = TRUE; $this->supports_form_extensions = TRUE; } @@ -237,4 +250,51 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { function permissionDenied() { drupal_access_denied(); } + + /** + * Get Url to view user record + * @param integer $contactID Contact ID + * + * @return string + */ + function getUserRecordUrl($contactID) { + $uid = CRM_Core_BAO_UFMatch::getUFId($contactID); + if (CRM_Core_Session::singleton()->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(array('cms:administer users', 'cms:view user account'))) { + return CRM_Utils_System::url('user/' . $uid); + }; + } + + /** + * Is the current user permitted to add a user + * @return bool + */ + function checkPermissionAddUser() { + if (CRM_Core_Permission::check('administer users')) { + return TRUE; + } + } + + + /** + * Log error to CMS + */ + function logger($message) { + if (CRM_Core_Config::singleton()->userFrameworkLogging) { + watchdog('civicrm', '%message', array('%message' => $message), NULL, WATCHDOG_DEBUG); + } + } + + /** + * Flush css/js caches + */ + function clearResourceCache() { + _drupal_flush_css_js(); + } + + /** + * Append to coreResourcesList + */ + function appendCoreResources(&$list) { + $list[] = 'js/crm.drupal.js'; + } }