3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Class CRM_Export_Controller_Standalone
15 class CRM_Export_Controller_Standalone
extends CRM_Core_Controller
{
20 * @param string $title
21 * @param bool|int $action
24 public function __construct($title = NULL, $action = CRM_Core_Action
::NONE
, $modal = TRUE) {
26 parent
::__construct($title, $modal);
28 $entity = ucfirst(CRM_Utils_Request
::retrieve('entity', 'String', $this, TRUE));
29 $this->set('entity', $entity);
30 $id = explode(',', CRM_Utils_Request
::retrieve('id', 'CommaSeparatedIntegers', $this, TRUE));
33 $perm = civicrm_api3($entity, 'get', [
35 'options' => ['limit' => 0],
36 'check_permissions' => 1,
37 'id' => ['IN' => $id],
40 $this->set('id', implode(',', array_keys($perm['values'])));
41 if ($entity == 'Contact') {
42 $this->set('cids', implode(',', array_keys($perm['values'])));
45 $this->_stateMachine
= new CRM_Export_StateMachine_Standalone($this, $action);
47 // create and instantiate the pages
48 $this->addPages($this->_stateMachine
, $action);
50 // add all the actions
55 * Export forms are historically tightly coupled to search forms,so this simulates
56 * the output of a search form, with an array of checkboxes for each selected entity.
58 * @param string $pageName
61 public function exportValues($pageName = NULL) {
62 $values = parent
::exportValues();
63 $values['radio_ts'] = 'ts_sel';
64 foreach (explode(',', $this->get('id')) as $id) {
66 $values[CRM_Core_Form
::CB_PREFIX
. $id] = 1;
69 // Set the "task" selector value to Export
70 $className = 'CRM_' . $this->get('entity') . '_Task';
71 foreach ($className::tasks() as $taskId => $task) {
72 $taskForm = (array) $task['class'];
73 if ($taskForm[0] == 'CRM_Export_Form_Select') {
74 $values['task'] = $taskId;