本文整理汇总了PHP中Tree::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::getInstance方法的具体用法?PHP Tree::getInstance怎么用?PHP Tree::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: accept
/**
* Initialise and Render the TemplateRender
*/
public function accept($norender = false)
{
if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
debug_log('Entered (%%)', 129, 0, __FILE__, __LINE__, __METHOD__, $fargs);
}
if (DEBUGTMP) {
printf('<font size=-2>%s:%s</font><br />', time(), __METHOD__);
}
if (DEBUGTMP || DEBUGTMPSUB) {
printf('<font size=-2>* %s [Visit-Start:%s]</font><br />', __METHOD__, get_class($this));
}
$tree = get_cached_item($this->server_id, 'tree');
if (!$tree) {
$tree = Tree::getInstance($this->server_id);
}
$treeitem = $tree->getEntry($this->dn);
# If we have a DN, and no template_id, see if the tree has one from last time
if ($this->dn && is_null($this->template_id) && $treeitem && $treeitem->getTemplate()) {
$this->template_id = $treeitem->getTemplate();
}
# Check that we have a valid template, or present a selection
# @todo change this so that the modification templates rendered are the ones for the objectclass of the dn.
if (!$this->template_id) {
$this->template_id = $this->getTemplateChoice();
}
if ($treeitem) {
$treeitem->setTemplate($this->template_id);
}
$this->page = get_request('page', 'REQUEST', false, 1);
if ($this->template_id and $this->template_id != 'invalid') {
if (!$this->template) {
parent::accept();
}
$this->url_base = sprintf('server_id=%s&dn=%s', $this->getServerID(), $this->template->getDNEncode());
$this->layout['hint'] = sprintf('<td class="icon"><img src="%s/light.png" alt="%s" /></td><td colspan="3"><span class="hint">%%s</span></td>', IMGDIR, _('Hint'));
$this->layout['action'] = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s">%s</a></td>';
$this->layout['actionajax'] = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a></td>';
# If we dont want to render this template automatically, we'll return here.
if ($norender) {
return;
}
$this->visitStart();
foreach ($this->template->getAttributes(true) as $attribute) {
# Evaluate our defaults
if ($attribute->getAutoValue()) {
$this->get('Default', $attribute, $this->template->getContainer() ? $this->template->getContainer() : $this->getServer()->getContainerPath($this->template->getDN()), 'autovalue');
}
# If this is the default template, we should mark all our attributes to show().
if ($this->template->getID() == 'none' && !$attribute->isInternal() && ($this->template->getContext() == 'edit' && $this->template->getID() == 'none' || $this->template->getContext() == 'create' && $attribute->getName() != 'objectclass')) {
$attribute->show();
}
}
if (DEBUGTMP || DEBUGTMPSUB) {
printf('<font size=-2>* %s [Visit-End:%s]</font><br />', __METHOD__, get_class($this));
}
$this->visitEnd();
}
}
示例2: findFrontNav
public function findFrontNav()
{
$_where = array("id='{$this->_R['navid']}'");
if (!$this->_check->oneCheck($this, $_where)) {
$this->_check->error('./');
}
$_allNav = parent::select(array('id', 'name', 'sid'));
return Tree::getInstance()->getTree($_allNav, $this->_R['navid']);
}
示例3: getFrontNav
public function getFrontNav()
{
$where = array("id='{$this->R['navid']}'");
$allFrontNavs = array();
if (!$this->check->checkOne($this, $where)) {
$this->check->showError('./');
}
$allFrontNavs = parent::select(array('id', 'name', 'sid'), array('order' => 'sort ASC'));
$oneFrontNav = Tree::getInstance()->getTree($allFrontNavs, $this->R['navid']);
if (isset($oneFrontNav[0]->child)) {
$this->tables = array(DB_FREFIX . 'goods');
foreach ($oneFrontNav[0]->child as $key => $value) {
$result = parent::select(array('COUNT(*) as count'), array('where' => array("nav='{$value->id}'")));
$oneFrontNav[0]->child[$key]->count = $result[0]->count;
}
$this->tables = array(DB_FREFIX . 'nav');
}
return $oneFrontNav;
}
示例4: findFrontNav
public function findFrontNav()
{
$_where = array("id='{$this->_R['navid']}'");
if (!$this->_check->oneCheck($this, $_where)) {
$this->_check->error('./');
}
$_allNav = parent::select(array('id', 'name', 'sid'), array('order' => 'sort ASC'));
$_obj = Tree::getInstance()->getTree($_allNav, $this->_R['navid']);
$this->_tables = array(DB_PREFIX . 'goods');
if (isset($_obj[0]->child)) {
foreach ($_obj[0]->child as $_key => $_value) {
$_count = parent::select(array('COUNT(*) AS count'), array('where' => array("nav='{$_value->id}' AND is_up=1")));
$_value->count = $_count[0]->count;
}
}
$this->_tables = array(DB_PREFIX . 'nav');
return $_obj;
}
示例5: array
/**
* Draw a portion of the LDAP tree.
*
* @package phpLDAPadmin
* @subpackage Tree
*/
/**
*/
$request = array();
$request['dn'] = get_request('dn', 'REQUEST');
$request['server_id'] = get_request('server_id', 'REQUEST');
$request['code'] = get_request('code', 'REQUEST');
$request['action'] = get_request('action', 'REQUEST');
$request['noheader'] = get_request('noheader', 'REQUEST', false, 0);
$tree = Tree::getInstance($request['server_id']);
if (!$tree) {
die;
}
$treesave = false;
if ($request['dn']) {
$dnentry = $tree->getEntry($request['dn']);
if (!$dnentry) {
$tree->addEntry($request['dn']);
$dnentry = $tree->getEntry($request['dn']);
$treesave = true;
}
switch ($request['action']) {
case 0:
$dnentry->close();
break;
示例6: get_cached_item
*
* @package phpLDAPadmin
* @subpackage Page
*/
/**
*/
require './common.php';
if (get_request('purge', 'REQUEST')) {
$tree = get_cached_item($app['server']->getIndex(), 'tree');
del_cached_item($app['server']->getIndex(), 'tree');
if ($tree) {
$openDNs = $tree->listOpenItems();
} else {
$openDNs = array();
}
$tree = Tree::getInstance($app['server']->getIndex());
foreach ($openDNs as $value) {
$entry = $tree->getEntry($value);
if (!$entry) {
$tree->addEntry($value);
$entry = $tree->getEntry($value);
}
$tree->readChildren($value, true);
$entry->open();
}
set_cached_item($app['server']->getIndex(), 'tree', 'null', $tree);
}
if (get_request('meth', 'REQUEST') == 'ajax') {
header(sprintf('Location: cmd.php?cmd=draw_tree_node&noheader=%s&server_id=%s&meth=ajax&frame=TREE', get_request('noheader', 'REQUEST', false, 0), $app['server']->getIndex()));
} else {
header(sprintf('Location: cmd.php?server_id=%s', $app['server']->getIndex()));
示例7: findFrontNav
public function findFrontNav()
{
$_allNav = $this->db->select('id,name,sid')->get('nav')->result_array();
return Tree::getInstance()->getTree($_allNav, $this->input->get('id'));
}
示例8: tree
protected function tree()
{
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
debug_log('Entered (%%)', 129, 0, __FILE__, __LINE__, __METHOD__, $fargs);
}
if (!isset($_SESSION[APPCONFIG])) {
return;
}
if (is_null($this->index)) {
$this->index = min(array_keys($_SESSION[APPCONFIG]->getServerList()));
}
if (count($_SESSION[APPCONFIG]->getServerList()) > 1) {
echo '<form name="server_select" action="cmd.php" method="post">';
echo '<table class="server_select"><tr><td>';
printf('%s:<br />%s', _('Server Select'), server_select_list($this->index, false, 'index', true, sprintf("onchange=\"tree_unhide('index',%s)\"", $this->index)));
echo '</td></tr></table>';
echo '</form>';
echo "\n\n";
}
foreach ($_SESSION[APPCONFIG]->getServerList() as $index => $server) {
printf('<div id="ajSID_%s" style="display: %s">', $server->getIndex(), $server->getIndex() == $this->index ? 'block' : 'none');
$tree = Tree::getInstance($server->getIndex());
$tree->draw();
echo '</div>';
echo "\n\n";
}
}