/** * Статитеческий метод экспорта Export::pull( SFObject, Connector) * последовательно: * - логинимся * - передаем пользователя * - разлогиниваемся * * @param SuccessFactorsStructSFObject $SFObject * @param SAPConn $conn * @return mixed */ static function pull(SuccessFactorsStructSFObject $SFObject, SAPConn $conn) { //login try { $successFactorsServiceLogin = new SuccessFactorsServiceLogin($conn->get('wsdl')); } catch (Exception $e) { die($e->__toString()); } if (!$successFactorsServiceLogin->login(new SuccessFactorsStructLogin($conn->get('credential')))) { self::$log = $successFactorsServiceLogin->getLastError(); } //export try { $successFactorsServiceUpsert = new SuccessFactorsServiceUpsert($conn->get('credential')); } catch (Exception $e) { die($e->__toString()); } if ($successFactorsServiceUpsert->upsert(new SuccessFactorsStructUpsert('user', $SFObject))) { self::$log = $successFactorsServiceUpsert->getResult(); } else { self::$log = $successFactorsServiceUpsert->getLastError(); } //logout try { $successFactorsServiceLogout = new SuccessFactorsServiceLogout($conn->get('credential')); } catch (Exception $e) { die($e->__toString()); } if (!$successFactorsServiceLogout->logout()) { self::$log = $successFactorsServiceLogout->getLastError(); } return self::$log; }
/** * Use the export action to get an instance of the Exporter. Use that to * manually generate the workspace for upload, then clean it up. * * @access private * @since 0.6.0 */ private function generate_article() { $export_action = new Export($this->settings, $this->id); $this->exporter = $export_action->fetch_exporter(); $this->exporter->generate(); return array($this->exporter->get_json(), $this->exporter->get_bundles()); }
public function testNormalizeValid() { $this->assertEquals(15, Exporter::normalize($this->db, self::UID, array("t" => "15"))); $this->assertEquals(15, Exporter::normalize($this->db, self::UID, array("tn" => self::TRIPNAME))); $this->assertTrue(Exporter::normalize($this->db, self::UID, array("t" => "a"))); $this->assertTrue(Exporter::normalize($this->db, self::UID, array("tn" => ""))); $this->assertNull(Exporter::normalize($this->db, self::UID, array("t" => "n"))); $this->assertNull(Exporter::normalize($this->db, self::UID, array("tn" => "<None>"))); }
/** * Returns the db data content * * @access public * * @param AbstractDB $db db identifier * @param Integer $type ANYDB_DUMP_ constants * @param String $seperator for csv files * * @returns Array the table data */ function getDB(&$db, $type = ANYDB_DUMP_SQL, $seperator = "\t") { $res = array(); $tables = $db->getTables(); if (@sizeof($tables) == 0) { die('dumpDB(): No tables found...'); } foreach ($tables as $table) { $res[$table] = Exporter::getTable($db, $table, $type, $seperator) . "\n"; } return $res; }
/** * Validate Settings * * @return true */ public function validate() { parent::validate(); // set table prefix $this->settings['tablePrefix'] = $this->settings['tablePrefix']; try { $this->getDB()->sendQuery("SELECT COUNT(*) FROM " . $this->dbPrefix . $this->settings['tablePrefix'] . "pfpost"); } catch (Exception $e) { throw new UserInputException('tablePrefix', 'invalid'); } // source path $tmpPath = FileUtil::addTrailingSlash($this->settings['sourcePath']); if ($this->data['avatars']) { if (!@file_exists($tmpPath . 'moderate.php')) { $tmpPath = FileUtil::addTrailingSlash(dirname($tmpPath)); if (!@file_exists($tmpPath . 'moderate.php')) { throw new UserInputException('sourcePath', 'invalid'); } } } $this->settings['sourcePath'] = $tmpPath; return true; }
<?php require "connect.inc.php"; require "../addon/Exporter.php"; $appname = 'MySQL Backup Class'; $myurl = 'http://localhost'; $backupPath = 'C:\\apachefriends\\xampp\\htdocs\\anyDB2'; // export table content as sql statements $sqlData = Exporter::structureOnly($db, $appname, $myurl, $backupPath); #foreach($sqlData as $key => $data) { # echo "$key<br>"; # echo nl2br($data); #} echo $sqlData; //require "disconnect.inc.php"; //////////////////////////////////////////////////////////////////////// echo '<hr>'; highlight_file(__FILE__);
public function getInfo() { $info = parent::getInfo(); $info = array('name' => 'XML Format', 'shortname' => 'XML', 'description' => 'Export data in XML file format.') + $info; return $info; }
echo "<Result>4</Result>"; die; } $showbearings = 0; if (!isset($_SESSION["ID"])) { echo "<Result>Not Logged in or this is not a private system</Result>"; die; } $action = $_GET["a"]; // $username = urldecode($_GET["u"]); // $password = urldecode($_GET["p"]); $datefrom = urldecode($_GET["df"]); $dateto = urldecode($_GET["dt"]); $showbearings = urldecode($_GET["sb"]); $userid = $_SESSION["ID"]; $tripid = Exporter::normalize($db, $userid, $_GET); if ($action == "kml") { require_once "exporter/kml.php"; $exporter = new KMLExporter($db, $userid, $tripid, $datefrom, $dateto); } else { if ($action = "gpx") { require_once "exporter/gpx.php"; $exporter = new GPXExporter($db, $userid, $tripid, $datefrom, $dateto); } else { echo "<Result>Invalid action selected</Result>"; die; } } $output = $exporter->export($showbearings); // Create file $FileName = str_replace(" ", "_", $exporter->username . "_" . $exporter->tripname . "_" . $datefrom . "_" . $dateto . ".{$action}");
public function getInfo() { $info = parent::getInfo(); $info = array('name' => 'Comma-separated Values Format', 'shortname' => 'CSV', 'description' => 'Export data in the .csv file format. Fields are wrapped with double quotes, separated by commas. Lines are separated by \\r\\n') + $info; return $info; }
public static function normalize($db, $userid, $parameters) { $tripid = Exporter::get_default("t", $parameters); $tripname = Exporter::get_default("tn", $parameters); if (!is_null($tripname)) { if (!is_null($tripid)) { throw new InvalidArgumentException("Either define trip id or name but not both."); } else { if ($tripname === "<None>") { $tripid = null; } else { if ($tripname === "") { $tripid = true; } else { $tripid = $db->exec_sql("SELECT `ID` FROM `trips` WHERE `Name` = ? AND `FK_Users_ID` = ?", $tripname, $userid)->fetchColumn(); } } } } else { if (!is_null($tripid)) { if ($tripid === "n") { $tripid = null; } else { if ($tripid === "a") { $tripid = true; } else { if (ctype_digit($parameters["t"])) { $tripid = intval($tripid); } else { throw new InvalidArgumentException("Trip id must be number."); } } } } else { throw new InvalidArgumentException("Neither tripname or trip id are defined."); } } return $tripid; }
/** * Fin! */ public function fin() { $this->exporter->finalize(); die; }
<?php require "connect.inc.php"; require "../addon/Exporter.php"; $appname = 'MySQL Backup Class'; $myurl = 'http://localhost'; $backupPath = 'C:\\apachefriends\\xampp\\htdocs\\anyDB2'; // export table content as sql statements #$sqlData = Exporter::getDBDataDump($db); $tables = $db->getTables(); $struct = Exporter::dbStructure($db, $tables); print_r($struct); #foreach($sqlData as $key => $data) { # echo "--$key--<br>"; # echo nl2br($data); #} #$file = Exporter::dumpDataFileBuilder($sqlData); #echo $file; #Exporter::dataOnly($db, $appname, $myurl, $backupPath); #echo $sfile; //require "disconnect.inc.php"; //////////////////////////////////////////////////////////////////////// echo '<hr>'; highlight_file(__FILE__);
<?php require "connect.inc.php"; require "../addon/Exporter.php"; // export table content as csv data $csv = Exporter::getTable($db, 'users', ANYDB_DUMP_CSV); echo nl2br($csv); require "disconnect.inc.php"; //////////////////////////////////////////////////////////////////////// echo '<hr>'; highlight_file(__FILE__);
<?php require_once '../src/Exporter.php'; date_default_timezone_set('Europe/Moscow'); $today = date('Y-m-d'); $log = array(); ini_set('memory_limit', '512M'); ini_set('display_errors', true); error_reporting(-1); $connector = new SAPConn('C00****9T1', 'sfadmin', 'sfpass', 'https://api.successfactors.eu/sfapi/v1/soap?wsdl'); $user = new SAPUser('1', 'Ivan', 'Petrov', 'Andreevich', '*****@*****.**', '18.07.1985', '10801'); $sfObj = new SAPObj($user, 'ivanov', 'petrov', 'sidorov', $today); Exporter::pull($sfObj->build(), $connector);
public function getInfo() { $info = parent::getInfo(); $info = array('name' => 'Drupal table formatter', 'shortname' => 'theme_table', 'description' => 'Export data using theme_table().') + $info; return $info; }
public function getInfo() { $info = parent::getInfo(); $info = array('name' => 'HTML List', 'shortname' => 'HTML List', 'description' => 'Export data in HTML list format.') + $info; return $info; }
public function getInfo() { $info = parent::getInfo(); $info = array('name' => 'JSON Format', 'shortname' => 'JSON', 'description' => 'Export data in JSON file format. For more information visit: http://www.json.org.') + $info; return $info; }
function showExportRes() { /* update last page */ $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res")); require_once "exporter.php"; $exporter = new Exporter(loadvar(POST_PARAM_SUID)); $exporter->export(); $displaySysAdmin = new DisplaySysAdmin(); return $displaySysAdmin->showExport(); }
$userHandler = $loader->userHandler; $courseHandler = $loader->courseHandler; $templater->loadTemplate('kurse.html'); if ($userHandler->login()->isLoggedIn()) { $templater->showWelcome($userHandler->getCurrentUser()); } else { $data = array('error' => 'Du bist nicht eingeloggt<br\\>', 'redirect' => 'kurse'); $templater->loadTemplate('login.html')->data($data); } if (isset($_GET['coursenews'])) { header("Content-Type: text/plain; charset=utf-8"); echo utf8_encode($courseHandler->generateCourseNews()); exit; } if (isset($_GET['export'])) { $exporter = new Exporter($db); if ($_GET['export'] == "xml") { header("Content-Type: text/xml; charset=utf-8"); header('Content-Disposition: filename="kurse.xml"'); echo $exporter->exportCoursesToXML(); exit; } else { header("Content-Type: text/javascript"); header('Content-Disposition: filename="kurse.txt"'); echo $exporter->exportCoursesToJSON(); exit; } } if (isset($_GET['delete_course'])) { $courseHandler->deleteCourse((int) $_GET['delete_course']); if (!isset($_GET['ajax'])) {
public function __construct($engine, $fp) { $this->outputFile = $fp; parent::__construct($engine); }
public function testInitConnect() { $this->setExpectedException('Exception'); Exporter::pull($this->sfObj->build(), $this->connector); }
include_once 'classes/Convert.php'; $results = array(); $firstResults = array(); $endpoints = array(); $endpoints['local'] = new Endpoint($conf['endpoint']['local'], $conf['endpointParams']['config']); $acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']); $extension = Utils::getExtension($acceptContentType); //Check content type is supported by LODSPeaKr if ($acceptContentType == NULL) { HTTPStatus::send406($uri); } //Export if ($conf['export'] && $_GET['q'] == 'export') { include_once 'settings.inc.php'; include_once 'classes/Exporter.php'; $exp = new Exporter(); header('Content-Type: text/plain'); $exp->run(); exit(0); } //Redirect to root URL if necessary $uri = $conf['basedir'] . $_GET['q']; $localUri = $uri; if ($uri == $conf['basedir']) { header('Location: ' . $conf['root']); exit(0); } //Configure external URIs if necessary $localUri = $conf['basedir'] . $_GET['q']; $uri = Utils::getMirroredUri($localUri); //Modules
public function descarga($clave) { $config = new ExporterConfig(); $exporter = new Exporter($config); //indicador $indicador = Indicador::where('clave', '=', $clave)->first(); $muestras = Muestra::where('id_indicador', '=', $indicador->id)->orderBy('anio', 'DESC')->orderBy('mes', 'ASC')->get(); $salida = array(); $salida[] = $this->encabezado_csv($indicador->frecuencia_muestreo); //recorrer las muestras foreach ($muestras as $muestra) { //decide que hacer switch ($indicador->frecuencia_muestreo) { case 0: $salida[] = array($muestra->anio, $muestra->valor); break; case 1: $salida[] = array($muestra->anio, $muestra->mes, $muestra->valor); break; case 2: $val = $muestra->mes; $val = $val - 300; $salida[] = array($muestra->anio, $val, $muestra->valor); break; case 3: $salida[] = array($muestra->anio, $muestra->mes - 600, $muestra->valor); break; case 4: $salida[] = array($muestra->anio, $muestra->mes, $muestra->dia, $muestra->valor); break; } } //el header header('Content-type: text/csv'); header('Content-disposition: attachment;filename=' . $clave . '.csv'); //exportar $exporter->export('php://output', $salida); }
printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300px" value="%s" /></td></tr>', _('Show Attributtes'), htmlspecialchars($request['attr'])); printf('<tr><td> </td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>', $request['sys_attr'] ? 'checked="checked" ' : '', _('Include system attributes')); printf('<tr><td> </td><td><input type="checkbox" id="save_as_file" name="save_as_file" onclick="export_field_toggle(this)" /> <label for="save_as_file">%s</label></td></tr>', _('Save as file')); printf('<tr><td> </td><td><input type="checkbox" id="compress" name="compress" disabled="disabled" /> <label for="compress">%s</label></td></tr>', _('Compress')); echo '</table>'; echo '</fieldset>'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo '<table style="width: 100%">'; echo '<tr>'; echo '<td style="width: 50%">'; echo '<fieldset style="height: 100px">'; printf('<legend>%s</legend>', _('Export format')); foreach (Exporter::types() as $index => $exporter) { printf('<input type="radio" name="exporter_id" id="exporter_id_%s" value="%s"%s/>', htmlspecialchars($exporter['type']), htmlspecialchars($exporter['type']), $exporter['type'] === $request['exporter_id'] ? ' checked="checked"' : ''); printf('<label for="exporter_id_%s">%s</label><br />', htmlspecialchars($exporter['type']), $exporter['type']); } echo '</fieldset>'; echo '</td>'; echo '<td style="width: 50%">'; echo '<fieldset style="height: 100px">'; printf('<legend>%s</legend>', _('Line ends')); foreach ($available_formats as $id => $desc) { printf('<input type="radio" name="format" value="%s" id="%s"%s /><label for="%s">%s</label><br />', htmlspecialchars($id), htmlspecialchars($id), $request['format'] == $id ? ' checked="checked"' : '', htmlspecialchars($id), $desc); } echo '</fieldset>'; echo '</td></tr>'; echo '</table>'; echo '</td>';
public function testNonObjectCanBeReturnedAsArray() { $this->assertEquals(array(true), $this->exporter->toArray(true)); }
/** * Method to du data dump only * @param AbstractDB $db db identifier * @param appname application name * @param myurl * @param backupPath backup file storage location */ function dataOnly(&$db, $appname = "eHMIS Backup", $myurl = "http://localhost", $backupPath) { //write the file headers $writefile = Exporter::sqlfileHeaders($appname, $myurl); //put in a sql comment to start the table data $writefile .= "-- Table data... \n\n"; //set the data variable to null $dataArray = null; //get the data $dataArray = Exporter::getDBDataDump($db, ANYDB_DUMP_SQL); $writefile .= Exporter::writeData($dataArray); Exporter::writeSQL($backupPath, $writefile); }
public function getInfo() { $info = parent::getInfo(); $info = array('name' => 'Markdown', 'shortname' => 'Markdown', 'description' => 'Export data in Markdown file format. For more information visit: http://daringfireball.net/projects/markdown/.') + $info; return $info; }
public function getInfo() { $info = parent::getInfo(); $info = array('name' => 'Plaintext List', 'shortname' => 'List', 'description' => 'Export data in plaintext list file format.') + $info; return $info; }
/** * Format a single column with a number format * * You must do this after calling $this->compile! * * @param string $column * @param string $format_code * - USD OR PHPExcel_Style_NumberFormat::setFormatCode() * * @return $this */ public function formatColumn($column, $format_code) { // By default we'll use USD. $format_code = isset($format_code) ? $format_code : 'USD'; $phpexcel_format = \PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; // Map to specific formats in PHPExcel if ($format_code === 'USD') { $phpexcel_format = \PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; } elseif ($format_code === \PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE) { $format_code = 'USD'; } $columns = $this->getPHPExcelColumns(); if (!array_key_exists($column, $columns)) { return; } $phpexcel_column = $columns[$column]; $page = $this->excel->getActiveSheet(); foreach ($page->getRowIterator() as $row) { $row_index = $row->getRowIndex(); $page->getStyle("{$phpexcel_column}{$row_index}")->getNumberFormat()->setFormatCode($phpexcel_format); } return parent::formatColumn($column, $format_code); }
<?php require "connect.inc.php"; require "../addon/Exporter.php"; // export table content as sql statements $sqlData = Exporter::getDB($db, ANYDB_DUMP_SQL); foreach ($sqlData as $key => $data) { echo "{$key}<br>"; echo nl2br($data); } require "disconnect.inc.php"; //////////////////////////////////////////////////////////////////////// echo '<hr>'; highlight_file(__FILE__);