Merge pull request #7803 from saurabhbatra96/CRM-17143
[civicrm-core.git] / CRM / Campaign / Info.php
index 3cbaf481b376ec0b5ac452ea52323309c0684d7e..8f3c74f0eb9688f80120921125ae4b9d03330baf 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -32,8 +32,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_Info extends CRM_Core_Component_Info {
 
@@ -60,19 +58,49 @@ class CRM_Campaign_Info extends CRM_Core_Component_Info {
   /**
    * @inheritDoc
    * @param bool $getAllUnconditionally
+   * @param bool $descriptions
+   *   Whether to return permission descriptions
    *
    * @return array
    */
-  public function getPermissions($getAllUnconditionally = FALSE) {
-    return array(
-      'administer CiviCampaign',
-      'manage campaign',
-      'reserve campaign contacts',
-      'release campaign contacts',
-      'interview campaign contacts',
-      'gotv campaign contacts',
-      'sign CiviCRM Petition',
+  public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
+    $permissions = array(
+      'administer CiviCampaign' => array(
+        ts('administer CiviCampaign'),
+        ts('Create new campaign, survey and petition types and their status'),
+      ),
+      'manage campaign' => array(
+        ts('manage campaign'),
+        ts('Create new campaigns, surveys and petitions, reserve respondents'),
+      ),
+      'reserve campaign contacts' => array(
+        ts('reserve campaign contacts'),
+        ts('Reserve campaign contacts for surveys and petitions'),
+      ),
+      'release campaign contacts' => array(
+        ts('release campaign contacts'),
+        ts('Release reserved campaign contacts for surveys and petitions'),
+      ),
+      'interview campaign contacts' => array(
+        ts('interview campaign contacts'),
+        ts('Record survey and petition responses from their reserved contacts'),
+      ),
+      'gotv campaign contacts' => array(
+        ts('GOTV campaign contacts'),
+        ts('Record that contacts voted'),
+      ),
+      'sign CiviCRM Petition' => array(
+        ts('sign CiviCRM Petition'),
+      ),
     );
+
+    if (!$descriptions) {
+      foreach ($permissions as $name => $attr) {
+        $permissions[$name] = array_shift($attr);
+      }
+    }
+
+    return $permissions;
   }