/**
* Dashboard page for managing Access Control.
- *
- * For initial version, this page only contains static links - so this class is empty for now.
*/
class CRM_Admin_Page_Access extends CRM_Core_Page {
* @return string
*/
public function run() {
- $config = CRM_Core_Config::singleton();
-
- switch ($config->userFramework) {
- case 'Drupal':
- $this->assign('ufAccessURL', url('admin/people/permissions'));
- break;
-
- case 'Drupal6':
- $this->assign('ufAccessURL', url('admin/user/permissions'));
- break;
-
- case 'Joomla':
- //condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value
- if (version_compare(JVERSION, '3.0', 'lt')) {
- JHTML::_('behavior.modal');
- $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component';
- $jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
-
- $this->assign('ufAccessURL', $url);
- $this->assign('jAccessParams', $jparams);
- }
- else {
- $uri = (string) JUri::getInstance();
- $return = urlencode(base64_encode($uri));
- $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&return=' . $return;
-
- $this->assign('ufAccessURL', $url);
- $this->assign('jAccessParams', '');
- }
- break;
-
- case 'WordPress':
- $this->assign('ufAccessURL', CRM_Utils_System::url('civicrm/admin/access/wp-permissions', 'reset=1'));
- break;
+ $urlParams = CRM_Utils_System::getCMSPermissionsUrlParams();
+ if (isset($urlParams['ufAccessURL'])) {
+ $this->assign('ufAccessURL', $urlParams['ufAccessURL']);
+ }
+ if (isset($urlParams['jAccessParams'])) {
+ $this->assign('jAccessParams', $urlParams['jAccessParams']);
}
return parent::run();
}
];
}
+ /**
+ * Return the CMS-specific url for its permissions page
+ * @return array
+ */
+ public function getCMSPermissionsUrlParams() {
+ $ufAccessURL = '';
+ $jAccessParams = '';
+ $config = CRM_Core_Config::singleton();
+ //condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value
+ if (version_compare(JVERSION, '3.0', 'lt')) {
+ JHTML::_('behavior.modal');
+ $ufAccessURL = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component';
+ $jAccessParams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
+ }
+ else {
+ $uri = (string) JUri::getInstance();
+ $return = urlencode(base64_encode($uri));
+ $ufAccessURL = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&return=' . $return;
+ }
+ return [
+ 'ufAccessURL' => $ufAccessURL,
+ 'jAccessParams' => $jAccessParams,
+ ];
+ }
+
}