code quality
@ -1,21 +1,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../bootstrap-5.1.3-dist/css/bootstrap.min.css">
|
||||
<title>Card example</title>
|
||||
<title>BreadCrumb example</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include "../phpxpress/breadcrumb.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 BreadCrumb;
|
||||
$breadcrumb = new PhpXpress\BreadCrumb;
|
||||
|
||||
$breadcrumb->setDataSource($links);
|
||||
$breadcrumb->draw();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -5,13 +5,13 @@
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include "../phpxpress/card.php";
|
||||
include "../phpxpress/Card.php";
|
||||
|
||||
Card::beginCardGroupLayout(36);
|
||||
PhpXpress\Card::beginCardGroupLayout(36);
|
||||
|
||||
// Rome
|
||||
|
||||
$card1 = new Card;
|
||||
$card1 = new PhpXpress\Card;
|
||||
$card1->setImageSource("./images/colosseum.jpg");
|
||||
$card1->setTitle("Rome");
|
||||
$card1->setSubTitle("Capital of Italy");
|
||||
@ -39,7 +39,7 @@
|
||||
$paris->Inhabitants = "2.229.095";
|
||||
$paris->Zip = "750XX";
|
||||
|
||||
$card2 = new Card;
|
||||
$card2 = new PhpXpress\Card;
|
||||
$card2->setImageSource("./images/paris.jpg");
|
||||
$card2->setTitle("Paris");
|
||||
$card2->setSubTitle("Capital of France");
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
$card2->draw();
|
||||
|
||||
Card::endCardGroupLayout();
|
||||
PhpXpress\Card::endCardGroupLayout();
|
||||
|
||||
function onFieldDisplaying(&$field , &$value){
|
||||
if($field == "Inhabitants"){
|
||||
@ -64,4 +64,4 @@
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -1,17 +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 Dropdown;
|
||||
include "../phpxpress/Dropdown.php";
|
||||
|
||||
$dropdown = new PhpXpress\Dropdown;
|
||||
|
||||
$dropdown->setTitle("Bank Account");
|
||||
$dropdown->setDataSource(array("Unicredit" => "#" , "United Bank" => "#" , "National Bank" => "#"));
|
||||
$dropdown->draw();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 213 KiB |
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 152 KiB |
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
@ -5,7 +5,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
include "../phpxpress/table.php";
|
||||
include "../phpxpress/Table.php";
|
||||
|
||||
class Employee{
|
||||
public $name;
|
||||
@ -27,7 +27,7 @@
|
||||
$employee2->surname = 'Johnstone';
|
||||
$employee2->dateOfBirth = "02-04-1988";
|
||||
$employee2->ssn = "56789";
|
||||
|
||||
|
||||
$employee3->name = 'Anna';
|
||||
$employee3->surname = 'Brenson';
|
||||
$employee3->dateOfBirth = "10-08-1998";
|
||||
@ -35,12 +35,12 @@
|
||||
|
||||
$employees = array($employee1,$employee2,$employee3);
|
||||
|
||||
$table = new Table;
|
||||
$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");
|
||||
|
||||
@ -66,4 +66,4 @@
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PhpXpress v1.0
|
||||
* PhpXpress v1.0.1
|
||||
*
|
||||
* @see https://github.com/xfarrow/phpxpress The PhpXpress GitHub project
|
||||
*
|
||||
@ -11,7 +11,7 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
include "include.php";
|
||||
namespace PhpXpress;
|
||||
|
||||
class BreadCrumb{
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
function setDataSource($dataSource){
|
||||
if(!is_array($dataSource))
|
||||
throw new InvalidArgumentException('Parameter dataSource must be an array.');
|
||||
|
||||
|
||||
foreach($dataSource as $caption => $link){
|
||||
$this->addElement($caption, $link);
|
||||
}
|
||||
@ -43,10 +43,10 @@
|
||||
** Adds an element at the end of the Breadcrumb
|
||||
*/
|
||||
function addElement($caption, $link){
|
||||
|
||||
|
||||
if(isset($this->locations))
|
||||
$this->locations[$caption] = $link;
|
||||
|
||||
|
||||
else
|
||||
$this->locations = array($caption => $link);
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
** or a string (the caption to be activated)
|
||||
*/
|
||||
function setActiveLocation($activeLocation){
|
||||
|
||||
|
||||
if(!is_scalar($activeLocation) && !is_string($activeLocation))
|
||||
throw new InvalidArgumentException('Parameter activeLocation can be either an int or a string. None of these provided.');
|
||||
|
||||
@ -79,13 +79,13 @@
|
||||
echo '<nav style="--bs-breadcrumb-divider: \'' . $this->divider . '\';" aria-label="breadcrumb">';
|
||||
|
||||
echo '<ol class="breadcrumb">';
|
||||
|
||||
|
||||
foreach($this->locations as $caption => $link){
|
||||
|
||||
|
||||
// active location
|
||||
if(
|
||||
if(
|
||||
(is_int($this->activeLocation) && $this->activeLocation == $iterator)
|
||||
|| (is_string($this->activeLocation) && $this->activeLocation == $caption)
|
||||
|| (is_string($this->activeLocation) && $this->activeLocation == $caption)
|
||||
){
|
||||
echo '<li class="breadcrumb-item active" aria-current="page">' . $caption . '</li>';
|
||||
}
|
||||
@ -102,4 +102,4 @@
|
||||
echo '</ol></nav>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PhpXpress v1.0
|
||||
* PhpXpress v1.0.1
|
||||
*
|
||||
* @see https://github.com/xfarrow/phpxpress The PhpXpress GitHub project
|
||||
*
|
||||
@ -11,10 +11,12 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
include "include.php";
|
||||
namespace PhpXpress;
|
||||
|
||||
include "Code.php";
|
||||
|
||||
class Card{
|
||||
|
||||
|
||||
// Structure
|
||||
private $imageSource;
|
||||
private $title;
|
||||
@ -183,10 +185,10 @@
|
||||
|
||||
if(isset($this->linksArray)){ // links
|
||||
foreach($this->linksArray as $caption => $link){
|
||||
echo '<a href="' . $link . '" class="card-link">'. $caption .'</a>';
|
||||
echo '<a href="' . $link . '" class="card-link">'. $caption .'</a>';
|
||||
}
|
||||
echo '<br/><br/>';
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($this->button))
|
||||
echo '<a href="' . $this->button["link"] . '" class="btn btn-primary">' . $this->button["text"] . '</a>';
|
||||
@ -221,11 +223,10 @@
|
||||
*/
|
||||
static function beginCardGroupLayout($width=36){
|
||||
echo '<div class="card-group" style="width:' . $width. 'rem;">';
|
||||
}
|
||||
}
|
||||
|
||||
static function endCardGroupLayout(){
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
@ -1,8 +1,7 @@
|
||||
<script type="text/javascript" src="../bootstrap-5.1.3-dist/js/bootstrap.bundle.js"></script>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PhpXpress v1.0
|
||||
* PhpXpress v1.0.1
|
||||
*
|
||||
* @see https://github.com/xfarrow/phpxpress The PhpXpress GitHub project
|
||||
*
|
||||
@ -12,7 +11,9 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
include "include.php";
|
||||
namespace PhpXpress;
|
||||
|
||||
include "Code.php";
|
||||
|
||||
class Dropdown{
|
||||
|
||||
@ -38,7 +39,7 @@
|
||||
public function setSize($size){
|
||||
if($size == "default")
|
||||
$this->size = NULL;
|
||||
|
||||
|
||||
else if($size == "large")
|
||||
$this->size = "btn-lg";
|
||||
|
||||
@ -77,12 +78,12 @@
|
||||
}
|
||||
|
||||
echo '<ul class="' . $ulClass . '" aria-labelledby="dropdownMenuButton1">';
|
||||
|
||||
|
||||
foreach($this->datasource as $name => $link){
|
||||
echo '<li><a class="dropdown-item" href="' . $link . '">' . $name . '</a></li>';
|
||||
}
|
||||
|
||||
|
||||
echo '</ul></div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
@ -10,8 +10,8 @@
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
include "include.php";
|
||||
namespace PhpXpress;
|
||||
|
||||
class Table{
|
||||
|
||||
/* === Structure === */
|
||||
@ -19,14 +19,14 @@
|
||||
/**
|
||||
* The datasource to provdide to the table.
|
||||
* Must be an array of arrays or an array of objects.
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $dataSource;
|
||||
|
||||
/**
|
||||
* The column captions
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $columnCaptions;
|
||||
@ -35,7 +35,7 @@
|
||||
* The columns to make invisible.
|
||||
* The column whose name is a key of the array
|
||||
* of the datasource, will not be shown.
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $invisible_columns;
|
||||
@ -63,7 +63,7 @@
|
||||
|
||||
/**
|
||||
* Draw the Table.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function draw(){
|
||||
@ -100,7 +100,7 @@
|
||||
else{
|
||||
$array_keys = array_keys(get_object_vars($this -> dataSource[0]));
|
||||
}
|
||||
|
||||
|
||||
$invisible_columns_captions = array();
|
||||
foreach($this->invisible_columns as $invisible_column_name){
|
||||
$column_index = array_search($invisible_column_name, $array_keys);
|
||||
@ -128,7 +128,7 @@
|
||||
if(!empty($this->invisible_columns) && in_array($name, $this->invisible_columns)){
|
||||
continue;
|
||||
}
|
||||
// fire event onValueDisplaying
|
||||
// fire event onValueDisplaying
|
||||
if(isset( $this -> onValueDisplayingFunctionName)){
|
||||
call_user_func_array($this -> onValueDisplayingFunctionName , array($name, &$value, (array)$obj));
|
||||
}
|
||||
@ -144,8 +144,8 @@
|
||||
* Set the table's datasource.
|
||||
* Datasource can be either an array of object(s) or
|
||||
* an array of array(s).
|
||||
*
|
||||
* @param array $datasource An array of arrays or an array of objects.
|
||||
*
|
||||
* @param array $datasource An array of arrays or an array of objects.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -219,8 +219,8 @@
|
||||
|
||||
/**
|
||||
* By default, the columns' captions will be the keys of the
|
||||
* array or object provided.
|
||||
*
|
||||
* array or object provided.
|
||||
*
|
||||
* You can override them by setting custom captions.
|
||||
*/
|
||||
function setCustomCaptions(Array $captions){
|
||||
@ -241,7 +241,7 @@
|
||||
/**
|
||||
* Add columns to the table (setting it before or after the datasource
|
||||
* will show the column before or after the datasource)
|
||||
*
|
||||
*
|
||||
* @param string $captionName The name of the new column
|
||||
*/
|
||||
function addColumn($captionName){
|
||||
@ -268,7 +268,7 @@
|
||||
* Making a column invisible, rather than removing it from the datasource, might
|
||||
* be useful in those circumstances where a value is needed in the datasource
|
||||
* or in the onValueDisplaying, without actually removing it.
|
||||
*
|
||||
*
|
||||
* @param string $column_name: the column to remove.
|
||||
*
|
||||
*/
|
||||
@ -291,7 +291,7 @@
|
||||
if(isset($this->invisible_columns)){
|
||||
if(in_array($column_name, $this->invisible_columns))
|
||||
throw new InvalidArgumentException("The provided column $column_name is already invisible");
|
||||
|
||||
|
||||
array_push($this->invisible_columns, $column_name);
|
||||
}
|
||||
else{
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
include_once 'code.php';
|
||||
?>
|