locale_xhtml('tree');
$dual = $INPUT->bool('dual', $this->getConf('dual'));
/** @var helper_plugin_move_plan $plan */
$plan = plugin_load('helper', 'move_plan');
if ($plan->isCommited()) {
echo '
' . $this->getLang('moveinprogress') . '
';
} else {
echo '' . $this->getLang('noscript') . '
';
echo '';
echo '';
echo '
';
if ($dual) {
$this->printTreeRoot('move-pages');
$this->printTreeRoot('move-media');
} else {
$this->printTreeRoot('move-pages move-media');
}
echo '
';
$form = new dokuwiki\Form\Form(['method' => 'post']);
$form->setHiddenField('page', 'move_main');
$cb = $form->addCheckbox('autoskip', $this->getLang('autoskip'));
if ($this->getConf('autoskip')) $cb->attr('checked', 'checked');
$cb = $form->addCheckbox('autorewrite', $this->getLang('autorewrite'));
if ($this->getConf('autorewrite')) $cb->attr('checked', 'checked');
$form->addButton('submit', $this->getLang('btn_start'));
echo $form->toHTML();
echo '
';
}
}
/**
* Print the root of the tree
*
* @param string $classes The classes to apply to the root
* @return void
*/
protected function printTreeRoot($classes) {
echo '';
}
/**
* Build a tree info structure from media or page directories
*
* @param int $type
* @param string $open The hierarchy to open FIXME not supported yet
* @param string $base The namespace to start from
* @return array
*/
public function tree($type = self::TYPE_PAGES, $open = '', $base = '')
{
global $conf;
$opendir = utf8_encodeFN(str_replace(':', '/', $open));
$basedir = utf8_encodeFN(str_replace(':', '/', $base));
$opts = array(
'pagesonly' => ($type == self::TYPE_PAGES),
'listdirs' => true,
'listfiles' => true,
'sneakyacl' => $conf['sneaky_index'],
'showmsg' => false,
'depth' => 1,
'showhidden' => true
);
$data = array();
if ($type == self::TYPE_PAGES) {
search($data, $conf['datadir'], 'search_universal', $opts, $basedir);
} elseif ($type == self::TYPE_MEDIA) {
search($data, $conf['mediadir'], 'search_universal', $opts, $basedir);
}
return $data;
}
}