Smarty - Export $crmPermissions object for use in all templates
authorTim Otten <totten@civicrm.org>
Mon, 11 Nov 2013 22:49:37 +0000 (14:49 -0800)
committerTim Otten <totten@civicrm.org>
Mon, 11 Nov 2013 22:49:37 +0000 (14:49 -0800)
CRM/Core/Smarty.php
CRM/Core/Smarty/Permissions.php [new file with mode: 0644]

index 6422ca2c489ac59884a160adcaaff16ae972e333..c88b450ee937fe51542cfac61377e2a3740aabab 100644 (file)
@@ -160,6 +160,8 @@ class CRM_Core_Smarty extends Smarty {
 
     $this->register_function('crmURL', array('CRM_Utils_System', 'crmURL'));
     $this->load_filter('pre', 'resetExtScope');
+
+    $this->assign('crmPermissions', new CRM_Core_Smarty_Permissions());
   }
 
   /**
diff --git a/CRM/Core/Smarty/Permissions.php b/CRM/Core/Smarty/Permissions.php
new file mode 100644 (file)
index 0000000..377c108
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+class CRM_Core_Smarty_Permissions {
+  // non-static adapter for CRM_Core_Permission::check
+  function check($offset) {
+    return CRM_Core_Permission::check($offset);
+  }
+
+}
\ No newline at end of file