3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * Class CRM_Export_Controller_Standalone
31 class CRM_Export_Controller_Standalone
extends CRM_Core_Controller
{
36 * @param string $title
37 * @param bool|int $action
40 public function __construct($title = NULL, $action = CRM_Core_Action
::NONE
, $modal = TRUE) {
42 parent
::__construct($title, $modal);
44 $entity = ucfirst(CRM_Utils_Request
::retrieve('entity', 'String', $this, TRUE));
45 $this->set('entity', $entity);
46 $id = explode(',', CRM_Utils_Request
::retrieve('id', 'CommaSeparatedIntegers', $this, TRUE));
49 $perm = civicrm_api3($entity, 'get', array(
51 'options' => array('limit' => 0),
52 'check_permissions' => 1,
53 'id' => array('IN' => $id),
56 $this->set('id', implode(',', array_keys($perm['values'])));
57 if ($entity == 'Contact') {
58 $this->set('cids', implode(',', array_keys($perm['values'])));
61 $this->_stateMachine
= new CRM_Export_StateMachine_Standalone($this, $action);
63 // create and instantiate the pages
64 $this->addPages($this->_stateMachine
, $action);
66 // add all the actions
71 * Export forms are historically tightly coupled to search forms,so this simulates
72 * the output of a search form, with an array of checkboxes for each selected entity.
74 * @param string $pageName
77 public function exportValues($pageName = NULL) {
78 $values = parent
::exportValues();
79 $values['radio_ts'] = 'ts_sel';
80 foreach (explode(',', $this->get('id')) as $id) {
82 $values[CRM_Core_Form
::CB_PREFIX
. $id] = 1;
85 // Set the "task" selector value to Export
86 $className = 'CRM_' . $this->get('entity') . '_Task';
87 foreach ($className::tasks() as $taskId => $task) {
88 $taskForm = (array) $task['class'];
89 if ($taskForm[0] == 'CRM_Export_Form_Select') {
90 $values['task'] = $taskId;