Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring for better understanding #9

Merged
merged 9 commits into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# CHANGELOG

## 0.2.0 - 2017-03-24

- BC-break; Completely refactored library and added more working methods.

## 0.1.1 - 2017-03-20

- Improved coding standards and testing

## 0.1.0 - 2013-11-20

- Initial version of making registrations possible using EDB-BRUGS PHP SDK
78 changes: 76 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

PHP 5 SDK to communicate with [De frie skolers EDB-BRUGS](http://edb-brugs.dk).

## Requirements

- Access to the programs from EDB-BRUGS.
- License for "Webtilmeldinger" (contact EDB-BRUGS support)
- EDB-BRUGS uses the new "stamdata" system

## Getting started

The service communicates via SOAP to EDB-BRUGS. You are only able to create new registrations which has to manually manipulated and put into the correct courses using the EDB-BRUGS Windows program.
Expand All @@ -24,13 +30,81 @@ Simply add a dependency on lsolesen/edbbrugs-php-sdk to your project's `composer
```
{
"require": {
"lsolesen/edbbrugs-php-sdk": "1.0.*"
"lsolesen/edbbrugs-php-sdk": "dev-master"
}
}
```

After running `composer install`, you can take advantage of Composer's autoloader in `vendor/autoload.php`.

## Usage

```php5
<?php
use EDBBrugs\Client;
use EDBBrugs\Credentials;
use EDBBrugs\RegistrationRepository;

$soap = new \SoapClient('https://www.webtilmeldinger.dk/TilmeldingsFormularV2Ws/Service.asmx?wsdl', array('trace' => 1));
$credentials = new Credentials($username, $password, $school_code);
$client = new Client($credentials, $soap);
$registration_repository = new RegistrationRepository($client);

// Add registrations.
$registrations = array(
array(
'Kartotek' => 'XX',
'Kursus' => 'Vinterkursus 18/19',
// The following is available for Elev, Mor, Far, Voksen
'Elev.Fornavn' => 'Svend Aage',
'Elev.Efternavn' => 'Thomsen',
'Elev.Adresse' => 'Ørnebjergvej 28',
'Elev.Lokalby' => 'Grejs',
'Elev.Postnr' => '7100',
'Elev.Bynavn' => 'Vejle',
'Elev.CprNr' => '010119421942',
'Elev.Fastnet' => '75820811',
'Elev.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Mobil' => '75820811',
'Elev.MobilBeskyttet' => 0, // 0 = No, 1 = Yes
'Elev.Email' => 'kontor@vih.dk',
'Elev.Land' => 'Danmark',
'Elev.Notat' => 'Svend Aage Thomsen er skolens grundlægger',
// Specific for student
'Elev.Linje' => 'Fodbold',
'Voksen.Fornavn' => 'Svend Aage',
'Voksen.Efternavn' => 'Thomsen',
'Voksen.Adresse' => 'Ørnebjergvej 28',
'Voksen.Lokalby' => 'Grejs',
'Voksen.Postnr' => '7100',
'Voksen.Bynavn' => 'Vejle',
'Voksen.Fastnet' => '75820811',
'Voksen.FastnetBeskyttet' => 0, // 0 = No, 1 = Yes
'Voksen.Mobil' => '75820811',
'Voksen.MobilBeskyttet' => 0, // 0 = No, 1 = Yes
'Voksen.Email' => 'kontor@vih.dk',
'Voksen.Land' => 'Danmark',
)
);

$registration_repository->addRegistrations($registrations);

// Get new registrations.
$registration_repository->getNewRegistrations();

// Get handled registrations.
$registration_repository->getHandledRegistrations();
?>
```

## Testing

During testing you need to manually delete the web registrations using the Windows program.
You can test the methods on the commandline, by running:

php vendor/bin/phpunit --exclude-group=IntegrationTest tests

If you want to test the integration, please create a ´phpunit.xml´ based on ´phpunit.dist.xml´ with the correct information for accesssing the service.

php vendor/bin/phpunit tests

During testing you need to manually delete the web registrations using the Windows EDB-BRUGS program. *There is no way to delete using the SOAP webservice*.
20 changes: 9 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@
],
"homepage": "http://github.com/vih/edbbrugs-php-sdk",
"authors": [
{
"name": "Lars Olesen",
"email": "lars@intraface.dk",
"homepage": "http://intraface.dk",
"role": "Developer"
}
],
"license": "MIT",
"require": {
"php": ">=5.5.0"
},
{
"name": "Lars Olesen",
"email": "lars@intraface.dk",
"homepage": "http://intraface.dk",
"role": "Developer"
}
],
"license": "MIT",
"autoload": {
"psr-4": {
"EDBBrugs\\": "src/"
}
},
"require": {
"php": ">=5.5.0",
"ext-soap": "*"
},
"require-dev": {
Expand Down
Loading