Returns Tree as HTML Table.
@access		public
@param		bool		[showBalanceFactor]		Flag: show Balance Factor
@return		void
963613
public function toTable( $showBalanceFactor = FALSE )
	{
		$la		= $this->left  ? $this->left->getHeight()  : 0;
		$lb		= $this->right ? $this->right->getHeight() : 0;
		$depth	= $this->getHeight ();
		$color	= 240 - ( 3 * $depth );
		if( $showBalanceFactor )
		{
			$k = $la - $lb;
			if( $k <= -1*$this->balance || $k >= $this->balance )
				$k = "<b style='color:red'>$k</b>";
			$ins_bf = "<b class='small' style='font-weight:normal; font-size:7pt;'>".$k."</b>";
		}
		$code = "<table cellspacing='1' cellpadding='0' border='0'>\n<tr><td colspan='2' align='center' style='background:rgb($color, $color, $color); font-size: 7pt'>".$this->value.$ins_bf."</td></tr>";
		if( $this->left || $this->right )
		{
			$code .= "<tr><td align=center valign=top>";
			if( $this->left )
				$code .= $this->left->toTable( $showBalanceFactor);
			else
				$code .= "&nbsp;";
			$code .= "</td><td align=center valign=top>";
			if( $this->right )
				$code .= $this->right->toTable( $showBalanceFactor );
			else
				$code .= "&nbsp;";
			$code .= "</td></tr>\n";
		}
		$code .= "</table>\n";
		return $code;
	}
876796
function getTree(table, options) {

      if (table.isPanel) {
        table = table.getView();
      }

      function getDefOpts() {
        return {
          throwIfInvisible: false,
          allFields: false
        };
      }

      var isVisible = table.isVisible(true);
      options = tiaEJ.ctMisc.checkVisibilityAndFillOptions(isVisible, options, getDefOpts);
      var panel = tiaEJ.search.parentPanel(table);
      var root = panel.getRootNode();
      var res = [];

      function traverseSubTree(node, indent) {

        var fieldsToPrint = ['text', 'checked', 'id'];

        if (tia.debugMode) {
          fieldsToPrint = [
            'text',
            'checked',
            'id',
            'visible',
            'expanded',
            'leaf',
            'expandable',
            'index',
            'depth',
            'qtip',
            'qtitle',
            'cls'
          ];
        }

        if (options.allFields) {
          res.push(indent + tiaEJ.ctMisc.stringifyAllRecord(node, fieldsToPrint, true));
        } else {
          res.push(indent + tiaEJ.ctMisc.stringifyRecord(node, fieldsToPrint, true));
        }

        if (node.hasChildNodes()) {
          indent += tia.cC.content.indent;
          node.eachChild(function (curNode) {
            traverseSubTree(curNode, indent);
          });
        }
      }

      traverseSubTree(root, '');

      return tia.cC.content.wrap('Tree content: \n' + res.join('\n') + '\n');

    }
72378
def tree_to_html(tree):
    """"""
    ul = etree.Element('ul')
    html_listify([tree], ul)
    return HTML_WRAPPER.format(etree.tostring(ul))
147457
function() { 
        this.logger.log("Generating html");
        var sb = [];

        sb[sb.length] = '<table id="ygtvtableel' + this.index + '" border="0" cellpadding="0" cellspacing="0" class="ygtvtable ygtvdepth' + this.depth;
        if (this.enableHighlight) {
            sb[sb.length] = ' ygtv-highlight' + this.highlightState;
        }
        if (this.className) {
            sb[sb.length] = ' ' + this.className;
        }           
        sb[sb.length] = '"><tr class="ygtvrow">';
        
        for (var i=0;i<this.depth;++i) {
            sb[sb.length] = '<td class="ygtvcell ' + this.getDepthStyle(i) + '"><div class="ygtvspacer"></div></td>';
        }

        if (this.hasIcon) {
            sb[sb.length] = '<td id="' + this.getToggleElId();
            sb[sb.length] = '" class="ygtvcell ';
            sb[sb.length] = this.getStyle() ;
            sb[sb.length] = '"><a href="#" class="ygtvspacer">&#160;</a></td>';
        }

        sb[sb.length] = '<td id="' + this.contentElId; 
        sb[sb.length] = '" class="ygtvcell ';
        sb[sb.length] = this.contentStyle  + ' ygtvcontent" ';
        sb[sb.length] = (this.nowrap) ? ' nowrap="nowrap" ' : '';
        sb[sb.length] = ' >';
        sb[sb.length] = this.getContentHtml();
        sb[sb.length] = '</td></tr></table>';

        return sb.join("");

    }
1173596
def get_html(self):
        """"""
        if self.__htmltree is not None:
            return self.__htmltree
        else:
            self.__make_tree()
            return self.__htmltree
236237
def tree():
    
    session = AppAggregate().open_session()
    classes = session.query(AssetClass).all()
    # Get the root classes
    root = []
    for ac in classes:
        if ac.parentid is None:
            root.append(ac)
        # logger.debug(ac.parentid)
    # header
    print_row("id", "asset class", "allocation", "level")
    print(f"-------------------------------")

    for ac in root:
        print_item_with_children(ac, classes, 0)
336452
public function display()
    {
        if (!$this->visible) {
            return;
        }

        SwatWidget::display();

        // tree is copied for display so we can add a blank node if show_blank
        // is true
        $display_tree = $this->getDisplayTree();
        $count = count($display_tree) - 1;

        // only show a select if there is more than one option
        if ($count > 1) {
            $select_tag = new SwatHtmlTag('select');
            $select_tag->name = $this->id;
            $select_tag->id = $this->id;
            $select_tag->class = $this->getCSSClassString();

            if (!$this->isSensitive()) {
                $select_tag->disabled = 'disabled';
            }

            $select_tag->open();

            foreach ($display_tree->getChildren() as $child) {
                $this->displayNode($child, 1);
            }

            $select_tag->close();
        } elseif ($count === 1) {
            // get first and only element
            $children = $display_tree->getChildren();
            $option = reset($children)->getOption();
            $this->displaySingle($option);
        }
    }
1072797
public function display()
    {
        if (!$this->visible) {
            return;
        }

        parent::display();

        $table_tag = new SwatHtmlTag('table');
        $table_tag->id = $this->id;
        $table_tag->class = $this->getCSSClassString();

        $table_tag->open();
        $this->displayContent();
        $table_tag->close();

        Swat::displayInlineJavaScript($this->getInlineJavaScript());
    }
227210
def render_html_tree(tree):
    

    # Restore any tag names that were changed in get_html_tree()
    for el in tree.iter():
        if '__tag_name' in el.attrib:
            actual_tag_name = el.attrib.pop('__tag_name')
            el.tag = actual_tag_name

    html = lxml.html.tostring(tree, encoding='utf8').decode('utf8')

    return strip_wrapping(html)
534942
public function index() {
        
        $tree = Globals::getTree();
        Theme::theme(new AdministrationTheme)->init($tree);
        $controller = new PageController();
        $controller
            ->restrictAccess(Auth::isAdmin())
            ->setPageTitle($this->module->getTitle());
			
		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
		if(is_null($token)) {
			$token = Functions::generateRandomToken();
			$this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token);
		}
        
        $data = new ViewBag();
        $data->set('title', $controller->getPageTitle());
        
        $table_id = 'table-admintasks-' . Uuid::uuid4();
        $data->set('table_id', $table_id);
		
		$data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger');
		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
		if(is_null($token)) {
			$token = Functions::generateRandomToken();
			$this->module->setSetting('MAJ_AT_FORCE_EXEC_TOKEN', $token);
		}
		$data->set('trigger_token', $token);
		
		$this->provider->getInstalledTasks();
		
		$controller
            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
            ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
            ->addInlineJavascript('
                //Datatable initialisation
				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
				jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);};
				jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);};
	
				var adminTasksTable = jQuery("#'.$table_id.'").DataTable({
					'.I18N::datatablesI18N().',			
					sorting: [[3, "asc"]],
					pageLength: 10,
                    processing: true,
                    serverSide : true,
					ajax : {
						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonTasksList&ged='. $tree->getNameUrl().'",
                        type : "POST"
					},
                    columns: [
						/* 0 Edit		 	*/ { sortable: false, className: "text-center"},
                        /* 1 task_name      */ { visible: false },
						/* 2 Enabled 		*/ { sortable: false, className: "text-center"  },
						/* 3 Task Title		*/ null,
						/* 4 Last Run		*/ null,
						/* 5 Last status 	*/ { className: "text-center" },
						/* 6 Frequency      */ { sortable: false, className: "text-center" },
						/* 7 Nb Occcurrences*/ { sortable: false, className: "text-center" },
						/* 8 Is Running    	*/ { sortable: false, className: "text-center" },					
						/* 9 Run task		*/ { sortable: false, className: "text-center" }
					],
				});
                
                ')
                ->addInlineJavascript('					
					function generate_force_token() {
						jQuery("#bt_genforcetoken").attr("disabled", "disabled");
						jQuery("#bt_tokentext").empty().html("<i class=\"fa fa-spinner fa-pulse fa-fw\"></i>");
						jQuery("#token_url").load(
							"module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@generateToken",
							function() {
								jQuery("#bt_genforcetoken").removeAttr("disabled");
								jQuery("#bt_tokentext").empty().html("'.I18N::translate('Regenerate token').'");
                                adminTasksTable.ajax.reload();
							}
						);
					}
				
                    function set_admintask_status(task, status) {
                		jQuery.ajax({
                            url: "module.php", 
                            type: "GET",
                            data: {
                			    mod: "' . $this->module->getName() .'",
                                mod_action:  "Task@setStatus",
                			    task: task,
                                status: status
                            },
                            error: function(result, stat, error) {
                                var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
                                alert("' . I18N::translate('An error occured while editing this task:') . '" + err);
                            },
                            complete: function(result, stat) {
                                adminTasksTable.ajax.reload(null, false);
                            }                            
                		});
                    } 
                    
                    function run_admintask(taskname) {
                        jQuery("#bt_runtask_" + taskname).attr("disabled", "disabled");
				        jQuery("#bt_runtasktext_" + taskname).empty().html("<i class=\"fa fa-cog fa-spin fa-fw\"></i><span class=\"sr-only\">'.I18N::translate('Running').'</span>");
				        jQuery("#bt_runtasktext_" + taskname).load(
					       "module.php?mod='.$this->module->getName().'&mod_action=Task@trigger&force='.$token.'&task=" + taskname,
        					function() {
        						jQuery("#bt_runtasktext_" + taskname).empty().html("<i class=\"fa fa-check\"></i>'.I18N::translate('Done').'");
        						adminTasksTable.ajax.reload();
        					}
				        );
                    
                    } 
                ');
        
        ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
    }
1051922
public function render()
  {
    $html = parent::render();

    if (is_null($this->value)) {
      $html = str_replace('%value%', '', $html);
    } else if ($this->value) {
      $content = static::getAssetContent('true');
      $html = str_replace('%value%', $content, $html);
    } else {
      $content = static::getAssetContent('false');
      $html = str_replace('%value%', $content, $html);
    }
    return $html;
  }
759444
def model_tree(array, base_class = nil)
      return EMPTY_STRING.html_safe if array.blank?
      options = { html_options: { class: 'dropdown-item' } }
      content_tag :ul, class: 'dropdown-menu', 'aria-labelledby': base_class do
        array.sort_by(&:name).each do |node|
          content = index_link(node.klass, options).try :<<, model_tree(node.children)
          concat content_tag(:li, content)
        end
      end
    end
1190250
protected function renderContent() {
        
        /** @var \Fisharebest\Webtrees\Tree $tree */
        $tree = $this->data->get('tree');
        
        echo '<h2 class="center">', $this->data->get('title') , '</h2>';
        echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>';
         
        if($this->data->get('issurnames', false)) {
            $surns = $this->data->get('surnameslist', array());
            $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage');
            // Show the surname list
            switch ($tree->getPreference('SURNAME_LIST_STYLE')) {
                case 'style1':
					echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $tree, $extra_params);
					break;
                case 'style3':
                    echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params);
                    break;
                case 'style2':
                default:
                    echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params);
                    break;
            }
        }
        else if ($this->data->get('islineages', false)) {
            //Link to indilist
            echo '<p class="center"><strong>'.
                '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. 
                I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')).
                '</a></strong></p>';
            
            $lineages = $this->data->get('lineages', null);
            $nb_lineages = is_null($lineages) ? 0 : count($lineages);
            if($nb_lineages == 0) {
            	echo '<p class="center"><span class="warning">',
            		I18N::translate('No individuals with surname %s has been found. Please try another name.',
            			'<span dir="auto">' . $this->data->get('legend') . '</span>'),
            			'</span></p>';
            } else { 
            	
            	echo '<div id="patronymiclineages">'.
            		'<div class="list_label">',
            		$this->data->get('table_title'),
            		'</div>';
            	
            	echo '<div class="list_value_wrap">';            	
            	
            	foreach($lineages as $i => $lineage) {
            		$this->printRootLineage($lineage);
            		if($i < $nb_lineages - 1) echo '<hr />';
            	}
            	
            	echo '</div>';
            	
            	echo '<div class="list_label">',
            		I18N::translate('%s lineages found', $nb_lineages),
            		'</div>'.
            		'</div>';

            }
        }
    }
464764
public function SiteTreeAsUL()
    {
        $treeClass = $this->config()->get('tree_class');
        $filter = $this->getSearchFilter();

        DataObject::singleton($treeClass)->prepopulateTreeDataCache(null, [
            'childrenMethod' => $filter ? $filter->getChildrenMethod() : 'AllChildrenIncludingDeleted',
            'numChildrenMethod' => $filter ? $filter->getNumChildrenMethod() : 'numChildren',
        ]);

        $html = $this->getSiteTreeFor($treeClass);

        $this->extend('updateSiteTreeAsUL', $html);

        return $html;
    }
401818
def show_tree(self):
        """"""
        self.initialize_view() # Clear before re-populating
        self.setItemsExpandable(True)
        self.setSortingEnabled(False)
        rootkey = self.find_root()  # This root contains profiler overhead
        if rootkey:
            self.populate_tree(self, self.find_callees(rootkey))
            self.resizeColumnToContents(0)
            self.setSortingEnabled(True)
            self.sortItems(1, Qt.AscendingOrder) # FIXME: hardcoded index
            self.change_view(1)
183343
function _buildTable() {
        if (!count($this->_data)) {
            return '';
        }

        $vertical = $this->_border['vertical'];
        $separator = $this->_getSeparator();

        $return = array();
        for ($i = 0; $i < count($this->_data); $i++) {
            for ($j = 0; $j < count($this->_data[$i]); $j++) {
                if ($this->_data[$i] !== self::CONSOLE_TABLE_HORIZONTAL_RULE &&
                    $this->_strlen($this->_data[$i][$j]) <
                    $this->_cell_lengths[$j]
                ) {
                    $this->_data[$i][$j] = $this->_strpad($this->_data[$i][$j],
                        $this->_cell_lengths[$j],
                        ' ',
                        $this->_col_align[$j]);
                }
            }

            if ($this->_data[$i] !== self::CONSOLE_TABLE_HORIZONTAL_RULE) {
                $row_begin = $this->_borderVisibility['left']
                    ? $vertical . str_repeat(' ', $this->_padding)
                    : '';
                $row_end = $this->_borderVisibility['right']
                    ? str_repeat(' ', $this->_padding) . $vertical
                    : '';
                $implode_char = str_repeat(' ', $this->_padding) . $vertical
                    . str_repeat(' ', $this->_padding);
                $return[] = $row_begin
                    . implode($implode_char, $this->_data[$i]) . $row_end;
            } elseif (!empty($separator)) {
                $return[] = $separator;
            }

        }

        $return = implode(PHP_EOL, $return);
        if (!empty($separator)) {
            if ($this->_borderVisibility['inner']) {
                $return = $separator . PHP_EOL . $return;
            }
            if ($this->_borderVisibility['bottom']) {
                $return .= PHP_EOL . $separator;
            }
        }
        $return .= PHP_EOL;

        if (!empty($this->_headers)) {
            $return = $this->_getHeaderLine() . PHP_EOL . $return;
        }

        return $return;
    }
551249
public function table(array $attributes = [], $drawFooter = false, $drawSearch = false)
    {
        $this->tableAttributes = array_merge($this->getTableAttributes(), $attributes);
        $htmlAttr = $this->html->attributes($this->tableAttributes);
        $tableHtml = '<table '.$htmlAttr.'></table>';

        return new HtmlString($tableHtml);
    }