Skip to content

Repository files navigation

Subway

Nothing more and nothing less than a private study
for additional code for WBCE.


Requirements

  • PHP >= 8.4.1
  • WBCE >= 1.6.4
  • Twig >= 3.14.x

Sub-Class ReadMe

  • ArrayStep
  • Date
  • Pages
  • Request
  • System
  • sql/Database
  • tools/Data
  • template/TwigBox

Examples

  • code2
use Subway\core\Pages;
use Subway\core\tools\Data;

echo "PageTree - Neu mit »Subway«.";

$aPages  = Pages::getInstance()->getPageTree(
    0, // root
    ['page_id', 'page_title', 'menu_title']
);

echo Data::display($aPages);
  • loading Subway-frontend css
\Subway\core\Subway::getInstance()->initFrontend();
  • e.g. test
// css in frontend
\Subway\core\Subway::getInstance()->initFrontend();

echo "<p></p>";
$oTwig = Subway\core\template\TwigBox::getInstance();
$oTwig->registerPath(WB_PATH."/modules/Subway/templates/", "test");

echo $oTwig->render(
  "@test/testFormatWithMYSQL.lte",
  [
      'message' => "Test von Subway - Twig function »formatWithMYSQL«.",
      'theFormat' => "%W, %d. %M, %Y  - %H:%i",
      'theTime' => time(),
      'theLang' => 'fr_FR'
  ]
);

See https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_date-format

fomantic calendar
/**
 * Fomantic Calendar
 *
 */
use Subway\core\Subway;
use Subway\core\css\FomanticCalendar;
use Subway\core\tools\Data;
use Subway\core\css\Fomantic;

Subway::getInstance()->initFrontend();

// Pre-initialize Formantic framework
Fomantic::getInstance();

$oCal = FomanticCalendar::getInstance();
$oCal->setDisplayMonths(3);

$oCal->addPeriod(
    '15.07.2026',
    '18.10.2026',
    ['Test Übungen 1', 'Prüfung A', 'Vorbereitung B'],
    '+2 week', // 'Monday next week'
    'orange',
    'orange' 
);

$oCal->addPeriod(
    '05.05.2026',
    '30.05.2026',
    ['Test Übungen 1', 'Test_Übung 2', 'Vorbereitung Test I', "Vorbereitung Prüfung II"],
    ['+2 day', '+5 day'],
    'green',
    'green' 
);

echo $oCal->generate();

Result:
Subway calendar

ArraySteps

Quick test inside code2 section ...

use Subway\core\Subway;
use Subway\core\ArrayStep;
use Subway\core\tools\Data;

Subway::getInstance()->initFrontend();

$iMax = 15;
$myArray = ["A", "B", "C", "D"];

$modes = [
    'Loop'      => ArrayStep::MODE_LOOP,
    'Toggle'    => ArrayStep::MODE_TOGGLE,
    'Hold'      => ArrayStep::MODE_HOLD,
    'Random'    => ArrayStep::MODE_RANDOM
];

foreach ($modes as $name => $currentMode)
{
    $oARRAY_STEP = new ArrayStep($myArray, $currentMode);
    $result = [];
    for ($i=0; $i < $iMax; $i++)
    {
	    $result[] = $oARRAY_STEP->getAndStep();
    }

    echo "<p><strong>" . $name . "</strong><br>".implode(", ", $result) . "</p>";
}

Example/Usage

$colors = ['red', 'green', 'blue', 'yellow'];
$stepper = new ArrayStep($colors, ArrayStep::MODE_LOOP);

// Basic usage
echo $stepper->getAndStep();  // 'red'
echo $stepper->getAndStep();  // 'green'
echo $stepper->getAndStep();  // 'blue'
echo $stepper->getAndStep();  // 'yellow'
echo $stepper->getAndStep();  // 'red' (loops)

// Iterator interface
foreach ($stepper as $color) {
    echo $color . "\n";
}

// Reset and reposition
$stepper->reset();
$stepper->setPosition(2);
echo $stepper->get();  // 'blue'

// Safe mode switching
if ($stepper->setMode(ArrayStep::MODE_RANDOM)) {
    echo $stepper->getAndStep();  // Random element
}

08.2026 Aldus

About

Nothing more and nothing less than a private study for additional code for WBCE.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages