consistent html_buildlist() usage

see usage of html_buildlist in plugin acl (admin and action component)
This commit is contained in:
Satoshi Sahara 2020-09-07 23:17:49 +09:00
parent a215faf2fc
commit d11e205ca5
2 changed files with 21 additions and 22 deletions

View File

@ -326,7 +326,8 @@ class Ajax {
foreach (array_keys($data) as $item) {
$data[$item]['level'] = $lvl + 1;
}
echo (new Ui\Index)->buildIndexList($data);
$idx = new Ui\Index;
echo html_buildlist($data, 'idx', [$idx,'formatListItem'], [$idx,'tagListItem']);
}
/**

View File

@ -33,38 +33,36 @@ class Index extends Ui
* @return void
*/
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 $ID;
$ns = cleanID($this->ns);
$ns = cleanID($this->ns);
if (empty($ns)){
$ns = getNS($ID);
if ($ns === false) $ns = '';
}
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
// print intro
print p_locale_xhtml('index');
print '<div id="index__tree" class="index__tree">';
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
$data = array();
search($data, $conf['datadir'], 'search_index', array('ns' => $ns));
print $this->buildIndexList($data);
print '</div>';
}
/**
* 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']);
$html = '<div id="index__tree" class="index__tree">'
. html_buildlist($data, 'idx', [$this,'formatListItem'], [$this,'tagListItem'])
. '</div>';
return $html;
}
/**