mirror of
https://github.com/xfarrow/phpxpress.git
synced 2025-06-05 21:59:21 +02:00
code quality
This commit is contained in:
21
examples/breadcrumb.php
Normal file
21
examples/breadcrumb.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../bootstrap-5.1.3-dist/css/bootstrap.min.css">
|
||||
<title>BreadCrumb example</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include "../phpxpress/Breadcrumb.php";
|
||||
|
||||
$links["Github"] = "https://www.github.com";
|
||||
$links["xfarrow"] = "https://www.github.com/xfarrow";
|
||||
$links["PhpXpress"] = "https://www.github.com/xfarrow/phoxpress";
|
||||
|
||||
$breadcrumb = new PhpXpress\BreadCrumb;
|
||||
|
||||
$breadcrumb->setDataSource($links);
|
||||
$breadcrumb->draw();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
67
examples/card.php
Normal file
67
examples/card.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../bootstrap-5.1.3-dist/css/bootstrap.min.css">
|
||||
<title>Card example</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include "../phpxpress/Card.php";
|
||||
|
||||
PhpXpress\Card::beginCardGroupLayout(36);
|
||||
|
||||
// Rome
|
||||
|
||||
$card1 = new PhpXpress\Card;
|
||||
$card1->setImageSource("./images/colosseum.jpg");
|
||||
$card1->setTitle("Rome");
|
||||
$card1->setSubTitle("Capital of Italy");
|
||||
$card1->setInnerText("After the foundation by Romulus according to a legend, Rome was ruled for a period of 244 years by a monarchical system, initially with sovereigns of Latin and Sabine origin, later by Etruscan kings.");
|
||||
$card1->setFooterText("Image By John");
|
||||
$card1->addField("Mayor", "Roberto Gualtieri");
|
||||
$card1->addField("Inhabitants", "2.763.804");
|
||||
$card1->AddField("Zip", "001XX");
|
||||
$card1->setButton("More info", "https://en.wikipedia.org/wiki/Rome");
|
||||
$card1->addLink("Town", "https://www.comune.roma.it/web/it/welcome.page");
|
||||
$card1->addLink("ATAC", "https://www.atac.roma.it/");
|
||||
$card1->draw();
|
||||
|
||||
|
||||
// Paris
|
||||
|
||||
class City{
|
||||
public $Mayor;
|
||||
public $Inhabitants;
|
||||
public $Zip;
|
||||
}
|
||||
|
||||
$paris = new City;
|
||||
$paris->Mayor = "Anne Hidalgo";
|
||||
$paris->Inhabitants = "2.229.095";
|
||||
$paris->Zip = "750XX";
|
||||
|
||||
$card2 = new PhpXpress\Card;
|
||||
$card2->setImageSource("./images/paris.jpg");
|
||||
$card2->setTitle("Paris");
|
||||
$card2->setSubTitle("Capital of France");
|
||||
$card2->setInnerText("The following fields' name & data will be acquired by the datasource.");
|
||||
$card2->setDataSource($paris);
|
||||
$card2->setButton("More info", "https://en.wikipedia.org/wiki/Paris");
|
||||
$card2->addArrayToList(array("this is", "just a list"));
|
||||
$card2->addElementToList("of various sentences");
|
||||
$card2->addLink("Link1", "#");
|
||||
$card2->addLink("Link2", "#");
|
||||
|
||||
$card2->onFieldDisplaying("onFieldDisplaying");
|
||||
|
||||
$card2->draw();
|
||||
|
||||
PhpXpress\Card::endCardGroupLayout();
|
||||
|
||||
function onFieldDisplaying(&$field , &$value){
|
||||
if($field == "Inhabitants"){
|
||||
$value .= " (census 2019)";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
19
examples/dropdown.php
Normal file
19
examples/dropdown.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../bootstrap-5.1.3-dist/css/bootstrap.min.css">
|
||||
<script type="text/javascript" src="../bootstrap-5.1.3-dist/js/bootstrap.bundle.js"></script>
|
||||
<title>Dropdown example</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include "../phpxpress/Dropdown.php";
|
||||
|
||||
$dropdown = new PhpXpress\Dropdown;
|
||||
|
||||
$dropdown->setTitle("Bank Account");
|
||||
$dropdown->setDataSource(array("Unicredit" => "#" , "United Bank" => "#" , "National Bank" => "#"));
|
||||
$dropdown->draw();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
BIN
examples/images/breadcrumb.jpg
Normal file
BIN
examples/images/breadcrumb.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
examples/images/card.jpg
Normal file
BIN
examples/images/card.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 213 KiB |
BIN
examples/images/colosseum.jpg
Normal file
BIN
examples/images/colosseum.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 152 KiB |
BIN
examples/images/demoTable.jpg
Normal file
BIN
examples/images/demoTable.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 144 KiB |
BIN
examples/images/paris.jpg
Normal file
BIN
examples/images/paris.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
69
examples/table.php
Normal file
69
examples/table.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../bootstrap-5.1.3-dist/css/bootstrap.min.css">
|
||||
<title>Table example</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include "../phpxpress/Table.php";
|
||||
|
||||
class Employee{
|
||||
public $name;
|
||||
public $surname;
|
||||
public $dateOfBirth;
|
||||
public $ssn;
|
||||
}
|
||||
|
||||
$employee1 = new Employee;
|
||||
$employee2 = new Employee;
|
||||
$employee3 = new Employee;
|
||||
|
||||
$employee1->name = 'Christopher';
|
||||
$employee1->surname = 'Anderson';
|
||||
$employee1->dateOfBirth = "01-01-1970";
|
||||
$employee1->ssn = "12345";
|
||||
|
||||
$employee2->name = 'Catherine';
|
||||
$employee2->surname = 'Johnstone';
|
||||
$employee2->dateOfBirth = "02-04-1988";
|
||||
$employee2->ssn = "56789";
|
||||
|
||||
$employee3->name = 'Anna';
|
||||
$employee3->surname = 'Brenson';
|
||||
$employee3->dateOfBirth = "10-08-1998";
|
||||
$employee3->ssn = "13579";
|
||||
|
||||
$employees = array($employee1,$employee2,$employee3);
|
||||
|
||||
$table = new PhpXpress\Table;
|
||||
$table->addColumn("Extra");
|
||||
$table->setDataSource($employees);
|
||||
$table->setCustomCaptions(array("Extra" , "Name", "Surname", "Date of Birth", "Social Security Number"));
|
||||
$table->addColumn("Extra2");
|
||||
|
||||
|
||||
$table->onValueDisplaying("onValueDisplaying");
|
||||
|
||||
$table->setStripedRows(true);
|
||||
$table->setBordered(true);
|
||||
$table->setHoverAnimation(true);
|
||||
|
||||
$table->draw();
|
||||
|
||||
function onValueDisplaying($caption, &$value, $row){
|
||||
if($caption == "ssn"){
|
||||
if($row["ssn"] != "12345"){
|
||||
$value = "SSN not shown for privacy reasons";
|
||||
}
|
||||
else{
|
||||
$value = $row["name"] . " " . $row["surname"] . " agreed to share their ssn (12345)" ;
|
||||
}
|
||||
}
|
||||
else if($caption == "Extra"){
|
||||
$value = "This column did not exist in the datasource";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user