aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Helpindex.php
blob: fbcd8c8b29d9b89a741821ef1a1a69c93781cbb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php

/**
 *   * Name: Help index
 *   * Description: Help pages index
 */

namespace Zotlabs\Widget;

class Helpindex {

	function widget($arr) {

		require_once('include/help.php');

		$o .= '<div class="widget">';

		$level_0 = get_help_content('sitetoc');
		if(! $level_0) {
			$path = 'toc';
			$x = determine_help_language();
			$lang = $x['language'];
			if($lang !== 'en') {
				$path = $lang . '/toc';
			}
			$level_0 = get_help_content($path);
		}

		$level_0 = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$level_0);

		$levels = array();


		// TODO: Implement support for translations in hierarchical table of content files
		/*
		if(argc() > 2) {
			$path = '';
			for($x = 1; $x < argc(); $x ++) {
				$path .= argv($x) . '/';
				$y = get_help_content($path . 'sitetoc');
				if(! $y)
					$y = get_help_content($path . 'toc');
				if($y)
					$levels[] = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$y);
			}
		}
		*/

		if($level_0)
			$o .= $level_0;
		if($levels) {
			foreach($levels as $l) {
				$o .= '<br /><br />';
				$o .= $l;
			}
		}

		$o .= '</div>';

		return $o;
	}
}