consistent html_buildlist() usage
see usage of html_buildlist in plugin acl (admin and action component)
This commit is contained in:
parent
a215faf2fc
commit
d11e205ca5
|
@ -326,7 +326,8 @@ class Ajax {
|
||||||
foreach (array_keys($data) as $item) {
|
foreach (array_keys($data) as $item) {
|
||||||
$data[$item]['level'] = $lvl + 1;
|
$data[$item]['level'] = $lvl + 1;
|
||||||
}
|
}
|
||||||
echo (new Ui\Index)->buildIndexList($data);
|
$idx = new Ui\Index;
|
||||||
|
echo html_buildlist($data, 'idx', [$idx,'formatListItem'], [$idx,'tagListItem']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,38 +33,36 @@ class Index extends Ui
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function show()
|
public function show()
|
||||||
|
{
|
||||||
|
// print intro
|
||||||
|
print p_locale_xhtml('index');
|
||||||
|
|
||||||
|
print $this->sitemap();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build html of sitemap, unordered list of pages under the namespace
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function sitemap()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
global $ID;
|
global $ID;
|
||||||
|
|
||||||
$ns = cleanID($this->ns);
|
$ns = cleanID($this->ns);
|
||||||
if (empty($ns)){
|
if (empty($ns)){
|
||||||
$ns = getNS($ID);
|
$ns = getNS($ID);
|
||||||
if ($ns === false) $ns = '';
|
if ($ns === false) $ns = '';
|
||||||
}
|
}
|
||||||
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
|
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
|
||||||
|
|
||||||
// print intro
|
|
||||||
print p_locale_xhtml('index');
|
|
||||||
|
|
||||||
print '<div id="index__tree" class="index__tree">';
|
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
search($data, $conf['datadir'], 'search_index', array('ns' => $ns));
|
search($data, $conf['datadir'], 'search_index', array('ns' => $ns));
|
||||||
print $this->buildIndexList($data);
|
|
||||||
|
|
||||||
print '</div>';
|
$html = '<div id="index__tree" class="index__tree">'
|
||||||
}
|
. html_buildlist($data, 'idx', [$this,'formatListItem'], [$this,'tagListItem'])
|
||||||
|
. '</div>';
|
||||||
/**
|
return $html;
|
||||||
* Build html of unordered list of index items
|
|
||||||
*
|
|
||||||
* @param array $data array with item arrays
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function buildIndexList($data)
|
|
||||||
{
|
|
||||||
return html_buildlist($data, 'idx', [$this,'formatListItem'], [$this,'tagListItem']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue