*/
static $_modeValues = NULL;
- /**
- * The context that we are working on
- *
- * @var string
- * @access protected
- */
- protected $_context;
-
/**
* The contextMenu
*
*/
protected $_ssID;
- /**
- * Are we forced to run a search
- *
- * @var int
- * @access protected
- */
- protected $_force;
-
- /**
- * name of search button
- *
- * @var string
- * @access protected
- */
- protected $_searchButtonName;
-
- /**
- * name of action button
- *
- * @var string
- * @access protected
- */
- protected $_actionButtonName;
-
/**
* the group elements
*
public $_tag;
public $_tagElement;
- /**
- * form values that we will be using
- *
- * @var array
- * @access protected
- */
- public $_formValues;
-
/**
* The params used for search
*
protected $_modeValue;
- /**
- * have we already done this search
- *
- * @access protected
- * @var boolean
- */
- protected $_done;
-
/**
* name of the selector to use
*/
*/
function buildQuickForm() {
parent::buildQuickForm();
+ $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)
$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)) {
// 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);
'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'
$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',
- 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 1);",
+ '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);
}
- // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
- $selectedRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', array(
- 'checked' => 'checked',
- 'onclick' => 'toggleTaskAction( true );',
- ));
- $this->assign('ts_sel_id', $selectedRowsRadio->_attributes['id']);
-
-
if ($qfKeyParam = CRM_Utils_Array::value('qfKey', $this->_formValues)) {
$qfKeyParam = "civicrm search {$qfKeyParam}";
$selectedContactIdsArr = CRM_Core_BAO_PrevNextCache::getSelection($qfKeyParam);
$this->assign_by_ref('selectedContactIds', $selectedContactIds);
- $allRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all', array('class' => 'select-rows', 'onclick' => $this->getName() . ".toggleSelect.checked = false; toggleTaskAction( true );toggleContactSelection( 'resetSel', '{$qfKeyParam}', 'reset' );"));
- $this->assign('ts_all_id', $allRowsRadio->_attributes['id']);
-
- /*
- * add form checkboxes for each row. This is needed out here to conform to QF protocol
- * of all elements being declared in builQuickForm
- */
-
$rows = $this->get('rows');
if (is_array($rows)) {
- $this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('class' => 'select-rows', 'onclick' => "toggleTaskAction( true ); toggleContactSelection( 'toggleSelect', '" . $qfKeyParam . "' , 'multiple' );"));
-
- $unselectedContactIds = array();
- foreach ($rows as $row) {
- $this->addElement('checkbox', $row['checkbox'],
- NULL, NULL,
- array('onclick' => "toggleContactSelection( '" . $row['checkbox'] . "', '" . $qfKeyParam . "' , 'single' );toggleTaskAction( true );", 'class' => 'select-row')
- );
-
- if (!in_array($row['contact_id'], $selectedContactIds)) {
- $unselectedContactIds[] = $row['contact_id'];
- }
- }
- $this->assign_by_ref('unselectedContactIds', $unselectedContactIds);
+ $this->addRowSelectors($rows);
}
}