forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request civicrm#11254 from colemanw/CRM-21406
CRM-21406 - Standalone export form
- Loading branch information
Showing
7 changed files
with
195 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| CiviCRM version 4.7 | | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC (c) 2004-2017 | | ||
+--------------------------------------------------------------------+ | ||
| This file is a part of CiviCRM. | | ||
| | | ||
| CiviCRM is free software; you can copy, modify, and distribute it | | ||
| under the terms of the GNU Affero General Public License | | ||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | ||
| | | ||
| CiviCRM is distributed in the hope that it will be useful, but | | ||
| WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ||
| See the GNU Affero General Public License for more details. | | ||
| | | ||
| You should have received a copy of the GNU Affero General Public | | ||
| License and the CiviCRM Licensing Exception along | | ||
| with this program; if not, contact CiviCRM LLC | | ||
| at info[AT]civicrm[DOT]org. If you have questions about the | | ||
| GNU Affero General Public License or the licensing of CiviCRM, | | ||
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* Class CRM_Export_Controller_Standalone | ||
*/ | ||
class CRM_Export_Controller_Standalone extends CRM_Core_Controller { | ||
|
||
/** | ||
* Class constructor. | ||
* | ||
* @param string $title | ||
* @param bool|int $action | ||
* @param bool $modal | ||
*/ | ||
public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { | ||
|
||
parent::__construct($title, $modal); | ||
|
||
$entity = ucfirst(CRM_Utils_Request::retrieve('entity', 'String', $this, TRUE)); | ||
$this->set('entity', $entity); | ||
$id = explode(',', CRM_Utils_Request::retrieve('id', 'CommaSeparatedIntegers', $this, TRUE)); | ||
|
||
// Check permissions | ||
$perm = civicrm_api3($entity, 'get', array( | ||
'return' => 'id', | ||
'options' => array('limit' => 0), | ||
'check_permissions' => 1, | ||
'id' => array('IN' => $id), | ||
)); | ||
|
||
$this->set('id', implode(',', array_keys($perm['values']))); | ||
if ($entity == 'Contact') { | ||
$this->set('cids', implode(',', array_keys($perm['values']))); | ||
} | ||
|
||
$this->_stateMachine = new CRM_Export_StateMachine_Standalone($this, $action); | ||
|
||
// create and instantiate the pages | ||
$this->addPages($this->_stateMachine, $action); | ||
|
||
// add all the actions | ||
$this->addActions(); | ||
} | ||
|
||
/** | ||
* | ||
* | ||
* @param string $pageName | ||
* @return array | ||
*/ | ||
public function exportValues($pageName = NULL) { | ||
$values = parent::exportValues(); | ||
$values['radio_ts'] = 'ts_sel'; | ||
foreach (explode(',', $this->get('id')) as $id) { | ||
if ($id) { | ||
$values[CRM_Core_Form::CB_PREFIX . $id] = 1; | ||
} | ||
} | ||
$className = 'CRM_' . $this->get('entity') . '_Task'; | ||
foreach ($className::tasks() as $taskId => $task) { | ||
$taskForm = (array) $task['class']; | ||
if ($taskForm[0] == 'CRM_Export_Form_Select') { | ||
$values['task'] = $taskId; | ||
} | ||
} | ||
return $values; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| CiviCRM version 4.7 | | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC (c) 2004-2017 | | ||
+--------------------------------------------------------------------+ | ||
| This file is a part of CiviCRM. | | ||
| | | ||
| CiviCRM is free software; you can copy, modify, and distribute it | | ||
| under the terms of the GNU Affero General Public License | | ||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | ||
| | | ||
| CiviCRM is distributed in the hope that it will be useful, but | | ||
| WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ||
| See the GNU Affero General Public License for more details. | | ||
| | | ||
| You should have received a copy of the GNU Affero General Public | | ||
| License and the CiviCRM Licensing Exception along | | ||
| with this program; if not, contact CiviCRM LLC | | ||
| at info[AT]civicrm[DOT]org. If you have questions about the | | ||
| GNU Affero General Public License or the licensing of CiviCRM, | | ||
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* | ||
* @package CRM | ||
* @copyright CiviCRM LLC (c) 2004-2017 | ||
*/ | ||
class CRM_Export_StateMachine_Standalone extends CRM_Core_StateMachine { | ||
|
||
/** | ||
* Class constructor. | ||
* | ||
* @param object $controller | ||
* @param \const|int $action | ||
*/ | ||
public function __construct($controller, $action = CRM_Core_Action::NONE) { | ||
parent::__construct($controller, $action); | ||
|
||
$this->_pages = array( | ||
'CRM_Export_Form_Select' => NULL, | ||
'CRM_Export_Form_Map' => NULL, | ||
); | ||
|
||
$this->addSequentialPages($this->_pages, $action); | ||
} | ||
|
||
/** | ||
* @todo So far does nothing. | ||
* | ||
* @return string | ||
*/ | ||
public function getTaskFormName() { | ||
return ''; | ||
} | ||
|
||
/** | ||
* @todo not sure if this is needed | ||
*/ | ||
public function shouldReset() { | ||
return FALSE; | ||
} | ||
|
||
} |