PHP code example of bluedogtraining / avetmiss

1. Go to this page and download the library: Download bluedogtraining/avetmiss library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bluedogtraining / avetmiss example snippets


use Bdt\Avetmiss\File;
use Bdt\Avetmiss\Nat\V7\Nat120;

// array of student courses, pulled from the database
$studentcourses = DB::getStudentCourses();

// initiate a new nat file
$file = new File(new Nat120);

// loop through the studentcourses and add them to the file
foreach($this->studentcourses as $studentcourse) {

    try {
        $row = $file->createRow();
        
        $row->set('client_id', $studentcourse->Student->id);
        $row->set('subject_id', $studentcourse->Course->id);
        //...
        
        $file->writeRow($row);
    } catch(Exception $e) {
        // Display or log any errors.
    }
}

$file->export('nat120.txt');

$myFieldset = new Fieldset([
    Field::make('date')->name('enrolment_date')->length(8),
    Field::make('numeric')->name('state_id')->length(2)->pad('0')->in(Config::keys('states')),
]);

class MyOwnConfig extends Config
{
    protected static $deliveryTypes = [
        10 => 'Classroom-based',
        20 => 'Electronic based',
        30 => 'Employment based',
        40 => 'Other delivery (eg correspondence)',
        90 => 'Not applicable - recognition of prior learning/ recognition of current competency/ credit transfer'
    ];
}

$validator = Validator::make([
    'my_start_date' => '01022000'
], [
    'my_start_date' => 'avetmiss:nat120,activity_start_date'
]);

$isValid = $validator->passes();

$factory = new Bdt\Avetmiss\Frameworks\Zf1\ValidatorFactory;
$validator = $factory->create('nat120', 'activity_start_date');
$validator->isValid('my_start_date');