print json_encode($dbaccess->getInitData());
            break;
        case 'getLog':
            //exit(json_encode($_REQUEST));
            $start = $_REQUEST['start'];
            $end = $_REQUEST['end'];
            if (DateTime::createFromFormat('Y/m/d H:i', $start) && DateTime::createFromFormat('Y/m/d H:i', $end)) {
                if (isset($_REQUEST['modules'])) {
                    print json_encode($dbaccess->getLogData($start, $end, $_REQUEST['modules'], $_REQUEST['events']));
                } else {
                    print json_encode($dbaccess->getLogData($start, $end));
                }
            } else {
                print json_encode(['success' => false, 'error' => 'Could not fetch log details, Please specify a valid time period.']);
            }
            break;
        case 'knoema':
            $w = new ZP\IEE\Template();
            //$_SESSION['w'] = new ZP\IEE\Writer();
            $template = $_FILES['templates']['tmp_name'];
            //exit(json_encode($templates));
            $_SESSION['w'] = $w->format($template);
            print json_encode(['success' => true]);
            break;
        case 'output':
            (new ZP\IEE\Template())->output($_SESSION['w']);
        default:
            print 'error';
            break;
    }
}
Exemple #2
0
     //exit(json_encode($_REQUEST));
     $mine = $dbaccess->getExtractiveCompany($tpin);
     if ($mine->success) {
         $mine = $mine->mine;
     } else {
         exit(json_encode($mine));
     }
     if (!is_null($entityID)) {
         $gov = $dbaccess->getGovtEntity($entityID);
         if ($gov->success) {
             $gov = $gov->entity;
         } else {
             exit(json_encode($gov));
         }
     }
     $template = new ZP\IEE\Template($period, $mine, $gov, $reportID, $templateID);
     //exit('date = '.$templates->getPeriod());
     $template->getTemplate();
     break;
 case 'download-error-log':
     $writer = new \ZP\IEE\Writer();
     if (isset($_SESSION['errors'])) {
         $writer->setData($_SESSION['errors'], 'errors');
         unset($_SESSION['errors']);
     }
     $writer->outputTemplate('error log');
     break;
 case 'upload-templates':
     // validate uploaded file
     \ZP\ZP::validateFile($_FILES['templates']);
     if ($_FILES['templates']['name']) {