PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Ujah Chigozie peter  >  PHP MySQL Hierarchical Tree  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Read me
Class: PHP MySQL Hierarchical Tree
Retrieve and display hierarchy trees from MySQL
Author: By
Last change:
Date: 7 months ago
Size: 2,147 bytes
 

Contents

Class file image Download

PHP Hierarchical

Hierarchical is a simple php & mysql program to arrange users based on their rankings, it can also be used to represent data in a chain ranking. This libery will work very well with Google Organisation chart

alt text

Installation

Installation is super-easy via Composer:

composer require peterujah/hierarchical

USAGES

Hierarchical can be use as an array, html or google organizations chart

  use Peterujah\NanoBlock\Hierarchical;
  $hierarchy = new Hierarchical($conn, Hierarchical::LIST);
  $hierarchy = new Hierarchical($conn, Hierarchical::HTML);
  $hierarchy = new Hierarchical($conn, Hierarchical::CHART);

Dump array

   $hierarchy = new Hierarchical($conn, Hierarchical::LIST);
   var_export($hierarchy->run("Peter", "vy7735"));

Display on google Organisation chart

  google.charts.load('current', {packages:["orgchart"]});
	google.charts.setOnLoadCallback(drawChart);
	function drawChart() {
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Name');
      data.addColumn('string', 'Manager');
      data.addColumn('string', 'ToolTip');
      data.addRows(<?php echo $hierarchy->run("Peter", "vy7735");?>);
      var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
      chart.draw(data, {'allowHtml':true});
}

Initalisation options new Hierarchical($conn, Hierarchical::CHART)

| Options | Description | |-----------------|-------------------------------------------------------------------------------------| | LIST | Retrieve result as an array | | HTML | Retrieve result in HTML list | | CHART | Retrieve result in json data for google chart |

For more information send a message to info at phpclasses dot org.