Class _Publisher_api { var $cms; // Global cmsdam api var $_publisher; // Internal genuine plugin api function _Publisher_api () { return true; // Class constructor } function hello_world() { return "Hello World!! I'm " . $this->_publisher->show_plugin_name() . " " . $this->_publisher->show_plugin_version() . " cmsdAm plugin!!"; } function graphic_section_tree() { //return $this->cms->sections->section_included; // Get the sorted sections tree $section_tree = $this->cms->sections->section_sorted_tree(); //print_r ($_sections_tree); $n_sections = count($section_tree); $previous_level = 0; $first_element = 1; $last_element = 0; echo "
| "; echo "home"; for ($i=0; $i<$n_sections; $i++) { // Scan the sorted section tree echo " | |||||||||
| ";
if ($i+1 == $n_sections) { // Last element
$last_element = 1;
$next_element_level = 0;
} else {
$next_element_level = $this->cms->sections->section_treelevel($section_tree[$i+1]);
}
$level = $this->cms->sections->section_treelevel($section_tree[$i]);
//echo "DEBUG: publisher_plugin: " . $section_tree[$i] .
//" level: " . $level . " previous level: " . $previous_level . " "; // Here we have alla data to begin. if ($first_element == 1) { // First element if ($last_element == 1) { // Last element echo " ![]() | ";
//echo "First, Last, without childs \n"; } if ($last_element == 0) { if ($next_element_level>$level) { // We have a child echo " ![]() | ";
//echo "First, not last, we have a child \n"; } else { echo " ![]() | ";
//echo "First, not last, we don't have a child \n"; } } } else { // Not first element if (($previous_level < $level) || ($level>1)) { // We are a child for ($j=2; $j<=$level; $j++) { echo " ";
}
if ($last_element == 1) { // Last element
echo "![]() | ";
//echo "Not first, Last, without childs \n"; } if ($last_element == 0) { if ($next_element_level>$level) { // We have a child echo " ![]() | ";
//echo "Not first, not last, we have a child \n"; } else { echo " ![]() | ";
//echo "Not first, not last, we don't have a child \n"; } } } else { // We are not a child if ($last_element == 1) { // Last element echo " ![]() | ";
//echo "Not first, Last, without childs \n"; } if ($last_element == 0) { if ($next_element_level>$level) { // We have a child echo " ![]() | ";
//echo "Not first, not last, we have a child \n"; } else { echo " ![]() | ";
//echo "Not first, not last, we don't have a child \n"; } } } } echo $this->cms->sections->section_llink($section_tree[$i]); echo " |