<?php
/**
* @file ClassWorkFlow.php
* Brief File Description
*
* This is the typical JavaDoc-style C-style comment. It starts with two
* asterisks.
*
* @param theory Even if there is only one possible unified theory. it is just a
* set of rules and equations.
*/
/**
* @brief ClassWorkFlow Brief Class description
*
*
* @author Sreekanth
* @date 29th August 2021
* @details I am sambhavam
*/
namespace ProjectWorkFlow;
class ClassWorkFlow
{
/// this stores the html of enire workflow tree
public $output = "";
/**
* @brief Brief description
*
* @param [in] $childNodeValue Description for $childNodeValue
* @param [in] $startingLevel Description for $startingLevel
* @return Return description
* @author Sreekanth
* @date 29th August 2021
* @details More details
*/
public function displayDivHeading($childNodeValue, $startingLevel, $closeTagsConfig = array())
{
$closeDiv = isset($closeTagsConfig["closeDiv"]) ? $closeTagsConfig["closeDiv"] : true;
$closeLi = isset($closeTagsConfig["closeLi"]) ? $closeTagsConfig["closeLi"] : true;
$hTag = "h" . $startingLevel;
/* $closeDivAppend = isset($closeTagsConfig["closeDiv"])?$closeTagsConfig["closeDiv"]:'not';
$closeLiAppend = isset($closeTagsConfig["closeLi"])?$closeTagsConfig["closeLi"]:'not'; */
//. $closeDivAppend.$closeLiAppend
return "<li>\r\n\t<div>\r\n\t<" . $hTag . ">" .
$childNodeValue . "</" . $hTag . ">\r\n" .
($closeDiv ? "</div>\r\n" : "") .
($closeLi ? "</li>\r\n" : "");
}
//function displayDivHeading($childNodeValue,$startingLevel, $closeLi = true)
/**
* Dynamically displays the nodes in tree format
* The url argument must specify an absolute
* <a href="https://codepen.io/kreddy/pen/YzWMQYY" target="_blank" >this</a>. The name
* argument is a specifier that is relative to the url argument.
* <p>
* This method always returns immediately, whether or not the
* image exists. When this applet attempts to draw the image on
* the screen, the data will be loaded. The graphics primitives
* that draw the image will incrementally paint on the screen.
*</p>
**Author:** Author name
**Date:** Date##
* @param childNodes Array of nodes to be displayed
* @param startingLevel the location of the image, relative to the url argument
* @return void
* @see Image
*/
public function displayChildNodes($childNodes, $startingLevel)
{
$this->output .= "<ol>\r\n\t";
foreach ($childNodes as $childNodeKey => $childNodeValue) {
if (!is_array($childNodeValue)) {
$this->output .= $this->displayDivHeading($childNodeValue, $startingLevel);
} elseif (isset($childNodeValue["main_h"])) {
$closeTagsConfig = array(
"closeDiv" => false,
"closeLi" => false
);
$sub_t = isset($childNodeValue["sub_t"]) ? $childNodeValue["sub_t"] : "";
$this->output .= $this->displayDivHeading(
$childNodeValue["main_h"],
($startingLevel),
$closeTagsConfig
) . $sub_t . "</div>\r\n" . "</li>\r\n";
} else {
$closeTagsConfig = array(
"closeDiv" => true,
"closeLi" => false
);
$this->output .= $this->displayDivHeading($childNodeKey, $startingLevel, $closeTagsConfig);
$this->displayChildNodes($childNodeValue, ($startingLevel + 1)) . "</li>\r\n";
}//if(!is_array($childNodeValue))
}//foreach ($childNodes as $childNodeKey => $childNodeValue)
$this->output .= "</ol>\r\n\t";
//echo $this->output;
}
//public function displayChildNodes($childNodes, $startingLevel)
public function showTree()
{
echo $this->output;
}
//public function showTree()
}
//class ClassWorkFlow{}