Esempio n. 1
0
 /**
  * Write the xml document
  */
 function save(&$ctx, OutputInterface $output)
 {
     if (file_exists($this->path) && $this->overwrite === 'ignore') {
         // do nothing
     } elseif (file_exists($this->path) && !$this->overwrite) {
         $output->writeln("<error>Skip " . $this->path . ": file already exists</error>");
     } else {
         $output->writeln("<info>Write " . $this->path . "</info>");
         file_put_contents($this->path, $this->export->toXML());
     }
 }
/**
 *
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2012
 * $Id$
 *
 */
function run()
{
    session_start();
    require_once '../../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton();
    // this does not return on failure
    CRM_Utils_System::authenticateScript(TRUE);
    require_once 'CRM/Utils/Migrate/Export.php';
    $export = new CRM_Utils_Migrate_Export();
    $export->run();
}
 /**
  * Execute a basic XML test case. Each test case creates a custom-group and
  * custom-field then compares the output to a pre-defined XML file.
  *
  * @param $customGroupParams
  * @param $fieldParams
  * @param $expectedXmlFilePath
  * @dataProvider basicXmlTestCases
  */
 function testBasicXMLExports($customGroupParams, $fieldParams, $expectedXmlFilePath)
 {
     $this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_custom_group WHERE title = %1', array(1 => array($customGroupParams['title'], 'String')));
     $customGroup = $this->customGroupCreate($customGroupParams);
     $fieldParams['custom_group_id'] = $customGroup['id'];
     $customField = $this->callAPISuccess('custom_field', 'create', $fieldParams);
     $exporter = new CRM_Utils_Migrate_Export();
     $exporter->buildCustomGroups(array($customGroup['id']));
     // print $exporter->toXML();
     $this->assertEquals(file_get_contents($expectedXmlFilePath), $exporter->toXML());
     $this->callAPISuccess('custom_field', 'delete', array('id' => $customField['id']));
     $this->callAPISuccess('custom_group', 'delete', array('id' => $customGroup['id']));
 }
Esempio n. 4
0
/**
 *
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2013
 * $Id$
 *
 */
function run()
{
    session_start();
    require_once '../../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton();
    // this does not return on failure
    CRM_Utils_System::authenticateScript(TRUE);
    require_once 'CRM/Utils/Migrate/Export.php';
    $export = new CRM_Utils_Migrate_Export();
    $export->build();
    CRM_Utils_System::download('CustomGroupData.xml', 'text/plain', $export->toXML());
}
Esempio n. 5
0
/**
 *
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2016
 */
function run()
{
    session_start();
    require_once '../../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton();
    // this does not return on failure
    CRM_Utils_System::authenticateScript(TRUE);
    if (!CRM_Core_Permission::check('administer CiviCRM')) {
        CRM_Utils_System::authenticateAbort("User does not have required permission (administer CiviCRM).\n", TRUE);
    }
    require_once 'CRM/Utils/Migrate/Export.php';
    $export = new CRM_Utils_Migrate_Export();
    $export->build();
    CRM_Utils_System::download('CustomGroupData.xml', 'text/plain', $export->toXML());
}