Merge pull request #4234 from jitendrapurohit/CRM-15368
[civicrm-core.git] / CRM / Contact / Form / Search.php
index 2cd681aa92d28beea38eddaddc89aa2ae1ba6f5f..7a0083b2f1209c69cbcea8df672b2b5b475c3de5 100644 (file)
@@ -337,7 +337,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
    */
   function buildQuickForm() {
     parent::buildQuickForm();
-    $this->setAttribute('class', 'crm-search-form crm-ajax-selection-form');
+    $this->addClass('crm-ajax-selection-form');
     CRM_Core_Resources::singleton()
       // jsTree is needed for tags popup
       ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)
@@ -381,10 +381,9 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
         $url = CRM_Utils_System::makeURL('qfKey') . $formQFKey;
         CRM_Utils_System::redirect($url);
       }
+      $permissionForGroup = FALSE;
 
       if (!empty($this->_groupID)) {
-        $permissionForGroup = FALSE;
-
         // check if user has permission to edit members of this group
         $permission = CRM_Contact_BAO_Group::checkPermission($this->_groupID);
         if ($permission && in_array(CRM_Core_Permission::EDIT, $permission)) {
@@ -394,13 +393,10 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
         // check if _groupID exists, it might not if
         // we are displaying a hidden group
         if (!isset($this->_group[$this->_groupID])) {
-          $permissionForGroup = FALSE;
           $this->_group[$this->_groupID] =
             CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID, 'title');
         }
 
-        $this->assign('permissionedForGroup', $permissionForGroup);
-
         // set the group title
         $groupValues = array('id' => $this->_groupID, 'title' => $this->_group[$this->_groupID]);
         $this->assign_by_ref('group', $groupValues);
@@ -430,7 +426,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
         'group_contact_status', ts('Group Status')
       );
 
-      $this->assign('permissionedForGroup', FALSE);
+      $this->assign('permissionedForGroup', $permissionForGroup);
     }
 
     // add the go button for the action form, note it is of type 'next' rather than of type 'submit'
@@ -450,10 +446,14 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
       $this->assign_by_ref('group', $groupValues);
       $this->add('submit', $this->_actionButtonName, ts('Add Contacts to %1', array(1 => $this->_group[$this->_amtgID])),
         array(
-          'class' => 'form-submit',
+          'class' => 'crm-form-submit',
         )
       );
       $this->add('hidden', 'task', CRM_Contact_Task::GROUP_CONTACTS);
+      $selectedRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', array('checked' => 'checked'));
+      $allRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all');
+      $this->assign('ts_sel_id', $selectedRowsRadio->_attributes['id']);
+      $this->assign('ts_all_id', $allRowsRadio->_attributes['id']);
     }
     else {
       $this->addTaskMenu($tasks);