Source of file GnCreateInsertCommand.php
Size: 1,807 Bytes - Last Modified: 2021-12-23T10:31:40+00:00
/var/www/docs.ssmods.com/process/src/code/commands/GnCreateInsertCommand.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 | <?php /** * @author Rainer Spittel (rainer at silverstripe dot com) * @package geocatalog * @subpackage commands * * Implementation of the GeoNetwork insert request. */ /** * Insert ISO19139 Metadata into GeoNetwork * * This command creates an XML GeoNetwork request to insert new ISO19139 metadata * into the GeoNetwork. Similar to {@see CreateInsertCommand} but utilize * GeoNetwork specific API. */ class GnCreateInsertCommand extends ControllerCommand { public static $schema_name = 'GenerateISO19139XML'; public static $gn_group = "3"; public static function implode_with_keys($data) { $first = true; $output = ''; foreach ($data as $key => $value) { if ($first) { $output = ''.$key.'='.urlencode($value); $first = false; } else { $output .= '&'.$key.'='.$value; } } return $output; } /** * Command execute * * Perform the request command. Creates a XML request based on the given * XML request parameter and the metadata data. This request is used to insert new * Metadata records into GeoNetwork. */ public function execute() { $data = $this->getParameters(); // generate xml file $cmd = $this->getController()->getCommand(self::$schema_name, $data); $xml = $cmd->execute(); $data = array(); $data['data'] = $xml; $data['group'] = self::$gn_group; $data['template'] = "n"; $data['title'] = ""; $data['category'] = "_none_"; $data['styleSheet'] = "_none_"; $data['validation'] = "off"; $data = $this->implode_with_keys($data); return $data; } } |