Initial commit

This commit is contained in:
2018-07-06 07:31:22 +02:00
commit 6ff6cc9563
312 changed files with 616782 additions and 0 deletions

18
.editorconfig Normal file
View File

@@ -0,0 +1,18 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.bat]
end_of_line = crlf
[*.yml]
indent_style = space
indent_size = 2

42
.gitattributes vendored Normal file
View File

@@ -0,0 +1,42 @@
# Define the line ending behavior of the different file extensions
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
* text eol=lf
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.php text
*.default text
*.ctp text
*.sql text
*.md text
*.po text
*.js text
*.css text
*.ini text
*.properties text
*.txt text
*.xml text
*.svg text
*.yml text
.htaccess text
# Declare files that will always have CRLF line endings on checkout.
*.bat eol=crlf
# Declare files that will always have LF line endings on checkout.
*.pem eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.gif binary
*.ico binary
*.mo binary
*.pdf binary
*.phar binary
*.woff binary
*.woff2 binary
*.ttf binary
*.otf binary
*.eot binary

23
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,23 @@
This is a (multiple allowed):
* [x] bug
* [ ] enhancement
* [ ] feature-discussion (RFC)
* CakePHP Application Skeleton Version: EXACT RELEASE VERSION OR COMMIT HASH, HERE.
* Platform and Target: YOUR WEB-SERVER, DATABASE AND OTHER RELEVANT INFO AND HOW THE REQUEST IS BEING MADE, HERE.
### What you did
EXPLAIN WHAT YOU DID, PREFERABLY WITH CODE EXAMPLES, HERE.
### What happened
EXPLAIN WHAT IS ACTUALLY HAPPENING, HERE.
### What you expected to happen
EXPLAIN WHAT IS TO BE EXPECTED, HERE.
P.S. Remember, an issue is not the place to ask questions. You can use [Stack Overflow](http://stackoverflow.com/questions/tagged/cakephp)
for that or join the #cakephp channel on irc.freenode.net, where we will be more
than happy to help answer your questions.
Before you open an issue, please check if a similar issue already exists or has been closed before.

10
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,10 @@
**PLEASE NOTE:**
This is only a issue tracker for issues related to the CakePHP Application Skeleton.
For CakePHP Framework issues please use this [issue tracker](https://github.com/cakephp/cakephp/issues).
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
The best way to propose a feature is to open an issue first and discuss your ideas there before implementing them.
Always follow the [contribution guidelines](https://github.com/cakephp/cakephp/blob/master/.github/CONTRIBUTING.md) guidelines when submitting a pull request. In particular, make sure existing tests still pass, and add tests for all new behavior. When fixing a bug, you may want to add a test to verify the fix.

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
/vendor/*
/config/app.php
/tmp/*
/logs/*

11
.htaccess Normal file
View File

@@ -0,0 +1,11 @@
# Uncomment the following to prevent the httpoxy vulnerability
# See: https://httpoxy.org/
#<IfModule mod_headers.c>
# RequestHeader unset Proxy
#</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>

30
.travis.yml Normal file
View File

@@ -0,0 +1,30 @@
language: php
dist: trusty
sudo: false
php:
- 5.5
- 5.6
- 7.0
- 7.1
matrix:
fast_finish: true
include:
- php: 7.0
env: PHPCS=1
before_script:
- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:~2.1; fi
- if [[ $PHPCS != 1 ]]; then composer install; fi
- if [[ $PHPCS != 1 ]]; then composer run-script post-install-cmd --no-interaction; fi
script:
- if [[ $PHPCS != 1 ]]; then phpunit; fi
- if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests ./config ./webroot; fi
notifications:
email: false

32
README.md Normal file
View File

@@ -0,0 +1,32 @@
# CakePHP Application Skeleton
[![Build Status](https://img.shields.io/travis/cakephp/app/master.svg?style=flat-square)](https://travis-ci.org/cakephp/app)
[![License](https://img.shields.io/packagist/l/cakephp/app.svg?style=flat-square)](https://packagist.org/packages/cakephp/app)
A skeleton for creating applications with [CakePHP](http://cakephp.org) 3.x.
The framework source code can be found here: [cakephp/cakephp](https://github.com/cakephp/cakephp).
## Installation
1. Download [Composer](http://getcomposer.org/doc/00-intro.md) or update `composer self-update`.
2. Run `php composer.phar create-project --prefer-dist cakephp/app [app_name]`.
If Composer is installed globally, run
```bash
composer create-project --prefer-dist cakephp/app [app_name]
```
You should now be able to visit the path to where you installed the app and see the default home page.
## Update
Since this skeleton is a starting point for your application and various files would have been modified as per your needs, there isn't a way to provide automated upgrades, so you have to do any updates manually.
## Configuration
Read and edit `config/app.php` and setup the `'Datasources'` and any other
configuration relevant for your application.
## Layout
The app skeleton uses a subset of [Foundation](http://foundation.zurb.com/) CSS framework by default. You can, however, replace it with any other library or custom styles.

46
bin/cake Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env sh
################################################################################
#
# Cake is a shell script for invoking CakePHP shell commands
#
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
#
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
# @link http://cakephp.org CakePHP(tm) Project
# @since 1.2.0
# @license http://www.opensource.org/licenses/mit-license.php MIT License
#
################################################################################
# Canonicalize by following every symlink of the given name recursively
canonicalize() {
NAME="$1"
if [ -f "$NAME" ]
then
DIR=$(dirname -- "$NAME")
NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
fi
while [ -h "$NAME" ]; do
DIR=$(dirname -- "$NAME")
SYM=$(readlink "$NAME")
NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM")
done
echo "$NAME"
}
CONSOLE=$(dirname -- "$(canonicalize "$0")")
APP=$(dirname "$CONSOLE")
if [ $(basename $0) != 'cake' ]
then
exec php "$CONSOLE"/cake.php $(basename $0) "$@"
else
exec php "$CONSOLE"/cake.php "$@"
fi
exit

27
bin/cake.bat Normal file
View File

@@ -0,0 +1,27 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Cake is a Windows batch script for invoking CakePHP shell commands
::
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
:: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
::
:: Licensed under The MIT License
:: Redistributions of files must retain the above copyright notice.
::
:: @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
:: @link http://cakephp.org CakePHP(tm) Project
:: @since 2.0.0
:: @license http://www.opensource.org/licenses/mit-license.php MIT License
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
SET app=%0
SET lib=%~dp0
php "%lib%cake.php" %*
echo.
exit /B %ERRORLEVEL%

34
bin/cake.php Normal file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/php -q
<?php
/**
* Command-line code generation utility to automate programmer chores.
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$minVersion = '5.5.9';
if (file_exists('composer.json')) {
$composer = json_decode(file_get_contents('composer.json'));
if (isset($composer->require->php)) {
$minVersion = preg_replace('/([^0-9\.])/', '', $composer->require->php);
}
}
if (version_compare(phpversion(), $minVersion, '<')) {
fwrite(STDERR, sprintf("Minimum PHP version: %s. You are using: %s.\n", $minVersion, phpversion()));
exit(-1);
}
require dirname(__DIR__) . '/vendor/autoload.php';
include dirname(__DIR__) . '/config/bootstrap.php';
exit(Cake\Console\ShellDispatcher::run($argv));

50
composer.json Normal file
View File

@@ -0,0 +1,50 @@
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": "3.3.*",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*",
"sunra/php-simple-html-dom-parser": "^1.5",
"microweber/screen": "^1.0",
"spatie/array-to-xml": "^2.7"
},
"require-dev": {
"psy/psysh": "@stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "~1.1"
},
"suggest": {
"markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump",
"check": [
"@test",
"@cs-check"
],
"cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"test": "phpunit --colors=always"
}
}

2221
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

346
config/app.default.php Normal file
View File

@@ -0,0 +1,346 @@
<?php
return [
/**
* Debug Level:
*
* Production Mode:
* false: No error messages, errors, or warnings shown.
*
* Development Mode:
* true: Errors and warnings shown.
*/
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
/**
* Configure basic information about the application.
*
* - namespace - The namespace to find app classes under.
* - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time.
* - encoding - The encoding used for HTML + database connections.
* - base - The base directory the app resides in. If false this
* will be auto detected.
* - dir - Name of app directory.
* - webroot - The webroot directory.
* - wwwRoot - The file path to webroot.
* - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
* use CakePHP pretty URLs, remove these .htaccess
* files:
* /.htaccess
* /webroot/.htaccess
* And uncomment the baseUrl key below.
* - fullBaseUrl - A base URL to use for absolute links.
* - imageBaseUrl - Web path to the public images directory under webroot.
* - cssBaseUrl - Web path to the public css directory under webroot.
* - jsBaseUrl - Web path to the public js directory under webroot.
* - paths - Configure paths for non class based resources. Supports the
* `plugins`, `templates`, `locales` subkeys, which allow the definition of
* paths for plugins, view templates and locale files respectively.
*/
'App' => [
'namespace' => 'App',
'encoding' => env('APP_ENCODING', 'UTF-8'),
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),
'base' => false,
'dir' => 'src',
'webroot' => 'webroot',
'wwwRoot' => WWW_ROOT,
// 'baseUrl' => env('SCRIPT_NAME'),
'fullBaseUrl' => false,
'imageBaseUrl' => 'img/',
'cssBaseUrl' => 'css/',
'jsBaseUrl' => 'js/',
'paths' => [
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [APP . 'Template' . DS],
'locales' => [APP . 'Locale' . DS],
],
],
/**
* Security and encryption configuration
*
* - salt - A random string used in security hashing methods.
* The salt value is also used as the encryption key.
* You should treat it as extremely sensitive data.
*/
'Security' => [
'salt' => env('SECURITY_SALT', '__SALT__'),
],
/**
* Apply timestamps with the last modified time to static assets (js, css, images).
* Will append a querystring parameter containing the time the file was modified.
* This is useful for busting browser caches.
*
* Set to true to apply timestamps when debug is true. Set to 'force' to always
* enable timestamping regardless of debug value.
*/
'Asset' => [
// 'timestamp' => true,
],
/**
* Configure the cache adapters.
*/
'Cache' => [
'default' => [
'className' => 'File',
'path' => CACHE,
'url' => env('CACHE_DEFAULT_URL', null),
],
/**
* Configure the cache used for general framework caching.
* Translation cache files are stored with this configuration.
* Duration will be set to '+2 minutes' in bootstrap.php when debug = true
* If you set 'className' => 'Null' core cache will be disabled.
*/
'_cake_core_' => [
'className' => 'File',
'prefix' => 'myapp_cake_core_',
'path' => CACHE . 'persistent/',
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKECORE_URL', null),
],
/**
* Configure the cache for model and datasource caches. This cache
* configuration is used to store schema descriptions, and table listings
* in connections.
* Duration will be set to '+2 minutes' in bootstrap.php when debug = true
*/
'_cake_model_' => [
'className' => 'File',
'prefix' => 'myapp_cake_model_',
'path' => CACHE . 'models/',
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKEMODEL_URL', null),
],
],
/**
* Configure the Error and Exception handlers used by your application.
*
* By default errors are displayed using Debugger, when debug is true and logged
* by Cake\Log\Log when debug is false.
*
* In CLI environments exceptions will be printed to stderr with a backtrace.
* In web environments an HTML page will be displayed for the exception.
* With debug true, framework errors like Missing Controller will be displayed.
* When debug is false, framework errors will be coerced into generic HTTP errors.
*
* Options:
*
* - `errorLevel` - int - The level of errors you are interested in capturing.
* - `trace` - boolean - Whether or not backtraces should be included in
* logged errors/exceptions.
* - `log` - boolean - Whether or not you want exceptions logged.
* - `exceptionRenderer` - string - The class responsible for rendering
* uncaught exceptions. If you choose a custom class you should place
* the file for that class in src/Error. This class needs to implement a
* render method.
* - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
* extend one of the listed exceptions will also be skipped for logging.
* E.g.:
* `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']`
* - `extraFatalErrorMemory` - int - The number of megabytes to increase
* the memory limit by when a fatal error is encountered. This allows
* breathing room to complete logging or error handling.
*/
'Error' => [
'errorLevel' => E_ALL,
'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
'skipLog' => [],
'log' => true,
'trace' => true,
],
/**
* Email configuration.
*
* By defining transports separately from delivery profiles you can easily
* re-use transport configuration across multiple profiles.
*
* You can specify multiple configurations for production, development and
* testing.
*
* Each transport needs a `className`. Valid options are as follows:
*
* Mail - Send using PHP mail function
* Smtp - Send using SMTP
* Debug - Do not send the email, just return the result
*
* You can add custom transports (or override existing transports) by adding the
* appropriate file to src/Mailer/Transport. Transports should be named
* 'YourTransport.php', where 'Your' is the name of the transport.
*/
'EmailTransport' => [
'default' => [
'className' => 'Mail',
// The following keys are used in SMTP transports
'host' => 'localhost',
'port' => 25,
'timeout' => 30,
'username' => 'user',
'password' => 'secret',
'client' => null,
'tls' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
],
/**
* Email delivery profiles
*
* Delivery profiles allow you to predefine various properties about email
* messages from your application and give the settings a name. This saves
* duplication across your application and makes maintenance and development
* easier. Each profile accepts a number of keys. See `Cake\Mailer\Email`
* for more information.
*/
'Email' => [
'default' => [
'transport' => 'default',
'from' => 'you@localhost',
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
],
],
/**
* Connection information used by the ORM to connect
* to your application's datastores.
* Do not use periods in database name - it may lead to error.
* See https://github.com/cakephp/cakephp/issues/6471 for details.
* Drivers include Mysql Postgres Sqlite Sqlserver
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
*/
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'non_standard_port_number',
'username' => 'my_app',
'password' => 'secret',
'database' => 'my_app',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
/**
* Set identifier quoting to true if you are using reserved words or
* special characters in your table or column names. Enabling this
* setting will result in queries built using the Query Builder having
* identifiers quoted when creating SQL. It should be noted that this
* decreases performance because each query needs to be traversed and
* manipulated before being executed.
*/
'quoteIdentifiers' => false,
/**
* During development, if using MySQL < 5.6, uncommenting the
* following line could boost the speed at which schema metadata is
* fetched from the database. It can also be set directly with the
* mysql configuration directive 'innodb_stats_on_metadata = 0'
* which is the recommended value in production environments
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null),
],
/**
* The test connection is used during the test suite.
*/
'test' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'my_app',
'password' => 'secret',
'database' => 'test_myapp',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_TEST_URL', null),
],
],
/**
* Configures logging options
*/
'Log' => [
'debug' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'debug',
'levels' => ['notice', 'info', 'debug'],
'url' => env('LOG_DEBUG_URL', null),
],
'error' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'error',
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
'url' => env('LOG_ERROR_URL', null),
],
],
/**
* Session configuration.
*
* Contains an array of settings to use for session configuration. The
* `defaults` key is used to define a default preset to use for sessions, any
* settings declared here will override the settings of the default config.
*
* ## Options
*
* - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'.
* - `cookiePath` - The url path for which session cookie is set. Maps to the
* `session.cookie_path` php.ini config. Defaults to base path of app.
* - `timeout` - The time in minutes the session should be valid for.
* Pass 0 to disable checking timeout.
* Please note that php.ini's session.gc_maxlifetime must be equal to or greater
* than the largest Session['timeout'] in all served websites for it to have the
* desired effect.
* - `defaults` - The default configuration set to use as a basis for your session.
* There are four built-in options: php, cake, cache, database.
* - `handler` - Can be used to enable a custom session handler. Expects an
* array with at least the `engine` key, being the name of the Session engine
* class to use for managing the session. CakePHP bundles the `CacheSession`
* and `DatabaseSession` engines.
* - `ini` - An associative array of additional ini values to set.
*
* The built-in `defaults` options are:
*
* - 'php' - Uses settings defined in your php.ini.
* - 'cake' - Saves session files in CakePHP's /tmp directory.
* - 'database' - Uses CakePHP's database sessions.
* - 'cache' - Use the Cache class to save sessions.
*
* To define a custom session handler, save it at src/Network/Session/<name>.php.
* Make sure the class implements PHP's `SessionHandlerInterface` and set
* Session.handler to <name>
*
* To use database sessions, load the SQL file located at config/Schema/sessions.sql
*/
'Session' => [
'defaults' => 'php',
],
];

227
config/bootstrap.php Normal file
View File

@@ -0,0 +1,227 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 0.10.8
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/*
* You can remove this if you are confident that your PHP version is sufficient.
*/
if (version_compare(PHP_VERSION, '5.5.9') < 0) {
trigger_error('Your PHP version must be equal or higher than 5.5.9 to use CakePHP.', E_USER_ERROR);
}
/*
* You can remove this if you are confident you have intl installed.
*/
if (!extension_loaded('intl')) {
trigger_error('You must enable the intl extension to use CakePHP.', E_USER_ERROR);
}
/*
* You can remove this if you are confident you have mbstring installed.
*/
if (!extension_loaded('mbstring')) {
trigger_error('You must enable the mbstring extension to use CakePHP.', E_USER_ERROR);
}
/*
* Configure paths required to find CakePHP + general filepath
* constants
*/
require __DIR__ . '/paths.php';
/*
* Bootstrap CakePHP.
*
* Does the various bits of setup that CakePHP needs to do.
* This includes:
*
* - Registering the CakePHP autoloader.
* - Setting the default application paths.
*/
require CORE_PATH . 'config' . DS . 'bootstrap.php';
use Cake\Cache\Cache;
use Cake\Console\ConsoleErrorHandler;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Core\Plugin;
use Cake\Database\Type;
use Cake\Datasource\ConnectionManager;
use Cake\Error\ErrorHandler;
use Cake\Log\Log;
use Cake\Mailer\Email;
use Cake\Network\Request;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/*
* Read configuration file and inject configuration into various
* CakePHP classes.
*
* By default there is only one configuration file. It is often a good
* idea to create multiple configuration files, and separate the configuration
* that changes from configuration that does not. This makes deployment simpler.
*/
try {
Configure::config('default', new PhpConfig());
Configure::load('app', 'default', false);
} catch (\Exception $e) {
exit($e->getMessage() . "\n");
}
/*
* Load an environment local configuration file.
* You can use a file like app_local.php to provide local overrides to your
* shared configuration.
*/
//Configure::load('app_local', 'default');
/*
* When debug = true the metadata cache should only last
* for a short time.
*/
if (Configure::read('debug')) {
Configure::write('Cache._cake_model_.duration', '+2 minutes');
Configure::write('Cache._cake_core_.duration', '+2 minutes');
}
/*
* Set server timezone to UTC. You can change it to another timezone of your
* choice but using UTC makes time calculations / conversions easier.
*/
date_default_timezone_set('UTC');
/*
* Configure the mbstring extension to use the correct encoding.
*/
mb_internal_encoding(Configure::read('App.encoding'));
/*
* Set the default locale. This controls how dates, number and currency is
* formatted and sets the default language to use for translations.
*/
ini_set('intl.default_locale', Configure::read('App.defaultLocale'));
/*
* Register application error and exception handlers.
*/
$isCli = PHP_SAPI === 'cli';
if ($isCli) {
(new ConsoleErrorHandler(Configure::read('Error')))->register();
} else {
(new ErrorHandler(Configure::read('Error')))->register();
}
/*
* Include the CLI bootstrap overrides.
*/
if ($isCli) {
require __DIR__ . '/bootstrap_cli.php';
}
/*
* Set the full base URL.
* This URL is used as the base of all absolute links.
*
* If you define fullBaseUrl in your config file you can remove this.
*/
if (!Configure::read('App.fullBaseUrl')) {
$s = null;
if (env('HTTPS')) {
$s = 's';
}
$httpHost = env('HTTP_HOST');
if (isset($httpHost)) {
Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
}
unset($httpHost, $s);
}
Cache::config(Configure::consume('Cache'));
ConnectionManager::config(Configure::consume('Datasources'));
Email::configTransport(Configure::consume('EmailTransport'));
Email::config(Configure::consume('Email'));
Log::config(Configure::consume('Log'));
Security::salt(Configure::consume('Security.salt'));
/*
* The default crypto extension in 3.0 is OpenSSL.
* If you are migrating from 2.x uncomment this code to
* use a more compatible Mcrypt based implementation
*/
//Security::engine(new \Cake\Utility\Crypto\Mcrypt());
/*
* Setup detectors for mobile and tablet.
*/
Request::addDetector('mobile', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isMobile();
});
Request::addDetector('tablet', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isTablet();
});
/*
* Enable immutable time objects in the ORM.
*
* You can enable default locale format parsing by adding calls
* to `useLocaleParser()`. This enables the automatic conversion of
* locale specific date formats. For details see
* @link http://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data
*/
Type::build('time')
->useImmutable();
Type::build('date')
->useImmutable();
Type::build('datetime')
->useImmutable();
Type::build('timestamp')
->useImmutable();
/*
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*/
//Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
//Inflector::rules('irregular', ['red' => 'redlings']);
//Inflector::rules('uninflected', ['dontinflectme']);
//Inflector::rules('transliteration', ['/å/' => 'aa']);
/*
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
/*
* Only try to load DebugKit in development mode
* Debug Kit should not be installed on a production system
*/
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
//Plugin::load('AsdCurl', ['autoload' => true]);
Plugin::load('AsdCurl', ['autoload' => true, 'bootstrap' => true, 'routes' => true]);

38
config/bootstrap_cli.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Configure;
use Cake\Core\Exception\MissingPluginException;
use Cake\Core\Plugin;
/**
* Additional bootstrapping and configuration for CLI environments should
* be put here.
*/
// Set the fullBaseUrl to allow URLs to be generated in shell tasks.
// This is useful when sending email from shells.
//Configure::write('App.fullBaseUrl', php_uname('n'));
// Set logs to different files so they don't have permission conflicts.
Configure::write('Log.debug.file', 'cli-debug');
Configure::write('Log.error.file', 'cli-error');
try {
Plugin::load('Bake');
} catch (MissingPluginException $e) {
// Do not halt if the plugin is missing
}
Plugin::load('Migrations');

85
config/paths.php Normal file
View File

@@ -0,0 +1,85 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Use the DS to separate the directories in other defines
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
* When using custom settings be sure to use the DS and do not add a trailing DS.
*/
/**
* The full path to the directory which holds "src", WITHOUT a trailing DS.
*/
define('ROOT', dirname(__DIR__));
/**
* The actual directory name for the application directory. Normally
* named 'src'.
*/
define('APP_DIR', 'src');
/**
* Path to the application's directory.
*/
define('APP', ROOT . DS . APP_DIR . DS);
/**
* Path to the config directory.
*/
define('CONFIG', ROOT . DS . 'config' . DS);
/**
* File path to the webroot directory.
*/
define('WWW_ROOT', ROOT . DS . 'webroot' . DS);
/**
* Path to the tests directory.
*/
define('TESTS', ROOT . DS . 'tests' . DS);
/**
* Path to the temporary files directory.
*/
define('TMP', ROOT . DS . 'tmp' . DS);
/**
* Path to the logs directory.
*/
define('LOGS', ROOT . DS . 'logs' . DS);
/**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/
define('CACHE', TMP . 'cache' . DS);
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
* CakePHP should always be installed with composer, so look there.
*/
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'vendor' . DS . 'cakephp' . DS . 'cakephp');
/**
* Path to the cake directory.
*/
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
define('CAKE', CORE_PATH . 'src' . DS);

83
config/routes.php Normal file
View File

@@ -0,0 +1,83 @@
<?php
/**
* Routes configuration
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different URLs to chosen controllers and their actions (functions).
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Plugin;
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;
/**
* The default class to use for all routes
*
* The following route classes are supplied with CakePHP and are appropriate
* to set as the default:
*
* - Route
* - InflectedRoute
* - DashedRoute
*
* If no call is made to `Router::defaultRouteClass()`, the class used is
* `Route` (`Cake\Routing\Route\Route`)
*
* Note that `Route` does not do any inflections on URLs which will result in
* inconsistently cased URLs when used with `:plugin`, `:controller` and
* `:action` markers.
*
*/
Router::defaultRouteClass(DashedRoute::class);
Router::scope('/', function (RouteBuilder $routes) {
/**
* Here, we are connecting '/' (base path) to a controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, src/Template/Pages/home.ctp)...
*/
$routes->connect('/', ['controller' => 'curls', 'action' => 'usStatistik']);
//$routes->connect('/', ['controller' => 'examinations', 'action' => 'index']);
/**
* ...and connect the rest of 'Pages' controller's URLs.
*/
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
/**
* Connect catchall routes for all controllers.
*
* Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
* `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
* `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
*
* Any route class can be used with this method, such as:
* - DashedRoute
* - InflectedRoute
* - Route
* - Or your own route class
*
* You can remove these routes once you've connected the
* routes you want in your application.
*/
$routes->fallbacks(DashedRoute::class);
});
/**
* Load all plugin routes. See the Plugin documentation on
* how to customize the loading of plugin routes.
*/
Plugin::routes();

18
config/schema/i18n.sql Normal file
View File

@@ -0,0 +1,18 @@
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
# MIT License (http://www.opensource.org/licenses/mit-license.php)
CREATE TABLE i18n (
id int NOT NULL auto_increment,
locale varchar(6) NOT NULL,
model varchar(255) NOT NULL,
foreign_key int(10) NOT NULL,
field varchar(255) NOT NULL,
content text,
PRIMARY KEY (id),
UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
INDEX I18N_FIELD(model, foreign_key, field)
);

View File

@@ -0,0 +1,13 @@
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
# MIT License (http://www.opensource.org/licenses/mit-license.php)
CREATE TABLE sessions (
id char(40) NOT NULL,
data text,
expires INT(11) NOT NULL,
PRIMARY KEY (id)
);

16
index.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 0.10.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';

View File

View File

@@ -0,0 +1,8 @@
copy.src.files=false
copy.src.on.open=false
copy.src.target=C:\\xampp\\htdocs\\asd-control
debug.proxy.host=10.1.248.54
debug.proxy.port=9001
debug.url=DEFAULT_URL
run.as=LOCAL
url=http://asd.local/

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/W:/asd-control/src/Template/Monitorings/viva.ctp</file>
<file>file:/W:/asd-control/src/Controller/Component/ToolsComponent.php</file>
<file>file:/W:/asd-control/src/Controller/MonitoringsController.php</file>
</group>
</open-files>
</project-private>

View File

@@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_70
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=webroot

9
nbproject/project.xml Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>asd-control</name>
</data>
</configuration>
</project>

40
phpunit.xml.dist Normal file
View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="App Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
<!-- Add plugin test suites here. -->
</testsuites>
<!-- Setup a listener for fixtures -->
<listeners>
<listener
class="\Cake\TestSuite\Fixture\FixtureInjector"
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
</arguments>
</listener>
</listeners>
<!-- Ignore vendor tests in code coverage reports -->
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
<directory suffix=".php">./plugins/*/src/</directory>
</whitelist>
</filter>
</phpunit>

11
plugins/AsdCurl/README.md Normal file
View File

@@ -0,0 +1,11 @@
# AsdCurl plugin for CakePHP
## Installation
You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).
The recommended way to install composer packages is:
```
composer require your-name-here/AsdCurl
```

View File

@@ -0,0 +1,23 @@
{
"name": "your-name-here/AsdCurl",
"description": "AsdCurl plugin for CakePHP",
"type": "cakephp-plugin",
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": ">=3.3.2 <4.0.0"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"autoload": {
"psr-4": {
"AsdCurl\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"AsdCurl\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
try {
Configure::config('default', new PhpConfig());
Configure::load('app', 'default', false);
} catch (\Exception $e) {
exit($e->getMessage() . "\n");
}
define('SCHULPORTAL_BASE0_URL', "https://portal.schulen.bayern.de");
define('SCHULPORTAL_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0');
define('SCHULPORTAL_ASD_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd');
//define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig9adaec6129c81dbeb2f42638bc9f27ac0c442a10891f0c915c9d7f0c371a00b3/uniquesig1/asd');
define('SCHULPORTAL_MSTR_BASE_URL', SCHULPORTAL_BASE0_URL . '/uniquesig182e937bef9540ecffb7e0ba167caaea052491068bd93a46e70dbd73bf9f8963/uniquesig1/asd');
Configure::write('AsdCurl.proxy','10.1.248.1:82');
Configure::write('AsdCurl.cookiejar', '/tmp/cookies.txt');
Configure::write('AsdCurl.cookiefile', '/tmp/cookies.txt');
Configure::write('AsdCurl.cookie', 'cookiename=cookievalue');
Configure::write('AsdCurl.useragent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0');
Configure::write('AsdCurl.cert','/var/www/html/ssl_KM_Z2016_asd.trinkl.pem');
Configure::write('AsdCurl.schulbase0url',SCHULPORTAL_BASE0_URL);
Configure::write('AsdCurl.schulbaseurl',SCHULPORTAL_BASE_URL);
Configure::write('AsdCurl.asdbaseurl',SCHULPORTAL_ASD_BASE_URL);
Configure::write('AsdCurl.mstrbaseurl',SCHULPORTAL_MSTR_BASE_URL);
?>

View File

@@ -0,0 +1,12 @@
<?php
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;
Router::plugin(
'AsdCurl',
['path' => '/asd-curl'],
function (RouteBuilder $routes) {
$routes->fallbacks(DashedRoute::class);
}
);

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="AsdCurl Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
</testsuites>
<!-- Setup a listener for fixtures -->
<listeners>
<listener
class="\Cake\TestSuite\Fixture\FixtureInjector"
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
</arguments>
</listener>
</listeners>
<!-- Prevent coverage reports from looking in tests and vendors -->
<filter>
<blacklist>
<directory suffix=".php">./vendor/</directory>
<directory suffix=".ctp">./vendor/</directory>
<directory suffix=".php">./tests/</directory>
<directory suffix=".ctp">./tests/</directory>
</blacklist>
</filter>
</phpunit>

View File

@@ -0,0 +1,193 @@
<?php
namespace AsdCurl;
use Cake\Core\Configure;
class AsdCurl
{
public $status;
public $error;
public $html;
public $message;
public function __construct()
{
$this->status = false;
$this->error = false;
$this->html = '';
$this->message = '';
}
public function init_curl_params()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, Configure::read('AsdCurl.proxy'));
curl_setopt($ch, CURLOPT_USERAGENT, Configure::read('AsdCurl.useragent'));
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, Configure::read('AsdCurl.cookiejar'));
curl_setopt($ch, CURLOPT_COOKIEFILE, Configure::read('AsdCurl.cookiefile'));
curl_setopt($ch, CURLOPT_COOKIE, Configure::read('AsdCurl.cookie'));
curl_setopt($ch, CURLOPT_SSLCERT, Configure::read('AsdCurl.cert'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
return ($ch);
}
public function get_string_between($string, $start, $end)
{
//debug($start);
//debug($end);
$string = " " . $string;
$ini = strpos($string, $start);
//debug($ini);
//debug($string);die;
if ($ini == 0) {
return "";
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
$sub = substr($string, $ini, $len);
$elem = explode(' ', $sub)[0];
return str_replace('"', '', $elem);
}
public function exec_curl($ch, $url, $post)
{
if ($post == false) {
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
} else {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
}
curl_setopt($ch, CURLOPT_URL, $url);
$this->html = curl_exec($ch);
//debug(curl_errno($ch));
//debug(curl_getinfo($ch, CURLINFO_HTTP_CODE));
if (curl_errno($ch)) {
$this->status = false;
$this->error = 'Couldn\'t send request: ' . curl_error($ch);
} else {
$resultStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($resultStatus != 200) {
$this->status = false;
$this->error = 'Request failed: HTTP status code: ' . $resultStatus;
}
}
}
public function login_asd($ch)
{
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asddv/dv_xy_00.jsf', false);
if(!($this->status)) {
die($this->error);
}
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$login_data = [
'asd_username' => 'A005_TrinklW',
'asd_password' => 'HiegTzs!12',
];
$post = [
'login:username' => $login_data['asd_username'],
'login:password' => $login_data['asd_password'],
'login' => 'login',
'javax.faces.ViewState' => $viewstate,
'login:loginButton' => 'login:loginButton',
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/login/login.jsf', $post);
if(!($this->status)) {
die($this->error);
}
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
Configure::write('Session', ['viewstate' => $viewstate]);
}
public function login_mstr($ch) {
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
$url = '/asp';
//debug($SCHULPORTAL_MSTR_BASE_URL . $url);die;
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false);
//debug($this->html);die;
$post = [
'Uid' => 'A005_TrinklW',
'Pwd' => 'HiegTzs!12',
];
$pvar['ConnMode'] = $this->get_string_between($this->html, '<input name="ConnMode" id="ConnMode" type="hidden" class="mstrHiddenInput" value="', '"/>');
$pvar['3054'] = $this->get_string_between($this->html, '<input name="3054" id="3054" type="submit" value="', '" class="mstrButton"/>');
$mstr_login_vars = array('evt', 'src', 'target', 'key', 'Port', 'Project', 'Server', 'login', 'smartBanner', 'lb');
foreach ($mstr_login_vars as $var) {
$value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value="', '"/>');
//$value = $this->get_string_between($this->html, 'name="' . $var . '" value=', 'type="hidden"');
$pvar[$var] = $value;
}
$post = array_merge($post, $pvar);
//debug($post);die;
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . '/asp/Main.aspx', $post);
if(strpos($this->html,'Login failure')) {
$this->status = false;
}
//debug($this->html);die;
}
public function logout_mstr($ch) {
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
$url = '/asp/Main.aspx';
$post = [
'evt' => '3008',
'src' => 'mstrWeb.3008',
'xts' => exec('date +%s%3N'),
];
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
curl_close($ch);
}
public function login_school($ch)
{
$SCHULPORTAL_BASE0_URL = Configure::read('AsdCurl.schulbase0url');
$SCHULPORTAL_BASE_URL = Configure::read('AsdCurl.schulbaseurl');
//$login_data = $this->request->session()->read('data');
$this->exec_curl($ch, $SCHULPORTAL_BASE_URL, false);
if(!($this->status)) {
die($this->error);
}
$login_data = [
'portal_username' => 'asd.trinkl',
'portal_password' => 'HiegTzs!182',
];
$post = [
'user_name' => $login_data['portal_username'],
'password' => $login_data['portal_password'],
'repository' => 'schulen.bayern.de',
'site_name' => 'schulportal',
'secure' => '1',
'resource_id' => '2',
'login_type' => '2',
];
// Anmeldeformular fuer das Schulportal abschicken - Step 2
$this->exec_curl($ch, $SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp', $post);
if(!($this->status)) {
die($this->error);
}
}
public function exec_mstr($ch, $url, $post)
{
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
$html = $this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
return ($html);
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace AsdCurl;
use AsdCurl\AsdCurl;
use Cake\Core\Configure;
class AsdMstr extends AsdCurl
{
public function __construct($url = null)
{
$this->status = true;
$this->error = false;
}
public function send_mail($ch,$status,$message,$lastsuccess) {
date_default_timezone_set("Europe/Berlin");
$datestring = date('d.m.Y H:i');
$url = 'http://www.dr-trinkl.de/index.php';
// 'to' => 'wilfried.trinkl@stmbw.bayern.de;philipp.knollmueller@stmbw.bayern.de;johannes.moesl@stmbw.bayern.de',
$email_params=[
'to' => 'wilfried.trinkl@stmbw.bayern.de;philipp.knollmueller@stmbw.bayern.de;johannes.moesl@stmbw.bayern.de',
'bcc' => 'wilfried.trinkl@mail-wt.de',
'from_name' => 'MSTR Monitoring',
'from' => 'wilfried.trinkl@mail-wt.de',
'secret' => 'QuaTe4tbchwFx9mxptEr'
];
if($status == 'Fail') {
$email_content = [
'subject' => 'MSTR Failing ' . $datestring,
'body' => '<p>MSTR geht <b>WIEDER</b> nicht! Bitte umgehend tätig werden</p><p>' . $message .'</p>',
];
}
else {
$email_content = [
'subject' => 'MSTR Up Again '. $datestring,
'body' => '<p>MSTR geht <b>WIEDER</b>!</p>'.
'<p>MSTR Monitoring auf JIRA: <a href="http://lfstad-sv-kmjira.rz-sued.bayern.de:8080/browse/AS-2112">http://lfstad-sv-kmjira.rz-sued.bayern.de:8080/browse/AS-2112</a></p>' .
'<p>|Prod|' . $lastsuccess . '|'. $datestring . ' |WiTr| Die Verbindung zum Server ist fehlgeschlagen. |unbekannt |</p>',
'bodyplain' => 'MSTR geht WIEDER!',
];
}
$this->exec_curl($ch, $url, array_merge($email_params,$email_content));
//debug($this->html);
}
public function monit_mstr($ch)
{
$SCHULPORTAL_MSTR_BASE_URL = Configure::read('AsdCurl.mstrbaseurl');
$reportID = '3F1FE53C4583613BABF14EA6242BACBE';
// MSTR Bericht ausführen - Step 5
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$links = $htmlParser->getElementsByTagName('a');
foreach ($links as $link) {
if ($link->nodeValue == 'Amtliche Schulstatistik') {
$params = explode('&', $link->getAttribute('href'));
foreach ($params as $param) {
$parts = explode('=', $param);
$lp[$parts[0]] = $parts[1];
}
}
}
//debug($this->html);
//debug($lp);
if (!isset($lp)) {
$this->status = false;
$this->error = 'Project missing';
} else {
$url = '/asp/Main.aspx?evt=3010&src=' . $lp['src'] . '&ServerAlias=' . $lp['ServerAlias'] . '&Port=' . $lp['Port'] . '&Project=' . $lp['Project'] . '&Server=' . $lp['Server'] . '&loginReq=true';
//debug($SCHULPORTAL_MSTR_BASE_URL . $url);die;
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false);
//$url = '/asp/Main.aspx?evt=4001&src=Main.aspx.4001&visMode=0&reportViewMode=1&reportID=' . $reportID . '&Server=' . $lp['ServerAlias'] . '&Project=PROD-1.46.1&Port=0&share=1';
//debug($url);die;
$url = '/asp/Main.aspx?evt=3067&src=Main.aspx.3067&reportViewMode=1&reportID=' . $reportID;
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, false);
//debug($this->html);
sleep(20);
$post = array();
$pvar = array();
$mstr_result_vars = array('evt', 'src', 'reportViewMode', 'reportID', 'fastExport', 'rsfb', 'rb', 'directExport');
foreach ($mstr_result_vars as $var) {
$value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value=', '"/>');
$pvar[$var] = $value;
}
$post = array_merge($post, $pvar);
$action = $this->get_string_between($this->html, 'FORM ACTION="Main.aspx', '" ID="printForm"');
$url = '/asp/Main.aspx' . $action;
//debug($post);
//debug($url);die;
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
//debug($this->html);
$post = array();
$pvar = array();
$mstr_down_vars = array('evt', 'src', 'SaveReportProperties', 'rb');
foreach ($mstr_down_vars as $var) {
$value = $this->get_string_between($this->html, 'name="' . $var . '" type="hidden" class="mstrHiddenInput" value=', '"/>');
$pvar[$var] = $value;
}
$post = array_merge($post, $pvar);
$action = $this->get_string_between($this->html, 'FORM ACTION="', '" ID="printForm"');
$url = '/asp/' . $action;
//debug($post);
//debug($url);
$this->exec_curl($ch, $SCHULPORTAL_MSTR_BASE_URL . $url, $post);
//debug($this->html);
}
}
}

View File

@@ -0,0 +1,480 @@
<?php
namespace AsdCurl;
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
use AsdCurl\AsdCurl;
use Cake\Core\Configure;
use Cake\I18n\Time;
class AsdUs extends AsdCurl
{
public function __construct($url = null)
{
$this->status = true;
$this->error = false;
}
public function save_us_data($ch) {
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
// Maske US 01 01 vom linken Menü aufrufen
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'sideMenu' => 'sideMenu',
'javax.faces.ViewState' => $viewstate,
'sideMenu:j_idt51:0:j_idt57:1:j_idt59' => 'sideMenu:j_idt51:0:j_idt57:1:j_idt59',
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_00_00.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
// In Maske US 01 01 alle Felder leer lassen und "Suchen" ausführen
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'false',
'mainForm:istAnzeigeMaske' => 'false',
'mainForm:dienststelle_schluessel' => '',
'mainForm:dienststelle_nameoffiziell' => '',
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0',
'mainForm:dienststelle_plzstrasse' => '',
'mainForm:dienststelle_ort' => '',
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
'mainForm:dienststelle_referent' => '',
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
'mainForm:dienststelle_status' => 'EMPTY:0',
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
'mainForm:action_suchen' => 'Suchen',
'javax.faces.ViewState' => $viewstate,
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_01.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
// Auf der Ergebnisseite auf "Alle" Klicken
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
//$mainform = $this->get_string_between($this->html, '\\\':\\\'', '\\\'},\\\'\\\')\');return false\" class=\"ignoreChangeNotification notBold\">ALLE</a>');
//debug($mainform);die;
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'true',
'mainForm:istAnzeigeMaske' => 'false',
'javax.faces.ViewState' => $viewstate,
'mainForm:j_idt189' => 'mainForm:j_idt189',
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
// Ergebnisse parsen und in die MySQL - Datenbank schreiben
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$table = $htmlParser->getElementById('mainForm:resultTable');
//debug($table);
$rel = [
'sname' => 0,
'snr' => 1,
'commune' => 2,
'state' => 5,
'delivery' => 6
];
$rows = $table->getElementsByTagName('tr');
$i = 0;
foreach ($rows as $row) {
//debug('Hallo');
if ($i > 0) {
$cols = $row->getElementsByTagName('td');
foreach($rel as $key => $value) {
if ($key == 'delivery') {
$time = Time::createFromFormat('d.m.Y, H:i:s', $cols->item($value)->nodeValue, 'UTC');
$data[$i][$key] = $time;
}
else {
$data[$i][$key] = $cols->item($value)->nodeValue;
}
}
}
$i++;
}
//debug($data);
$usdates = TableRegistry::get('Usdates');
$usdates->deleteAll('id' > 0);
$entities = $usdates->newEntities($data);
$result = $usdates->saveMany($entities);
if(!($result)) {
debug($entities);die;
}
}
public function save_up_data($ch) {
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
// Maske US 01 01 vom linken Menü aufrufen
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'sideMenu' => 'sideMenu',
'javax.faces.ViewState' => $viewstate,
'sideMenu:j_idt52:0:j_idt58:1:j_idt60' => 'sideMenu:j_idt52:0:j_idt58:1:j_idt60',
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_18_01.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
// In Maske US 01 01 alle Felder leer lassen und "Suchen" ausführen
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'false',
'mainForm:istAnzeigeMaske' => 'false',
'mainForm:dienststelle_schluessel' => '',
'mainForm:dienststelle_nameoffiziell' => '',
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0',
'mainForm:dienststelle_plzstrasse' => '',
'mainForm:dienststelle_ort' => '',
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
'mainForm:dienststelle_referent' => '',
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
'mainForm:dienststelle_status' => 'EMPTY:0',
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
'mainForm:action_suchen' => 'Suchen',
'javax.faces.ViewState' => $viewstate,
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_01.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
// Auf der Ergebnisseite auf "Alle" Klicken
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
//$mainform = $this->get_string_between($this->html, '\\\':\\\'', '\\\'},\\\'\\\')\');return false\" class=\"ignoreChangeNotification notBold\">ALLE</a>');
//debug($mainform);die;
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'true',
'mainForm:istAnzeigeMaske' => 'false',
'javax.faces.ViewState' => $viewstate,
'mainForm:j_idt189' => 'mainForm:j_idt189',
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdup/up_03_02.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
//echo $this->html;die;
// Ergebnisse parsen und in die MySQL - Datenbank schreiben
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$table = $htmlParser->getElementById('mainForm:resultTable');
//debug($table);
$rel = [
'sname' => 1,
'snr' => 2,
'commune' => 3,
'state' => 6,
'delivery' => 7
];
$rows = $table->getElementsByTagName('tr');
$i = 0;
foreach ($rows as $row) {
//debug('Hallo');
//debug($row);
if ($i > 0) {
$cols = $row->getElementsByTagName('td');
foreach($rel as $key => $value) {
//debug($key);
//debug($value);
if ($key == 'delivery') {
//debug($cols->item($value)->nodeValue);
$time = Time::createFromFormat('d.m.Y, H:i:s', $cols->item($value)->nodeValue, 'UTC');
$data[$i][$key] = $time;
}
else {
$data[$i][$key] = $cols->item($value)->nodeValue;
}
}
}
$i++;
}
//debug($data);
$usdates = TableRegistry::get('Usdates');
$usdates->deleteAll('id' > 0);
$entities = $usdates->newEntities($data);
$result = $usdates->saveMany($entities);
if(!($result)) {
debug($entities);die;
}
}
public function get_us_statistic($ch)
{
$SCHULPORTAL_ASD_BASE_URL = Configure::read('AsdCurl.asdbaseurl');
$viewstate = Configure::read('Session.viewstate');
//debug($viewstate);die;
$schularten = array(
'Gymnasium' => '747',
'Grundsch.sow.Mittelschule' => '742',
'Realschule' => '745',
'Abendrealschule' => '752',
'Realschule z. sp. F.' => '746',
'Schulartunabhängige Orientierungsstufe' => '749',
'Integrierte Gesamtschule' => '750',
);
$output = array();
foreach ($schularten as $sakey => $savalue) {
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf', false);
if(!($this->status)) {
die($this->error);
}
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'false',
'mainForm:istAnzeigMaske' => 'false',
'mainForm:dienststellenName' => '',
'mainForm:schulart' => '',
'mainForm:teilnehmendeGesamt' => '',
'mainForm:nichtAbgegebenKeinLv' => '',
'mainForm:nichtAbgegebenLv' => '',
'mainForm:vollstaendigMitPlFehler' => '',
'mainForm:vollstaendigOhnePlFehler' => '',
'mainForm:abgegeben=&' => '',
'mainForm:abgelehnt' => '',
'mainForm:freigegeben' => '',
'mainForm:us_03_01_popup_selectSchulart' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:' . $savalue,
'mainForm:popup_ok' => 'Ok',
'javax.faces.ViewState' => $viewstate,
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
//debug($this->html);die;
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$fields = array(
'Teilnehmende Schulen insgesamt' => 'mainForm:teilnehmendeGesamt',
'Schulen nicht übermittelt (kein Lieferversuch)' => 'mainForm:nichtAbgegebenKeinLv',
'Schulen nicht übermittelt (Lieferversuch)' => 'mainForm:nichtAbgegebenLv',
'Schulen übermittelt (PL-Fehler)' => 'mainForm:vollstaendigMitPlFehler',
'Schulen übermittelt (keine PL-Fehler)' => 'mainForm:vollstaendigOhnePlFehler',
'Schulen abgegeben' => 'mainForm:abgegeben',
'Schulen von Schulaufsicht abgelehnt' => 'mainForm:abgelehnt',
'Schulen von Schulaufsicht freigegeben' => 'mainForm:freigegeben');
foreach ($fields as $key => $field) {
$output[$sakey][$key] = $htmlParser->getElementById($field)->getAttribute('value');
}
}
// staatliche Gymnasien
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'sideMenu' => 'sideMenu',
'javax.faces.ViewState' => $viewstate,
'sideMenu:j_idt51:0:j_idt57:1:j_idt59' => 'sideMenu:j_idt51:0:j_idt57:1:j_idt59',
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_03_01.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'false',
'mainForm:istAnzeigeMaske' => 'false',
'mainForm:dienststelle_schluessel' => '',
'mainForm:dienststelle_nameoffiziell' => '',
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'com.hp.asd.wl.domain.standard.Dienststellentyp:1671',
'mainForm:dienststelle_plzstrasse' => '',
'mainForm:dienststelle_ort' => '',
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:747',
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
'mainForm:dienststelle_referent' => '',
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
'mainForm:dienststelle_status' => 'EMPTY:0',
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
'mainForm:action_suchen' => 'Suchen',
'javax.faces.ViewState' => $viewstate,
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_01.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
$viewstate = $this->get_string_between($this->html, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($this->html, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'true',
'mainForm:istAnzeigeMaske' => 'false',
'mainForm:resultTable:0:email' => '0252@schulen.bayern.de',
'mainForm:resultTable:0:j_idt112' => 'on',
'mainForm:resultTable:1:email' => '0282@schulen.bayern.de',
'mainForm:resultTable:1:j_idt112' => 'on',
'mainForm:resultTable:2:email' => '0180@schulen.bayern.de',
'mainForm:resultTable:2:j_idt112' => 'on',
'mainForm:resultTable:3:email' => '0072@schulen.bayern.de',
'mainForm:resultTable:3:j_idt112' => 'on',
'mainForm:resultTable:4:email' => '0151@schulen.bayern.de',
'mainForm:resultTable:4:j_idt112' => 'on',
'javax.faces.ViewState' => $viewstate,
'mainForm:j_idt183' => 'mainForm:j_idt183',
];
$this->exec_curl($ch, $SCHULPORTAL_ASD_BASE_URL . '/asdus/us_01_02.jsf?cid=' . $conversationId, $post);
if(!($this->status)) {
die($this->error);
}
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$table = $htmlParser->getElementById('mainForm:resultTable');
//debug($table);
$rows = $table->getElementsByTagName('tr');
$i = 0;
foreach ($rows as $row) {
//debug('Hallo');
if ($i > 0) {
$cols = $row->getElementsByTagName('td');
$status[$i] = $cols->item(5)->nodeValue;
}
$i++;
}
$result = array_count_values($status);
$output2['Staatliche Gymnasien']['Teilmende Schulen insgesamt'] = sizeof($status);
if (!isset($result['n. überm. (kein Liefervers.)'])) {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (kein Lieferversuch)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (kein Lieferversuch)'] = $result['n. überm. (kein Liefervers.)'];
}
if (!isset($result['n. überm. (Lieferversuch)'])) {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (Lieferversuch)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (Lieferversuch)'] = $result['n. überm. (Lieferversuch)'];
}
if (!isset($result['übermittelt (PL-Fehler)'])) {
$output2['Staatliche Gymnasien']['Schulen übermittelt (PL-Fehler)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen übermittelt (PL-Fehler)'] = $result['übermittelt (PL-Fehler)'];
}
if (!isset($result['übermittelt (keine PL-Fehler)'])) {
$output2['Staatliche Gymnasien']['Schulen übermittelt (keine PL-Fehler)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen übermittelt (keine PL-Fehler)'] = $result['übermittelt (keine PL-Fehler)'];
}
if (!isset($result['abgegeben'])) {
$output2['Staatliche Gymnasien']['Schulen abgegeben'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen abgegeben'] = $result['abgegeben'];
}
if (!isset($result['Schulaufs. abgelehnt'])) {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = $result['Schulaufs. abgelehnt'];
}
if (!isset($result['freigegeben'])) {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = $result['freigegeben'];
}
$output = array_merge($output2, $output);
return ($output);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace AsdCurl\Controller;
use App\Controller\AppController as BaseController;
class AppController extends BaseController
{
}

View File

@@ -0,0 +1,35 @@
<?php
namespace AsdCurl;
class Url
{
/**
* URL source
*
* @var string
*/
protected $src;
public function __construct($url)
{
// Prepend http:// if the url doesn't contain it
if (!stristr($url, 'http://') && !stristr($url, 'https://')) {
$url = 'http://' . $url;
}
if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
throw new InvalidUrlException($url);
}
$url = str_replace(array(';', '"', '<?'), '', strip_tags($url));
$url = str_replace(array('\077', '\''), array(' ', '/'), $url);
$this->src = $url;
}
public function __toString()
{
return $this->src;
}
}

View File

52
src/Application.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App;
use Cake\Core\Configure;
use Cake\Error\Middleware\ErrorHandlerMiddleware;
use Cake\Http\BaseApplication;
use Cake\Routing\Middleware\AssetMiddleware;
use Cake\Routing\Middleware\RoutingMiddleware;
/**
* Application setup class.
*
* This defines the bootstrapping logic and middleware layers you
* want to use in your application.
*/
class Application extends BaseApplication
{
/**
* Setup the middleware your application will use.
*
* @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup.
* @return \Cake\Http\MiddlewareQueue The updated middleware.
*/
public function middleware($middleware)
{
$middleware
// Catch any exceptions in the lower layers,
// and make an error page/response
->add(new ErrorHandlerMiddleware(Configure::read('Error.exceptionRenderer')))
// Handle plugin/theme assets like CakePHP normally does.
->add(new AssetMiddleware())
// Apply routing
->add(new RoutingMiddleware());
return $middleware;
}
}

195
src/Console/Installer.php Normal file
View File

@@ -0,0 +1,195 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Console;
use Cake\Utility\Security;
use Composer\Script\Event;
use Exception;
/**
* Provides installation hooks for when this application is installed via
* composer. Customize this class to suit your needs.
*/
class Installer
{
/**
* Does some routine installation tasks so people don't have to.
*
* @param \Composer\Script\Event $event The composer event object.
* @throws \Exception Exception raised by validator.
* @return void
*/
public static function postInstall(Event $event)
{
$io = $event->getIO();
$rootDir = dirname(dirname(__DIR__));
static::createAppConfig($rootDir, $io);
static::createWritableDirectories($rootDir, $io);
// ask if the permissions should be changed
if ($io->isInteractive()) {
$validator = function ($arg) {
if (in_array($arg, ['Y', 'y', 'N', 'n'])) {
return $arg;
}
throw new Exception('This is not a valid answer. Please choose Y or n.');
};
$setFolderPermissions = $io->askAndValidate(
'<info>Set Folder Permissions ? (Default to Y)</info> [<comment>Y,n</comment>]? ',
$validator,
10,
'Y'
);
if (in_array($setFolderPermissions, ['Y', 'y'])) {
static::setFolderPermissions($rootDir, $io);
}
} else {
static::setFolderPermissions($rootDir, $io);
}
static::setSecuritySalt($rootDir, $io);
if (class_exists('\Cake\Codeception\Console\Installer')) {
\Cake\Codeception\Console\Installer::customizeCodeceptionBinary($event);
}
}
/**
* Create the config/app.php file if it does not exist.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function createAppConfig($dir, $io)
{
$appConfig = $dir . '/config/app.php';
$defaultConfig = $dir . '/config/app.default.php';
if (!file_exists($appConfig)) {
copy($defaultConfig, $appConfig);
$io->write('Created `config/app.php` file');
}
}
/**
* Create the `logs` and `tmp` directories.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function createWritableDirectories($dir, $io)
{
$paths = [
'logs',
'tmp',
'tmp/cache',
'tmp/cache/models',
'tmp/cache/persistent',
'tmp/cache/views',
'tmp/sessions',
'tmp/tests'
];
foreach ($paths as $path) {
$path = $dir . '/' . $path;
if (!file_exists($path)) {
mkdir($path);
$io->write('Created `' . $path . '` directory');
}
}
}
/**
* Set globally writable permissions on the "tmp" and "logs" directory.
*
* This is not the most secure default, but it gets people up and running quickly.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function setFolderPermissions($dir, $io)
{
// Change the permissions on a path and output the results.
$changePerms = function ($path, $perms, $io) {
// Get permission bits from stat(2) result.
$currentPerms = fileperms($path) & 0777;
if (($currentPerms & $perms) == $perms) {
return;
}
$res = chmod($path, $currentPerms | $perms);
if ($res) {
$io->write('Permissions set on ' . $path);
} else {
$io->write('Failed to set permissions on ' . $path);
}
};
$walker = function ($dir, $perms, $io) use (&$walker, $changePerms) {
$files = array_diff(scandir($dir), ['.', '..']);
foreach ($files as $file) {
$path = $dir . '/' . $file;
if (!is_dir($path)) {
continue;
}
$changePerms($path, $perms, $io);
$walker($path, $perms, $io);
}
};
$worldWritable = bindec('0000000111');
$walker($dir . '/tmp', $worldWritable, $io);
$changePerms($dir . '/tmp', $worldWritable, $io);
$changePerms($dir . '/logs', $worldWritable, $io);
}
/**
* Set the security.salt value in the application's config file.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function setSecuritySalt($dir, $io)
{
$config = $dir . '/config/app.php';
$content = file_get_contents($config);
$newKey = hash('sha256', Security::randomBytes(64));
$content = str_replace('__SALT__', $newKey, $content, $count);
if ($count == 0) {
$io->write('No Security.salt placeholder to replace.');
return;
}
$result = file_put_contents($config, $content);
if ($result) {
$io->write('Updated Security.salt value in config/app.php');
return;
}
$io->write('Unable to update Security.salt value.');
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Apimports Controller
*
* @property \App\Model\Table\ApimportsTable $Apimports
*/
class ApimportsController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$apimports = $this->paginate($this->Apimports);
$this->set(compact('apimports'));
$this->set('_serialize', ['apimports']);
}
/**
* View method
*
* @param string|null $id Apimport id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$apimport = $this->Apimports->get($id, [
'contain' => []
]);
$this->set('apimport', $apimport);
$this->set('_serialize', ['apimport']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$apimport = $this->Apimports->newEntity();
if ($this->request->is('post')) {
$apimport = $this->Apimports->patchEntity($apimport, $this->request->data);
if ($this->Apimports->save($apimport)) {
$this->Flash->success(__('The apimport has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The apimport could not be saved. Please, try again.'));
}
$this->set(compact('apimport'));
$this->set('_serialize', ['apimport']);
}
/**
* Edit method
*
* @param string|null $id Apimport id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$apimport = $this->Apimports->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$apimport = $this->Apimports->patchEntity($apimport, $this->request->data);
if ($this->Apimports->save($apimport)) {
$this->Flash->success(__('The apimport has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The apimport could not be saved. Please, try again.'));
}
$this->set(compact('apimport'));
$this->set('_serialize', ['apimport']);
}
/**
* Delete method
*
* @param string|null $id Apimport id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$apimport = $this->Apimports->get($id);
if ($this->Apimports->delete($apimport)) {
$this->Flash->success(__('The apimport has been deleted.'));
} else {
$this->Flash->error(__('The apimport could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;
/**
* Application Controller
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @link http://book.cakephp.org/3.0/en/controllers.html#the-app-controller
*/
class AppController extends Controller
{
/**
* Initialization hook method.
*
* Use this method to add common initialization code like loading components.
*
* e.g. `$this->loadComponent('Security');`
*
* @return void
*/
public function initialize()
{
parent::initialize();
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
/*
* Enable the following components for recommended CakePHP security settings.
* see http://book.cakephp.org/3.0/en/controllers/components/security.html
*/
//$this->loadComponent('Security');
//$this->loadComponent('Csrf');
}
/**
* Before render callback.
*
* @param \Cake\Event\Event $event The beforeRender event.
* @return \Cake\Network\Response|null|void
*/
public function beforeRender(Event $event)
{
if (!array_key_exists('_serialize', $this->viewVars) &&
in_array($this->response->type(), ['application/json', 'application/xml'])
) {
$this->set('_serialize', true);
}
}
}

View File

@@ -0,0 +1,162 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\I18n\Time;
/**
* Apresults Controller
*
* @property \App\Model\Table\ApresultsTable $Apresults
*/
class ApresultsController extends AppController
{
function export() {
$fields = array('snr','aptype','lieferstatus','erzeugungsdatum','apcount','anzahl');
$schools = $this->Apresults->find('all',array('fields' => $fields));
$schools_array = json_decode(json_encode($schools), true);
$path = WWW_ROOT.'files/ap/export.csv';
//debug($path);
$file = fopen($path,"w");
$title = true;
$columns = array();
foreach($schools_array as $school) {
//debug(explode(',',$school));
//die;
if ($title) {
foreach ($school as $key => $column) {
array_push($columns,$key);
}
fputcsv($file,$columns,';',' ');
$title = false;
}
//debug(date('Y-m-d H:i:s',strtotime($school['erzeugungsdatum'])));
//debug($school['erzeugungsdatum']);
if(!is_null($school['erzeugungsdatum'])) {
$school['erzeugungsdatum'] = date('Y-m-d H:i:s',strtotime($school['erzeugungsdatum']));
//debug($school['erzeugungsdatum']);
}
//debug($school['erzeugungsdatum']);
//die;
fputcsv($file,$school,';',' ');
}
fclose($file);
$ftp_server = "10.190.22.35";
$ftp_port = "2587";
$ftp_user = "LfStaD-Log";
$ftp_pass = "135!Log!086";
$local_folder = '/test';
$conn_id = ftp_connect($ftp_server, $ftp_port) or die("Couldn't connect to $ftp_server");
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Angemeldet als $ftp_user@$ftp_server\n";
} else {
echo "Anmeldung als $ftp_user nicht möglich\n";
}
ftp_chdir($conn_id, 'ap-csv');
ftp_put($conn_id, 'export.csv', $path, FTP_BINARY);
ftp_close($conn_id);
}
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$apresults = $this->Apresults->find('all',array('conditions' => array('lieferstatus' => '1')));
$this->set('apresults',$apresults);
}
/**
* View method
*
* @param string|null $id Apresult id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$apresult = $this->Apresults->get($id, [
'contain' => []
]);
$this->set('apresult', $apresult);
$this->set('_serialize', ['apresult']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$apresult = $this->Apresults->newEntity();
if ($this->request->is('post')) {
$apresult = $this->Apresults->patchEntity($apresult, $this->request->data);
if ($this->Apresults->save($apresult)) {
$this->Flash->success(__('The apresult has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The apresult could not be saved. Please, try again.'));
}
$this->set(compact('apresult'));
$this->set('_serialize', ['apresult']);
}
/**
* Edit method
*
* @param string|null $id Apresult id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$apresult = $this->Apresults->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$apresult = $this->Apresults->patchEntity($apresult, $this->request->data);
if ($this->Apresults->save($apresult)) {
$this->Flash->success(__('The apresult has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The apresult could not be saved. Please, try again.'));
}
$this->set(compact('apresult'));
$this->set('_serialize', ['apresult']);
}
/**
* Delete method
*
* @param string|null $id Apresult id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$apresult = $this->Apresults->get($id);
if ($this->Apresults->delete($apresult)) {
$this->Flash->success(__('The apresult has been deleted.'));
} else {
$this->Flash->error(__('The apresult could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,202 @@
<?php
namespace App\Controller\Component;
use Cake\Controller\Component;
use Screen\Capture;
class ToolsComponent extends Component
{
public function screen($url)
{
//$url = 'http://www.heise.de';
debug($url);
$screenCapture = new Capture($url);
$screenCapture->setClipWidth(1200);
$screenCapture->setClipHeight(800);
$screenCapture->setUserAgentString('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0');
//$screenCapture->setOptions(array('proxy' => '10.1.248.1:82'));
$screenCapture->setOptions(array('proxy' => '10.1.248.1:82',
'cookies-file' => '/tmp/cookies.txt',
'ssl-client-certificate-file' => '/home/wilfried/phantomjs-2.1.1-linux-x86_64/clientcert.key',
'ssl-certificates-path' => '/home/wilfried/phantomjs-2.1.1-linux-x86_64/certs/',
'ignore-ssl-errors' => true,
'ssl-client-key-passphrase' => '2pRaTkCSrw'));
$screenCapture->setImageType('png');
$path = 'files/screen/test.' . $screenCapture->getImageType()->getFormat();
$fileLocation = WWW_ROOT . $path;
debug($fileLocation);
$screenCapture->save($fileLocation);
return ($path);
}
public function init_curl_params()
{
$cert_file = '/var/www/html/ssl_KM_Z2016_asd.trinkl.pem';
$proxy = '10.1.248.1:82';
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
//curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIE, 'cookiename=cookievalue');
curl_setopt($ch, CURLOPT_SSLCERT, $cert_file);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
return ($ch);
}
public function asd_curl($ch, $post, $header, $url)
{
$SCHULPORTAL_ASD_BASE_URL = SCHULPORTAL_BASE0_URL . "/uniquesigc3ba1685059aaf325d44099df697a0a635e79a4ec36ec614a98f3bf4b79d7c043ac3880605b7751df91d11233380ad86/uniquesig0/asd";
if (!empty($post)) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
} else {
curl_setopt($ch, CURLOPT_POST, 0);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_ASD_BASE_URL . $url);
//debug($SCHULPORTAL_ASD_BASE_URL . $url);
$text = curl_exec($ch);
return ($text);
}
public function asd_basic($text)
{
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($text); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
//$dienststellentable = $htmlParser->getElementById('mainForm:dienststellenTable');
$fields = array(
'schulnummer' => 'mainForm:schulnummer',
'schule' => 'mainForm:schule',
'schulart' => 'mainForm:schulstellePlzStrasse');
foreach ($fields as $key => $field) {
$output['dienststellentable'][$key] = $htmlParser->getElementById($field)->getAttribute('value');
}
$output['bemerkung'] = $htmlParser->getElementById('mainForm:erhebungsinformationskommentar')->textContent;
return ($output);
}
public function asd_lk($text, $schooltype)
{
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($text); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
//debug($schooltype);
if ($schooltype == 'gms') {
//$lk_table = $htmlParser->getElementById('mainForm:resultTable:cfhf');
$lk_table = $htmlParser->getElementById('mainForm:resultTable:tbtf');
} else {
$lk_table = $htmlParser->getElementById('mainForm:resultTable:tbtf');
}
$rows = $lk_table->getElementsByTagName('tr');
$t_heads1 = array('Name', 'LBef', 'AbwDst', 'UPZber', 'UPZSoll', 'StdIst', 'StdSoll', 'Diff');
$i = 0;
$teachers = '';
foreach ($rows as $row) {
$cols = $row->getElementsByTagName('td');
$j = 0;
foreach ($cols as $col) {
$spans = $col->getElementsByTagName('span');
if ($spans->length > 1) {
$teachers[$i][$t_heads1[$j]] = $spans->item(0)->getAttribute('title');
} else {
$teachers[$i][$t_heads1[$j]] = $spans->item(0)->nodeValue;
}
$j++;
}
$i++;
}
$lk_table = $htmlParser->getElementById('mainForm:resultTable:tbtn');
$rows = $lk_table->getElementsByTagName('tr');
$t_heads2 = array('MM', 'MA', 'AZK', 'NT', 'RES', 'PF', 'ABO', 'AN', 'ER', 'ABW', 'FR', 'UNTwiss', 'UNTNwiss', 'EASwiss', 'EASnwiss', 'EASwiss', 'EASNwiss', 'Leer');
$i = 0;
foreach ($rows as $row) {
$cols = $row->getElementsByTagName('td');
$j = 0;
foreach ($cols as $col) {
$spans = $col->getElementsByTagName('span');
if ($spans->length > 1) {
$teachers[$i][$t_heads2[$j]] = $spans->item(0)->getAttribute('title');
} elseif ($spans->length == 0) {
} else {
$teachers[$i][$t_heads2[$j]] = $spans->item(0)->nodeValue;
}
$j++;
}
$i++;
}
$data['t_heads'] = array_merge($t_heads1, $t_heads2);
$data['teachers'] = $teachers;
//debug($data);
return ($data);
}
public function asd_lf($text)
{
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($text); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$lf_table = $htmlParser->getElementById('leftTable');
$rows = $lf_table->getElementsByTagName('tr');
$i = 0;
$lehrfach = '';
foreach ($rows as $row) {
$atags = $row->getElementsByTagName('a');
$lehrfach[$i]['Name'] = str_replace(array("\n", "\t", "\r"), '', $atags->item(0)->nodeValue);
$i++;
}
$lf_table = $htmlParser->getElementById('lehrkapazitaetFach');
$rows = $lf_table->getElementsByTagName('tr');
$t_headslf = array('PKZ', 'ADB', 'RV', 'LB', 'UPZInd', 'UStdSoll', 'UStdIst', 'EinsatzBes', 'Fach1', 'Std1', 'Fach2', 'Std2', 'Fach3', 'Std3', 'Fach4', 'Std4', 'Weitere');
$i = 0;
foreach ($rows as $row) {
$cols = $row->getElementsByTagName('td');
$j = 0;
foreach ($cols as $col) {
$divs = $col->getElementsByTagName('div');
$lehrfach[$i][$t_headslf[$j]] = $divs->item(0)->nodeValue;
$j++;
}
$i++;
}
$data['t_headslf'] = $t_headslf;
$data['lehrfach'] = $lehrfach;
return ($data);
}
}

View File

View File

@@ -0,0 +1,109 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Configs Controller
*
* @property \App\Model\Table\ConfigsTable $Configs
*/
class ConfigsController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$configs = $this->paginate($this->Configs);
$this->set(compact('configs'));
$this->set('_serialize', ['configs']);
}
/**
* View method
*
* @param string|null $id Config id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$config = $this->Configs->get($id, [
'contain' => []
]);
$this->set('config', $config);
$this->set('_serialize', ['config']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$config = $this->Configs->newEntity();
if ($this->request->is('post')) {
$config = $this->Configs->patchEntity($config, $this->request->data);
if ($this->Configs->save($config)) {
$this->Flash->success(__('The config has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The config could not be saved. Please, try again.'));
}
$this->set(compact('config'));
$this->set('_serialize', ['config']);
}
/**
* Edit method
*
* @param string|null $id Config id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$config = $this->Configs->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$config = $this->Configs->patchEntity($config, $this->request->data);
if ($this->Configs->save($config)) {
$this->Flash->success(__('The config has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The config could not be saved. Please, try again.'));
}
$this->set(compact('config'));
$this->set('_serialize', ['config']);
}
/**
* Delete method
*
* @param string|null $id Config id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$config = $this->Configs->get($id);
if ($this->Configs->delete($config)) {
$this->Flash->success(__('The config has been deleted.'));
} else {
$this->Flash->error(__('The config could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,189 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use AsdCurl\AsdMstr;
use AsdCurl\AsdUs;
use Cake\I18n\Time;
use Cake\Filesystem\File;
class CurlsController extends AppController
{
//public $uses = array('Monitoring');
public function monitmstr()
{
$this->loadModel('Monitorings');
$curl = new AsdMstr();
$ch = $curl->init_curl_params();
$curl->login_school($ch);
$curl->login_mstr($ch);
$data['data'] = '';
$result = '';
if(!($curl->status)) {
$curl->message .= 'Login failed! ' . $curl->error;
}
else {
$curl->monit_mstr($ch);
if(!($curl->status)) {
$curl->message .= 'Report failed: ' . $curl->error;
}
else {
$data['data'] = json_encode($result);
$result = iconv($in_charset = 'UTF-16LE', $out_charset = 'UTF-8', $curl->html);
}
}
$curl->logout_mstr($ch);
//Ergebnis in Datenbank speichern
$data['action'] = 'mstr';
$data['school'] = '';
$data['data'] = json_encode($result);
$now = Time::parse();
$now->timezone = "Europe/Berlin";
$data['date'] = $now;
if (strpos($result, 'MMIHG') !== false) {
$data['comment'] = 'Success';
} else {
$data['comment'] = 'Fail';
}
$data['message'] = $curl->message;
$all = $this->Monitorings->find('all', array('conditions' => array('action' => 'mstr'), 'order' => array('id' => 'DESC')));
$last = $all->first();
$monitoring = $this->Monitorings->newEntity();
$monitoring = $this->Monitorings->patchEntity($monitoring, $data);
if($last['comment'] != $monitoring['comment']) {
if($last['comment'] == 'Success') {
$curl->send_mail($ch,'Fail',$curl->message, '');
}
else {
$allsuccess = $this->Monitorings->find('all', array('conditions' => array('action' => 'mstr','comment' => 'Success'), 'order' => array('id' => 'DESC')));
$lastsuccess = $allsuccess->first();
$datestring = $lastsuccess['date']->i18nFormat('dd.MM.yyyy HH:mm');
$curl->send_mail($ch,'Success',$curl->message, $datestring);
}
}
$result_save = $this->Monitorings->save($monitoring);
//$curl->send_mail($ch);
$this->set('html', $result);
$this->viewBuilder()->layout('ajax');
}
public function saveus() {
$curl = new AsdUs();
//debug($curl->status);
$ch = $curl->init_curl_params();
$curl->login_school($ch);
$curl->login_asd($ch);
$curl->save_us_data($ch);
$this->set('html',$curl->html);
$this->redirect(['action' => 'getjsonus']);
}
public function saveup() {
$curl = new AsdUs();
//debug($curl->status);
$ch = $curl->init_curl_params();
$curl->login_school($ch);
$curl->login_asd($ch);
$curl->save_up_data($ch);
$this->set('html',$curl->html);
$this->redirect(['action' => 'getjsonup']);
}
public function showus() {
$this->loadModel('Results');
$results = $this->Results->find('all');
$this->set('results',$results);
}
public function getjsonus() {
echo 'Write Json data to file';
$this->loadModel('Results');
$results = $this->Results->find('all');
$this->set('results',$results);
$file = new File('/var/www/html/asd-control/webroot/files/data-us.json', true, 0644);
$file->create();
$status = $file->write(json_encode($results), 'w', true);
echo $status;
$file->close();
$this->viewBuilder()->layout('getjson');
}
public function getjsonup() {
echo 'Write Json data to file';
$this->loadModel('Results');
$results = $this->Results->find('all');
$this->set('results',$results);
$file = new File('/var/www/html/asd-control/webroot/files/data-up.json', true, 0644);
$file->create();
$status = $file->write(json_encode($results), 'w', true);
echo $status;
$file->close();
$this->viewBuilder()->layout('getjson');
}
public function usStatistik() {
$file = new File('/var/www/html/asd-control/webroot/files/data-us.json', true, 0644);
$ts = $file->lastChange();
$time = Time::createFromTimestamp($ts);
$time->timezone = 'Europe/Paris';
$this->set('time', $time);
$this->viewBuilder()->layout('pivot');
}
public function upStatistik() {
$file = new File('/var/www/html/asd-control/webroot/files/data-up.json', true, 0644);
$ts = $file->lastChange();
$time = Time::createFromTimestamp($ts);
$time->timezone = 'Europe/Paris';
$this->set('time', $time);
$this->viewBuilder()->layout('pivot');
}
public function asdus()
{
$curl = new AsdUs();
//debug($curl->status);
$ch = $curl->init_curl_params();
$curl->login_school($ch);
$curl->login_asd($ch);
$output = $curl->get_us_statistic($ch);
$this->loadModel('Monitorings');
if (!empty($this->request['pass'])) {
$command = $this->request['pass']['0'];
if ($command == 'save') {
$data['action'] = 'asdus';
$data['school'] = '';
$data['data'] = json_encode($output);
$now = Time::parse();
$now->timezone = "Europe/Berlin";
$data['date'] = $now;
$data['comment'] = '';
$monitoring = $this->Monitorings->newEntity();
$monitoring = $this->Monitorings->patchEntity($monitoring, $data);
$result = $this->Monitorings->save($monitoring);
}
}
$all = $this->Monitorings->find('all', array('conditions' => array('action' => 'asdus'), 'order' => array('id' => 'DESC')));
$old = $all->first();
$now = Time::parse();
$now->timezone = "Europe/Berlin";
$this->set('now', $now);
$this->set('old', $old);
$this->set('output', $output);
$this->set('html', $this->html);
}
}

View File

@@ -0,0 +1,245 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Departments Controller
*
* @property \App\Model\Table\DepartmentsTable $Departments
*/
class DepartmentsController extends AppController {
public function listDep($examination_id = null) {
$this->loadModel('Examinations');
$examinations = $this->Examinations->find('all');
if(isset($examination_id)) {
$actual = $this->Examinations->get($examination_id);
$this->set('actual',$actual);
}
//debug($examinations);die;
$this->set('examinations', $examinations);
//$this->loadModel('Supervisings');
//$supervisings = $this->Supervisings->find('all', array('conditions' => array('schooltype_id' => $school_type)));
$supervisings = $this->Departments->find('all', array('fields' => array('super_school_code'), 'conditions' => array('examination_id' => $examination_id), 'group' => array('super_school_code')));
foreach ($supervisings as $supervising) {
//debug($supervising);
if (!empty($supervising['super_school_code'])) {
$aufsicht[$supervising['super_school_code']]['super_school_code'] = $supervising['super_school_code'];
$delivered_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id,'super_school_code' => $supervising['super_school_code'], 'delivery_date is not null')));
$aufsicht[$supervising['super_school_code']]['delivered'] = $delivered_query->count();
$all_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id,'super_school_code' => $supervising['super_school_code'])));
$aufsicht[$supervising['super_school_code']]['all'] = $all_query->count();
//debug($supervising);
}
}
if(isset($examination_id)) {
$sum_all_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id)));
$this->set('all',$sum_all_query->count());
$sum_del_query = $this->Departments->find('all', array('conditions' => array('examination_id' => $examination_id, 'delivery_date is not null')));
$this->set('del',$sum_del_query->count());
}
//debug($aufsicht);
//die;
$status = $this->Departments->find('all', array('fields' => array('status'), 'conditions' => array('examination_id' => $examination_id),'group' => array('status')));
$status_arr = '';
$i = 0;
foreach ($status as $s) {
//debug($s);
$status_arr[$i] = $s->status;
$i++;
}
//debug($status_arr);die;
$this->set('status', $status);
$this->set('examination_id', $examination_id);
//$this->set('schooltype', $schooltype->name);
//$this->set('school_type',$school_type);
if(isset($aufsicht)) {
$this->set('aufsicht', $aufsicht);
}
$this->render(null, 'asd');
}
public function listDepAjax($examination_id) {
//debug($school_type);
$list = '';
$conditions = array('examination_id' => $examination_id);
//debug($conditions);
//debug($this->request->data);
if (isset($this->request->data['delivery_date_on']) AND isset($this->request->data['delivery_date_off'])) {
unset($this->request->data['delivery_date_on']);
unset($this->request->data['delivery_date_off']);
} elseif (isset($this->request->data['delivery_date_on'])) {
unset($this->request->data['delivery_date_on']);
$conditions[0] = 'delivery_date is not null';
} else {
unset($this->request->data['delivery_date_off']);
$conditions[0] = 'delivery_date is null';
}
//debug($this->request->data);
//debug($conditions);
if (!empty($this->request->data)) {
foreach ($this->request->data as $key => $d) {
//debug($key);
$key_ex = explode('--', $key);
$list[$key_ex[0]][$key_ex[1]] = $key_ex[1];
}
$j = 1;
foreach ($list as $key => $l) {
$i = 0;
foreach ($l as $item) {
$item_arr[$i] = '"' . $item . '"';
$i++;
}
//debug($item_arr);
$string[$key] = rtrim(implode(',', $item_arr), ',');
$conditions[$j] = $key . ' IN (' . $string[$key] . ')';
$j++;
}
} else {
$string = '';
}
//debug($conditions);
//die;
//$this->loadModel('Schooltypes');
//$schooltype = $this->Schooltypes->get($school_type);
//$this->loadModel('Supervisings');
//$supervisings = $this->Supervisings->find('all');
//$aufsicht = '';
//foreach ($supervisings as $s) {
// $aufsicht[$s->id] = $s->code;
//}
//debug($conditions);
if (isset($this->request->query['delivered']) && $this->request->query['delivered'] == 'no') {
//debug('Hallo1');
$departments = $this->Departments->find('all', array('conditions' => array('schooltype_id' => $school_type, 'delivery_date is null'), 'fields' => array('supervising_id', 'title', 'status', 'code', 'delivery_date', 'delivered')));
} else {
//debug('Hallo2');
//$departments = $this->Departments->find('all', array('fields' => array('supervising_id', 'title', 'status', 'code', 'delivery_date', 'delivered')));
$departments = $this->Departments->find('all', array('conditions' => $conditions, 'fields' => array('super_school_code', 'super_school_code_2', 'title', 'status', 'code', 'delivery_date', 'delivered', 'checkedin')));
//debug($departments);
}
foreach ($departments as $department) {
//debug($department);
//$department->supervising_id = $aufsicht[$department->supervising_id];
//debug($department->delivery_date);
$time = $department->delivery_date;
//debug($time->i18nFormat('yyyy-MM-dd')); die;
if (!empty($department->delivery_date)) {
$department->delivery_date = $time->i18nFormat('yyyy-MM-dd');
}
//debug($department);
}
//debug(json_encode($departments));
//die;
//$this->set('schooltype', $schooltype->name);
$this->set('departments', $departments);
$this->render(null, 'ajax');
}
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index() {
$this->paginate = [
'contain' => ['Schooltypes', 'Supervisings']
];
$departments = $this->paginate($this->Departments);
$this->set(compact('departments'));
$this->set('_serialize', ['departments']);
}
/**
* View method
*
* @param string|null $id Department id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null) {
$department = $this->Departments->get($id, [
'contain' => ['Schooltypes', 'Supervisings']
]);
$this->set('department', $department);
$this->set('_serialize', ['department']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add() {
$department = $this->Departments->newEntity();
if ($this->request->is('post')) {
$department = $this->Departments->patchEntity($department, $this->request->data);
if ($this->Departments->save($department)) {
$this->Flash->success(__('The department has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The department could not be saved. Please, try again.'));
}
$schooltypes = $this->Departments->Schooltypes->find('list', ['limit' => 200]);
$supervisings = $this->Departments->Supervisings->find('list', ['limit' => 200]);
$this->set(compact('department', 'schooltypes', 'supervisings'));
$this->set('_serialize', ['department']);
}
/**
* Edit method
*
* @param string|null $id Department id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null) {
$department = $this->Departments->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$department = $this->Departments->patchEntity($department, $this->request->data);
if ($this->Departments->save($department)) {
$this->Flash->success(__('The department has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The department could not be saved. Please, try again.'));
}
$schooltypes = $this->Departments->Schooltypes->find('list', ['limit' => 200]);
$supervisings = $this->Departments->Supervisings->find('list', ['limit' => 200]);
$this->set(compact('department', 'schooltypes', 'supervisings'));
$this->set('_serialize', ['department']);
}
/**
* Delete method
*
* @param string|null $id Department id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']);
$department = $this->Departments->get($id);
if ($this->Departments->delete($department)) {
$this->Flash->success(__('The department has been deleted.'));
} else {
$this->Flash->error(__('The department could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,253 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Mailer\Email;
use Cake\I18n\Time;
/**
* Emails Controller
*
* @property \App\Model\Table\EmailsTable $Emails
*/
class EmailsController extends AppController
{
public function deleteall() {
$this->Emails->connection()->transactional(function ($conn) {
$sqls = $this->Emails->schema()->truncateSql($this->Emails->connection());
foreach ($sqls as $sql) {
$this->Emails->connection()->execute($sql)->execute();
}
});
}
public function sendresult() {
$this->loadModel('Offices');
$emails = $this->Emails->find('all', [
'conditions' => ['sent' => 0]
]);
foreach($emails as $mail) {
$query = $this->Offices->find('all', [
'conditions' => ['dst_schluessel' => $mail->snr]
]);
//debug($mail->snr);die;
$office = $query->first();
//debug($office->dst_name);
//die;
$email = new Email();
$email->viewVars(['content' => $mail->text]);
$email
->emailFormat('html')
->from(['abschlusspruefung@schulen.bayern.de' => 'Abschlusspruefung'])
->to($mail->snr . '@schulen.bayern.de')
->cc('abschlusspruefung@schulen.bayern.de')
->template('abschluss')
->subject($mail->subject . ' ' . $office->dst_name . ' - Übermittlung Abschlussprüfung Typ ' . $mail->examinationtype)
->send();
$mail['sent'] = 1;
//$line = $this->Apimports->patchEntity($line, (array) $data);
$result = $this->Emails->save($mail);
}
return $this->redirect(['controller' => 'Apresults', 'action' => 'export']);
}
public function create() {
$query = $this->Emails->find('all',[
'order' => ['lieferung DESC']
]);
$lastmail = $query->first();
if(!empty($lastmail)) {
$lastsent = $lastmail->lieferung;
}
else {
$lastsent = 0;
}
//debug($lastsent);
$this->loadModel('Apimports');
$deliveries = $this->Apimports->find('all', [
'conditions' => ["lieferung > $lastsent"],
'order' => 'lieferung ASC'
]);
$deliveries->select(['lieferung'])
->distinct(['lieferung']);
//debug($deliveries);
foreach ($deliveries as $delivery) {
//debug($delivery->lieferung);
$items = $this->Apimports->find('all',[
'conditions' => ['lieferung' => $delivery->lieferung ]
])->toArray();
$data = (object) [];
$data->examinationtype = $items[0]['pruefungsart'];
$data->snr = $items[0]['schule'];
$data->createdate = $items[0]['erzeugungsdatum'];
$data->date = Time::now();
$data->lieferung = $delivery->lieferung;
$data->sent = 0;
$data->subject = $items[0]['schule'];
$data->text = '<h2>Übermittlung der Ergebnisse der Abschlussprüfung Typ ' . $items[0]['pruefungsart'] . '</h2>';
$data->text .= '<p>Für die Schule ' . $items[0]['schule'] . ' wurden am ' . $items[0]['erzeugungsdatum']->i18nFormat('dd.MM.yyyy') . ' um ' . $items[0]['erzeugungsdatum']->i18nFormat('HH:mm') . ' Uhr folgende Ergebnisse übermittelt:</p>';
$data->text .= '<table border="1"><tr><th align="left">Anzahl</th><th align="left">Schülerstatus</th></tr>';
foreach ($items as $item) {
//debug($item);
$data->text .= '<tr><td align="left">'. $item->anzahl . '</td><td align="left">' . $item->schuelerstatus .'</td></tr>';
}
$data->text .= '</table>';
$data->text .= '<p>Bitte überprüfen Sie diese Ergebnisse sorgfältig und wenden Sie sich umgehend an den ASV Support, falls Unstimmigkeiten auftreten sollten.</p>';
$data->text .= '<p>Ihr ASD-Team</p>';
//debug($data);
$email = $this->Emails->newEntity();
$email = $this->Emails->patchEntity($email, (array) $data);
$this->Emails->save($email);
}
//die;
return $this->redirect(['action' => 'sendresult']);
}
public function import() {
$options = [
'length' => 0,
'delimiter' => '|',
'enclosure' => ' ',
'escape' => '\\',
'headers' => false,
'text' => false,
'excel_bom' => false,
];
$this->loadModel('Apimports');
// Tabelle leeren
$this->Apimports->connection()->transactional(function ($conn) {
$sqls = $this->Apimports->schema()->truncateSql($this->Apimports->connection());
foreach ($sqls as $sql) {
$this->Apimports->connection()->execute($sql)->execute();
}
});
$filepath = '/var/www/html/asd-control/webroot/files/ap/results.csv';
$handle = fopen($filepath, "r");
//$i = 1;
//$header = fgetcsv($handle, $options['length'], $options['delimiter']);
while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) {
//debug($row);
$data = (object) [];
$data->schule = trim($row[0]);
$data->pruefungsart = trim($row[1]);
$data->anzahl = trim($row[2]);
$data->schuelerstatus = trim($row[3]);
$data->erzeugungsdatum = date('Y-m-d H:i:s', strtotime(str_replace('-', '/', trim($row[4]))));
$data->lieferung = trim($row[5]);
$line = $this->Apimports->newEntity();
$line = $this->Apimports->patchEntity($line, (array) $data);
$result = $this->Apimports->save($line);
//$i++;
}
//die;
return $this->redirect(['action' => 'create']);
}
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$this->paginate = [
'contain' => ['Examinations']
];
$emails = $this->paginate($this->Emails);
$this->set(compact('emails'));
$this->set('_serialize', ['emails']);
}
/**
* View method
*
* @param string|null $id Email id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$email = $this->Emails->get($id, [
'contain' => ['Examinations']
]);
$this->set('email', $email);
$this->set('_serialize', ['email']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$email = $this->Emails->newEntity();
if ($this->request->is('post')) {
$email = $this->Emails->patchEntity($email, $this->request->data);
if ($this->Emails->save($email)) {
$this->Flash->success(__('The email has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The email could not be saved. Please, try again.'));
}
$examinations = $this->Emails->Examinations->find('list', ['limit' => 200]);
$this->set(compact('email', 'examinations'));
$this->set('_serialize', ['email']);
}
/**
* Edit method
*
* @param string|null $id Email id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$email = $this->Emails->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$email = $this->Emails->patchEntity($email, $this->request->data);
if ($this->Emails->save($email)) {
$this->Flash->success(__('The email has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The email could not be saved. Please, try again.'));
}
$examinations = $this->Emails->Examinations->find('list', ['limit' => 200]);
$this->set(compact('email', 'examinations'));
$this->set('_serialize', ['email']);
}
/**
* Delete method
*
* @param string|null $id Email id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$email = $this->Emails->get($id);
if ($this->Emails->delete($email)) {
$this->Flash->success(__('The email has been deleted.'));
} else {
$this->Flash->error(__('The email could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,68 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.3.4
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Controller;
use Cake\Event\Event;
/**
* Error Handling Controller
*
* Controller used by ExceptionRenderer to render error responses.
*/
class ErrorController extends AppController
{
/**
* Initialization hook method.
*
* @return void
*/
public function initialize()
{
$this->loadComponent('RequestHandler');
}
/**
* beforeFilter callback.
*
* @param \Cake\Event\Event $event Event.
* @return \Cake\Network\Response|null|void
*/
public function beforeFilter(Event $event)
{
}
/**
* beforeRender callback.
*
* @param \Cake\Event\Event $event Event.
* @return \Cake\Network\Response|null|void
*/
public function beforeRender(Event $event)
{
parent::beforeRender($event);
$this->viewBuilder()->templatePath('Error');
}
/**
* afterFilter callback.
*
* @param \Cake\Event\Event $event Event.
* @return \Cake\Network\Response|null|void
*/
public function afterFilter(Event $event)
{
}
}

View File

@@ -0,0 +1,135 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Mailer\Email;
/**
* Examinations Controller
*
* @property \App\Model\Table\ExaminationsTable $Examinations
*/
class ExaminationsController extends AppController {
public function sendresult() {
$email = new Email('default');
$email->from(['asd.trinkl@schulen.bayern.de' => 'ASD Trinkl'])
->to('asd.kraupner@schulen.bayern.de')
->subject('Test')
->send('Hallo Martina!');
}
public function listImports() {
$this->loadModel('Imports');
//$import = $this->Imports->newEntity();
$list = $this->Examinations->find('all', [
'contain' => ['Schooltypes','Imports']
]);
//$this->set('import',$import);
$this->set('list', $list);
//foreach($list as $item) {
// debug($item);
//}
//die;
}
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index() {
$this->paginate = [
'contain' => ['Schooltypes']
];
$examinations = $this->paginate($this->Examinations);
//debug($examinations);die;
$this->set(compact('examinations'));
$this->set('_serialize', ['examinations']);
}
/**
* View method
*
* @param string|null $id Examination id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null) {
$examination = $this->Examinations->get($id, [
'contain' => ['Schooltypes', 'Imports']
]);
$this->set('examination', $examination);
$this->set('_serialize', ['examination']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add() {
$examination = $this->Examinations->newEntity();
if ($this->request->is('post')) {
$examination = $this->Examinations->patchEntity($examination, $this->request->data);
if ($this->Examinations->save($examination)) {
$this->Flash->success(__('The examination has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The examination could not be saved. Please, try again.'));
}
$schooltypes = $this->Examinations->Schooltypes->find('list', ['limit' => 200]);
$this->set(compact('examination', 'schooltypes'));
$this->set('_serialize', ['examination']);
}
/**
* Edit method
*
* @param string|null $id Examination id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null) {
$examination = $this->Examinations->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$examination = $this->Examinations->patchEntity($examination, $this->request->data);
if ($this->Examinations->save($examination)) {
$this->Flash->success(__('The examination has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The examination could not be saved. Please, try again.'));
}
$schooltypes = $this->Examinations->Schooltypes->find('list', ['limit' => 200]);
$this->set(compact('examination', 'schooltypes'));
$this->set('_serialize', ['examination']);
}
/**
* Delete method
*
* @param string|null $id Examination id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']);
$examination = $this->Examinations->get($id);
if ($this->Examinations->delete($examination)) {
$this->Flash->success(__('The examination has been deleted.'));
} else {
$this->Flash->error(__('The examination could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,243 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Extracts Controller
*
* @property \App\Model\Table\ExtractsTable $Extracts
*/
class ExtractsController extends AppController
{
public $html;
public $error;
public $status;
public function init_curl_params()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, '10.1.248.1:82');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return ($ch);
}
public function exec_curl($ch, $url)
{
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
curl_setopt($ch, CURLOPT_URL, $url);
$this->html = curl_exec($ch);
}
public function getElementsByClass(&$parentNode, $tagName, $className) {
$nodes=array();
$childNodeList = $parentNode->getElementsByTagName($tagName);
for ($i = 0; $i < $childNodeList->length; $i++) {
$temp = $childNodeList->item($i);
if (stripos($temp->getAttribute('class'), $className) !== false) {
$nodes[]=$temp;
}
}
return $nodes;
}
public function readxml() {
$path = WWW_ROOT . 'files';
$filename = '20180118_101716_2377078511295.xml';
$file = $path . DS . $filename;
$xml = file_get_contents($file, true);
//debug($xml);
$dom = new \DOMDocument(); //to parse html using DOMDocument
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$dom->loadXML($xml); //Loaded the html string we took from simple xml
$nodes = $dom->getElementsByTagName('KOPPLUNG_LANG_BEZEICHNUNG');
//debug($nodes->length);
foreach ($nodes as $node) {
$node->textContent = 'Anonym';
//foreach($node->childNodes as $child ) {
// debug($child->nodeName);
// debug($child->nodeValue);
//}
//$node->getElementsByTagName('KOPPLUNG_LANG_BEZEICHNUNG')->item(0)->textContent = 'Anonym';
}
//die;
$dom->saveXML(); // This will return the XML as a string
$newfile = $file . '.new';
$dom->save($newfile); // This saves the XML to a file
$newcontent = file_get_contents($newfile, true);
$this->viewBuilder()->layout('ajax');
$this->set('content',$newcontent);
}
public function generate() {
$snr = '9310';
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$random_string_length = 4;
$string = '';
$max = strlen($characters) - 1;
for ($i = 0; $i < $random_string_length; $i++) {
$string .= $characters[mt_rand(0, $max)];
}
$millis = round(microtime(true) * 1000);
$string_ohne = $snr . $string . $millis;
//debug($string_ohne);
$good = '9310QEKU15162667399540879';
debug($good);
$string_ohne = '9310QEKU1516266739954';
debug($string_ohne);
$hash = str_pad(hexdec(hash('adler32',$string_ohne)) % 9857, 4, '0', STR_PAD_LEFT);
debug($hash);
$string_mit = $string_ohne . $hash;
debug($string_mit);
die;
}
public function import()
{
$ch = $this->init_curl_params();
echo 'Hallo';
$types = array('weibliche-vornamen','maennliche-vornamen','nachnamen','strassen');
$alphas = range('a', 'z');
debug($alphas);
foreach($types as $type) {
foreach($alphas as $alpha) {
$url = 'http://www.namen-liste.de/' . $type . '-' .$alpha .'/';
echo '<p>' . $url . '</p>';
$this->exec_curl($ch, $url);
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$nodes = $this->getElementsByClass($htmlParser, 'span' , 't4');
foreach($nodes as $node) {
debug($node->nodeValue);
$extract = $this->Extracts->newEntity();
$extract->type = $type;
$extract->value = $node->nodeValue;
$this->Extracts->save($extract);
}
}
}
}
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$extracts = $this->paginate($this->Extracts);
$this->set(compact('extracts'));
$this->set('_serialize', ['extracts']);
}
/**
* View method
*
* @param string|null $id Extract id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$extract = $this->Extracts->get($id, [
'contain' => []
]);
$this->set('extract', $extract);
$this->set('_serialize', ['extract']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$extract = $this->Extracts->newEntity();
if ($this->request->is('post')) {
$extract = $this->Extracts->patchEntity($extract, $this->request->data);
if ($this->Extracts->save($extract)) {
$this->Flash->success(__('The extract has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The extract could not be saved. Please, try again.'));
}
$this->set(compact('extract'));
$this->set('_serialize', ['extract']);
}
/**
* Edit method
*
* @param string|null $id Extract id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$extract = $this->Extracts->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$extract = $this->Extracts->patchEntity($extract, $this->request->data);
if ($this->Extracts->save($extract)) {
$this->Flash->success(__('The extract has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The extract could not be saved. Please, try again.'));
}
$this->set(compact('extract'));
$this->set('_serialize', ['extract']);
}
/**
* Delete method
*
* @param string|null $id Extract id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$extract = $this->Extracts->get($id);
if ($this->Extracts->delete($extract)) {
$this->Flash->success(__('The extract has been deleted.'));
} else {
$this->Flash->error(__('The extract could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,325 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use ZipArchive;
/**
* Imports Controller
*
* @property \App\Model\Table\ImportsTable $Imports
*/
class ImportsController extends AppController {
public function ftp() {
$ftp_server = "10.190.22.35";
$ftp_port = "2587";
$ftp_user = "LfStaD-Log";
$ftp_pass = "135!Log!086";
$local_file = '/test/test.zip';
$zip_pass = '!AP-AS-2018!';
$local_folder = '/test';
$conn_id = ftp_connect($ftp_server, $ftp_port) or die("Couldn't connect to $ftp_server");
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Angemeldet als $ftp_user@$ftp_server\n";
} else {
echo "Anmeldung als $ftp_user nicht möglich\n";
}
ftp_chdir($conn_id, 'ap-csv');
$contents = ftp_nlist($conn_id, ".");
//debug($contents);
$abschluss = array_search('Abschlusspruefung_2018.zip',$contents);
//debug($abschluss);
//die;
ftp_get($conn_id, $local_file, $contents[$abschluss], FTP_BINARY);
$zip = new ZipArchive();
$zip_status = $zip->open($local_file);
if ($zip_status === true) {
if ($zip->setPassword($zip_pass)) {
if (!$zip->extractTo('/test/results/'))
echo "Extraction failed (wrong password?)";
}
//debug($zip->statIndex(0));
$file = $zip->statIndex(0)['name'];
//debug($file);
//debug($file);
$zip->close();
}
else {
die("Failed opening archive: " . @$zip->getStatusString() . " (code: " . $zip_status . ")");
}
rename('/test/results/'.$file,'/var/www/html/asd-control/webroot/files/ap/results.csv');
exec('/usr/bin/smbclient -U \'BAYKM/km-tri-wil%HiegTzs!182\' //KM-Svr-Daten/Projektshare -c \'cd /14_Materialien/Austausch/WiTr/ap; put /var/www/html/asd-control/webroot/files/ap/results.csv results-ap.csv\'');
//die;
//debug($contents);die;
/* $this->loadModel('Imports');
$imports = $this->Imports->find('all');
foreach ($imports as $import) {
//debug($import);
$file = glob($local_folder . '/results/' . explode('.', $import->filename)['0'] . '_*');
copy($file['0'], '/var/www/html/asd-control/webroot/files/' . $import->filename);
$parts = explode('/', $file['0']);
$filename = end($parts);
rename($file['0'], $local_folder . '/old/' . $filename);
}
$this->loadModel('Examinations');
$examinations = $this->Examinations->find('all', [
'contain' => ['Imports']]);
foreach ($examinations as $examination) {
//debug($examination);
$job['examination_id'] = $examination->id;
$i = 1;
foreach ($examination->imports as $import) {
$job['files']['file-' . $i]['filename'] = $import->filename;
$i++;
}
//debug($job);
$this->csv2db($job);
} */
ftp_close($conn_id);
return $this->redirect(['controller' => 'Emails', 'action' => 'import']);
}
function addModels($importtype) {
//debug($importtype->mapping);
//debug(json_decode($importtype->mapping));
foreach (json_decode($importtype->mapping) as $map_key => $map_value) {
if (substr($map_key, -3) == '_id') {
$map_key_array = explode('_', $map_key);
//debug(ucfirst($map_key_array[0] . 's'));
//debug($map_key_array[0]);
$this->loadModel(ucfirst($map_key_array[0] . 's'));
}
}
}
function csv2db($import) {
$options = [
'length' => 0,
'delimiter' => ';',
'enclosure' => ' ',
'escape' => '\\',
'headers' => false,
'text' => false,
'excel_bom' => false,
];
$this->loadModel('Configs');
$config = $this->Configs->find('all', array('conditions' => array('title' => 'path')))->first();
$path = $config->value;
$examination_id = $import['examination_id'];
//debug($examination_id);
foreach ($import['files'] as $key => $file) {
//$file_name = (object) [];
$import_id = explode('-', $key)[1];
//debug($file);
$importtype = $this->Imports->find('all', array('conditions' => array('filename' => $file['filename'])))->first();
//debug($importtype);
//if (!empty($file['filename'])) {
// $file_name->filename = $file['filename'];
// $importtype = $this->Imports->patchEntity($importtype, (array) $file_name);
// $this->Imports->save($importtype);
// $filepath = $path . DS . $file['filename'];
//} else {
// if ($file['csv']['error'] == 0) {
// if (!empty($file['csv']['name'])) {
// $importtype->filename = $file['csv']['name'];
// $this->Imports->save($importtype);
// }
// $filepath = $import[$key]['csv']['tmp_name'];
// }
//}
$filepath = $path . DS . $file['filename'];
//debug($file);
//debug($filepath);
//die;
if (!empty($filepath)) {
$this->loadModel($importtype->tablename);
if ($importtype->clear) {
$dtable = $importtype->tablename;
$conn = $this->$dtable->connection();
$conn->query('DELETE FROM ' . strtolower($dtable) . ' WHERE examination_id = ' . $examination_id);
}
$this->addModels($importtype); /* Zusaetzliche Models laden */
$table = $importtype->tablename;
$columns = $this->$table->schema()->columns();
$schema = (object) [];
foreach ($columns as $column) {
$schema->$column = $this->$table->schema()->columnType($column);
}
//debug($schema);die;
$options['delimiter'] = $importtype['field_separator'];
if (!empty($importtype['enclosure'])) {
$options['enclosure'] = $importtype['enclosure'];
}
$filepath = glob($filepath)[0];
$handle = fopen($filepath, "r");
$i = 1;
while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) {
$data = (object) [];
if ($i > $importtype->skip) {
foreach (json_decode($importtype->mapping) as $key => $value) {
if (substr($key, -3) == '_id') {
$key_array = explode('_', $key);
$ftable = ucfirst($key_array[0] . 's');
$field = $key_array[0] . '_id';
$data->$field = $this->$ftable->find('all', array('conditions' => array($key_array[1] => $row[$value]), 'fields' => array('id')))->first()->id;
} else {
if ($schema->$key == 'datetime') {
$date = date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $row[$value])));
$data->$key = $date;
} elseif ($schema->$key == 'integer') {
$data->$key = str_replace(".", "", $row[$value]);
} else {
$data->$key = $row[$value];
}
}
}
if ($importtype->update_table) {
$value = current((Array) $data);
$table_key = array_keys((Array) $data)[0];
$line = $this->$table->find('all', array('conditions' => array('examination_id' => $examination_id, $table_key => $value)))->first();
$line = $this->$table->patchEntity($line, (array) $data);
} else {
$line = $this->$table->newEntity();
$data->examination_id = $examination_id;
$line = $this->$table->patchEntity($line, (array) $data);
}
$result = $this->$table->save($line);
}
$i++;
}
$filepath = '';
} else {
}
}
}
public function listImports() {
if ($this->request->is('post')) {
$import = $this->request->data();
$examination_id = $import['examination_id'];
$this->csv2db($import);
return $this->redirect(['controller' => 'Departments', 'action' => 'list_dep/' . $examination_id]);
}
$list = $this->Imports->find('all', [
'contain' => ['Schooltypes', 'Examinations']
]);
$this->set('list', $list);
}
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index() {
$this->paginate = [
'contain' => ['Schooltypes', 'Examinations']
];
$imports = $this->paginate($this->Imports);
$this->set(compact('imports'));
$this->set('_serialize', ['imports']);
}
/**
* View method
*
* @param string|null $id Import id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null) {
$import = $this->Imports->get($id, [
'contain' => ['Schooltypes']
]);
$this->set('import', $import);
$this->set('_serialize', ['import']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add() {
$import = $this->Imports->newEntity();
if ($this->request->is('post')) {
//debug($this->request->data); die;
$import = $this->Imports->patchEntity($import, $this->request->data);
if ($this->Imports->save($import)) {
$this->Flash->success(__('The import has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The import could not be saved. Please, try again.'));
}
$schooltypes = $this->Imports->Schooltypes->find('list', ['limit' => 200]);
$examinations = $this->Imports->Examinations->find('list', ['limit' => 200]);
$this->set(compact('import', 'schooltypes', 'examinations'));
$this->set('_serialize', ['import']);
}
/**
* Edit method
*
* @param string|null $id Import id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null) {
$import = $this->Imports->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$import = $this->Imports->patchEntity($import, $this->request->data);
if ($this->Imports->save($import)) {
$this->Flash->success(__('The import has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The import could not be saved. Please, try again.'));
}
$schooltypes = $this->Imports->Schooltypes->find('list', ['limit' => 200]);
$examinations = $this->Imports->Examinations->find('list', ['limit' => 200]);
$this->set(compact('import', 'schooltypes', 'examinations'));
$this->set('_serialize', ['import']);
}
/**
* Delete method
*
* @param string|null $id Import id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']);
$import = $this->Imports->get($id);
if ($this->Imports->delete($import)) {
$this->Flash->success(__('The import has been deleted.'));
} else {
$this->Flash->error(__('The import could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,725 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Filesystem\File;
use Cake\I18n\Time;
use Cake\Utility\Xml;
//define('SCHULPORTAL_BASE0_URL', "https://portal.schulen.bayern.de");
//define('SCHULPORTAL_BASE_URL', SCHULPORTAL_BASE0_URL . "/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0");
class MonitoringsController extends AppController
{
public function initialize()
{
parent::initialize();
$this->loadComponent('Tools');
}
private function query_to_var($string)
{
$arr = array();
$pairs = explode('&', $string);
//debug($pairs);
foreach ($pairs as $pair) {
$parts = explode('=', $pair);
$arr[urldecode($parts[0])] = urldecode($parts[1]);
}
return $arr;
}
private function get_string_between($string, $start, $end)
{
$string = " " . $string;
$ini = strpos($string, $start);
if ($ini == 0) {
return "";
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
$sub = substr($string, $ini, $len);
$elem = explode(' ', $sub)[0];
return str_replace('"', '', $elem);
}
private function login_school($ch)
{
//$login_data = $this->request->session()->read('data');
$login_data = [
'portal_username' => 'asd.trinkl',
'portal_password' => 'HiegTzs!182',
];
curl_setopt($ch, CURLOPT_URL, SCHULPORTAL_BASE_URL);
$text = curl_exec($ch);
$post = [
'user_name' => $login_data['portal_username'],
'password' => $login_data['portal_password'],
'repository' => 'schulen.bayern.de',
'site_name' => 'schulportal',
'secure' => '1',
'resource_id' => '2',
'login_type' => '2',
];
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
// Anmeldeformular fuer das Schulportal abschicken - Step 2
curl_setopt($ch, CURLOPT_URL, SCHULPORTAL_BASE_URL . '/InternalSite/Validate.asp');
$text = curl_exec($ch);
}
public function screen()
{
$this->set('path', $this->Tools->screen());
}
public function trans()
{
if ($this->request->is('post')) {
//debug($this->request);
$string = $this->request['data']['string'];
$arr = $this->query_to_var($string);
$this->set('arr', $arr);
}
}
public function showxml()
{
if ($this->request->is('post')) {
//debug($this->request);
$string = $this->request['data']['string'];
echo($string);
//$arr = $p = xml_parser_create();
//xml_parse_into_struct($p, $string, $vals, $index);
//xml_parser_free($p);
$vals = Xml::toArray(Xml::build($string));
//debug($vals);
//debug($index);
$this->set('arr', $vals);
}
}
public function login()
{
if ($this->request->is('post')) {
$post = $this->request['data'];
$this->request->session()->write('data', $this->request['data']);
debug($post);
return $this->redirect(['action' => 'examine']);
}
}
public function viva()
{
$schools = $this->Monitorings->find('all', array('conditions' => array('action' => 'lehrkap')));
$schools->select(['school'])
->distinct(['school']);
foreach ($schools as $school) {
$snr = $school->school;
$vdata = $this->Monitorings->find('all', array('conditions' => array('action' => 'lehrkap', 'school' => $snr, 'comment' => 'vor Viva')));
$vdata->select(['data']);
//debug($vdata->first()->data);
$ndata = $this->Monitorings->find('all', array('conditions' => array('action' => 'lehrkap', 'school' => $snr, 'comment' => 'nach Viva')));
//debug($ndata->first()->data);
$ndata->select(['data']);
$data[$snr]['vor'] = $vdata->first()->data;
$data[$snr]['nach'] = $ndata->first()->data;
//debug($data);
}
$this->set('data', $data);
}
public function examine()
{
//$login_data = $this->request->session()->read('data');
if ($this->request->is('post')) {
//debug($this->request->data['school_nr']);die;
$login_data = [
'asd_username' => 'A005_TrinklW',
'asd_password' => 'HiegTzs!12',
];
$school_nr = $this->request->data['school_nr'];
//$school_nr = '0181';
$ch = $this->Tools->init_curl_params();
$this->login_school($ch);
$text = $this->Tools->asd_curl($ch, '', array(), '/asddv/dv_xy_00.jsf');
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$post = [
'login:username' => $login_data['asd_username'],
'login:password' => $login_data['asd_password'],
'login' => 'login',
'javax.faces.ViewState' => $viewstate,
'login:loginButton' => 'login:loginButton',
];
$text = $this->Tools->asd_curl($ch, $post, array('Content-Type: application/x-www-form-urlencoded'), '/login/login.jsf');
$text = $this->Tools->asd_curl($ch, '', array(), '/asdus/us_01_01.jsf');
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$post_basic = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'false',
'mainForm:istAnzeigeMaske' => 'false',
];
$post = [
'changeNotification' => 'false',
'conversationId' => $conversationId,
'mainForm:dienststelle_schluessel' => $school_nr,
'mainForm:dienststelle_nameoffiziell' => '',
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'EMPTY:0',
'mainForm:dienststelle_plzstrasse' => '',
'mainForm:dienststelle_ort' => '',
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
'mainForm:dienststelle_referent' => '',
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
'mainForm:dienststelle_status' => 'EMPTY:0',
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
'mainForm:action_suchen' => 'Suchen',
'javax.faces.ViewState' => $viewstate,
];
$text = $this->Tools->asd_curl($ch, array_merge($post_basic, $post), array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_01_01.jsf?cid=' . $conversationId);
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$post = [
'changeNotification' => 'false',
'conversationId' => $conversationId,
'mainForm:resultTable:0:email' => '0001@schulen.bayern.de',
'mainForm:resultTable:0:j_idt112' => 'on',
'javax.faces.ViewState' => $viewstate,
'mainForm:resultTable:0:dienststelle_nameoffiziell' => 'mainForm:resultTable:0:dienststelle_nameoffiziell',
];
$text = $this->Tools->asd_curl($ch, array_merge($post_basic, $post), array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_01_02.jsf?cid=' . $conversationId);
//debug($text);die;
//$output = $this->Tools->asd_basic($text);
//$this->set('output', $output);
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$mask = $this->get_string_between($text, '/uniquesig0/asd/asdus/', '.jsf?cid=');
//debug($mask);
//debug($text);die;
$post = [
'conversationId' => $conversationId,
'changeNotification' => 'true',
'mainForm:schulnummer' => $school_nr,
'mainForm:schule' => 'Leibniz-Gymnasium+Altdorf',
'mainForm:schulstellePlzStrasse' => 'Gymnasium',
'mainForm:lehrkapazitaet' => 'Lehrkapazit%C3%A4t',
'mainForm:erhebungsinformationskommentar' => '',
'mainForm:statusaenderungen_kommentar' => '',
'javax.faces.ViewState' => $viewstate,
];
if ($mask == 'us_01_10') {
$schooltype = 'gms';
$schuleSelect = $this->get_string_between($text, 'name="mainForm:schuleSelect" class="w100p" size="1" onchange="submit()"> <option value="', '" selected="selected">');
//debug($schuleSelect);
//debug($text);die;
$post = [
'conversationId' => $conversationId,
'changeNotification' => 'true',
'mainForm:schuleSelect' => $schuleSelect,
'mainForm:lehrkapazitaet' => 'Lehrkapazität',
'mainForm:erhebungsinformationskommentar' => '',
'mainForm:statusaenderungen_kommentar' => '',
'javax.faces.ViewState' => $viewstate,
];
} else {
$schooltype = 'gymreal';
}
$text = $this->Tools->asd_curl($ch, array_merge($post_basic, $post), array('Content-Type: application/x-www-form-urlencoded'), '/asdus/' . $mask . '.jsf?cid=' . $conversationId);
//debug('/asdus/' . $mask . '.jsf?cid=' . $conversationId);
//echo $text;die;
$data = $this->Tools->asd_lk($text, $schooltype);
$this->set('t_heads', $data['t_heads']);
$this->set('teachers', $data['teachers']);
$data['action'] = 'lehrkap';
$data['school'] = $school_nr;
$data['data'] = json_encode($data['teachers']);
$now = Time::parse();
$now->timezone = "Europe/Berlin";
$data['date'] = $now;
$data['comment'] = 'nach Viva';
$monitoring = $this->Monitorings->newEntity();
$monitoring = $this->Monitorings->patchEntity($monitoring, $data);
$result = $this->Monitorings->save($monitoring);
/* $viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$post = [
'conversationId' => $conversationId,
'changeNotification' => 'true',
'mainForm:schulnummer' => $school_nr,
'mainForm:schule' => 'Oskar-von-Miller-Gymnasium München',
'mainForm:schulstellePlzStrasse' => 'Gymnasium',
'mainForm:lehrkapazitaetFach' => 'Lehrkap./Fach',
'mainForm:selectedUnterrichtsfach' => 'alle',
'mainForm:resultTable:wi' => '',
'mainForm:resultTable:cols' => '',
'mainForm:resultTable:si' => '|||',
'javax.faces.ViewState' => $viewstate
];
$text = $this->Tools->asd_curl($ch, array_merge($post_basic, $post), array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_01_50.jsf?cid=' . $conversationId);
$data = $this->Tools->asd_lf($text);
$this->set('t_headslf', array_merge(array('Name'), $data['t_headslf']));
$this->set('lehrfach', $data['lehrfach']); */
//debug($output);
$this->set('text', $text);
$this->render(null, 'asd');
}
}
public function asdus()
{
$save = false;
if (!empty($this->request['pass'])) {
$command = $this->request['pass']['0'];
if ($command == 'save') {
$save = true;
}
}
//$login_data = $this->request->session()->read('data');
$login_data = [
'asd_username' => 'A005_TrinklW',
'asd_password' => 'HiegTzs!12',
];
$ch = $this->Tools->init_curl_params();
$this->login_school($ch);
// ASD aufrufen - Step 3
$text = $this->Tools->asd_curl($ch, '', array(), '/asddv/dv_xy_00.jsf');
//debug($text);die;
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$post = [
'login:username' => $login_data['asd_username'],
'login:password' => $login_data['asd_password'],
'login' => 'login',
'javax.faces.ViewState' => $viewstate,
'login:loginButton' => 'login:loginButton',
];
$text = $this->Tools->asd_curl($ch, $post, array('Content-Type: application/x-www-form-urlencoded'), '/login/login.jsf');
//debug($text);die;
$schularten = array(
'Gymnasium' => '747',
'Grundsch.sow.Mittelschule' => '742',
'Realschule' => '745',
'Abendrealschule' => '752',
'Realschule z. sp. F.' => '746',
'Schulartunabhängige Orientierungsstufe' => '749',
'Integrierte Gesamtschule' => '750',
);
$output = array();
foreach ($schularten as $sakey => $savalue) {
$text = $this->Tools->asd_curl($ch, '', array(), '/asdus/us_03_01.jsf');
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'false',
'mainForm:istAnzeigMaske' => 'false',
'mainForm:dienststellenName' => '',
'mainForm:schulart' => '',
'mainForm:teilnehmendeGesamt' => '',
'mainForm:nichtAbgegebenKeinLv' => '',
'mainForm:nichtAbgegebenLv' => '',
'mainForm:vollstaendigMitPlFehler' => '',
'mainForm:vollstaendigOhnePlFehler' => '',
'mainForm:abgegeben=&' => '',
'mainForm:abgelehnt' => '',
'mainForm:freigegeben' => '',
'mainForm:us_03_01_popup_selectSchulart' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:' . $savalue,
'mainForm:popup_ok' => 'Ok',
'javax.faces.ViewState' => $viewstate,
];
$text = $this->Tools->asd_curl($ch, $post, array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_03_01.jsf?cid=' . $conversationId);
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($text); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$fields = array(
'Teilnehmende Schulen insgesamt' => 'mainForm:teilnehmendeGesamt',
'Schulen nicht übermittelt (kein Lieferversuch)' => 'mainForm:nichtAbgegebenKeinLv',
'Schulen nicht übermittelt (Lieferversuch)' => 'mainForm:nichtAbgegebenLv',
'Schulen übermittelt (PL-Fehler)' => 'mainForm:vollstaendigMitPlFehler',
'Schulen übermittelt (keine PL-Fehler)' => 'mainForm:vollstaendigOhnePlFehler',
'Schulen abgegeben' => 'mainForm:abgegeben',
'Schulen von Schulaufsicht abgelehnt' => 'mainForm:abgelehnt',
'Schulen von Schulaufsicht freigegeben' => 'mainForm:freigegeben');
foreach ($fields as $key => $field) {
$output[$sakey][$key] = $htmlParser->getElementById($field)->getAttribute('value');
}
}
// staatliche Gymnasien
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$post = [
'sideMenu' => 'sideMenu',
'javax.faces.ViewState' => $viewstate,
'sideMenu:j_idt51:0:j_idt57:1:j_idt59' => 'sideMenu:j_idt51:0:j_idt57:1:j_idt59',
];
$text = $this->Tools->asd_curl($ch, $post, array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_03_01.jsf?cid=' . $conversationId);
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'false',
'mainForm:istAnzeigeMaske' => 'false',
'mainForm:dienststelle_schluessel' => '',
'mainForm:dienststelle_nameoffiziell' => '',
'mainForm:dienststelle_dst_wl_dsttyp_id_uebe' => 'com.hp.asd.wl.domain.standard.Dienststellentyp:1671',
'mainForm:dienststelle_plzstrasse' => '',
'mainForm:dienststelle_ort' => '',
'mainForm:dienststelle_sat_kurz_bezeichnung' => 'com.hp.asd.wl.domain.standard.SchulartRechtlich:747',
'mainForm:dienststelle_bdg_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_wl_kurz_bezeichnung' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_regierung_id_u' => 'EMPTY:0',
'mainForm:dienststelle_dst_wl_schulamt_id' => 'EMPTY:0',
'mainForm:dienststelle_referent' => '',
'mainForm:dienststelle_dst_wl_mb_bezirk_id_u' => 'EMPTY:0',
'mainForm:dienststelle_status' => 'EMPTY:0',
'mainForm:dienststelle_sortierung' => 'com.hp.asd.domain.tech.PersProperty:7',
'mainForm:action_suchen' => 'Suchen',
'javax.faces.ViewState' => $viewstate,
];
$text = $this->Tools->asd_curl($ch, $post, array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_01_01.jsf?cid=' . $conversationId);
$viewstate = $this->get_string_between($text, 'id="javax.faces.ViewState" value="', '" autocomplete');
$conversationId = $this->get_string_between($text, 'name="conversationId" value="', '" />');
$post = [
'mainForm' => 'mainForm',
'referenzBaumAnzeigen' => 'false',
'conversationId' => $conversationId,
'changeNotification' => 'false',
'mainForm:hasChanged' => 'false',
'mainForm:hasNotReleased' => 'false',
'mainForm:hasPopUpChanged' => 'false',
'mainForm:hasAdresseChanged' => 'false',
'mainForm:confirmedOverride' => 'false',
'mainForm:zuordnungNotification' => 'false',
'skipvalidation' => 'true',
'mainForm:istAnzeigeMaske' => 'false',
'mainForm:resultTable:0:email' => '0252@schulen.bayern.de',
'mainForm:resultTable:0:j_idt112' => 'on',
'mainForm:resultTable:1:email' => '0282@schulen.bayern.de',
'mainForm:resultTable:1:j_idt112' => 'on',
'mainForm:resultTable:2:email' => '0180@schulen.bayern.de',
'mainForm:resultTable:2:j_idt112' => 'on',
'mainForm:resultTable:3:email' => '0072@schulen.bayern.de',
'mainForm:resultTable:3:j_idt112' => 'on',
'mainForm:resultTable:4:email' => '0151@schulen.bayern.de',
'mainForm:resultTable:4:j_idt112' => 'on',
'javax.faces.ViewState' => $viewstate,
'mainForm:j_idt183' => 'mainForm:j_idt183',
];
$text = $this->Tools->asd_curl($ch, $post, array('Content-Type: application/x-www-form-urlencoded'), '/asdus/us_01_02.jsf?cid=' . $conversationId);
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($text); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$table = $htmlParser->getElementById('mainForm:resultTable');
//debug($table);
$rows = $table->getElementsByTagName('tr');
$i = 0;
foreach ($rows as $row) {
//debug('Hallo');
if ($i > 0) {
$cols = $row->getElementsByTagName('td');
$status[$i] = $cols->item(5)->nodeValue;
}
$i++;
}
$result = array_count_values($status);
$output2['Staatliche Gymnasien']['Teilmende Schulen insgesamt'] = sizeof($status);
if (!isset($result['n. überm. (kein Liefervers.)'])) {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (kein Lieferversuch)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (kein Lieferversuch)'] = $result['n. überm. (kein Liefervers.)'];
}
if (!isset($result['n. überm. (Lieferversuch)'])) {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (Lieferversuch)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen nicht übermittelt (Lieferversuch)'] = $result['n. überm. (Lieferversuch)'];
}
if (!isset($result['übermittelt (PL-Fehler)'])) {
$output2['Staatliche Gymnasien']['Schulen übermittelt (PL-Fehler)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen übermittelt (PL-Fehler)'] = $result['übermittelt (PL-Fehler)'];
}
if (!isset($result['übermittelt (keine PL-Fehler)'])) {
$output2['Staatliche Gymnasien']['Schulen übermittelt (keine PL-Fehler)'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen übermittelt (keine PL-Fehler)'] = $result['übermittelt (keine PL-Fehler)'];
}
if (!isset($result['abgegeben'])) {
$output2['Staatliche Gymnasien']['Schulen abgegeben'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen abgegeben'] = $result['abgegeben'];
}
if (!isset($result['Schulaufs. abgelehnt'])) {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht abgelehnt'] = $result['Schulaufs. abgelehnt'];
}
if (!isset($result['Schulaufs. freigegeben'])) {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = 0;
} else {
$output2['Staatliche Gymnasien']['Schulen von Schulaufsicht freigegeben'] = $result['Schulaufs. freigegeben'];
}
$output = array_merge($output2, $output);
//debug($output);die;
if ($save) {
$data['action'] = 'asdus';
$data['school'] = '';
$data['data'] = json_encode($output);
$now = Time::parse();
$now->timezone = "Europe/Berlin";
$data['date'] = $now;
$data['comment'] = '';
$monitoring = $this->Monitorings->newEntity();
$monitoring = $this->Monitorings->patchEntity($monitoring, $data);
$result = $this->Monitorings->save($monitoring);
}
$all = $this->Monitorings->find('all', array('conditions' => array('action' => 'asdus'), 'order' => array('id' => 'DESC')));
$old = $all->first();
$now = Time::parse();
$now->timezone = "Europe/Berlin";
$this->set('now', $now);
$this->set('old', $old);
$this->set('output', $output);
$this->set('text', $text);
$viewOutput = $this->render();
$path = WWW_ROOT . 'files/html/asdus.html';
$file = new File($path, true);
$file->write($viewOutput);
$file->close();
}
public function mstr()
{
$SCHULPORTAL_MSTR_BASE_URL = SCHULPORTAL_BASE0_URL . '/uniquesig9adaec6129c81dbeb2f42638bc9f27ac0c442a10891f0c915c9d7f0c371a00b3/uniquesig1/asd';
$reportID = '3F1FE53C4583613BABF14EA6242BACBE';
$ch = $this->Tools->init_curl_params();
$this->login_school($ch);
// MSTR aufrufen - Step 3
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_MSTR_BASE_URL . '/servlet/mstrWeb');
$text = curl_exec($ch);
$post = [
'Uid' => 'A005_TrinklW',
'Pwd' => 'HiegTzs!12',
];
$mstr_login_vars = array('ConnMode', '3054', 'evt', 'src', 'target', 'key', 'Port', 'Project', 'Server', 'login', 'smartBanner', 'lb');
foreach ($mstr_login_vars as $var) {
$value = $this->get_string_between($text, 'name="' . $var . '" value=', 'type="hidden"');
$pvar[$var] = $value;
}
$post = array_merge($post, $pvar);
//debug($post);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
// Bei MSTR uber Formular anmelden - Step 4
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_MSTR_BASE_URL . '/servlet/mstrWeb');
$text = curl_exec($ch);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
// MSTR Bericht ausführen - Step 5
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($text); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$links = $htmlParser->getElementsByTagName('a');
foreach ($links as $link) {
if ($link->nodeValue == 'Amtliche Schulstatistik') {
$params = explode('&', $link->getAttribute('href'));
foreach ($params as $param) {
$parts = explode('=', $param);
$lp[$parts[0]] = $parts[1];
}
}
}
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_MSTR_BASE_URL . '/servlet/mstrWeb?evt=3010&src=' . $lp['src'] . '&ServerAlias=' . $lp['ServerAlias'] . '&Port=' . $lp['Port'] . '&Project=' . $lp['Project'] . '&Server=' . $lp['Server'] . '&loginReq=true');
$text = curl_exec($ch);
//$this->Tools->screen($SCHULPORTAL_MSTR_BASE_URL . '/servlet/mstrWeb?evt=3010&src=' . $lp['src'] . '&ServerAlias=' . $lp['ServerAlias'] . '&Port=' . $lp['Port'] . '&Project=' . $lp['Project'] . '&Server=' . $lp['Server'] . '&loginReq=true');
//$this->Tools->screen('https://portal.schulen.bayern.de/uniquesig2d1dfad4a11c25e42c462e53b4721e48/uniquesig0/SecureSchulportalPortalHomePage/');
//die;
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_MSTR_BASE_URL . '/servlet/mstrWeb?evt=3067&src=mstrWeb.3067&reportViewMode=1&reportID=' . $reportID);
$text = curl_exec($ch);
$post = array();
$pvar = array();
$mstr_result_vars = array('evt', 'src', 'reportViewMode', 'reportID', 'fastExport', 'rsfb', 'rb', 'directExport');
foreach ($mstr_result_vars as $var) {
$value = $this->get_string_between($text, 'name="' . $var . '" value=', 'type="hidden"');
$pvar[$var] = $value;
}
$post = array_merge($post, $pvar);
$action = $this->get_string_between($text, 'FORM ACTION="mstrWeb', 'ID="printForm"');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
// MSTR fertigen Bericht anzeigen - Step 6
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_MSTR_BASE_URL . '/servlet/mstrWeb' . $action);
sleep(20);
$text = curl_exec($ch);
$post = array();
$pvar = array();
$mstr_down_vars = array('evt', 'src', 'SaveReportProperties', 'rb');
foreach ($mstr_down_vars as $var) {
$value = $this->get_string_between($text, 'name="' . $var . '" value=', 'type="hidden"');
$pvar[$var] = $value;
}
$post = array_merge($post, $pvar);
$action = $this->get_string_between($text, 'FORM ACTION="', 'ID="printForm"');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_MSTR_BASE_URL . '/servlet/' . $action);
$text = curl_exec($ch);
// Von MSTR abmelden - Step 8
$post = [
'evt' => '3008',
'src' => 'mstrWeb.3008',
'xts' => exec('date +%s%3N'),
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_URL, $SCHULPORTAL_MSTR_BASE_URL . '/servlet/mstrWeb');
$logout = curl_exec($ch);
// Vom Schulportal abmelden - Step 9
curl_close($ch);
$text = iconv($in_charset = 'UTF-16LE', $out_charset = 'UTF-8', $text);
//Ergebnis in Datenbank speichern
$data['action'] = 'mstr';
$data['school'] = '';
$data['data'] = json_encode($text);
$now = Time::parse();
$now->timezone = "Europe/Berlin";
$data['date'] = $now;
if (strpos($text, 'MMIHG') !== false) {
$data['comment'] = 'Success';
} else {
$data['comment'] = 'Fail';
}
$monitoring = $this->Monitorings->newEntity();
$monitoring = $this->Monitorings->patchEntity($monitoring, $data);
$result = $this->Monitorings->save($monitoring);
$this->set('text', $text);
$this->viewBuilder()->layout('ajax');
}
public function showFails()
{
$data = $this->Monitorings->find('all', array('conditions' => array('comment' => 'Fail', 'action' => 'mstr')));
$this->set('data', $data);
}
}

View File

@@ -0,0 +1,206 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
//use Cake\ORM\TableRegistry;
/**
* Offices Controller
*
* @property \App\Model\Table\OfficesTable $Offices
*/
class OfficesController extends AppController
{
public function importdst() {
$office = $this->Offices->newEntity();
if ($this->request->is(['patch', 'post', 'put'])) {
$options = [
'length' => 0,
'delimiter' => ',',
'enclosure' => '"',
'escape' => '\\',
'headers' => false,
'text' => false,
'excel_bom' => false,
];
$handle = fopen($this->request['data']['file']['tmp_name'], "r");
$i = 0;
while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) {
$data = array();
if($i == 0) {
$keys = $row;
}
else {
$j = 0;
foreach($keys as $column) {
$data[$column] = $row[$j];
$j++;
}
//debug($data);
$office = $this->Offices->find('all',['conditions' => array('dst_schluessel' => $data['d_dst_schluessel'])])->first();
$office['d_regierung'] = $data['d_regierung'];
$office['d_mb'] = $data['d_mb'];
$office['d_schulamt'] = $data['d_schulamt'];
//debug($office);
if (!($this->Offices->save($office))) {
debug($office);die;
}
}
$i++;
}
}
}
public function import() {
$office = $this->Offices->newEntity();
if ($this->request->is(['patch', 'post', 'put'])) {
//debug($this->request['data']);
$this->Offices->deleteAll('id' > 0);
$options = [
'length' => 0,
'delimiter' => ',',
'enclosure' => '"',
'escape' => '\\',
'headers' => false,
'text' => false,
'excel_bom' => false,
];
$handle = fopen($this->request['data']['file']['tmp_name'], "r");
$i = 0;
while ($row = fgetcsv($handle, $options['length'], $options['delimiter'])) {
$data = array();
if($i == 0) {
$keys = $row;
}
else {
$j = 0;
//debug($row);
foreach($keys as $column) {
$data[$column] = $row[$j];
$j++;
}
$office = $this->Offices->newEntity();
$office = $this->Offices->patchEntity($office, $data);
//debug($office);
if (!($this->Offices->save($office))) {
debug($office);die;
}
//debug($data);
//die;
}
$i++;
}
//debug($data_array);die;
//$offices = TableRegistry::get('Offices');
//$entities = $offices->newEntities($data_array);
//debug($entities);die;
//$result = $this->Offices->saveMany($entities);
}
//$this->set(compact('office'));
//$this->set('_serialize', ['office']);
}
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$offices = $this->paginate($this->Offices);
$this->set(compact('offices'));
$this->set('_serialize', ['offices']);
}
/**
* View method
*
* @param string|null $id Office id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$office = $this->Offices->get($id, [
'contain' => []
]);
$this->set('office', $office);
$this->set('_serialize', ['office']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$office = $this->Offices->newEntity();
if ($this->request->is('post')) {
$office = $this->Offices->patchEntity($office, $this->request->data);
if ($this->Offices->save($office)) {
$this->Flash->success(__('The office has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The office could not be saved. Please, try again.'));
}
$this->set(compact('office'));
$this->set('_serialize', ['office']);
}
/**
* Edit method
*
* @param string|null $id Office id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$office = $this->Offices->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$office = $this->Offices->patchEntity($office, $this->request->data);
if ($this->Offices->save($office)) {
$this->Flash->success(__('The office has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The office could not be saved. Please, try again.'));
}
$this->set(compact('office'));
$this->set('_serialize', ['office']);
}
/**
* Delete method
*
* @param string|null $id Office id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$office = $this->Offices->get($id);
if ($this->Offices->delete($office)) {
$this->Flash->success(__('The office has been deleted.'));
} else {
$this->Flash->error(__('The office could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Controller;
use Cake\Core\Configure;
use Cake\Network\Exception\ForbiddenException;
use Cake\Network\Exception\NotFoundException;
use Cake\View\Exception\MissingTemplateException;
/**
* Static content controller
*
* This controller will render views from Template/Pages/
*
* @link http://book.cakephp.org/3.0/en/controllers/pages-controller.html
*/
class PagesController extends AppController
{
/**
* Displays a view
*
* @return void|\Cake\Network\Response
* @throws \Cake\Network\Exception\ForbiddenException When a directory traversal attempt.
* @throws \Cake\Network\Exception\NotFoundException When the view file could not
* be found or \Cake\View\Exception\MissingTemplateException in debug mode.
*/
public function display()
{
$path = func_get_args();
$count = count($path);
if (!$count) {
return $this->redirect('/');
}
if (in_array('..', $path, true) || in_array('.', $path, true)) {
throw new ForbiddenException();
}
$page = $subpage = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
$this->set(compact('page', 'subpage'));
try {
$this->render(implode('/', $path));
} catch (MissingTemplateException $e) {
if (Configure::read('debug')) {
throw $e;
}
throw new NotFoundException();
}
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Results Controller
*
* @property \App\Model\Table\ResultsTable $Results
*/
class ResultsController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$results = $this->paginate($this->Results);
$this->set(compact('results'));
$this->set('_serialize', ['results']);
}
/**
* View method
*
* @param string|null $id Result id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$result = $this->Results->get($id, [
'contain' => []
]);
$this->set('result', $result);
$this->set('_serialize', ['result']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$result = $this->Results->newEntity();
if ($this->request->is('post')) {
$result = $this->Results->patchEntity($result, $this->request->data);
if ($this->Results->save($result)) {
$this->Flash->success(__('The result has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The result could not be saved. Please, try again.'));
}
$this->set(compact('result'));
$this->set('_serialize', ['result']);
}
/**
* Edit method
*
* @param string|null $id Result id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$result = $this->Results->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$result = $this->Results->patchEntity($result, $this->request->data);
if ($this->Results->save($result)) {
$this->Flash->success(__('The result has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The result could not be saved. Please, try again.'));
}
$this->set(compact('result'));
$this->set('_serialize', ['result']);
}
/**
* Delete method
*
* @param string|null $id Result id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$result = $this->Results->get($id);
if ($this->Results->delete($result)) {
$this->Flash->success(__('The result has been deleted.'));
} else {
$this->Flash->error(__('The result could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Schooltypes Controller
*
* @property \App\Model\Table\SchooltypesTable $Schooltypes
*/
class SchooltypesController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$schooltypes = $this->paginate($this->Schooltypes);
$this->set(compact('schooltypes'));
$this->set('_serialize', ['schooltypes']);
}
/**
* View method
*
* @param string|null $id Schooltype id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$schooltype = $this->Schooltypes->get($id, [
'contain' => ['Departments', 'Examinations', 'Imports', 'Subjects', 'Supervisings']
]);
$this->set('schooltype', $schooltype);
$this->set('_serialize', ['schooltype']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$schooltype = $this->Schooltypes->newEntity();
if ($this->request->is('post')) {
$schooltype = $this->Schooltypes->patchEntity($schooltype, $this->request->data);
if ($this->Schooltypes->save($schooltype)) {
$this->Flash->success(__('The schooltype has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The schooltype could not be saved. Please, try again.'));
}
$this->set(compact('schooltype'));
$this->set('_serialize', ['schooltype']);
}
/**
* Edit method
*
* @param string|null $id Schooltype id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$schooltype = $this->Schooltypes->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$schooltype = $this->Schooltypes->patchEntity($schooltype, $this->request->data);
if ($this->Schooltypes->save($schooltype)) {
$this->Flash->success(__('The schooltype has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The schooltype could not be saved. Please, try again.'));
}
$this->set(compact('schooltype'));
$this->set('_serialize', ['schooltype']);
}
/**
* Delete method
*
* @param string|null $id Schooltype id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$schooltype = $this->Schooltypes->get($id);
if ($this->Schooltypes->delete($schooltype)) {
$this->Flash->success(__('The schooltype has been deleted.'));
} else {
$this->Flash->error(__('The schooltype could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,281 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Spatie\ArrayToXml\ArrayToXml;
class StudiesController extends AppController
{
public $html;
public $error;
public $status;
public function getElementsByClass(&$parentNode, $tagName, $className) {
$nodes=array();
$childNodeList = $parentNode->getElementsByTagName($tagName);
for ($i = 0; $i < $childNodeList->length; $i++) {
$temp = $childNodeList->item($i);
if (stripos($temp->getAttribute('class'), $className) !== false) {
$nodes[]=$temp;
}
}
return $nodes;
}
public function array2xml($array, $xml = false){
if($xml === false){
$xml = new \SimpleXMLElement('<xjxobj/>');
}
foreach($array as $key => $value){
if(is_array($value)){
$this->array2xml($value, $xml->addChild($key));
}else{
$xml->addChild($key, $value);
}
}
return $xml->asXML();
}
public function init_curl_params()
{
$ch = curl_init();
if($_SERVER['SERVER_NAME'] != 'asd-control.wtrinkl.de') {
curl_setopt($ch, CURLOPT_PROXY, '10.1.248.1:82');
}
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return ($ch);
}
public function get_string_between($string, $start, $end)
{
$string = " " . $string;
$ini = strpos($string, $start);
if ($ini == 0) {
return "";
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
$sub = substr($string, $ini, $len);
$elem = explode(' ', $sub)[0];
return str_replace('"', '', $elem);
}
public function exec_curl($ch, $url, $post)
{
if ($post == false) {
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
} else {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
}
curl_setopt($ch, CURLOPT_URL, $url);
$this->html = curl_exec($ch);
//debug(curl_errno($ch));
//debug(curl_getinfo($ch, CURLINFO_HTTP_CODE));
if (curl_errno($ch)) {
$this->status = false;
$this->error = 'Couldn\'t send request: ' . curl_error($ch);
} else {
$resultStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($resultStatus != 200) {
$this->status = false;
$this->error = 'Request failed: HTTP status code: ' . $resultStatus;
}
}
}
public function ajaxCount() {
$request = $this->request->query;
//debug($request);die;
$ch = $this->init_curl_params();
$xjxobj = [
'e' => [
(int) 0 => ['k' => '0', 'v' => 'iframe'],
(int) 1 => ['k' => '1', 'v' => '1'],
(int) 2 => ['k' => '2', 'v' => 'tx_szhrksearch_pi1[bundesland][]'],
(int) 3 => ['k' => '3', 'v' => '2'],
(int) 4 => ['k' => '4', 'v' => 'tx_szhrksearch_pi1[search]'],
(int) 5 => ['k' => '5', 'v' => '1'],
(int) 6 => ['k' => '6', 'v' => 'tx_szhrksearch_pi1[fach]'],
(int) 7 => ['k' => '7', 'v' => $request['fachrichtung']],
(int) 8 => ['k' => '8', 'v' => 'tx_szhrksearch_pi1[studtyp]'],
(int) 9 => ['k' => '9', 'v' => '3'],
(int) 10 => ['k' => '10', 'v' => []],
(int) 11 => ['k' => '11', 'v' => '3'],
(int) 12 => ['k' => '12', 'v' => 'tx_szhrksearch_pi1[zubesch][]'],
(int) 13 => ['k' => '13', 'v' => 'O'],
(int) 14 => ['k' => '14', 'v' => 'tx_szhrksearch_pi1[ort]'],
(int) 15 => ['k' => '15', 'v' => 'Regensburg'],
(int) 16 => ['k' => '16', 'v' => 'tx_szhrksearch_pi1[plzdist]'],
(int) 17 => ['k' => '17', 'v' => '25']
]
];
$test = ArrayToXml::convert($xjxobj,'xjxobj');
$test = trim(str_replace('<?xml version="1.0"?>','',$test));
$url = 'https://www.hochschulkompass.de/en/degree-programmes/study-in-germany-search/advanced-degree-programme-search.html?type=9993';
$post = [
'xajax' => 'getCount',
'xajaxr' => exec('date +%s%3N'),
'xajaxargs[]' => $test
];
debug($post);
$this->exec_curl($ch, $url, $post);
//debug($this->html);
$xml_count = simplexml_load_string($this->html);
$json_count = json_encode($xml_count);
$array_count = json_decode($json_count,TRUE);
$count = $array_count['cmd']['xjxobj']['e']['v'];
$this->set('count',$count);
$this->viewBuilder()->layout('ajax');
}
public function getparams()
{
$ch = $this->init_curl_params();
$post ='';
$url = 'https://www.hochschulkompass.de/en/bavaria/degree-programmes/study-in-germany-search/advanced-degree-programme-search.html';
$this->exec_curl($ch, $url, $post);
//debug($this->html);
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$selects = ['zusemester','sprache'];
$singles = array();
foreach ($selects as $select) {
$languages = array();
$items = $htmlParser->getElementById($select);
//debug($items->getAttribute('name'));
$rows = $items->getElementsByTagName('option');
foreach ($rows as $row) {
//debug($row->nodeValue);
//debug($row->getAttribute('value'));
$singles[$select][$row->nodeValue] = $row->getAttribute('value');
}
}
//debug($singles);
$label_arr = array();
$labels = $htmlParser->getElementsByTagName('label');
foreach ($labels as $label) {
$label_arr[$label->getAttribute('for')] =$label->nodeValue;
}
//debug($label_arr);
//die;
$multi_arr = array();
$xpath = new \DOMXpath($htmlParser);
$articles = $xpath->query('//div[@class="hrk-select select td-0"]');
//debug($articles);
foreach($articles as $article) {
$sginputs = $article->getElementsByTagName('input');
foreach($sginputs as $sginput) {
$multi_arr['sachgr'][$label_arr[$sginput->getAttribute('id')]] = $sginput->getAttribute('id');
//debug($sginput->getAttribute('id'));
//debug($label_arr[$sginput->getAttribute('id')]);
}
}
$multis = ['besform', 'zubesch', 'abschluss' ];
$inputs = $htmlParser->getElementsByTagName('input');
foreach ($multis as $multi) {
//debug($inputs);
foreach ($inputs as $input) {
$id = $input->getAttribute('id');
//debug($id);
if (!empty($id)) {
//debug(strpos($id,$multi));
if (strpos($id,$multi) === 0) {
$input_id = $input->getAttribute('id');
//debug($input_id);
//debug($label_arr[$input_id]);
$multi_arr[$multi][$label_arr[$input_id]] = $input->getAttribute('value');
//debug($input->getAttribute('value'));
}
}
}
}
$this->set('singles', $singles);
$this->set('multi_arr', $multi_arr);
$this->viewBuilder()->layout('studies');
}
public function index()
{
$get = [
'iframe'=>'1',
'tx_szhrksearch_pi1[bundesland][]'=>'2',
'tx_szhrksearch_pi1[search]'=>'1',
'genios'=>'',
'tx_szhrksearch_pi1[fach]'=>'Physics',
'tx_szhrksearch_pi1[studtyp]'=>'3',
'tx_szhrksearch_pi1[zusemester]'=>'',
'tx_szhrksearch_pi1[lehramt]'=>'',
'tx_szhrksearch_pi1[sprache]'=>'',
'tx_szhrksearch_pi1[name]'=>'',
'tx_szhrksearch_pi1[plz]'=>'',
'tx_szhrksearch_pi1[ort]'=>'Deggendorf',
'tx_szhrksearch_pi1[traegerschaft]'=>'',
'tx_szhrksearch_pi1[plzdist]'=>'25',
'tx_szhrksearch_pi1[results_at_a_time]'=>'25'
];
$url = 'https://www.hochschulkompass.de/en/degree-programmes/study-in-germany-search/advanced-degree-programme-search.html?';
//debug(http_build_query($get));
$url .= http_build_query($get);
//debug($url);
//debug($get);
$this->exec_curl($ch, $url, $post);
//debug($this->html);die;
$htmlParser = new \DOMDocument(); //to parse html using DOMDocument
libxml_use_internal_errors(true); // your HTML gives parser warnings, keep them internal
$htmlParser->loadHTML($this->html); //Loaded the html string we took from simple xml
$htmlParser->preserveWhiteSpace = false;
$list = array();
$results = $this->getElementsByClass($htmlParser, 'section', 'result-box');
foreach($results as $result) {
$properties = (object) array();
$course = $result->getElementsByTagName('h2')->item(0)->nodeValue;
$properties->Course = $course;
$items = $result->getElementsByTagName('li');
foreach($items as $item) {
$title = $this->getElementsByClass($item, 'span', 'title')[0]->nodeValue;
$status = $this->getElementsByClass($item, 'span', 'status')[0]->nodeValue;
$properties->$title = $status;
}
array_push($list,$properties);
}
$this->set('list', $list);
$this->viewBuilder()->layout('studies');
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Subjects Controller
*
* @property \App\Model\Table\SubjectsTable $Subjects
*/
class SubjectsController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$this->paginate = [
'contain' => ['Schooltypes']
];
$subjects = $this->paginate($this->Subjects);
$this->set(compact('subjects'));
$this->set('_serialize', ['subjects']);
}
/**
* View method
*
* @param string|null $id Subject id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$subject = $this->Subjects->get($id, [
'contain' => ['Schooltypes']
]);
$this->set('subject', $subject);
$this->set('_serialize', ['subject']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$subject = $this->Subjects->newEntity();
if ($this->request->is('post')) {
$subject = $this->Subjects->patchEntity($subject, $this->request->data);
if ($this->Subjects->save($subject)) {
$this->Flash->success(__('The subject has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The subject could not be saved. Please, try again.'));
}
$schooltypes = $this->Subjects->Schooltypes->find('list', ['limit' => 200]);
$this->set(compact('subject', 'schooltypes'));
$this->set('_serialize', ['subject']);
}
/**
* Edit method
*
* @param string|null $id Subject id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$subject = $this->Subjects->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$subject = $this->Subjects->patchEntity($subject, $this->request->data);
if ($this->Subjects->save($subject)) {
$this->Flash->success(__('The subject has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The subject could not be saved. Please, try again.'));
}
$schooltypes = $this->Subjects->Schooltypes->find('list', ['limit' => 200]);
$this->set(compact('subject', 'schooltypes'));
$this->set('_serialize', ['subject']);
}
/**
* Delete method
*
* @param string|null $id Subject id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$subject = $this->Subjects->get($id);
if ($this->Subjects->delete($subject)) {
$this->Flash->success(__('The subject has been deleted.'));
} else {
$this->Flash->error(__('The subject could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Supervisings Controller
*
* @property \App\Model\Table\SupervisingsTable $Supervisings
*/
class SupervisingsController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$this->paginate = [
'contain' => ['Schooltypes']
];
$supervisings = $this->paginate($this->Supervisings);
$this->set(compact('supervisings'));
$this->set('_serialize', ['supervisings']);
}
/**
* View method
*
* @param string|null $id Supervising id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$supervising = $this->Supervisings->get($id, [
'contain' => ['Schooltypes', 'Departments']
]);
$this->set('supervising', $supervising);
$this->set('_serialize', ['supervising']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$supervising = $this->Supervisings->newEntity();
if ($this->request->is('post')) {
$supervising = $this->Supervisings->patchEntity($supervising, $this->request->data);
if ($this->Supervisings->save($supervising)) {
$this->Flash->success(__('The supervising has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The supervising could not be saved. Please, try again.'));
}
$schooltypes = $this->Supervisings->Schooltypes->find('list', ['limit' => 200]);
$this->set(compact('supervising', 'schooltypes'));
$this->set('_serialize', ['supervising']);
}
/**
* Edit method
*
* @param string|null $id Supervising id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$supervising = $this->Supervisings->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$supervising = $this->Supervisings->patchEntity($supervising, $this->request->data);
if ($this->Supervisings->save($supervising)) {
$this->Flash->success(__('The supervising has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The supervising could not be saved. Please, try again.'));
}
$schooltypes = $this->Supervisings->Schooltypes->find('list', ['limit' => 200]);
$this->set(compact('supervising', 'schooltypes'));
$this->set('_serialize', ['supervising']);
}
/**
* Delete method
*
* @param string|null $id Supervising id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$supervising = $this->Supervisings->get($id);
if ($this->Supervisings->delete($supervising)) {
$this->Flash->success(__('The supervising has been deleted.'));
} else {
$this->Flash->error(__('The supervising could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,110 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* Usdates Controller
*
* @property \App\Model\Table\UsdatesTable $Usdates
*/
class UsdatesController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$usdates = $this->paginate($this->Usdates);
$this->set(compact('usdates'));
$this->set('_serialize', ['usdates']);
}
/**
* View method
*
* @param string|null $id Usdate id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$usdate = $this->Usdates->get($id, [
'contain' => []
]);
$this->set('usdate', $usdate);
$this->set('_serialize', ['usdate']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$usdate = $this->Usdates->newEntity();
if ($this->request->is('post')) {
$usdate = $this->Usdates->patchEntity($usdate, $this->request->data);
debug($usdate);die;
if ($this->Usdates->save($usdate)) {
$this->Flash->success(__('The usdate has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The usdate could not be saved. Please, try again.'));
}
$this->set(compact('usdate'));
$this->set('_serialize', ['usdate']);
}
/**
* Edit method
*
* @param string|null $id Usdate id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$usdate = $this->Usdates->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$usdate = $this->Usdates->patchEntity($usdate, $this->request->data);
if ($this->Usdates->save($usdate)) {
$this->Flash->success(__('The usdate has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The usdate could not be saved. Please, try again.'));
}
$this->set(compact('usdate'));
$this->set('_serialize', ['usdate']);
}
/**
* Delete method
*
* @param string|null $id Usdate id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$usdate = $this->Usdates->get($id);
if ($this->Usdates->delete($usdate)) {
$this->Flash->success(__('The usdate has been deleted.'));
} else {
$this->Flash->error(__('The usdate could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

0
src/Model/Behavior/empty Normal file
View File

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Apimport Entity
*
* @property int $id
* @property string $schule
* @property string $pruefungsart
* @property int $anzahl
* @property string $schuelerstatus
* @property int $lieferung
* @property \Cake\I18n\Time $erzeugungsdatum
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*/
class Apimport extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Apresult Entity
*
* @property int $lieferstatus
* @property \Cake\I18n\Time $erzeugungsdatum
* @property float $anzahl
* @property int $id
* @property string $aptype
* @property string $snr
* @property int $apcount
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*/
class Apresult extends Entity
{
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Config Entity
*
* @property int $id
* @property string $title
* @property string $value
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*/
class Config extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Department Entity
*
* @property int $id
* @property int $schooltype_id
* @property int $supervising_id
* @property string $title
* @property string $status
* @property string $code
* @property string $super_school_code
* @property int $count
* @property \Cake\I18n\Time $delivery_date
* @property int $requested
* @property int $delivered
* @property int $checkedin
* @property int $delivery_count
* @property string $data
* @property int $fmismatch
* @property int $pmismatch
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*
* @property \App\Model\Entity\Schooltype $schooltype
* @property \App\Model\Entity\Supervising $supervising
*/
class Department extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Email Entity
*
* @property int $id
* @property string $examinationtype
* @property string $snr
* @property \Cake\I18n\Time $createdate
* @property string $subject
* @property string $text
* @property \Cake\I18n\Time $date
* @property int $lieferung
* @property bool $sent
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*
* @property \App\Model\Entity\Examination $examination
*/
class Email extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Examination Entity
*
* @property int $id
* @property int $schooltype_id
* @property string $title
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*
* @property \App\Model\Entity\Schooltype $schooltype
* @property \App\Model\Entity\Import[] $imports
*/
class Examination extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Extract Entity
*
* @property int $id
* @property string $type
* @property string $value
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*/
class Extract extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Import Entity
*
* @property int $id
* @property int $schooltype_id
* @property int $examination_id
* @property string $title
* @property string $filename
* @property string $tablename
* @property string $field_separator
* @property string $mapping
* @property int $skip
* @property bool $clear
* @property bool $update_table
* @property bool $overwrite
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*
* @property \App\Model\Entity\Schooltype $schooltype
*/
class Import extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Monitoring Entity
*
* @property int $id
* @property string $data
* @property \Cake\I18n\Time $date
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*/
class Monitoring extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

100
src/Model/Entity/Office.php Normal file
View File

@@ -0,0 +1,100 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Office Entity
*
* @property int $id
* @property string $dst_name
* @property string $dst_schluessel
* @property string $dst_schulart
* @property string $dst_typ
* @property string $oe_typ
* @property string $dst_kurz
* @property string $dst_kurz_zusatz
* @property string $dst_briefkopf_1
* @property string $dst_briefkopf_2
* @property string $dst_briefkopf_3
* @property string $dst_briefkopf_4
* @property string $dst_kommentar
* @property string $dst_ist_ausgelagert
* @property string $dst_ist_mittelschule
* @property string $gkz_kennzahl
* @property string $lkz_kennzahl
* @property string $asd_plz_strasse
* @property string $adr_ort
* @property string $adr_strasse
* @property string $adr_hausnummer
* @property string $adr_ortsteil
* @property string $adr_plz_postfach
* @property string $adr_postfach_ort
* @property string $dst_ministerium_schluessel
* @property string $dst_mb_schluessel
* @property string $str_schluessel
* @property string $str_lan_bezeichnung
* @property string $str_art
* @property string $seminar
* @property string $sst_name_offiziell
* @property string $sts_datum_genehmigung
* @property string $sts_schluessel
* @property string $telefon
* @property string $fax
* @property string $email
* @property string $web
* @property string $bdg_schluessel
* @property string $bdg_status
* @property string $bdg_jg_von
* @property string $bdg_jg_bis
* @property string $bdg_bes_kreis
* @property string $fsprofil
* @property string $ffs_schluessel
* @property string $dst_vkz
* @property string $pu_schluessel
* @property string $dst_pu
* @property string $bv_schluessel
* @property string $dst_bv
* @property string $gt_betreuung
* @property string $so_zusatzangebot
* @property string $unterbringung
* @property string $sja_schluessel
* @property string $klassen_gesamt
* @property string $lehrer_gesamt
* @property string $lehrer_m
* @property string $lehrer_w
* @property string $lehrer_neben
* @property string $abgaenger
* @property string $schueler_gesamt
* @property string $schueler_m
* @property string $schuler_w
* @property string $schueller_kolleg
* @property string $schueler_bvj
* @property string $schueler_bgj
* @property string $stunden_insg
* @property string $szjgst
* @property string $szgst_klassen
* @property string $szjgst_schueler
* @property string $d_regierung
* @property string $d_mb
* @property string $d_schulamt
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*/
class Office extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Result Entity
*
* @property string $dst_typ
* @property string $schulart
* @property string $uestatus
* @property string $schulname
* @property string $schulnummer
*/
class Result extends Entity
{
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Schooltype Entity
*
* @property int $id
* @property string $name
* @property string $code
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*
* @property \App\Model\Entity\Department[] $departments
* @property \App\Model\Entity\Examination[] $examinations
* @property \App\Model\Entity\Subject[] $subjects
* @property \App\Model\Entity\Supervising[] $supervisings
*/
class Schooltype extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Subject Entity
*
* @property int $id
* @property int $schooltype_id
* @property string $title
* @property string $code
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*
* @property \App\Model\Entity\Schooltype $schooltype
*/
class Subject extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Supervising Entity
*
* @property int $id
* @property int $schooltype_id
* @property string $code
* @property string $token
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*
* @property \App\Model\Entity\Schooltype $schooltype
* @property \App\Model\Entity\Department[] $departments
*/
class Supervising extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
/**
* Fields that are excluded from JSON versions of the entity.
*
* @var array
*/
protected $_hidden = [
'token'
];
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Usdate Entity
*
* @property int $id
* @property string $sname
* @property string $snr
* @property string $commune
* @property string $state
* @property \Cake\I18n\Time $delivery
* @property \Cake\I18n\Time $created
* @property \Cake\I18n\Time $modified
*/
class Usdate extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false
];
}

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Apimports Model
*
* @method \App\Model\Entity\Apimport get($primaryKey, $options = [])
* @method \App\Model\Entity\Apimport newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Apimport[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Apimport|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Apimport patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Apimport[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Apimport findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class ApimportsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('apimports');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('schule', 'create')
->notEmpty('schule');
$validator
->requirePresence('pruefungsart', 'create')
->notEmpty('pruefungsart');
$validator
->integer('anzahl')
->requirePresence('anzahl', 'create')
->notEmpty('anzahl');
$validator
->requirePresence('schuelerstatus', 'create')
->notEmpty('schuelerstatus');
$validator
->integer('lieferung')
->requirePresence('lieferung', 'create')
->notEmpty('lieferung');
$validator
->dateTime('erzeugungsdatum')
->requirePresence('erzeugungsdatum', 'create')
->notEmpty('erzeugungsdatum');
return $validator;
}
}

View File

@@ -0,0 +1,81 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Apresults Model
*
* @method \App\Model\Entity\Apresult get($primaryKey, $options = [])
* @method \App\Model\Entity\Apresult newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Apresult[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Apresult|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Apresult patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Apresult[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Apresult findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class ApresultsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('apresults');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('lieferstatus')
->requirePresence('lieferstatus', 'create')
->notEmpty('lieferstatus');
$validator
->dateTime('erzeugungsdatum')
->allowEmpty('erzeugungsdatum');
$validator
->decimal('anzahl')
->allowEmpty('anzahl');
$validator
->integer('id')
->requirePresence('id', 'create')
->notEmpty('id');
$validator
->requirePresence('aptype', 'create')
->notEmpty('aptype');
$validator
->requirePresence('snr', 'create')
->notEmpty('snr');
$validator
->integer('apcount')
->requirePresence('apcount', 'create')
->notEmpty('apcount');
return $validator;
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Configs Model
*
* @method \App\Model\Entity\Config get($primaryKey, $options = [])
* @method \App\Model\Entity\Config newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Config[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Config|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Config patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Config[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Config findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class ConfigsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('configs');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('title', 'create')
->notEmpty('title');
$validator
->requirePresence('value', 'create')
->notEmpty('value');
return $validator;
}
}

View File

@@ -0,0 +1,130 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Departments Model
*
* @property \Cake\ORM\Association\BelongsTo $Schooltypes
* @property \Cake\ORM\Association\BelongsTo $Supervisings
*
* @method \App\Model\Entity\Department get($primaryKey, $options = [])
* @method \App\Model\Entity\Department newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Department[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Department|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Department patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Department[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Department findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class DepartmentsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('departments');
$this->displayField('title');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Schooltypes', [
'foreignKey' => 'schooltype_id'
]);
$this->belongsTo('Supervisings', [
'foreignKey' => 'supervising_id'
]);
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('title', 'create')
->notEmpty('title');
$validator
->notEmpty('status');
$validator
->requirePresence('code', 'create')
->notEmpty('code');
$validator
->allowEmpty('super_school_code');
$validator
->integer('count')
->allowEmpty('count');
$validator
->dateTime('delivery_date')
->allowEmpty('delivery_date');
$validator
->integer('requested')
->allowEmpty('requested');
$validator
->integer('delivered')
->allowEmpty('delivered');
$validator
->integer('checkedin')
->allowEmpty('checkedin');
$validator
->integer('delivery_count')
->allowEmpty('delivery_count');
$validator
->allowEmpty('data');
$validator
->integer('fmismatch')
->allowEmpty('fmismatch');
$validator
->integer('pmismatch')
->allowEmpty('pmismatch');
return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->existsIn(['schooltype_id'], 'Schooltypes'));
$rules->add($rules->existsIn(['supervising_id'], 'Supervisings'));
return $rules;
}
}

View File

@@ -0,0 +1,92 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Emails Model
*
* @method \App\Model\Entity\Email get($primaryKey, $options = [])
* @method \App\Model\Entity\Email newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Email[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Email|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Email patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Email[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Email findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class EmailsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('emails');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('examinationtype', 'create')
->notEmpty('examinationtype');
$validator
->requirePresence('snr', 'create')
->notEmpty('snr');
$validator
->dateTime('createdate')
->requirePresence('createdate', 'create')
->notEmpty('createdate');
$validator
->requirePresence('subject', 'create')
->notEmpty('subject');
$validator
->requirePresence('text', 'create')
->notEmpty('text');
$validator
->dateTime('date')
->requirePresence('date', 'create')
->notEmpty('date');
$validator
->integer('lieferung')
->requirePresence('lieferung', 'create')
->notEmpty('lieferung');
$validator
->boolean('sent')
->requirePresence('sent', 'create')
->notEmpty('sent');
return $validator;
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Examinations Model
*
* @property \Cake\ORM\Association\BelongsTo $Schooltypes
* @property \Cake\ORM\Association\HasMany $Imports
*
* @method \App\Model\Entity\Examination get($primaryKey, $options = [])
* @method \App\Model\Entity\Examination newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Examination[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Examination|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Examination patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Examination[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Examination findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class ExaminationsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('examinations');
$this->displayField('title');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Schooltypes', [
'foreignKey' => 'schooltype_id',
'joinType' => 'INNER'
]);
$this->hasMany('Imports', [
'foreignKey' => 'examination_id'
]);
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('title', 'create')
->notEmpty('title');
return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->existsIn(['schooltype_id'], 'Schooltypes'));
return $rules;
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Extracts Model
*
* @method \App\Model\Entity\Extract get($primaryKey, $options = [])
* @method \App\Model\Entity\Extract newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Extract[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Extract|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Extract patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Extract[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Extract findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class ExtractsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('extracts');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('type', 'create')
->notEmpty('type');
$validator
->requirePresence('value', 'create')
->notEmpty('value');
return $validator;
}
}

View File

@@ -0,0 +1,123 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Imports Model
*
* @property \Cake\ORM\Association\BelongsTo $Schooltypes
* @property \Cake\ORM\Association\BelongsTo $Examinations
*
* @method \App\Model\Entity\Import get($primaryKey, $options = [])
* @method \App\Model\Entity\Import newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Import[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Import|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Import patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Import[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Import findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class ImportsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('imports');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Schooltypes', [
'foreignKey' => 'schooltype_id',
'joinType' => 'INNER'
]);
$this->belongsTo('Examinations', [
'foreignKey' => 'examination_id',
'joinType' => 'INNER'
]);
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('title', 'create')
->notEmpty('title');
$validator
->requirePresence('filename', 'create')
->allowEmpty('filename');
$validator
->requirePresence('tablename', 'create')
->notEmpty('tablename');
$validator
->requirePresence('field_separator', 'create')
->notEmpty('field_separator');
$validator
->requirePresence('mapping', 'create')
->notEmpty('mapping');
$validator
->integer('skip')
->requirePresence('skip', 'create')
->notEmpty('skip');
$validator
->boolean('clear')
->requirePresence('clear', 'create')
->notEmpty('clear');
$validator
->boolean('update_table')
->requirePresence('update_table', 'create')
->notEmpty('update_table');
$validator
->boolean('overwrite')
->requirePresence('overwrite', 'create')
->notEmpty('overwrite');
return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->existsIn(['schooltype_id'], 'Schooltypes'));
$rules->add($rules->existsIn(['examination_id'], 'Examinations'));
return $rules;
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Monitorings Model
*
* @method \App\Model\Entity\Monitoring get($primaryKey, $options = [])
* @method \App\Model\Entity\Monitoring newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Monitoring[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Monitoring|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Monitoring patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Monitoring[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Monitoring findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class MonitoringsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('monitorings');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('data', 'create')
->notEmpty('data');
$validator
->date('date')
->requirePresence('date', 'create')
->notEmpty('date');
return $validator;
}
}

View File

@@ -0,0 +1,294 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Offices Model
*
* @method \App\Model\Entity\Office get($primaryKey, $options = [])
* @method \App\Model\Entity\Office newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Office[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Office|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Office patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Office[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Office findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class OfficesTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('offices');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('dst_name', 'create')
->notEmpty('dst_name');
$validator
->requirePresence('dst_schluessel', 'create')
->notEmpty('dst_schluessel');
$validator
->allowEmpty('dst_schulart');
$validator
->requirePresence('dst_typ', 'create')
->notEmpty('dst_typ');
$validator
->requirePresence('oe_typ', 'create')
->notEmpty('oe_typ');
$validator
->allowEmpty('dst_kurz');
$validator
->allowEmpty('dst_kurz_zusatz');
$validator
->allowEmpty('dst_briefkopf_1');
$validator
->allowEmpty('dst_briefkopf_2');
$validator
->allowEmpty('dst_briefkopf_3');
$validator
->allowEmpty('dst_briefkopf_4');
$validator
->allowEmpty('dst_kommentar');
$validator
->requirePresence('dst_ist_ausgelagert', 'create')
->notEmpty('dst_ist_ausgelagert');
$validator
->requirePresence('dst_ist_mittelschule', 'create')
->notEmpty('dst_ist_mittelschule');
$validator
->requirePresence('gkz_kennzahl', 'create')
->notEmpty('gkz_kennzahl');
$validator
->requirePresence('lkz_kennzahl', 'create')
->notEmpty('lkz_kennzahl');
$validator
->allowEmpty('asd_plz_strasse');
$validator
->allowEmpty('adr_ort');
$validator
->allowEmpty('adr_strasse');
$validator
->allowEmpty('adr_hausnummer');
$validator
->allowEmpty('adr_ortsteil');
$validator
->allowEmpty('adr_plz_postfach');
$validator
->allowEmpty('adr_postfach_ort');
$validator
->allowEmpty('dst_ministerium_schluessel');
$validator
->allowEmpty('dst_mb_schluessel');
$validator
->allowEmpty('str_schluessel');
$validator
->allowEmpty('str_lan_bezeichnung');
$validator
->allowEmpty('str_art');
$validator
->allowEmpty('seminar');
$validator
->requirePresence('sst_name_offiziell', 'create')
->notEmpty('sst_name_offiziell');
$validator
->requirePresence('sts_datum_genehmigung', 'create')
->notEmpty('sts_datum_genehmigung');
$validator
->requirePresence('sts_schluessel', 'create')
->notEmpty('sts_schluessel');
$validator
->allowEmpty('telefon');
$validator
->allowEmpty('fax');
$validator
->allowEmpty('email');
$validator
->allowEmpty('web');
$validator
->allowEmpty('bdg_schluessel');
$validator
->allowEmpty('bdg_status');
$validator
->allowEmpty('bdg_jg_von');
$validator
->allowEmpty('bdg_jg_bis');
$validator
->allowEmpty('bdg_bes_kreis');
$validator
->allowEmpty('fsprofil');
$validator
->allowEmpty('ffs_schluessel');
$validator
->allowEmpty('dst_vkz');
$validator
->allowEmpty('pu_schluessel');
$validator
->allowEmpty('dst_pu');
$validator
->allowEmpty('bv_schluessel');
$validator
->allowEmpty('dst_bv');
$validator
->allowEmpty('gt_betreuung');
$validator
->allowEmpty('so_zusatzangebot');
$validator
->allowEmpty('unterbringung');
$validator
->allowEmpty('sja_schluessel');
$validator
->allowEmpty('klassen_gesamt');
$validator
->allowEmpty('lehrer_gesamt');
$validator
->allowEmpty('lehrer_m');
$validator
->allowEmpty('lehrer_w');
$validator
->allowEmpty('lehrer_neben');
$validator
->allowEmpty('abgaenger');
$validator
->allowEmpty('schueler_gesamt');
$validator
->allowEmpty('schueler_m');
$validator
->allowEmpty('schuler_w');
$validator
->allowEmpty('schueller_kolleg');
$validator
->allowEmpty('schueler_bvj');
$validator
->allowEmpty('schueler_bgj');
$validator
->allowEmpty('stunden_insg');
$validator
->allowEmpty('szjgst');
$validator
->allowEmpty('szgst_klassen');
$validator
->allowEmpty('szjgst_schueler');
$validator
->allowEmpty('d_regierung');
$validator
->allowEmpty('d_mb');
$validator
->allowEmpty('d_schulamt');
return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
public function buildRules(RulesChecker $rules)
{
//$rules->add($rules->isUnique(['email']));
return $rules;
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Results Model
*
* @method \App\Model\Entity\Result get($primaryKey, $options = [])
* @method \App\Model\Entity\Result newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Result[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Result|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Result patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Result[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Result findOrCreate($search, callable $callback = null, $options = [])
*/
class ResultsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('results');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->requirePresence('dst_typ', 'create')
->notEmpty('dst_typ');
$validator
->requirePresence('schulart', 'create')
->notEmpty('schulart');
$validator
->requirePresence('uestatus', 'create')
->notEmpty('uestatus');
$validator
->requirePresence('schulname', 'create')
->notEmpty('schulname');
$validator
->requirePresence('schulnummer', 'create')
->notEmpty('schulnummer');
return $validator;
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Schooltypes Model
*
* @property \Cake\ORM\Association\HasMany $Departments
* @property \Cake\ORM\Association\HasMany $Examinations
* @property \Cake\ORM\Association\HasMany $Imports
* @property \Cake\ORM\Association\HasMany $Subjects
* @property \Cake\ORM\Association\HasMany $Supervisings
*
* @method \App\Model\Entity\Schooltype get($primaryKey, $options = [])
* @method \App\Model\Entity\Schooltype newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Schooltype[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Schooltype|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Schooltype patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Schooltype[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Schooltype findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class SchooltypesTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('schooltypes');
$this->displayField('name');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
$this->hasMany('Departments', [
'foreignKey' => 'schooltype_id'
]);
$this->hasMany('Examinations', [
'foreignKey' => 'schooltype_id'
]);
$this->hasMany('Imports', [
'foreignKey' => 'schooltype_id'
]);
$this->hasMany('Subjects', [
'foreignKey' => 'schooltype_id'
]);
$this->hasMany('Supervisings', [
'foreignKey' => 'schooltype_id'
]);
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('name', 'create')
->notEmpty('name');
$validator
->requirePresence('code', 'create')
->notEmpty('code');
return $validator;
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Subjects Model
*
* @property \Cake\ORM\Association\BelongsTo $Schooltypes
*
* @method \App\Model\Entity\Subject get($primaryKey, $options = [])
* @method \App\Model\Entity\Subject newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Subject[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Subject|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Subject patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Subject[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Subject findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class SubjectsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('subjects');
$this->displayField('title');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Schooltypes', [
'foreignKey' => 'schooltype_id',
'joinType' => 'INNER'
]);
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('title', 'create')
->notEmpty('title');
$validator
->requirePresence('code', 'create')
->notEmpty('code');
return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->existsIn(['schooltype_id'], 'Schooltypes'));
return $rules;
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Supervisings Model
*
* @property \Cake\ORM\Association\BelongsTo $Schooltypes
* @property \Cake\ORM\Association\HasMany $Departments
*
* @method \App\Model\Entity\Supervising get($primaryKey, $options = [])
* @method \App\Model\Entity\Supervising newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Supervising[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Supervising|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Supervising patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Supervising[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Supervising findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class SupervisingsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('supervisings');
$this->displayField('code');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Schooltypes', [
'foreignKey' => 'schooltype_id',
'joinType' => 'INNER'
]);
$this->hasMany('Departments', [
'foreignKey' => 'supervising_id'
]);
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('code', 'create')
->notEmpty('code');
$validator
->requirePresence('token', 'create')
->notEmpty('token');
return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
public function buildRules(RulesChecker $rules)
{
$rules->add($rules->existsIn(['schooltype_id'], 'Schooltypes'));
return $rules;
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* Usdates Model
*
* @method \App\Model\Entity\Usdate get($primaryKey, $options = [])
* @method \App\Model\Entity\Usdate newEntity($data = null, array $options = [])
* @method \App\Model\Entity\Usdate[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\Usdate|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\Usdate patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\Usdate[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\Usdate findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class UsdatesTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->table('usdates');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
$validator
->integer('id')
->allowEmpty('id', 'create');
$validator
->requirePresence('sname', 'create')
->notEmpty('sname');
$validator
->requirePresence('snr', 'create')
->notEmpty('snr');
$validator
->requirePresence('commune', 'create')
->notEmpty('commune');
$validator
->requirePresence('state', 'create')
->notEmpty('state');
$validator
->dateTime('delivery')
->requirePresence('delivery', 'create')
->notEmpty('delivery');
return $validator;
}
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Shell;
use Cake\Console\ConsoleOptionParser;
use Cake\Console\Shell;
use Cake\Log\Log;
use Psy\Shell as PsyShell;
/**
* Simple console wrapper around Psy\Shell.
*/
class ConsoleShell extends Shell
{
/**
* Start the shell and interactive console.
*
* @return int|null
*/
public function main()
{
if (!class_exists('Psy\Shell')) {
$this->err('<error>Unable to load Psy\Shell.</error>');
$this->err('');
$this->err('Make sure you have installed psysh as a dependency,');
$this->err('and that Psy\Shell is registered in your autoloader.');
$this->err('');
$this->err('If you are using composer run');
$this->err('');
$this->err('<info>$ php composer.phar require --dev psy/psysh</info>');
$this->err('');
return self::CODE_ERROR;
}
$this->out("You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>");
$this->out('');
Log::drop('debug');
Log::drop('error');
$this->_io->setLoggers(false);
restore_error_handler();
restore_exception_handler();
$psy = new PsyShell();
$psy->run();
}
/**
* Display help for this console.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = new ConsoleOptionParser('console');
$parser->description(
'This shell provides a REPL that you can use to interact ' .
'with your application in an interactive fashion. You can use ' .
'it to run adhoc queries with your models, or experiment ' .
'and explore the features of CakePHP and your application.' .
"\n\n" .
'You will need to have psysh installed for this Shell to work.'
);
return $parser;
}
}

View File

@@ -0,0 +1,27 @@
<?php
/**
* @var \App\View\AppView $this
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('List Apimports'), ['action' => 'index']) ?></li>
</ul>
</nav>
<div class="apimports form large-9 medium-8 columns content">
<?= $this->Form->create($apimport) ?>
<fieldset>
<legend><?= __('Add Apimport') ?></legend>
<?php
echo $this->Form->input('schule');
echo $this->Form->input('pruefungsart');
echo $this->Form->input('anzahl');
echo $this->Form->input('schuelerstatus');
echo $this->Form->input('lieferung');
echo $this->Form->input('erzeugungsdatum');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>

View File

@@ -0,0 +1,33 @@
<?php
/**
* @var \App\View\AppView $this
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Form->postLink(
__('Delete'),
['action' => 'delete', $apimport->id],
['confirm' => __('Are you sure you want to delete # {0}?', $apimport->id)]
)
?></li>
<li><?= $this->Html->link(__('List Apimports'), ['action' => 'index']) ?></li>
</ul>
</nav>
<div class="apimports form large-9 medium-8 columns content">
<?= $this->Form->create($apimport) ?>
<fieldset>
<legend><?= __('Edit Apimport') ?></legend>
<?php
echo $this->Form->input('schule');
echo $this->Form->input('pruefungsart');
echo $this->Form->input('anzahl');
echo $this->Form->input('schuelerstatus');
echo $this->Form->input('lieferung');
echo $this->Form->input('erzeugungsdatum');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>

View File

@@ -0,0 +1,60 @@
<?php
/**
* @var \App\View\AppView $this
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('New Apimport'), ['action' => 'add']) ?></li>
</ul>
</nav>
<div class="apimports index large-9 medium-8 columns content">
<h3><?= __('Apimports') ?></h3>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
<th scope="col"><?= $this->Paginator->sort('schule') ?></th>
<th scope="col"><?= $this->Paginator->sort('pruefungsart') ?></th>
<th scope="col"><?= $this->Paginator->sort('anzahl') ?></th>
<th scope="col"><?= $this->Paginator->sort('schuelerstatus') ?></th>
<th scope="col"><?= $this->Paginator->sort('lieferung') ?></th>
<th scope="col"><?= $this->Paginator->sort('erzeugungsdatum') ?></th>
<th scope="col"><?= $this->Paginator->sort('created') ?></th>
<th scope="col"><?= $this->Paginator->sort('modified') ?></th>
<th scope="col" class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($apimports as $apimport): ?>
<tr>
<td><?= $this->Number->format($apimport->id) ?></td>
<td><?= h($apimport->schule) ?></td>
<td><?= h($apimport->pruefungsart) ?></td>
<td><?= $this->Number->format($apimport->anzahl) ?></td>
<td><?= h($apimport->schuelerstatus) ?></td>
<td><?= $this->Number->format($apimport->lieferung) ?></td>
<td><?= h($apimport->erzeugungsdatum) ?></td>
<td><?= h($apimport->created) ?></td>
<td><?= h($apimport->modified) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $apimport->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $apimport->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $apimport->id], ['confirm' => __('Are you sure you want to delete # {0}?', $apimport->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
</div>
</div>

View File

@@ -0,0 +1,55 @@
<?php
/**
* @var \App\View\AppView $this
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('Edit Apimport'), ['action' => 'edit', $apimport->id]) ?> </li>
<li><?= $this->Form->postLink(__('Delete Apimport'), ['action' => 'delete', $apimport->id], ['confirm' => __('Are you sure you want to delete # {0}?', $apimport->id)]) ?> </li>
<li><?= $this->Html->link(__('List Apimports'), ['action' => 'index']) ?> </li>
<li><?= $this->Html->link(__('New Apimport'), ['action' => 'add']) ?> </li>
</ul>
</nav>
<div class="apimports view large-9 medium-8 columns content">
<h3><?= h($apimport->id) ?></h3>
<table class="vertical-table">
<tr>
<th scope="row"><?= __('Schule') ?></th>
<td><?= h($apimport->schule) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Pruefungsart') ?></th>
<td><?= h($apimport->pruefungsart) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Schuelerstatus') ?></th>
<td><?= h($apimport->schuelerstatus) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Id') ?></th>
<td><?= $this->Number->format($apimport->id) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Anzahl') ?></th>
<td><?= $this->Number->format($apimport->anzahl) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Lieferung') ?></th>
<td><?= $this->Number->format($apimport->lieferung) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Erzeugungsdatum') ?></th>
<td><?= h($apimport->erzeugungsdatum) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Created') ?></th>
<td><?= h($apimport->created) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Modified') ?></th>
<td><?= h($apimport->modified) ?></td>
</tr>
</table>
</div>

View File

@@ -0,0 +1 @@
<h1>Export sucessfull!</h1>

View File

@@ -0,0 +1,14 @@
<table>
<tr><th>Typ</th><th>SNR</th><th>Anzahl</th><th>Apcount</th><th>Datum</th></tr>
<?php
foreach($apresults as $apresult) {
echo '<tr>';
echo '<td>'.$apresult['aptype'].'</td>';
echo '<td>'.$apresult['snr'].'</td>';
echo '<td>'.$apresult['anzahl'].'</td>';
echo '<td>'.$apresult['apcount'].'</td>';
echo '<td>'.date('Y-m-d H:i:s',strtotime($apresult['erzeugungsdatum'])).'</td>';
echo '</tr>';
}
?>
</table>

Some files were not shown because too many files have changed in this diff Show More