<?php include_once "../model/watch_directory_configuration.php"; include_once '../../config/include.php'; if ($_REQUEST['folderpath'] == '') { echo "Please provide directory path."; die; } if ($_REQUEST['selctconfig'] == '') { echo "Please select file conversion configuration."; die; } // Save Cron $saveConfig['save_sch_id'] = $_REQUEST['save_sch_id']; $saveConfig['folderpath'] = $_REQUEST['folderpath']; $saveConfig['selctconfig'] = $_REQUEST['selctconfig']; $saveConfig['destfolderpath'] = $_REQUEST['destfolderpath']; // Save configuration details $conversionConfiguration = new ConversionConfiguration(); $saveCron = $conversionConfiguration->saveSchedule($saveConfig); if ($saveCron) { echo "Schedule created successfully."; die; } else { echo "Something went wrong, please try again."; die; }
<?php include_once "application/model/watch_directory_configuration.php"; include_once 'config/include.php'; // Save configuration details $conversionConfiguration = new ConversionConfiguration(); $scheduleList = $conversionConfiguration->getScheduleList(); /* create a dom document with encoding utf8 */ $domtreeBatch = new DOMDocument('1.0', 'UTF-8'); /* create the root element of the xml tree */ $xmlRootBatch = $domtreeBatch->createElement("xml"); /* append it to the document created */ $xmlRootBatch = $domtreeBatch->appendChild($xmlRootBatch); foreach ($scheduleList as $key => $value) { $dir = $value['source_dir_path']; $destin_dir = $value['destin_dir_path']; $table = $value['table']; $conversionType = $value['conversion']; if (empty($table)) { $table = 'table'; } if (empty($value['field'])) { continue; } // Open a directory, and read its contents $folderContent = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (!is_dir($file)) { // Get file extension