PHP Classes

Winbox PHP Wrapper Class: Generate HTML to show draggable windows on a page

Recommend this page to a friend!
  Info   View files Documentation   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 167 All time: 8,805 This week: 189Up
Version License PHP version Categories
winbox-php 1.0.0GNU General Publi...5.6HTML, PHP 5, GUI
Description Author

This package can generate HTML to show draggable windows on a page.

It can create a list of windows that will display on a Web page and set parameters that define the values of windows attributes like the window size and position, whether the window is modal, the border thickness, the background color, the HTML element identified, the CSS class, JavaScript to run after certain events are triggered, etc...

The package can generate HTML and JavaScript to add the defined windows to the page being generated by the current PHP script.

Innovation Award
PHP Programming Innovation award winner
May 2021
Winner


Prize: 1 Year Subscription to NomadPHP Advanced PHP Learning
Draggable windows are useful to display content on a Web page that the user may want to move around the page to avoid overlapping the sections of a page that he is more interested in.

This package can help to generate pages that can show draggable windows. It can generate HTML with JavaScript code that can display that kind of window using the Winbox library.

Manuel Lemos
Picture of Carlos Artur Curvelo da Matos
  Performance   Level  
Name: Carlos Artur Curvelo da ... <contact>
Classes: 19 packages by
Country: Portugal Portugal
Innovation award
Innovation award
Nominee: 13x

Winner: 2x

Details

Winbox PHP

A wrapper for using Winbox.js just coding in PHP. Based on:

<h1>

<img src="https://cdn.jsdelivr.net/gh/nextapps-de/winbox@master/demo/winbox.png" alt="WinBox.js: HTML5 Window Manager for the Web." width="100%">

</h1>

Installation

Clone the repo or use Composer composer require carloswph/winbox-php

Usage

Using this wrapper is actually pretty simple and can be done by just using two different classes. The class Init() provides a static method that adds Winbox.js bundle, allowing new windows to be created. Once the bundle is running, new windows can be added by instances of the class Window(), and respective window name as arguments, and its options.

The options can be either set by a number of different methods or passed while creating the instance as an array. When using the Init::enqueue() static method, a boolean can be passed optionally. If true, Winbox PHP will actually enqueue the Winbox bundle from a local repository, rather than the CDN link.

require __DIR__ . '/vendor/autoload.php';

?>

<head>
<?php 
	Winbox\Init::enqueue(); // Adds Winbox.js bundle.
	$wb = new Winbox\Window("Winbox Test");
	$wb->setBorder(4); // Sets the winbox border thickness
?>
</head>

<body>
	<?php $wb->render(); ?>
</body>

Methods

setBorder($thickness) - accepts integer or strings, corresponding to any CSS unit (px, for instance)

setColor($color - admits any valid CSS color and determines the window's border background

setViewport($viewport) - admits a single integer or string, or an array of measure (2, 3 or 4 values), corresponding to top, bottom, right and left viewport sizes

setPosition($x, $y) - each of the axis variables can be a single value, or an array of two values or strings ([x, width] and [y, height])

isModal() - if called, the winbox behaves as a modal box

setInner($html) - sets any HTML code to appear inside the winbox

setID($ID) - sets the winbox ID

setClass($class) - sets the winbox CSS class

render() - renders the winbox final result

To-do

  • Add custom behaviours to the windows, through the trait On(), as well as allowing a programatic control of the windows features.
  • Create an additional class to set custom CSS, icons and scrollbars to be configured.
  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (3 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file codacy-analysis.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageassets (1 file)
  Plain text file Init.php Class Class source
  Plain text file On.php Class Class source
  Plain text file Window.php Class Class source

  Files folder image Files  /  src  /  assets  
File Role Description
  Accessible without login Plain text file winbox.bundle.js Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:167
This week:0
All time:8,805
This week:189Up
For more information send a message to info at phpclasses dot org.