PHP Classes

File: examples/fullexample/dashboard.php

Recommend this page to a friend!
  Classes of Jorge Castro   DashOne   examples/fullexample/dashboard.php   Download  
File: examples/fullexample/dashboard.php
Role: Example script
Content type: text/plain
Description: Example script
Class: DashOne
Compose and display a dashboard programmatically
Author: By
Last change:
Date: 4 years ago
Size: 1,984 bytes
 

Contents

Class file image Download
<?php

use eftec\DashOne\controls\ButtonOne;
use
eftec\DashOne\controls\ImageOne;
use
eftec\DashOne\controls\LinkOne;
use
eftec\DashOne\DashOne;

include
"../../vendor/autoload.php";


$valueUL=['Cocacola','Fanta','Sprite'];

$values=
    [
        [
'IdProduct'=>1,'Name'=>'Cocacola','Price'=>"20.2","Buttons"=>[new ButtonOne('https://www.google.cl',"click",'btn btn-danger btn-sm','link')]],
        [
'IdProduct'=>2,'Name'=>'Fanta','Price'=>"30.5","Buttons"=>[new ButtonOne('https://www.google.cl',"click",'btn btn-danger btn-sm','link')]],
        [
'IdProduct'=>3,'Name'=>'Sprite','Price'=>"11.5"],
    ];

$definitionsTable=['IdProduct'=>'Id. of the Product'
   
,'Name'=>'Name'
   
,'Price'=>'Price in USD'
   
,'Buttons'=>'Edit'];


$definition=['IdProduct'=>'hidden'
   
,'Name'=>'text'
   
,'Price'=>'text'
   
,'Type'=>['cocacola','fanta','sprite']
    ,
'Description'=>'textarea'];
$currentValue=['IdProduct'=>"2"
   
,'Name'=>"aaa"
   
,'Price'=>"333"
   
,'Type'=>1
   
,'Description'=>''];

$buttons=[
    new
ButtonOne('button1','Click me','btn btn-primary'),
    new
ButtonOne('button2','Click me too','btn btn-danger')
];

$links=[
    new
LinkOne('Link1','#','far fa-star'),
    new
LinkOne('Link2','#','far fa-star'),
    new
LinkOne('Link3','#','far fa-star')
];


$dash=new DashOne();

$dash->head('Example - test 1');
$dash->menuUpper([new ImageOne('https://via.placeholder.com/32x32')," - ",new LinkOne('Cocacola','#')]);
$dash
   
->startcontent()
    ->
menu($links)
    ->
startmain()
    ->
title('Table of Products')
    ->
rawHtml('<br>')
    ->
table($values,$definitionsTable)->setClass('table table-stripped')->setId('table1')
    ->
title('Form')
    ->
rawHtml('<br>')
    ->
fetchValue($currentValue)
    ->
form($currentValue,$definition)
    ->
rawHtml('<br>')
    ->
rawHtml('<br>')
    ->
link("Go to google","https://www.google.com","far fa-star")
    ->
rawHtml('<br>')
    ->
rawHtml('<br>')
    ->
buttons($buttons,false)
    ->
rawHtml('<br><br>')
    ->
ul($valueUL)
    ->
rawHtml("<br><br>")
    ->
alert('title','subtitle')
    ->
endmain()
    ->
endcontent();
$dash->footer();
$dash->render();