/** * build all the data structures needed to build the form * * @param * @return void * @access public */ function preProcess() { $this->_contactIds = array(); // get the submitted values of the search form // we'll need to get fv from either search or adv search in the future if ($this->_action == CRM_CORE_ACTION_ADVANCED) { $values = $this->controller->exportValues('Advanced'); } else { $values = $this->controller->exportValues('Search'); } $this->_task = $values['task']; $crmContactTaskTasks = CRM_Contact_Task::tasks(); $this->assign('taskName', $crmContactTaskTasks[$this->_task]); // all contacts or action = save a search if ($values['radio_ts'] == 'ts_all' || $this->_task == CRM_CONTACT_TASK_SAVE_SEARCH) { // need to perform action on all contacts // fire the query again and get the contact id's + display name $contact =& new CRM_Contact_BAO_Contact(); $fv = $this->get('formValues'); $query =& new CRM_Contact_BAO_Query($fv); $ids = $query->searchQuery(0, 0, null, false, false, false, true, false); $this->_contactIds = explode(',', $ids); } else { if ($values['radio_ts'] == 'ts_sel') { // selected contacts only // need to perform action on only selected contacts foreach ($values as $name => $value) { if (substr($name, 0, CRM_CORE_FORM_CB_PREFIX_LEN) == CRM_CORE_FORM_CB_PREFIX) { $this->_contactIds[] = substr($name, CRM_CORE_FORM_CB_PREFIX_LEN); } } } } $this->assign('totalSelectedContacts', count($this->_contactIds)); }
/** * build all the data structures needed to build the form * * @param * @return void * @access public */ function preProcess() { $this->_contactIds = array(); $this->_selectAll = false; // get the submitted values of the search form // we'll need to get fv from either search or adv search in the future if ($this->_action == CRM_CORE_ACTION_ADVANCED) { $values = $this->controller->exportValues('Advanced'); } else { $values = $this->controller->exportValues('Search'); } $this->_task = $values['task']; $crmContactTaskTasks = CRM_Contact_Task::tasks(); $this->assign('taskName', $crmContactTaskTasks[$this->_task]); // all contacts or action = save a search if ($values['radio_ts'] == 'ts_all' || $this->_task == CRM_CONTACT_TASK_SAVE_SEARCH) { $this->_selectAll = true; $this->assign('totalSelectedContacts', $this->get('rowCount')); } else { if ($values['radio_ts'] == 'ts_sel') { // selected contacts only // need to perform action on only selected contacts foreach ($values as $name => $value) { if (substr($name, 0, CRM_CORE_FORM_CB_PREFIX_LEN) == CRM_CORE_FORM_CB_PREFIX) { $this->_contactIds[] = substr($name, CRM_CORE_FORM_CB_PREFIX_LEN); } } $this->assign('totalSelectedContacts', count($this->_contactIds)); } } $this->set('contactIds', $this->_contactIds); $this->set('selectAll', $this->_selectAll); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $this->_id = null; // get the submitted values of the search form // we'll need to get fv from either search or adv search in the future if ($this->_action == CRM_CORE_ACTION_ADVANCED) { $values = $this->controller->exportValues('Advanced'); } else { $values = $this->controller->exportValues('Search'); } $this->_task = $values['task']; $crmContactTaskTasks = CRM_Contact_Task::tasks(); $this->assign('taskName', $crmContactTaskTasks[$this->_task]); }
/** * show tasks selectively based on the permission level * of the user * * @param int $permission * * @return array set of tasks that are valid for the user * @access public */ function &permissionedTasks($permission) { if ($permission == CRM_CORE_PERMISSION_EDIT) { return CRM_Contact_Task::tasks(); } else { $tasks = array(4096 => ts('Export Contacts'), 2048 => ts('Map Contacts using Google Maps')); return $tasks; } }