Merge pull request #4761 from atif-shaikh/CRM-15743
[civicrm-core.git] / CRM / Event / Task.php
index ad3f9caad0f976ea50b0ca3b60616776caea0a36..ee91e2d42b4b1e2fd1118edb651bd837a50460d6 100644 (file)
@@ -43,10 +43,10 @@ class CRM_Event_Task {
   CONST DELETE_EVENTS = 1, PRINT_EVENTS = 2, EXPORT_EVENTS = 3, BATCH_EVENTS = 4, CANCEL_REGISTRATION = 5, EMAIL_CONTACTS = 6,
   // Value for LABEL_CONTACTS is set to 16 in accordance with CRM_Contact_Task::LABEL_CONTACTS
   SAVE_SEARCH = 13, SAVE_SEARCH_UPDATE = 14, PARTICIPANT_STATUS = 15,
-  LABEL_CONTACTS = 16;
+  LABEL_CONTACTS = 16, GROUP_CONTACTS = 20;
 
   /**
-   * the task array
+   * The task array
    *
    * @var array
    * @static
@@ -54,7 +54,7 @@ class CRM_Event_Task {
   static $_tasks = NULL;
 
   /**
-   * the optional task array
+   * The optional task array
    *
    * @var array
    * @static
@@ -127,12 +127,21 @@ class CRM_Event_Task {
           'class' => 'CRM_Event_Form_Task_Badge',
           'result' => FALSE,
         ),
+        20 => array(
+          'title' => ts('Add Contacts to Group'),
+          'class' => 'CRM_Event_Form_Task_AddToGroup',
+          'result' => FALSE,
+        ),
       );
 
       //CRM-4418, check for delete
       if (!CRM_Core_Permission::check('delete in CiviEvent')) {
         unset(self::$_tasks[1]);
       }
+      //CRM-12920 - check for edit permission
+      if( !CRM_Core_Permission::check('edit event participants') ){
+        unset(self::$_tasks[4],self::$_tasks[5],self::$_tasks[15]);
+      }
     }
 
     CRM_Utils_Hook::searchTasks('event', self::$_tasks);
@@ -175,7 +184,7 @@ class CRM_Event_Task {
   }
 
   /**
-   * show tasks selectively based on the permission level
+   * Show tasks selectively based on the permission level
    * of the user
    *
    * @param int $permission